/** * Takes the file, reads it in, and prints out the likelihood of each possible * label at each point. * * @param filename The path to the specified file */ public void printProbs(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter // flags.ocrTrain = false; ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter); printProbsDocuments(docs); }
/** * 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); }
public ObjectBank<List<IN>> makeObjectBankFromFile(String filename) { return makeObjectBankFromFile(filename, defaultReaderAndWriter()); }
/** 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); }
/** * Classify the contents of a file. * * @param filename Contains the sentence(s) to be classified. * @return {@link List} of classified List of IN. */ public List<List<IN>> classifyFile(String filename) { ObjectBank<List<IN>> documents = makeObjectBankFromFile(filename, plainTextReaderAndWriter()); return classifyObjectBank(documents); }
/** * 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 name of the file to test on. * @param k How many best to print * @param readerAndWriter Class to be used for printing answers */ public void classifyAndWriteAnswersKBest(String testFile, int k, DocumentReaderAndWriter<IN> readerAndWriter) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFile(testFile, readerAndWriter); PrintWriter pw = IOUtils.encodedOutputStreamPrintWriter(System.out, flags.outputEncoding, true); classifyAndWriteAnswersKBest(documents, k, pw, readerAndWriter); pw.flush(); }
ObjectBank<List<IN>> documents = makeObjectBankFromFile(testFile, readerAndWriter); int numWords = 0; int numSentences = 0;
public void train(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter // flags.ocrTrain = true; train(makeObjectBankFromFile(filename, readerAndWriter), readerAndWriter); }
public ObjectBank<List<IN>> makeObjectBankFromFile(String filename) { return makeObjectBankFromFile(filename, defaultReaderAndWriter); }
public void train(String filename, DocumentReaderAndWriter readerAndWriter) { // only for the OCR data does this matter flags.ocrTrain = true; train(makeObjectBankFromFile(filename, readerAndWriter), readerAndWriter); }
public ObjectBank<List<IN>> makeObjectBankFromFile(String filename) { return makeObjectBankFromFile(filename, defaultReaderAndWriter()); }
public void train(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter flags.ocrTrain = true; train(makeObjectBankFromFile(filename, readerAndWriter), readerAndWriter); }
public void classifyAndWriteAnswers(String testFile, OutputStream outStream, DocumentReaderAndWriter readerWriter) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFile(testFile, readerWriter); classifyAndWriteAnswers(documents, outStream, readerWriter); }
/** * Takes the file, reads it in, and prints out the likelihood of each * possible label at each point. * * @param filename * The path to the specified file */ public void printProbs(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter flags.ocrTrain = false; ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter); printProbsDocuments(docs); }
/** * Takes the file, reads it in, and prints out the likelihood of each possible * label at each point. * * @param filename * The path to the specified file */ public void printProbs(String filename, DocumentReaderAndWriter readerAndWriter) { // only for the OCR data does this matter flags.ocrTrain = false; ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter); printProbsDocuments(docs); }
/** * Takes the file, reads it in, and prints out the likelihood of each possible * label at each point. * * @param filename The path to the specified file */ public void printProbs(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter // flags.ocrTrain = false; ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter); printProbsDocuments(docs); }
/** * Classify the contents of a file. * * @param filename Contains the sentence(s) to be classified. * @return {@link List} of classified List of IN. */ public List<List<IN>> classifyFile(String filename) { ObjectBank<List<IN>> documents = makeObjectBankFromFile(filename, plainTextReaderAndWriter()); return classifyObjectBank(documents); }
/** 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); }
/** * If the flag <code>outputEncoding</code> is defined, the output is written * in that character encoding, otherwise in the system default character * encoding. */ public void classifyAndWriteAnswers(String testFile, OutputStream outStream, DocumentReaderAndWriter<IN> readerWriter) throws IOException { ObjectBank<List<IN>> documents = makeObjectBankFromFile(testFile, readerWriter); PrintWriter pw = IOUtils.encodedOutputStreamPrintWriter(outStream, flags.outputEncoding, true); classifyAndWriteAnswers(documents, pw, readerWriter); }
public void train(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter // flags.ocrTrain = true; train(makeObjectBankFromFile(filename, readerAndWriter), readerAndWriter); }