public Triple<Double,Double,Double> classifyAndWriteAnswers(Collection<List<IN>> documents, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { return classifyAndWriteAnswers(documents, IOUtils.encodedOutputStreamPrintWriter(System.out, flags.outputEncoding, true), readerWriter, outputScores); }
public void classifyFilesAndWriteAnswers(Collection<File> testFiles, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFiles(testFiles, readerWriter); classifyAndWriteAnswers(documents, readerWriter, outputScores); }
public Triple<Double,Double,Double> classifyAndWriteAnswers(String baseDir, String filePattern, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFiles(baseDir, filePattern, readerWriter); return classifyAndWriteAnswers(documents, readerWriter, outputScores); }
/** * Load a test file, run the classifier on it, and then print the answers to * stdout (with timing to stderr). This uses the value of flags.documentReader * to determine testFile format. By default, this means that it is set up to * read a tab-separated columns test file * * @param testFile The file to test on. * @param outputScores Whether to calculate and then log performance scores (P/R/F1) * @return A Triple of P/R/F1 if outputScores is true, else null */ public Triple<Double,Double,Double> classifyAndWriteAnswers(String testFile, boolean outputScores) throws IOException { return classifyAndWriteAnswers(testFile, defaultReaderAndWriter(), outputScores); }
/** * Load a text file, run the classifier on it, and then print the answers to * stdout (with timing to stderr). This uses the value of flags.plainTextDocumentReaderAndWriter * to determine how to read the textFile format. By default this gives * edu.stanford.nlp.sequences.PlainTextDocumentReaderAndWriter. * <i>Note:</i> This means that it works right for * a plain textFile (and not a tab-separated columns test file). * * @param textFile The file to test on. */ public void classifyAndWriteAnswers(String textFile) throws IOException { classifyAndWriteAnswers(textFile, plainTextReaderAndWriter(), false); }
public void classifyStdin(DocumentReaderAndWriter<IN> readerWriter) throws IOException { BufferedReader is = IOUtils.readerFromStdin(flags.inputEncoding); for (String line; (line = is.readLine()) != null; ) { Collection<List<IN>> documents = makeObjectBankFromString(line, readerWriter); if (flags.keepEmptySentences && documents.isEmpty()) { documents = Collections.<List<IN>>singletonList(Collections.<IN>emptyList()); } classifyAndWriteAnswers(documents, readerWriter, false); } }
/** * Load a test file, run the classifier on it, and then print the answers to * stdout (with timing to stderr). * * @param testFile The file to test on. * @param readerWriter A reader and writer to use for the output * @param outputScores Whether to calculate and then log performance scores (P/R/F1) * @return A Triple of P/R/F1 if outputScores is true, else null */ public Triple<Double,Double,Double> classifyAndWriteAnswers(String testFile, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFile(testFile, readerWriter); return classifyAndWriteAnswers(documents, readerWriter, outputScores); }
/** If the flag * {@code outputEncoding} is defined, the output is written in that * character encoding, otherwise in the system default character encoding. */ public Triple<Double,Double,Double> classifyAndWriteAnswers(String testFile, OutputStream outStream, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFile(testFile, readerWriter); PrintWriter pw = IOUtils.encodedOutputStreamPrintWriter(outStream, flags.outputEncoding, true); return classifyAndWriteAnswers(documents, pw, readerWriter, outputScores); }
/** * Load a test file, run the classifier on it, and then print the answers to * stdout (with timing to stderr). This uses the value of * flags.documentReader to determine testFile format. * * @param testFile * The file to test on. */ public void classifyAndWriteAnswers(String testFile) throws IOException { classifyAndWriteAnswers(testFile, plainTextReaderAndWriter); }
private void classifyAndWriteAnswers(Collection<List<IN>> documents, DocumentReaderAndWriter<IN> readerWriter) throws IOException { classifyAndWriteAnswers(documents, IOUtils.encodedOutputStreamPrintWriter(System.out, flags.outputEncoding, true), readerWriter); }
public Triple<Double,Double,Double> classifyAndWriteAnswers(String baseDir, String filePattern, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFiles(baseDir, filePattern, readerWriter); return classifyAndWriteAnswers(documents, readerWriter, outputScores); }
public Triple<Double,Double,Double> classifyAndWriteAnswers(Collection<List<IN>> documents, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { return classifyAndWriteAnswers(documents, IOUtils.encodedOutputStreamPrintWriter(System.out, flags.outputEncoding, true), readerWriter, outputScores); }
public void classifyAndWriteAnswers(String baseDir, String filePattern, DocumentReaderAndWriter<IN> readerWriter) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFiles(baseDir, filePattern, readerWriter); classifyAndWriteAnswers(documents, readerWriter); }
public void classifyFilesAndWriteAnswers(Collection<File> testFiles, DocumentReaderAndWriter<IN> readerWriter) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFiles(testFiles, readerWriter); classifyAndWriteAnswers(documents, readerWriter); }
public void classifyFilesAndWriteAnswers(Collection<File> testFiles, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFiles(testFiles, readerWriter); classifyAndWriteAnswers(documents, readerWriter, outputScores); }
public void classifyAndWriteAnswers(String baseDir, String filePattern, DocumentReaderAndWriter readerWriter) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFiles(baseDir, filePattern, readerWriter); classifyAndWriteAnswers(documents, readerWriter); }
public void classifyAndWriteAnswers(Collection<File> testFiles, DocumentReaderAndWriter readerWriter) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFiles(testFiles, readerWriter); classifyAndWriteAnswers(documents, readerWriter); }
public void classifyStdin(DocumentReaderAndWriter<IN> readerWriter) throws IOException { BufferedReader is = IOUtils.readerFromStdin(flags.inputEncoding); for (String line; (line = is.readLine()) != null; ) { Collection<List<IN>> documents = makeObjectBankFromString(line, readerWriter); if (flags.keepEmptySentences && documents.isEmpty()) { documents = Collections.<List<IN>>singletonList(Collections.<IN>emptyList()); } classifyAndWriteAnswers(documents, readerWriter, false); } }
public void classifyStdin(DocumentReaderAndWriter<IN> readerWriter) throws IOException { BufferedReader is = IOUtils.readerFromStdin(flags.inputEncoding); for (String line; (line = is.readLine()) != null;) { Collection<List<IN>> documents = makeObjectBankFromString(line, readerWriter); if (flags.keepEmptySentences && documents.size() == 0) { documents = Collections.<List<IN>> singletonList(Collections .<IN> emptyList()); } classifyAndWriteAnswers(documents, readerWriter); } }
/** If the flag * {@code outputEncoding} is defined, the output is written in that * character encoding, otherwise in the system default character encoding. */ public Triple<Double,Double,Double> classifyAndWriteAnswers(String testFile, OutputStream outStream, DocumentReaderAndWriter<IN> readerWriter, boolean outputScores) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFile(testFile, readerWriter); PrintWriter pw = IOUtils.encodedOutputStreamPrintWriter(outStream, flags.outputEncoding, true); return classifyAndWriteAnswers(documents, pw, readerWriter, outputScores); }