|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<Tree>
edu.stanford.nlp.trees.Treebank
edu.stanford.nlp.trees.MemoryTreebank
public final class MemoryTreebank
A MemoryTreebank object stores a corpus of examples with
given tree structures in memory (as a List).
| Field Summary |
|---|
| Fields inherited from class edu.stanford.nlp.trees.Treebank |
|---|
DEFAULT_TREE_FILE_SUFFIX |
| Constructor Summary | |
|---|---|
MemoryTreebank()
Create a new tree bank. |
|
MemoryTreebank(int initialCapacity)
Create a new Treebank. |
|
MemoryTreebank(int initialCapacity,
TreeReaderFactory trf)
Create a new tree bank. |
|
MemoryTreebank(java.util.List<Tree> trees,
TreeReaderFactory trf,
java.lang.String encoding)
Create a new tree bank. |
|
MemoryTreebank(java.lang.String encoding)
Create a new tree bank, set the encoding for file access |
|
MemoryTreebank(TreeNormalizer tm)
Create a new tree bank, using a specific TreeNormalizer. |
|
MemoryTreebank(TreeReaderFactory trf)
Create a new tree bank. |
|
MemoryTreebank(TreeReaderFactory trf,
java.lang.String encoding)
Create a new tree bank. |
|
| Method Summary | |
|---|---|
void |
add(int index,
Tree element)
|
boolean |
add(Tree element)
|
boolean |
addAll(int index,
java.util.Collection<? extends Tree> c)
|
void |
apply(TreeVisitor tp)
Apply the TreeVisitor tp to all trees in the Treebank. |
void |
clear()
Empty a Treebank. |
Tree |
get(int i)
Get a tree by index from the Treebank. |
int |
indexOf(java.lang.Object o)
|
java.util.Iterator<Tree> |
iterator()
Return an Iterator over Trees in the Treebank. |
int |
lastIndexOf(java.lang.Object o)
|
java.util.ListIterator<Tree> |
listIterator()
|
java.util.ListIterator<Tree> |
listIterator(int index)
|
void |
load(java.io.Reader r)
Load a collection of parse trees from a Reader. |
void |
load(java.io.Reader r,
java.lang.String id)
Load a collection of parse trees from a Reader. |
void |
loadPath(java.io.File path,
java.io.FileFilter filt)
Load trees from given directory. |
void |
loadPath(java.lang.String path,
java.io.FileFilter filt,
java.lang.String srlFile)
|
static void |
main(java.lang.String[] args)
Loads treebank grammar from first argument and prints it. |
void |
processFile(java.io.File file)
Load a collection of parse trees from the file of given name. |
Tree |
remove(int index)
|
Tree |
set(int index,
Tree element)
|
int |
size()
Returns the size of the Treebank. |
java.util.List<Tree> |
subList(int fromIndex,
int toIndex)
|
Treebank |
transform(TreeTransformer treeTrans)
Return a MemoryTreebank where each Tree in the current treebank has been transformed using the TreeTransformer. |
| Methods inherited from class edu.stanford.nlp.trees.Treebank |
|---|
decimate, encoding, loadPath, loadPath, loadPath, loadPath, loadPath, remove, textualSummary, textualSummary, toString, treeReaderFactory |
| Methods inherited from class java.util.AbstractCollection |
|---|
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.List |
|---|
addAll, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
|---|
public MemoryTreebank()
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. This one now
uses a LabledScoredTreeReaderFactory with a no-op TreeNormalizer.
public MemoryTreebank(TreeNormalizer tm)
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.
public MemoryTreebank(java.lang.String encoding)
encoding - the encoding to use for file access.public MemoryTreebank(TreeReaderFactory trf)
trf - the factory class to be called to create a new
TreeReader
public MemoryTreebank(TreeReaderFactory trf,
java.lang.String encoding)
trf - the factory class to be called to create a new
TreeReaderencoding - the encoding to use for file access.
public MemoryTreebank(java.util.List<Tree> trees,
TreeReaderFactory trf,
java.lang.String encoding)
trees - The trees to put in the Treebank.trf - the factory class to be called to create a new
TreeReaderencoding - the encoding to use for file access.public MemoryTreebank(int initialCapacity)
initialCapacity - The initial size of the underlying Collection,
(if a Collection-based storage mechanism is being provided)
public MemoryTreebank(int initialCapacity,
TreeReaderFactory trf)
initialCapacity - The initial size of the underlying Collectiontrf - the factory class to be called to create a new
TreeReader| Method Detail |
|---|
public void clear()
Treebank.
clear in interface java.util.Collection<Tree>clear in interface java.util.List<Tree>clear in class Treebank
public void loadPath(java.io.File path,
java.io.FileFilter filt)
loadPath in class Treebankpath - file or directory to load fromfilt - a FilenameFilter of files to load
public void loadPath(java.lang.String path,
java.io.FileFilter filt,
java.lang.String srlFile)
public void processFile(java.io.File file)
FileProcessor interface.
processFile in interface FileProcessorfile - file to load a tree fromfor traversing directoriespublic void load(java.io.Reader r)
r - The reader to read trees from. (If you want it buffered,
you should already have buffered it!)
public void load(java.io.Reader r,
java.lang.String id)
r - The reader to read trees from. (If you want it buffered,
you should already have buffered it!)id - An ID for where these files come from (arbitrary, but
something like a filename. Can be null for none.public Tree get(int i)
Treebank feature set, and
so is only available with a MemoryTreebank, but is
useful in allowing the latter to be used as a List.
get in interface java.util.List<Tree>i - The integer (counting from 0) index of the tree
public void apply(TreeVisitor tp)
apply in class Treebanktp - A class that implements the TreeVisitor interfacepublic java.util.Iterator<Tree> iterator()
iterator in interface java.lang.Iterable<Tree>iterator in interface java.util.Collection<Tree>iterator in interface java.util.List<Tree>iterator in class java.util.AbstractCollection<Tree>public int size()
Treebank
size in interface java.util.Collection<Tree>size in interface java.util.List<Tree>size in class Treebank
public void add(int index,
Tree element)
add in interface java.util.List<Tree>public boolean add(Tree element)
add in interface java.util.Collection<Tree>add in interface java.util.List<Tree>add in class java.util.AbstractCollection<Tree>
public boolean addAll(int index,
java.util.Collection<? extends Tree> c)
addAll in interface java.util.List<Tree>public int indexOf(java.lang.Object o)
indexOf in interface java.util.List<Tree>public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<Tree>public Tree remove(int index)
remove in interface java.util.List<Tree>
public Tree set(int index,
Tree element)
set in interface java.util.List<Tree>public java.util.ListIterator<Tree> listIterator()
listIterator in interface java.util.List<Tree>public java.util.ListIterator<Tree> listIterator(int index)
listIterator in interface java.util.List<Tree>
public java.util.List<Tree> subList(int fromIndex,
int toIndex)
subList in interface java.util.List<Tree>public Treebank transform(TreeTransformer treeTrans)
transform in class TreebanktreeTrans - The TreeTransformer to use
public static void main(java.lang.String[] args)
usage: java MemoryTreebank treebankFilesPath
args - array of command-line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||