<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.agmip.acmo.translators.cropgrownau.core;

import au.com.bytecode.opencsv.CSVWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.agmip.acmo.util.AcmoUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author qiuxiaolei
 */
public class AcmoCropGrowNAUCsvOutput {
    
    private static final Logger log = LoggerFactory.getLogger(AcmoCropGrowNAUOutputFileInput.class);
    private File outputFile;
    /**
     * Generate ACMO CSV file
     *
     * @param outputCsvPath The path for output csv file
     * @param data The data holder for model output data and meta data
     */
    public void writeFile(String outputCsvPath,List metaListData,List summaryListData) throws IOException,NullPointerException,IndexOutOfBoundsException {
        MetaReader metaReader = new MetaReader(metaListData);
        OutputSummaryReader summaryReader = new OutputSummaryReader(summaryListData);
        //Create output CSV File
        outputFile = AcmoUtil.createCsvFile(outputCsvPath, "CropGrow-NAU");
        CSVWriter writer = new CSVWriter(new FileWriter(outputFile), ',');	
        //write Meta Header
        writer.writeAll(metaReader.getHeader());
        for (String exname : metaReader.getExname()) {
            List<String> writeData = new ArrayList<String>();
            writeData.addAll(Arrays.asList(metaReader.getData(exname)));
            //If Something Wrong, Fill blank<commit_msg>Revise Javadoc<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.agmip.acmo.translators.cropgrownau.core;

import au.com.bytecode.opencsv.CSVWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.agmip.acmo.util.AcmoUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author qiuxiaolei
 */
public class AcmoCropGrowNAUCsvOutput {
    
    private static final Logger log = LoggerFactory.getLogger(AcmoCropGrowNAUOutputFileInput.class);
    private File outputFile;
    /**
     * Generate ACMO CSV file
     *
     * @param outputCsvPath The path for output csv file
     * @param summaryListData The data holder for model output data and meta data
     */
    public void writeFile(String outputCsvPath,List metaListData,List summaryListData) throws IOException,NullPointerException,IndexOutOfBoundsException {
        MetaReader metaReader = new MetaReader(metaListData);
        OutputSummaryReader summaryReader = new OutputSummaryReader(summaryListData);
        //Create output CSV File
        outputFile = AcmoUtil.createCsvFile(outputCsvPath, "CropGrow-NAU");
        CSVWriter writer = new CSVWriter(new FileWriter(outputFile), ',');	
        //write Meta Header
        writer.writeAll(metaReader.getHeader());
        for (String exname : metaReader.getExname()) {
            List<String> writeData = new ArrayList<String>();
            writeData.addAll(Arrays.asList(metaReader.getData(exname)));
            //If Something Wrong, Fill blank
{'fraction_non_alphanumeric': 0.09202096680256261, 'fraction_numerical': 0.0011648223645894002, 'mean_word_length': 3.757617728531856, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3877204', 'n_tokens_mistral': 1020, 'n_tokens_neox': 1016, 'n_words': 250}