|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.trees.PennTreeReader
public class PennTreeReader
This class implements the TreeReader interface to read Penn Treebank-style
files. The reader is implemented as a pushdown automaton (PDA) that parses the Lisp-style
format in which the trees are stored. This reader is compatible with both PTB
and PATB trees.
| Constructor Summary | |
|---|---|
PennTreeReader(java.io.Reader in)
Read parse trees from a Reader. |
|
PennTreeReader(java.io.Reader in,
TreeFactory tf)
Read parse trees from a Reader. |
|
PennTreeReader(java.io.Reader in,
TreeFactory tf,
TreeNormalizer tn)
Read parse trees from a Reader. |
|
PennTreeReader(java.io.Reader in,
TreeFactory tf,
TreeNormalizer tn,
Tokenizer<java.lang.String> st)
Read parse trees from a Reader. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the underlying Reader used to create this
class. |
static void |
main(java.lang.String[] args)
Loads treebank data from first argument and prints it. |
Tree |
readTree()
Reads a single tree in standard Penn Treebank format from the input stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PennTreeReader(java.io.Reader in)
Reader.
For the defaulted arguments, you get a
SimpleTreeFactory, no TreeNormalizer, and
a PennTreebankTokenizer.
in - The Reader
public PennTreeReader(java.io.Reader in,
TreeFactory tf)
Reader.
in - the Readertf - TreeFactory -- factory to create some kind of Tree
public PennTreeReader(java.io.Reader in,
TreeFactory tf,
TreeNormalizer tn)
in - Readertf - TreeFactory -- factory to create some kind of Treetn - the method of normalizing trees
public PennTreeReader(java.io.Reader in,
TreeFactory tf,
TreeNormalizer tn,
Tokenizer<java.lang.String> st)
in - Readertf - TreeFactory -- factory to create some kind of Treetn - the method of normalizing treesst - Tokenizer that divides up Reader| Method Detail |
|---|
public Tree readTree()
throws java.io.IOException
IOException.
Note that the method will skip malformed trees and attempt to
read additional trees from the input stream. It is possible, however,
that a malformed tree will corrupt the token stream. In this case,
an IOException will eventually be thrown.
readTree in interface TreeReadernull at end of token stream.
java.io.IOException - If I/O problem
public void close()
throws java.io.IOException
Reader used to create this
class.
close in interface TreeReaderclose in interface java.io.Closeablejava.io.IOExceptionpublic static void main(java.lang.String[] args)
args - Array of command-line arguments: specifies a filename
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||