public class DefaultFrequencySortedDictionary extends Object implements FrequencySortedDictionary
FrequencySortedDictionary
. Term ids start at 1, which corresponds to
the most frequent term. Term id 2 is the second most frequent term, etc.Constructor and Description |
---|
DefaultFrequencySortedDictionary(Path prefixPath,
Path idsPath,
Path idToTermPath,
FileSystem fs)
Constructs an instance of this dictionary from serialized data files.
|
Modifier and Type | Method and Description |
---|---|
int |
getId(String term)
Returns the id associated with this term.
|
String |
getTerm(int id)
Returns the term associated with this term id.
|
Iterator<String> |
iterator()
Returns an iterator over the dictionary in order of term id.
|
static void |
main(String[] args)
Simple demo program for looking up terms and term ids.
|
int |
size()
Returns the size of this dictionary.
|
public DefaultFrequencySortedDictionary(Path prefixPath, Path idsPath, Path idToTermPath, FileSystem fs) throws IOException
IOException
public int getId(String term)
Dictionary
getId
in interface Dictionary
term
- termpublic String getTerm(int id)
Dictionary
getTerm
in interface Dictionary
id
- term idpublic Iterator<String> iterator()
public static void main(String[] args) throws Exception
Exception
public int size()
Dictionary
size
in interface Dictionary