|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.sequences.PlainTextDocumentReaderAndWriter
public class PlainTextDocumentReaderAndWriter
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.
Field Summary | |
---|---|
static int |
OUTPUT_STYLE_INLINE_XML
|
static int |
OUTPUT_STYLE_SLASH_TAGS
|
static int |
OUTPUT_STYLE_TSV
|
static int |
OUTPUT_STYLE_XML
|
Constructor Summary | |
---|---|
PlainTextDocumentReaderAndWriter()
Construct a PlainTextDocumentReaderAndWriter. |
Method Summary | |
---|---|
static int |
asIntOutputFormat(String outputFormat)
Convert a String expressing an output format to its internal coding as an int constant. |
static String |
getAnswers(List<CoreLabel> l)
Deprecated. This has been left in since it is still called in the version of the tagger that we currently distribute, but it will be removed. |
String |
getAnswers(List<CoreLabel> l,
int outputStyle,
boolean preserveSpacing)
|
Iterator<List<CoreLabel>> |
getIterator(Reader r)
|
void |
init(SeqClassifierFlags flags)
Will be called immediately after construction. |
void |
printAnswers(List<CoreLabel> list,
PrintWriter out)
Print the classifications for the document to the given Writer. |
void |
printAnswers(List<CoreLabel> l,
PrintWriter out,
int outputStyle,
boolean preserveSpacing)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OUTPUT_STYLE_SLASH_TAGS
public static final int OUTPUT_STYLE_XML
public static final int OUTPUT_STYLE_INLINE_XML
public static final int OUTPUT_STYLE_TSV
Constructor Detail |
---|
public PlainTextDocumentReaderAndWriter()
Method Detail |
---|
public void init(SeqClassifierFlags flags)
DocumentReaderAndWriter
init
in interface DocumentReaderAndWriter
flags
- Flags specifying behaviorpublic Iterator<List<CoreLabel>> getIterator(Reader r)
getIterator
in interface IteratorFromReaderFactory<List<CoreLabel>>
public static String getAnswers(List<CoreLabel> l)
public static int asIntOutputFormat(String outputFormat)
outputFormat
- The String
public void printAnswers(List<CoreLabel> 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
list
- List of tokens with classifier answersout
- Where to print the output topublic String getAnswers(List<CoreLabel> l, int outputStyle, boolean preserveSpacing)
public void printAnswers(List<CoreLabel> l, PrintWriter out, int outputStyle, boolean preserveSpacing)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |