up
Class PennTreebankReader

java.lang.Object
  extended by up.PennTreebankReader

public class PennTreebankReader
extends java.lang.Object

Read files in the Penn Treebank format.


Field Summary
static java.lang.String ROOT_LABEL
          The label used for the root node of a tree.
 
Constructor Summary
PennTreebankReader(TreeHandler handler)
          Constructs a reader that sends the trees to the specified handler.
 
Method Summary
 void read(java.io.File file)
          Reads trees from the specified file.
 void read(java.io.File root, int from, int to)
          Reads trees from the specified range of WSJ data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_LABEL

public static final java.lang.String ROOT_LABEL
The label used for the root node of a tree.

See Also:
Constant Field Values
Constructor Detail

PennTreebankReader

public PennTreebankReader(TreeHandler handler)
Constructs a reader that sends the trees to the specified handler.

Parameters:
handler - the tree handler to send the read trees to
Method Detail

read

public void read(java.io.File file)
          throws java.io.FileNotFoundException,
                 java.io.IOException
Reads trees from the specified file.

Parameters:
file - the file to read
Throws:
java.io.FileNotFoundException - if the specified file cannot be found
java.io.IOException - if an error occurs during the reading of the specified file

read

public void read(java.io.File root,
                 int from,
                 int to)
          throws java.io.FileNotFoundException,
                 java.io.IOException
Reads trees from the specified range of WSJ data.

Parameters:
root - the root of the file structure containing the WSJ data
from - the lowest file number to be read from the specified file structure
to - the highest file number to be read from the specified file structure
Throws:
java.io.FileNotFoundException - if a file cannot be found
java.io.IOException - if an error occurs during reading