Java 类com.amazonaws.mturk.addon.HITDataCSVWriter 实例源码

项目:java-aws-mturk    文件:Reviewer.java   
/**
 * Prints the submitted results of HITs when provided with a .success file.
 * @param successFile The .success file containing the HIT ID and HIT Type ID
 * @param outputFile The output file to write the submitted results to
 */
public void printResults(String successFile, String outputFile) {

  try {

    //Loads the .success file containing the HIT IDs and HIT Type IDs of HITs to be retrieved.
    HITDataInput success = new HITDataCSVReader(successFile);

    //Retrieves the submitted results of the specified HITs from Mechanical Turk
    HITTypeResults results = service.getHITTypeResults(success);
    results.setHITDataOutput(new HITDataCSVWriter(outputFile));

    //Writes the submitted results to the defined output file.
    //The output file is a tab delimited file containing all relevant details
    //of the HIT and assignments.  The submitted results are included as the last set of fields
    //and are represented as tab separated question/answer pairs
    results.writeResults();

    System.out.println("Results have been written to: " + outputFile);

  } catch (Exception e) {
    System.err.println("ERROR: Could not print results: " + e.getLocalizedMessage());
  }
}
项目:mturksdk-java-code-maven    文件:Reviewer.java   
/**
 * Prints the submitted results of HITs when provided with a .success file.
 * @param successFile The .success file containing the HIT ID and HIT Type ID
 * @param outputFile The output file to write the submitted results to
 */
public void printResults(String successFile, String outputFile) {

  try {

    //Loads the .success file containing the HIT IDs and HIT Type IDs of HITs to be retrieved.
    HITDataInput success = new HITDataCSVReader(successFile);

    //Retrieves the submitted results of the specified HITs from Mechanical Turk
    HITTypeResults results = service.getHITTypeResults(success);
    results.setHITDataOutput(new HITDataCSVWriter(outputFile));

    //Writes the submitted results to the defined output file.
    //The output file is a tab delimited file containing all relevant details
    //of the HIT and assignments.  The submitted results are included as the last set of fields
    //and are represented as tab separated question/answer pairs
    results.writeResults();

    System.out.println("Results have been written to: " + outputFile);

  } catch (Exception e) {
    System.err.println("ERROR: Could not print results: " + e.getLocalizedMessage());
  }
}
项目:hiding    文件:Reviewer.java   
/**
 * Prints the submitted results of HITs when provided with a .success file.
 * @param successFile The .success file containing the HIT ID and HIT Type ID
 * @param outputFile The output file to write the submitted results to
 */
public void printResults(String successFile, String outputFile) {

  try {

    //Loads the .success file containing the HIT IDs and HIT Type IDs of HITs to be retrieved.
    HITDataInput success = new HITDataCSVReader(successFile);

    //Retrieves the submitted results of the specified HITs from Mechanical Turk
    HITTypeResults results = service.getHITTypeResults(success);
    results.setHITDataOutput(new HITDataCSVWriter(outputFile));

    //Writes the submitted results to the defined output file.
    //The output file is a tab delimited file containing all relevant details
    //of the HIT and assignments.  The submitted results are included as the last set of fields
    //and are represented as tab separated question/answer pairs
    results.writeResults();

    System.out.println("Results have been written to: " + outputFile);

  } catch (Exception e) {
    System.err.println("ERROR: Could not print results: " + e.getLocalizedMessage());
  }
}
项目:gort-public    文件:Reviewer.java   
/**
 * Prints the submitted results of HITs when provided with a .success file.
 * @param successFile The .success file containing the HIT ID and HIT Type ID
 * @param outputFile The output file to write the submitted results to
 */
