edu.stanford.nlp.sequences
Class CoNLLDocumentReaderAndWriter

java.lang.Object
  extended by edu.stanford.nlp.sequences.CoNLLDocumentReaderAndWriter
All Implemented Interfaces:
IteratorFromReaderFactory<List<FeatureLabel>>, DocumentReaderAndWriter, Serializable

public class CoNLLDocumentReaderAndWriter
extends Object
implements DocumentReaderAndWriter

DocumentReader for CoNLL 03 format. In this format, there is one word per line, with extra attributes of a word (POS tag, chunk, etc.) in other space or tab separated columns, where leading and trailing whitespace on the line are ignored. Sentences are supposedly separated by a blank line (one with no non-whitespace characters), but where blank lines occur is in practice often fairly random. In particular, entities not infrequently span blank lines.

Author:
Jenny Finkel, Huy Nguyen, Christopher Manning
See Also:
Serialized Form

Field Summary
static String BOUNDARY
           
static String OTHER
           
 
Constructor Summary
CoNLLDocumentReaderAndWriter()
           
 
Method Summary
 Iterator<List<FeatureLabel>> getIterator(Reader r)
           
 void init(SeqClassifierFlags flags)
          Will be called immediately after construction.
static void main(String[] args)
          Count some stats on what occurs in a file.
 void printAnswers(List<FeatureLabel> doc, PrintWriter out)
          This method prints the output of the classifier to a PrintWriter.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BOUNDARY

public static final String BOUNDARY
See Also:
Constant Field Values

OTHER

public static final String OTHER
See Also:
Constant Field Values
Constructor Detail

CoNLLDocumentReaderAndWriter

public CoNLLDocumentReaderAndWriter()
Method Detail

init

public void init(SeqClassifierFlags flags)
Description copied from interface: DocumentReaderAndWriter
Will be called immediately after construction. Needed because of reflection.

Specified by:
init in interface DocumentReaderAndWriter

toString

public String toString()
Overrides:
toString in class Object

getIterator

public Iterator<List<FeatureLabel>> getIterator(Reader r)
Specified by:
getIterator in interface IteratorFromReaderFactory<List<FeatureLabel>>

printAnswers

public void printAnswers(List<FeatureLabel> doc,
                         PrintWriter out)
Description copied from interface: DocumentReaderAndWriter
This method prints the output of the classifier to a PrintWriter.

Specified by:
printAnswers in interface DocumentReaderAndWriter
Parameters:
doc - The document: A List of FeatureLabel
out - Where to send the answers to

main

public static void main(String[] args)
                 throws IOException,
                        ClassNotFoundException
Count some stats on what occurs in a file.

Throws:
IOException
ClassNotFoundException


Stanford NLP Group