|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
edu.stanford.nlp.trees.Treebank
edu.stanford.nlp.trees.MemoryTreebank
A MemoryTreebank
object stores a corpus of examples with
given tree structures in memory (as a List
).
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(String encoding)
Create a new tree bank, set the encoding for file access |
|
MemoryTreebank(TreeReaderFactory trf)
Create a new tree bank. |
|
MemoryTreebank(TreeReaderFactory trf,
String encoding)
Create a new tree bank. |
Method Summary | |
void |
add(int index,
Object element)
|
boolean |
add(Object element)
|
boolean |
addAll(int index,
Collection c)
|
void |
apply(TreeProcessor tp)
Apply the TreeProcessor tp to all trees in the Treebank. |
void |
clear()
Empty a Treebank . |
Object |
get(int i)
Get a tree by index from the Treebank. |
String |
getEncoding()
Returns the encoding in use for bytestream access. |
int |
indexOf(Object o)
|
Iterator |
iterator()
Return an Iterator over Trees in the Treebank. |
int |
lastIndexOf(Object o)
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
void |
loadPath(File path,
FileFilter filt)
Load trees from given directory. |
static void |
main(String[] args)
Loads treebank grammar from first argument and prints it. |
void |
processFile(File file)
Load a collection of parse trees from the file of given name. |
Object |
remove(int index)
|
Object |
set(int index,
Object element)
|
int |
size()
Returns the size of the Treebank. |
List |
subList(int fromIndex,
int toIndex)
|
Methods inherited from class edu.stanford.nlp.trees.Treebank |
loadPath, loadPath, loadPath, loadPath, loadPath, remove, 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()
public MemoryTreebank(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, String encoding)
trf
- the factory class to be called to create a new
TreeReader
encoding
- 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 String getEncoding()
public void clear()
Treebank
.
clear
in interface List
clear
in class Treebank
public void loadPath(File path, FileFilter filt)
loadPath
in class Treebank
path
- file or directory to load fromfilt
- a FilenameFilter of files to loadpublic void processFile(File file)
FileProcessor
interface.
processFile
in interface FileProcessor
file
- file to load a tree fromfor traversing directories
public Object 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 an ArrayList
.
get
in interface List
i
- The integer (counting from 0) index of the tree
public void apply(TreeProcessor tp)
apply
in class Treebank
tp
- A class that implements the TreeProcessor interfacepublic Iterator iterator()
iterator
in interface List
iterator
in class Treebank
public int size()
Treebank
size
in interface List
size
in class Treebank
public void add(int index, Object element)
add
in interface List
public boolean add(Object element)
add
in interface List
public boolean addAll(int index, Collection c)
addAll
in interface List
public int indexOf(Object o)
indexOf
in interface List
public int lastIndexOf(Object o)
lastIndexOf
in interface List
public Object remove(int index)
remove
in interface List
public Object set(int index, Object element)
set
in interface List
public ListIterator listIterator()
listIterator
in interface List
public ListIterator listIterator(int index)
listIterator
in interface List
public List subList(int fromIndex, int toIndex)
subList
in interface List
public static void main(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 |