edu.stanford.nlp.trees
Class TransformingTreebank

java.lang.Object
  extended by java.util.AbstractCollection<Tree>
      extended by edu.stanford.nlp.trees.Treebank
          extended by edu.stanford.nlp.trees.TransformingTreebank
All Implemented Interfaces:
Iterable<Tree>, Collection<Tree>

public class TransformingTreebank
extends Treebank

Author:
Pi-Chuan Chang

Constructor Summary
TransformingTreebank()
          Create a new TransformingTreebank.
TransformingTreebank(String encoding)
          Create a new tree bank, set the encoding for file access.
TransformingTreebank(Treebank tf, TreeTransformer transformer)
           
TransformingTreebank(TreeReaderFactory trf)
          Create a new TransformingTreebank.
TransformingTreebank(TreeReaderFactory trf, String encoding)
          Create a new TransformingTreebank.
 
Method Summary
 void apply(TreeVisitor tp)
          Applies the TreeVisitor to to all trees in the Treebank.
 void clear()
          Empty a Treebank.
 Iterator<Tree> iterator()
           
 void loadPath(File path, FileFilter filt)
          Load trees from given path specification.
static void main(String[] args)
          Loads treebank grammar from first argument and prints it.
 
Methods inherited from class edu.stanford.nlp.trees.Treebank
encoding, loadPath, loadPath, loadPath, loadPath, loadPath, remove, size, textualSummary, toString, transform, treeReaderFactory
 
Methods inherited from class java.util.AbstractCollection
add, addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

TransformingTreebank

public TransformingTreebank()
Create a new TransformingTreebank. The trees are made with a LabeledScoredTreeReaderFactory.

Compatibility note: Until Sep 2004, this used to create a Treebank with a SimpleTreeReaderFactory, but this was changed as the old default wasn't very useful, especially to naive users.


TransformingTreebank

public TransformingTreebank(String encoding)
Create a new tree bank, set the encoding for file access.

Parameters:
encoding - The charset encoding to use for treebank file decoding

TransformingTreebank

public TransformingTreebank(TreeReaderFactory trf)
Create a new TransformingTreebank.

Parameters:
trf - the factory class to be called to create a new TreeReader

TransformingTreebank

public TransformingTreebank(TreeReaderFactory trf,
                            String encoding)
Create a new TransformingTreebank.

Parameters:
trf - the factory class to be called to create a new TreeReader
encoding - The charset encoding to use for treebank file decoding

TransformingTreebank

public TransformingTreebank(Treebank tf,
                            TreeTransformer transformer)
Method Detail

clear

public void clear()
Empty a Treebank.

Specified by:
clear in interface Collection<Tree>
Specified by:
clear in class Treebank

loadPath

public void loadPath(File path,
                     FileFilter filt)
Load trees from given path specification.

Specified by:
loadPath in class Treebank
Parameters:
path - file or directory to load from
filt - a FilenameFilter of files to load

apply

public void apply(TreeVisitor tp)
Applies the TreeVisitor to to all trees in the Treebank.

Specified by:
apply in class Treebank
Parameters:
tp - A class that can process trees.

iterator

public Iterator<Tree> iterator()
Specified by:
iterator in interface Iterable<Tree>
Specified by:
iterator in interface Collection<Tree>
Specified by:
iterator in class AbstractCollection<Tree>

main

public static void main(String[] args)
Loads treebank grammar from first argument and prints it. Just a demonstration of functionality.
usage: java MemoryTreebank treebankFilesPath

Parameters:
args - array of command-line arguments


Stanford NLP Group