/** This is the default DocumentReaderAndWriter used for reading text files for runtime * classification. It is the DocumentReaderAndWriter specified by the plainTextDocumentReaderAndWriter * flag and defaults to {@code edu.stanford.nlp.sequences.PlainTextDocumentReaderAndWriter} which * is suitable for reading plain text files, in languages with a Tokenizer available. * This reader is now allocated lazily when required, since many times (such as when using * AbstractSequenceClassifiers in StanfordCoreNLP, these DocumentReaderAndWriters are never used. * Synchronized for safe lazy initialization. * * @return The default plain text DocumentReaderAndWriter */ public synchronized DocumentReaderAndWriter<IN> plainTextReaderAndWriter() { if (plainTextReaderAndWriter == null) { if (flags.readerAndWriter != null && flags.readerAndWriter.equals(flags.plainTextDocumentReaderAndWriter)) { plainTextReaderAndWriter = defaultReaderAndWriter(); } else { plainTextReaderAndWriter = makePlainTextReaderAndWriter(); } } return plainTextReaderAndWriter; }
DocumentReaderAndWriter<CoreLabel> readerAndWriter = classifier.makePlainTextReaderAndWriter(); classifier.classifyAndWriteAnswersKBest(args[1], 10, readerAndWriter);
/** This is the default DocumentReaderAndWriter used for reading text files for runtime * classification. It is the DocumentReaderAndWriter specified by the plainTextDocumentReaderAndWriter * flag and defaults to {@code edu.stanford.nlp.sequences.PlainTextDocumentReaderAndWriter} which * is suitable for reading plain text files, in languages with a Tokenizer available. * This reader is now allocated lazily when required, since many times (such as when using * AbstractSequenceClassifiers in StanfordCoreNLP, these DocumentReaderAndWriters are never used. * Synchronized for safe lazy initialization. * * @return The default plain text DocumentReaderAndWriter */ public synchronized DocumentReaderAndWriter<IN> plainTextReaderAndWriter() { if (plainTextReaderAndWriter == null) { if (flags.readerAndWriter != null && flags.readerAndWriter.equals(flags.plainTextDocumentReaderAndWriter)) { plainTextReaderAndWriter = defaultReaderAndWriter(); } else { plainTextReaderAndWriter = makePlainTextReaderAndWriter(); } } return plainTextReaderAndWriter; }
plainTextReaderAndWriter = defaultReaderAndWriter; } else { plainTextReaderAndWriter = makePlainTextReaderAndWriter();