public void printResults(String successFile, String outputFile) {

  try {

    //Loads the .success file containing the HIT IDs and HIT Type IDs of HITs to be retrieved.
    HITDataInput success = new HITDataCSVReader(successFile);

    //Retrieves the submitted results of the specified HITs from Mechanical Turk
    HITTypeResults results = service.getHITTypeResults(success);
    results.setHITDataOutput(new HITDataCSVWriter(outputFile));

    //Writes the submitted results to the defined output file.
    //The output file is a tab delimited file containing all relevant details
    //of the HIT and assignments.  The submitted results are included as the last set of fields
    //and are represented as tab separated question/answer pairs
    results.writeResults();

    System.out.println("Results have been written to: " + outputFile);

  } catch (Exception e) {
    System.err.println("ERROR: Could not print results: " + e.getLocalizedMessage());
  }
}
项目:java-aws-mturk    文件:SiteCategory.java   
/**
 * Create the website category HITs.
 *
 */
public void createSiteCategoryHITs() {
  try {

    //Loading the input file.  The input file is a tab delimited file where the first row
    //defines the fields/variables and the remaining rows contain the values for each HIT.
    //Each row represents a unique HIT.  The SDK uses the Apache Velocity engine to merge
    //the input values into a templatized QAP file.
    //Please refer to http://velocity.apache.org for more details on this engine and
    //how to specify variable names.  Apache Velocity is fully supported so there may be
    //additional functionality you can take advantage of if you know the Velocity syntax.
    HITDataInput input = new HITDataCSVReader(inputFile);

    //Loading the question (QAP) file.  This QAP file contains Apache Velocity variable names where the values
    //from the input file are to be inserted.  Essentially the QAP becomes a template for the input file.
    HITQuestion question = new HITQuestion(questionFile);

    //Loading the HIT properties file.  The properties file defines two system qualifications that will
    //be used for the HIT.  The properties file can also be a Velocity template.  Currently, only
    //the "annotation" field is allowed to be a Velocity template variable.  This allows the developer
    //to "tie in" the input value to the results.
    HITProperties props = new HITProperties(propertiesFile);

    HIT[] hits = null;

    // Create multiple HITs using the input, properties, and question files

    System.out.println("--[Loading HITs]----------");
    Date startTime = new Date();
    System.out.println("  Start time: " + startTime);

    //The simpliest way to bulk load a large number of HITs where all details are defined in files.
    //When using this method, it will automatically create output files of the following type:
    //  - <your input file name>.success - A file containing the HIT IDs and HIT Type IDs of
    //                                     all HITs that were successfully loaded.  This file will
    //                                     not exist if there are no HITs successfully loaded.
    //  - <your input file name>.failure - A file containing the input rows that failed to load.
    //                                     This file will not exist if there are no failures.
    //The .success file can be used in subsequent operations to retrieve the results that workers submitted.
    HITDataOutput success = new HITDataCSVWriter(inputFile + ".success");
    HITDataOutput failure = new HITDataCSVWriter(inputFile + ".failure");
    hits = service.createHITs(input, props, question, success, failure);

    System.out.println("--[End Loading HITs]----------");
    Date endTime = new Date();
    System.out.println("  End time: " + endTime);
    System.out.println("--[Done Loading HITs]----------");
    System.out.println("  Total load time: "
        + (endTime.getTime() - startTime.getTime())/1000 + " seconds.");

    if (hits == null) {
      throw new Exception("Could not create HITs");
    }

  } catch (Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}
项目:mturksdk-java-code-maven    文件:SiteCategory.java   
/**
 * Create the website category HITs.
 *
 */
public void createSiteCategoryHITs() {
  try {

    //Loading the input file.  The input file is a tab delimited file where the first row
    //defines the fields/variables and the remaining rows contain the values for each HIT.
    //Each row represents a unique HIT.  The SDK uses the Apache Velocity engine to merge
    //the input values into a templatized QAP file.
    //Please refer to http://velocity.apache.org for more details on this engine and
    //how to specify variable names.  Apache Velocity is fully supported so there may be
    //additional functionality you can take advantage of if you know the Velocity syntax.
    HITDataInput input = new HITDataCSVReader(inputFile);

    //Loading the question (QAP) file.  This QAP file contains Apache Velocity variable names where the values
    //from the input file are to be inserted.  Essentially the QAP becomes a template for the input file.
    HITQuestion question = new HITQuestion(questionFile);

    //Loading the HIT properties file.  The properties file defines two system qualifications that will
    //be used for the HIT.  The properties file can also be a Velocity template.  Currently, only
    //the "annotation" field is allowed to be a Velocity template variable.  This allows the developer
    //to "tie in" the input value to the results.
    HITProperties props = new HITProperties(propertiesFile);

    HIT[] hits = null;

    // Create multiple HITs using the input, properties, and question files

    System.out.println("--[Loading HITs]----------");
    Date startTime = new Date();
    System.out.println("  Start time: " + startTime);

    //The simpliest way to bulk load a large number of HITs where all details are defined in files.
    //When using this method, it will automatically create output files of the following type:
    //  - <your input file name>.success - A file containing the HIT IDs and HIT Type IDs of
    //                                     all HITs that were successfully loaded.  This file will
    //                                     not exist if there are no HITs successfully loaded.
    //  - <your input file name>.failure - A file containing the input rows that failed to load.
    //                                     This file will not exist if there are no failures.
    //The .success file can be used in subsequent operations to retrieve the results that workers submitted.
    HITDataOutput success = new HITDataCSVWriter(inputFile + ".success");
    HITDataOutput failure = new HITDataCSVWriter(inputFile + ".failure");
    hits = service.createHITs(input, props, question, success, failure);

    System.out.println("--[End Loading HITs]----------");
    Date endTime = new Date();
    System.out.println("  End time: " + endTime);
    System.out.println("--[Done Loading HITs]----------");
    System.out.println("  Total load time: "
        + (endTime.getTime() - startTime.getTime())/1000 + " seconds.");

    if (hits == null) {
      throw new Exception("Could not create HITs");
    }

  } catch (Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}
项目:gort-public    文件:SiteCategory.java   
/**
 * Create the website category HITs.
 *
 */
public void createSiteCategoryHITs() {
  try {

    //Loading the input file.  The input file is a tab delimited file where the first row
    //defines the fields/variables and the remaining rows contain the values for each HIT.
    //Each row represents a unique HIT.  The SDK uses the Apache Velocity engine to merge
    //the input values into a templatized QAP file.
    //Please refer to http://velocity.apache.org for more details on this engine and
    //how to specify variable names.  Apache Velocity is fully supported so there may be
    //additional functionality you can take advantage of if you know the Velocity syntax.
    HITDataInput input = new HITDataCSVReader(inputFile);

    //Loading the question (QAP) file.  This QAP file contains Apache Velocity variable names where the values
    //from the input file are to be inserted.  Essentially the QAP becomes a template for the input file.
    HITQuestion question = new HITQuestion(questionFile);

    //Loading the HIT properties file.  The properties file defines two system qualifications that will
    //be used for the HIT.  The properties file can also be a Velocity template.  Currently, only
    //the "annotation" field is allowed to be a Velocity template variable.  This allows the developer
    //to "tie in" the input value to the results.
    HITProperties props = new HITProperties(propertiesFile);

    HIT[] hits = null;

    // Create multiple HITs using the input, properties, and question files

    System.out.println("--[Loading HITs]----------");
    Date startTime = new Date();
    System.out.println("  Start time: " + startTime);

    //The simpliest way to bulk load a large number of HITs where all details are defined in files.
    //When using this method, it will automatically create output files of the following type:
    //  - <your input file name>.success - A file containing the HIT IDs and HIT Type IDs of
    //                                     all HITs that were successfully loaded.  This file will
    //                                     not exist if there are no HITs successfully loaded.
    //  - <your input file name>.failure - A file containing the input rows that failed to load.
    //                                     This file will not exist if there are no failures.
    //The .success file can be used in subsequent operations to retrieve the results that workers submitted.
    HITDataOutput success = new HITDataCSVWriter(inputFile + ".success");
    HITDataOutput failure = new HITDataCSVWriter(inputFile + ".failure");
    hits = service.createHITs(input, props, question, success, failure);

    System.out.println("--[End Loading HITs]----------");
    Date endTime = new Date();
    System.out.println("  End time: " + endTime);
    System.out.println("--[Done Loading HITs]----------");
    System.out.println("  Total load time: "
        + (endTime.getTime() - startTime.getTime())/1000 + " seconds.");

    if (hits == null) {
      throw new Exception("Could not create HITs");
    }

  } catch (Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}