|
|||||||||
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(Reader in)
Read parse trees from a Reader . |
|
PennTreeReader(Reader in,
TreeFactory tf)
Read parse trees from a Reader . |
|
PennTreeReader(Reader in,
TreeFactory tf,
TreeNormalizer tn)
Read parse trees from a Reader. |
|
PennTreeReader(Reader in,
TreeFactory tf,
TreeNormalizer tn,
Tokenizer<String> st)
Read parse trees from a Reader. |
Method Summary | |
---|---|
void |
close()
Closes the underlying Reader used to create this
class. |
static void |
main(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(Reader in)
Reader
.
For the defaulted arguments, you get a
SimpleTreeFactory
, no TreeNormalizer
, and
a PennTreebankTokenizer
.
in
- The Reader
public PennTreeReader(Reader in, TreeFactory tf)
Reader
.
in
- the Readertf
- TreeFactory -- factory to create some kind of Treepublic PennTreeReader(Reader in, TreeFactory tf, TreeNormalizer tn)
in
- Readertf
- TreeFactory -- factory to create some kind of Treetn
- the method of normalizing treespublic PennTreeReader(Reader in, TreeFactory tf, TreeNormalizer tn, Tokenizer<String> st)
in
- Readertf
- TreeFactory -- factory to create some kind of Treetn
- the method of normalizing treesst
- Tokenizer that divides up ReaderMethod Detail |
---|
public Tree readTree() throws 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 TreeReader
null
at end of token stream.
IOException
public void close() throws IOException
Reader
used to create this
class.
close
in interface TreeReader
IOException
public static void main(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 |