public abstract class MapLexicon extends Lexicon<String> implements Closeable
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
MapLexicon.Id2EntryIndexLookup
Interface for getting the lexicon term index for a given term id
|
protected static class |
MapLexicon.IdIsIndex
Lexicon map where the termid is the term index
|
| Modifier and Type | Field and Description |
|---|---|
protected WriteableFactory<org.apache.hadoop.io.Text> |
keyFactory |
protected Map<org.apache.hadoop.io.Text,LexiconEntry> |
map |
protected Object |
modificationLock |
| Constructor and Description |
|---|
MapLexicon(Map<org.apache.hadoop.io.Text,LexiconEntry> backingMap)
Construct an instance of the class with
|
MapLexicon(Map<org.apache.hadoop.io.Text,LexiconEntry> backingMap,
MapLexicon.Id2EntryIndexLookup idlookupobject)
Construct an instance of the class with
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Map.Entry<String,LexiconEntry> |
getIthLexiconEntry(int index)
Get the term and LexiconEntry (contains statistics and a pointer) for
the entry in the lexicon with the specified index.
|
Map.Entry<String,LexiconEntry> |
getLexiconEntry(int termid)
Get the term and LexiconEntry (contains statistics and a pointer) for
a given term id.
|
LexiconEntry |
getLexiconEntry(String term)
Get the LexiconEntry (contains statistics and a pointer) for the given term.
|
Iterator<Map.Entry<String,LexiconEntry>> |
getLexiconEntryRange(String from,
String to)
Returns an iterator over a set of LexiconEntries within a range of
entries in the lexicon.
|
int |
numberOfEntries()
Return the number of entries in the lexicon
|
protected void |
setTermIdLookup(MapLexicon.Id2EntryIndexLookup idlookupobject) |
protected WriteableFactory<org.apache.hadoop.io.Text> keyFactory
protected Object modificationLock
protected final Map<org.apache.hadoop.io.Text,LexiconEntry> map
public MapLexicon(Map<org.apache.hadoop.io.Text,LexiconEntry> backingMap)
backingMap - public MapLexicon(Map<org.apache.hadoop.io.Text,LexiconEntry> backingMap, MapLexicon.Id2EntryIndexLookup idlookupobject)
backingMap - idlookupobject - protected void setTermIdLookup(MapLexicon.Id2EntryIndexLookup idlookupobject)
public LexiconEntry getLexiconEntry(String term)
getLexiconEntry in class Lexicon<String>term - key to lookup the lexicon withpublic Map.Entry<String,LexiconEntry> getIthLexiconEntry(int index)
getIthLexiconEntry in class Lexicon<String>index - the entry number to lookup in the lexiconpublic Iterator<Map.Entry<String,LexiconEntry>> getLexiconEntryRange(String from, String to)
getLexiconEntryRange in class Lexicon<String>from - low endpoint term in the subset, inclusive.to - high endpoint term in the subset, exclusive.public Map.Entry<String,LexiconEntry> getLexiconEntry(int termid)
getLexiconEntry in class Lexicon<String>termid - the term id to lookup in the lexiconpublic int numberOfEntries()
numberOfEntries in class Lexicon<String>public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionTerrier 4.0. Copyright © 2004-2014 University of Glasgow