|
||||||||||
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.Sentencebank
A Sentencebank
object provides access to a corpus of
sentences -- just plain sentences or tagged sentences, etc.
This class implements the Collection interface, but in a read-only way.
A typical way of creating and using a Sentencebank looks like:
SentenceReaderFactory srf = new AdwaitSentenceReaderFactory(true); Sentencebank sb1 = new DiskSentencebank(srf); sb1.loadPath(inputFile); for (Iterator i1 = sb1.iterator(); i1.hasNext(); ) { Sentence s1 = (Sentence) i1.next(); System.out.println(s1); }
Constructor Summary | |
Sentencebank()
Create a new Sentencebank. |
|
Sentencebank(int initialCapacity)
Create a new Sentencebank. |
|
Sentencebank(int initialCapacity,
SentenceReaderFactory srf)
Create a new Sentencebank. |
|
Sentencebank(SentenceReaderFactory srf)
Create a new Sentencebank. |
Method Summary | |
abstract void |
apply(SentenceVisitor tp)
Apply a SentenceVisitor to each sentence in the Sentencebank. |
abstract void |
clear()
Empty a Sentencebank . |
abstract Iterator |
iterator()
Return an Iterator over Sentences in the Sentencebank. |
void |
loadPath(File path)
Load a sequence of sentences from given directory and its subdirectories. |
abstract void |
loadPath(File path,
FileFilter filt)
Load sentences from given path specification. |
void |
loadPath(File path,
String suffix,
boolean recursively)
Load sentences from given directory. |
void |
loadPath(String pathName)
Load a sequence of sentences from the given directory and its subdirectories. |
boolean |
remove(Object o)
This operation isn't supported for a Sentencebank. |
protected SentenceReaderFactory |
sentenceReaderFactory()
Get the SentenceReaderFactory for a
Sentencebank -- this method is provided in order to
make the
SentenceReaderFactory available to subclasses. |
int |
size()
Returns the size of the Sentencebank. |
String |
toString()
Return the whole Sentencebank as a series of big bracketed lists. |
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 |
public Sentencebank()
public Sentencebank(SentenceReaderFactory srf)
srf
- the factory class to be called to create a new
SentenceReader
public Sentencebank(int initialCapacity)
initialCapacity
- The initial size of the underlying Collection,
(if a Collection-based storage mechanism is being provided)public Sentencebank(int initialCapacity, SentenceReaderFactory srf)
initialCapacity
- The initial size of the underlying Collection,
(if a Collection-based storage mechanism is being provided)Method Detail |
protected SentenceReaderFactory sentenceReaderFactory()
SentenceReaderFactory
for a
Sentencebank
-- this method is provided in order to
make the
SentenceReaderFactory
available to subclasses.
public abstract void clear()
Sentencebank
.
public void loadPath(String pathName)
pathName
- file or directory namepublic void loadPath(File path)
path
- File specificationpublic void loadPath(File path, String suffix, boolean recursively)
path
- file or directory to load fromsuffix
- suffix of files to loadrecursively
- descend into subdirectories as wellpublic abstract void loadPath(File path, FileFilter filt)
path
- file or directory to load frompublic abstract void apply(SentenceVisitor tp)
tp
- The SentenceVisitor to be appliedpublic abstract Iterator iterator()
public String toString()
public int size()
public boolean remove(Object o)
o
- The object that would be removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |