|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.terrier.structures.Lexicon<String>
org.terrier.structures.MapLexicon
public abstract class MapLexicon
Implementation of a lexicon. This class should be subclassed by any lexicon implementation which use a java.util.Map for storing entries.
Nested Class Summary | |
---|---|
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 |
Field Summary | |
---|---|
protected WriteableFactory<org.apache.hadoop.io.Text> |
keyFactory
|
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Field Detail |
---|
protected WriteableFactory<org.apache.hadoop.io.Text> keyFactory
Constructor Detail |
---|
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
- Method Detail |
---|
protected void setTermIdLookup(MapLexicon.Id2EntryIndexLookup idlookupobject)
public LexiconEntry getLexiconEntry(String term)
getLexiconEntry
in class Lexicon<String>
term
- key to lookup the lexicon with
public Map.Entry<String,LexiconEntry> getIthLexiconEntry(int index)
getIthLexiconEntry
in class Lexicon<String>
index
- the entry number to lookup in the lexicon
public 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 lexicon
public int numberOfEntries()
numberOfEntries
in class Lexicon<String>
public void close() throws IOException
close
in interface Closeable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |