|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.sequences.PlainTextDocumentReaderAndWriter<IN>
public class PlainTextDocumentReaderAndWriter<IN extends CoreMap>
This class provides methods for reading plain text documents and writing out those documents once classified in several different formats.
Implementation note: see
itest/src/edu/stanford/nlp/ie/crf/CRFClassifierITest.java for examples and
test cases for the output options.
It can be over anything that extends CoreMap
, and the default is
CoreLabel
Nested Class Summary | |
---|---|
static class |
PlainTextDocumentReaderAndWriter.OutputStyle
|
Constructor Summary | |
---|---|
PlainTextDocumentReaderAndWriter()
Construct a PlainTextDocumentReaderAndWriter. |
Method Summary | |
---|---|
String |
getAnswers(List<IN> l,
PlainTextDocumentReaderAndWriter.OutputStyle outputStyle,
boolean preserveSpacing)
|
Iterator<List<IN>> |
getIterator(Reader r)
Return an iterator over the contents read from r. |
void |
init(SeqClassifierFlags flags)
This will be called immediately after construction. |
void |
init(SeqClassifierFlags flags,
TokenizerFactory<IN> tokenizerFactory)
|
void |
init(SeqClassifierFlags flags,
TokenizerFactory<IN> tokenizerFactory,
CoreTokenFactory<IN> tokenFactory)
|
void |
printAnswers(List<IN> list,
PrintWriter out)
Print the classifications for the document to the given Writer. |
void |
printAnswers(List<IN> l,
PrintWriter out,
PlainTextDocumentReaderAndWriter.OutputStyle outputStyle,
boolean preserveSpacing)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PlainTextDocumentReaderAndWriter()
Method Detail |
---|
public void init(SeqClassifierFlags flags)
DocumentReaderAndWriter
init
in interface DocumentReaderAndWriter<IN extends CoreMap>
flags
- Flags specifying behaviorpublic void init(SeqClassifierFlags flags, TokenizerFactory<IN> tokenizerFactory)
public void init(SeqClassifierFlags flags, TokenizerFactory<IN> tokenizerFactory, CoreTokenFactory<IN> tokenFactory)
public Iterator<List<IN>> getIterator(Reader r)
IteratorFromReaderFactory
getIterator
in interface IteratorFromReaderFactory<List<IN extends CoreMap>>
r
- Where to read objects from
public void printAnswers(List<IN> list, PrintWriter out)
outputFormat
property, and can print in
slashTags, inlineXML, or xml (stand-Off XML). For both the XML output
formats, it preserves spacing, while for the slashTags format, it prints
tokenized (since preserveSpacing output is somewhat dysfunctional with the
slashTags format).
printAnswers
in interface DocumentReaderAndWriter<IN extends CoreMap>
list
- List of tokens with classifier answersout
- Where to print the output topublic String getAnswers(List<IN> l, PlainTextDocumentReaderAndWriter.OutputStyle outputStyle, boolean preserveSpacing)
public void printAnswers(List<IN> l, PrintWriter out, PlainTextDocumentReaderAndWriter.OutputStyle outputStyle, boolean preserveSpacing)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |