C - the type of object stored in this dictionarypublic class MapDictionary<C> extends AbstractDictionary<C> implements Compilable, Serializable
MapDictionary uses an underlying map from phrases to
their set of dictionary entries. Map-based dictionaries are
compilable if their underlying entries are compilable, which
requires every category object to implement either the LingPipe
interface Compilable or the Java interface Serializable
The result is a fast
implementation of addEntry(DictionaryEntry), iterator() and phraseEntryIt(String).
The dictionary entries must be serializable or compilable.
| Constructor and Description |
|---|
MapDictionary()
Construct an empty map-based dictionary.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEntry(DictionaryEntry<C> entry)
Adds the specified dictionary entry to the dictionary.
|
void |
compileTo(ObjectOutput out)
Serializes the object to the specified output.
|
Iterator<DictionaryEntry<C>> |
iterator()
Return an iterator over the dictionary entries in this dictionary.
|
Iterator<DictionaryEntry<C>> |
phraseEntryIt(String phrase)
Returns an iterator over the dictionary entries with the
specified phrase.
|
categoryEntryIt, categoryEntryList, entryList, phraseEntryList, sizeequals, hashCode, removeAlladd, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toStringpublic void addEntry(DictionaryEntry<C> entry)
AbstractDictionaryaddEntry in interface Dictionary<C>addEntry in class AbstractDictionary<C>entry - Dictionary entry to add.public Iterator<DictionaryEntry<C>> iterator()
iterator in interface Iterable<DictionaryEntry<C>>iterator in interface Collection<DictionaryEntry<C>>iterator in interface Set<DictionaryEntry<C>>iterator in class AbstractCollection<DictionaryEntry<C>>public Iterator<DictionaryEntry<C>> phraseEntryIt(String phrase)
AbstractDictionaryImplementation Note: This implementation filters the
result of AbstractCollection.iterator() for entries with a matching
phrase.
phraseEntryIt in interface Dictionary<C>phraseEntryIt in class AbstractDictionary<C>phrase - The phrase to look up.public void compileTo(ObjectOutput out) throws IOException
compileTo in interface CompilablecompileTo in class AbstractDictionary<C>out - Object output to which this dictionary is compiled.IOException - If there is an I/O error writing the
object.Copyright © 2016 Alias-i, Inc.. All rights reserved.