edu.stanford.nlp.sequences
Class ObjectBankWrapper<IN extends CoreMap>

java.lang.Object
  extended by edu.stanford.nlp.objectbank.ObjectBank<List<IN>>
      extended by edu.stanford.nlp.sequences.ObjectBankWrapper<IN>
All Implemented Interfaces:
Serializable, Iterable<List<IN>>, Collection<List<IN>>

public class ObjectBankWrapper<IN extends CoreMap>
extends ObjectBank<List<IN>>

This class is used to wrap the ObjectBank used by the sequence models and is where any sort of general processing, like the IOB mapping stuff and wordshape stuff, should go. It checks the SeqClassifierFlags to decide what to do.

TODO: We should rearchitect this so that the FeatureFactory-specific stuff is done by a callback to the relevant FeatureFactory.

Author:
Jenny Finkel
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.stanford.nlp.objectbank.ObjectBank
ObjectBank.PathToFileFunction
 
Field Summary
 
Fields inherited from class edu.stanford.nlp.objectbank.ObjectBank
ifrf, rif
 
Constructor Summary
ObjectBankWrapper(SeqClassifierFlags flags, ObjectBank<List<IN>> wrapped, Set<String> knownLCWords)
           
 
Method Summary
 boolean add(List<IN> o)
          Unsupported Operation.
 boolean addAll(Collection<? extends List<IN>> c)
          Unsupported Operation.
 void clear()
           
 void clearMemory()
          If you are keeping the contents in memory, this will clear hte memory, and they will be recomputed the next time iterator() is called.
 boolean contains(List<IN> o)
           
 boolean containsAll(Collection<?> c)
          Can be slow.
 boolean isEmpty()
           
 Iterator<List<IN>> iterator()
           
 void keepInMemory(boolean keep)
          Tells the ObjectBank to store all of its contents in memory so that it doesn't have to be recomputed each time you iterate through it.
 List<IN> processDocument(List<IN> doc)
           
 boolean remove(List<IN> o)
           
 boolean removeAll(Collection<?> c)
          Unsupported Operation.
 boolean retainAll(Collection<?> c)
          Unsupported Operation.
 int size()
          Can be slow.
 Object[] toArray()
          Can be slow.
 List<IN>[] toArray(List<IN>[] o)
           
 
Methods inherited from class edu.stanford.nlp.objectbank.ObjectBank
contains, getLineIterator, getLineIterator, getLineIterator, getLineIterator, getLineIterator, getLineIterator, getLineIterator, getLineIterator, getLineIterator, getLineIterator, getLineIterator, getLineIterator, remove, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

ObjectBankWrapper

public ObjectBankWrapper(SeqClassifierFlags flags,
                         ObjectBank<List<IN>> wrapped,
                         Set<String> knownLCWords)
Method Detail

iterator

public Iterator<List<IN>> iterator()
Specified by:
iterator in interface Iterable<List<IN extends CoreMap>>
Specified by:
iterator in interface Collection<List<IN extends CoreMap>>
Overrides:
iterator in class ObjectBank<List<IN extends CoreMap>>

processDocument

public List<IN> processDocument(List<IN> doc)

add

public boolean add(List<IN> o)
Description copied from class: ObjectBank
Unsupported Operation. If you wish to add a new data source, do so in the underlying ReaderIteratorFactory

Specified by:
add in interface Collection<List<IN extends CoreMap>>
Overrides:
add in class ObjectBank<List<IN extends CoreMap>>

addAll

public boolean addAll(Collection<? extends List<IN>> c)
Description copied from class: ObjectBank
Unsupported Operation. If you wish to add new data sources, do so in the underlying ReaderIteratorFactory

Specified by:
addAll in interface Collection<List<IN extends CoreMap>>
Overrides:
addAll in class ObjectBank<List<IN extends CoreMap>>

clear

public void clear()
Specified by:
clear in interface Collection<List<IN extends CoreMap>>
Overrides:
clear in class ObjectBank<List<IN extends CoreMap>>

clearMemory

public void clearMemory()
Description copied from class: ObjectBank
If you are keeping the contents in memory, this will clear hte memory, and they will be recomputed the next time iterator() is called.

Overrides:
clearMemory in class ObjectBank<List<IN extends CoreMap>>

contains

public boolean contains(List<IN> o)

containsAll

public boolean containsAll(Collection<?> c)
Description copied from class: ObjectBank
Can be slow. Usage not recommended.

Specified by:
containsAll in interface Collection<List<IN extends CoreMap>>
Overrides:
containsAll in class ObjectBank<List<IN extends CoreMap>>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<List<IN extends CoreMap>>
Overrides:
isEmpty in class ObjectBank<List<IN extends CoreMap>>

keepInMemory

public void keepInMemory(boolean keep)
Description copied from class: ObjectBank
Tells the ObjectBank to store all of its contents in memory so that it doesn't have to be recomputed each time you iterate through it. This is useful when the data is small enough that it can be kept in memory, but reading/processing it is expensive/slow. Defaults to false.

Overrides:
keepInMemory in class ObjectBank<List<IN extends CoreMap>>
Parameters:
keep - Whether to keep contents in memory

remove

public boolean remove(List<IN> o)

removeAll

public boolean removeAll(Collection<?> c)
Description copied from class: ObjectBank
Unsupported Operation. If you wish to remove data sources, remove, do so in the underlying ReaderIteratorFactory.

Specified by:
removeAll in interface Collection<List<IN extends CoreMap>>
Overrides:
removeAll in class ObjectBank<List<IN extends CoreMap>>

retainAll

public boolean retainAll(Collection<?> c)
Description copied from class: ObjectBank
Unsupported Operation. If you wish to retain only certain data sources, do so in the underlying ReaderIteratorFactory.

Specified by:
retainAll in interface Collection<List<IN extends CoreMap>>
Overrides:
retainAll in class ObjectBank<List<IN extends CoreMap>>

size

public int size()
Description copied from class: ObjectBank
Can be slow. Usage not recommended.

Specified by:
size in interface Collection<List<IN extends CoreMap>>
Overrides:
size in class ObjectBank<List<IN extends CoreMap>>

toArray

public Object[] toArray()
Description copied from class: ObjectBank
Can be slow. Usage not recommended.

Specified by:
toArray in interface Collection<List<IN extends CoreMap>>
Overrides:
toArray in class ObjectBank<List<IN extends CoreMap>>

toArray

public List<IN>[] toArray(List<IN>[] o)


Stanford NLP Group