edu.stanford.nlp.trees
Class FilteringTreebank

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

public class FilteringTreebank
extends Treebank

This class wraps another Treebank, and will vend trees that passed a Filter.

Author:
John Bauer

Field Summary
 
Fields inherited from class edu.stanford.nlp.trees.Treebank
DEFAULT_TREE_FILE_SUFFIX
 
Constructor Summary
FilteringTreebank(Treebank treebank, Filter<Tree> filter)
           
 
Method Summary
 void apply(TreeVisitor tv)
          Applies the TreeVisitor, but only to the trees that pass the filter.
 void clear()
          Empty a Treebank.
 java.util.Iterator<Tree> iterator()
           
 void loadPath(java.io.File path, java.io.FileFilter filt)
          Load trees from given path specification.
 
Methods inherited from class edu.stanford.nlp.trees.Treebank
decimate, encoding, loadPath, loadPath, loadPath, loadPath, loadPath, remove, size, textualSummary, 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

FilteringTreebank

public FilteringTreebank(Treebank treebank,
                         Filter<Tree> filter)
Method Detail

clear

public void clear()
Empty a Treebank.

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

loadPath

public void loadPath(java.io.File path,
                     java.io.FileFilter filt)
Load trees from given path specification. Not supported for this type of treebank.

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 tv)
Applies the TreeVisitor, but only to the trees that pass the filter. Applies the visitor to a copy of the tree.

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

iterator

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


Stanford NLP Group