public final class DiskTreebank extends Treebank
DiskTreebank
is a Collection
of
Tree
s.
A DiskTreebank
object stores merely the information to
get at a corpus of trees that is stored on disk. Access is usually
via apply()'ing a TreeVisitor to each Tree in the Treebank or by using
an iterator() to get an iteration over the Trees.
If the root Label of the Tree objects built by the TreeReader
implements HasIndex, then the filename and index of the tree in
a corpus will be inserted as they are read in.DEFAULT_TREE_FILE_SUFFIX
Constructor and Description |
---|
DiskTreebank()
Create a new DiskTreebank.
|
DiskTreebank(int initialCapacity)
Create a new Treebank.
|
DiskTreebank(int initialCapacity,
TreeReaderFactory trf)
Create a new Treebank.
|
DiskTreebank(String encoding)
Create a new treebank, set the encoding for file access.
|
DiskTreebank(TreeReaderFactory trf)
Create a new DiskTreebank.
|
DiskTreebank(TreeReaderFactory trf,
String encoding)
Create a new DiskTreebank.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(TreeVisitor tp)
Applies the TreeVisitor to to all trees in the Treebank.
|
void |
clear()
Empty a
Treebank . |
String |
getCurrentFilename()
Returns the absolute path of the file currently being read.
|
List<File> |
getCurrentPaths() |
Iterator<Tree> |
iterator()
Return an Iterator over Trees in the Treebank.
|
void |
loadPath(File path,
FileFilter filt)
Load trees from given directory.
|
void |
printFileNames() |
decimate, encoding, loadPath, loadPath, loadPath, loadPath, loadPath, remove, size, textualSummary, textualSummary, toString, transform, treeReaderFactory
add, addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, parallelStream, removeIf, spliterator, stream
public DiskTreebank()
LabeledScoredTreeReaderFactory
.public DiskTreebank(String encoding)
encoding
- The charset encoding to use for treebank file decodingpublic DiskTreebank(TreeReaderFactory trf)
trf
- the factory class to be called to create a new
TreeReader
public DiskTreebank(TreeReaderFactory trf, String encoding)
trf
- the factory class to be called to create a new
TreeReader
encoding
- The charset encoding to use for treebank file decodingpublic DiskTreebank(int initialCapacity)
LabeledScoredTreeReaderFactory
.initialCapacity
- The initial size of the underlying Collection.
For a DiskTreebank
, this parameter is ignored.public DiskTreebank(int initialCapacity, TreeReaderFactory trf)
initialCapacity
- The initial size of the underlying Collection,
For a DiskTreebank
, this parameter is ignored.trf
- the factory class to be called to create a new
TreeReader
public void clear()
Treebank
.clear
in interface Collection<Tree>
clear
in class Treebank
public void loadPath(File path, FileFilter filt)
public void apply(TreeVisitor tp)
public String getCurrentFilename()
public void printFileNames()
public Iterator<Tree> iterator()
apply()
.iterator
in interface Iterable<Tree>
iterator
in interface Collection<Tree>
iterator
in class AbstractCollection<Tree>