edu.stanford.nlp.trees.international.pennchinese
Class FragDiscardingPennTreeReader
java.lang.Object
edu.stanford.nlp.trees.PennTreeReader
edu.stanford.nlp.trees.international.pennchinese.FragDiscardingPennTreeReader
- All Implemented Interfaces:
- TreeReader
public class FragDiscardingPennTreeReader
- extends PennTreeReader
- Author:
- Galen Andrew
Method Summary |
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 |
FragDiscardingPennTreeReader
public FragDiscardingPennTreeReader(Reader in,
TreeFactory tf,
TreeNormalizer tn,
Tokenizer<String> tk)
readTree
public Tree readTree()
throws IOException
- Description copied from class:
PennTreeReader
- Reads a single tree in standard Penn Treebank format from the
input stream. The method supports additional parentheses around the
tree (an unnamed ROOT node) so long as they are balanced. If the token stream
ends before the current tree is complete, then the method will throw an
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.
- Specified by:
readTree
in interface TreeReader
- Overrides:
readTree
in class PennTreeReader
- Returns:
- A single tree, or
null
at end of token stream.
- Throws:
IOException
Stanford NLP Group