|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.trees.SentenceReader
A SentenceReader
adds functionality to a Reader
by reading in Sentence
s, or some descendant class. Like
other standard classes, this class does not provide buffering, so for
high performance, a typical invocation of SentenceReader
would be something like:
SentenceReader sr = new SentenceReader(new BufferedReader(new
FileReader(file)), myWordFactory);
It is designed for sentences to be delimited in one of two ways: either
by a recognizable end-of-sentence token or by an end-of-line. If the
latter, the StreamTokenizer should return end-of-lines, and the
SentenceNormalizer should say to use them.
Constructor Summary | |
SentenceReader(Reader in)
Read sentences from a Reader . |
|
SentenceReader(Reader in,
LabelFactory lf)
Read sentences from a Reader . |
|
SentenceReader(Reader in,
LabelFactory lf,
SentenceNormalizer sn)
Read sentences from a Reader . |
|
SentenceReader(Reader in,
LabelFactory lf,
SentenceNormalizer sn,
StreamTokenizer st)
Read sentences from a Reader . |
Method Summary | |
void |
close()
Close the Reader behind this SentenceReader . |
static void |
main(String[] args)
Loads sentences from first argument and prints them. |
Sentence |
readSentence()
Reads a single sentence. |
String |
toString()
Returns a representation of the SentenceReader
object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SentenceReader(Reader in)
Reader
.
in
- the Reader
public SentenceReader(Reader in, LabelFactory lf)
Reader
.
in
- the Readerlf
- LabelFactory -- factory to create some kind
of LinguisticLabelpublic SentenceReader(Reader in, LabelFactory lf, SentenceNormalizer sn)
Reader
.
in
- input streamlf
- LabelFactory -- factory to create some kind
of LinguisticLabelsn
- the method of normalizing sentencespublic SentenceReader(Reader in, LabelFactory lf, SentenceNormalizer sn, StreamTokenizer st)
Reader
. All of the arguments must
be provided. They cannot be null
.
in
- input Reader
lf
- LabelFactory -- factory to create some kind
of LinguisticLabelsn
- the method of normalizing sentences.st
- StreamTokenizer that divides up input from ReaderMethod Detail |
public Sentence readSentence() throws IOException
null
at (and only at) end of file.
IOException
- If format is invalidpublic void close() throws IOException
SentenceReader
.
IOException
- If can't close filepublic String toString()
SentenceReader
object. This indicates the objects it contains.
toString
in class Object
SentenceReader
public static void main(String[] args)
args
- Array of command-line arguments (just filePath)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |