public class StringDictionary
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
StringDictionary.IndexAndCount |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NIL_VALUE |
Constructor and Description |
---|
StringDictionary(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
java.lang.String |
get(int idx)
Reverse mapping from integer key to string value
|
int |
get(java.lang.String s) |
int |
get(java.lang.String s,
boolean shouldThrow)
Fetches the index of this string If mCreate is true, the entry is created
if it does not exist.
|
int |
getCount(int idx) |
StringDictionary.IndexAndCount |
getIndexAndCount(java.lang.String s) |
java.util.Set<java.lang.String> |
keys() |
java.util.Set<java.lang.String> |
keySet() |
void |
load(java.lang.String path,
java.lang.String prefix)
Loads all saved dictionary entries from disk
|
void |
save(java.lang.String path,
java.lang.String prefix,
int threshold)
Saves all dictionary entries that appeared > threshold times Note: feature
indices are changed to contiguous values starting at 0.
|
void |
setMode(boolean mode) |
int |
size() |
public static final java.lang.String NIL_VALUE
public void setMode(boolean mode)
public int size()
public int get(java.lang.String s)
public StringDictionary.IndexAndCount getIndexAndCount(java.lang.String s)
public int get(java.lang.String s, boolean shouldThrow)
public java.lang.String get(int idx)
public int getCount(int idx)
public void save(java.lang.String path, java.lang.String prefix, int threshold) throws java.io.IOException
java.io.IOException
public void clear()
public java.util.Set<java.lang.String> keySet()
public void load(java.lang.String path, java.lang.String prefix) throws java.io.IOException
java.io.IOException
public java.util.Set<java.lang.String> keys()