public class MapBackedDictionary extends Dictionary
Dictionary backed by Maps. Warning: this has huge memory requirements.
Make sure to start the interpreter with a large enough free memory pool to accomodate this.| Modifier and Type | Class and Description |
|---|---|
private static class |
MapBackedDictionary.IndexWordIterator |
private static class |
MapBackedDictionary.MapTableKey |
| Modifier and Type | Field and Description |
|---|---|
private static MessageLog |
_log |
private static java.util.Random |
_rand
Random number generator used by getRandomIndexWord()
|
private java.util.Map |
_tableMap |
static java.lang.String |
FILE_TYPE
File type install parameter.
|
static java.lang.String |
MORPH
MorphologicalProcessor class install parameter. |
static java.lang.String |
PATH
The path of the dictionary files
|
| Modifier | Constructor and Description |
|---|---|
|
MapBackedDictionary() |
private |
MapBackedDictionary(DictionaryCatalogSet files,
MorphologicalProcessor morph)
Create a
MapBackedDictionary with the specified set of files. |
| Modifier and Type | Method and Description |
|---|---|
private static void |
checkFileType(java.lang.Class c) |
void |
close()
Shut down the dictionary
|
Exc |
getException(POS pos,
java.lang.String derivation)
Lookup
derivation in the exceptions file of part-of-speech
pos and return an Exc object containing the results. |
java.util.Iterator |
getExceptionIterator(POS pos)
Return an Iterator over all the Exceptions in the database.
|
IndexWord |
getIndexWord(POS pos,
java.lang.String lemma)
Look up a word in the database.
|
java.util.Iterator |
getIndexWordIterator(POS pos)
Return an Iterator over all the IndexWords of part-of-speech
pos in the database.
|
java.util.Iterator |
getIndexWordIterator(POS pos,
java.lang.String substring)
Return an Iterator over all the IndexWords of part-of-speech pos
whose lemmas contain substring as a substring.
|
private java.util.Iterator |
getIterator(java.util.Map map) |
IndexWord |
getRandomIndexWord(POS pos) |
java.lang.String |
getSenseKey(long offset,
java.lang.String lemma)
Not implemented in Map yet.
|
Synset |
getSynsetAt(POS pos,
long offset)
Return the
Synset at offset offset from the database. |
java.util.Iterator |
getSynsetIterator(POS pos)
Return an Iterator over all the Synsets of part-of-speech pos
in the database.
|
private java.util.Map |
getTable(POS pos,
DictionaryFileType fileType) |
int |
getUsageCount(long offset,
java.lang.String lemma)
Not implemented in Map yet.
|
void |
install(java.util.Map params)
Install a
MapBackedDictionary from a map of parameters. |
static void |
install(java.lang.String searchDir,
java.lang.Class dictionaryFileType) |
static void |
install(java.lang.String searchDir,
java.lang.Class dictionaryFileType,
MorphologicalProcessor morph) |
private java.util.Map |
loadDictFile(DictionaryFile file) |
private void |
putTable(POS pos,
DictionaryFileType fileType,
java.util.Map table)
Use table for lookups to the file represented by pos and
fileType.
|
getInstance, getMorphologicalProcessor, lookupAllIndexWords, lookupIndexWord, prepareQueryString, setDictionary, uninstallprivate static final MessageLog _log
public static final java.lang.String MORPH
MorphologicalProcessor class install parameter. The value should be the
class of MorphologicalProcessor to use.public static final java.lang.String FILE_TYPE
DictionaryFileType.public static final java.lang.String PATH
private static final java.util.Random _rand
private java.util.Map _tableMap
public MapBackedDictionary()
private MapBackedDictionary(DictionaryCatalogSet files, MorphologicalProcessor morph) throws JWNLException
MapBackedDictionary with the specified set of files.JWNLExceptionpublic static void install(java.lang.String searchDir,
java.lang.Class dictionaryFileType)
throws JWNLException
JWNLExceptionpublic static void install(java.lang.String searchDir,
java.lang.Class dictionaryFileType,
MorphologicalProcessor morph)
throws JWNLException
JWNLExceptionpublic void install(java.util.Map params)
throws JWNLException
MapBackedDictionary from a map of parameters. The parameters are chosen from the static
variables above.JWNLExceptionprivate static void checkFileType(java.lang.Class c)
public IndexWord getIndexWord(POS pos, java.lang.String lemma)
DictionaryDictionary.lookupIndexWord(POS, String).getIndexWord in class Dictionarypos - The part-of-speech.lemma - The orthographic representation of the word.null if
no such entry exists.public java.util.Iterator getIndexWordIterator(POS pos, java.lang.String substring)
DictionarygetIndexWordIterator in class Dictionarypos - The part-of-speech.IndexWords.public java.util.Iterator getIndexWordIterator(POS pos)
DictionarygetIndexWordIterator in class Dictionarypos - The part-of-speechIndexWordspublic IndexWord getRandomIndexWord(POS pos) throws JWNLException
getRandomIndexWord in class DictionaryJWNLExceptionpublic java.util.Iterator getSynsetIterator(POS pos)
DictionarygetSynsetIterator in class Dictionarypos - The part-of-speech.Synsets.public java.util.Iterator getExceptionIterator(POS pos)
DictionarygetExceptionIterator in class Dictionarypos - the part-of-speechStringsprivate java.util.Iterator getIterator(java.util.Map map)
public Synset getSynsetAt(POS pos, long offset)
DictionarySynset at offset offset from the database.getSynsetAt in class Dictionarypos - The part-of-speech file to look inoffset - The offset of the synset in the filepublic Exc getException(POS pos, java.lang.String derivation)
Dictionaryderivation in the exceptions file of part-of-speech
pos and return an Exc object containing the results.getException in class Dictionarypos - the exception file to look inderivation - the word to look uppublic void close()
Dictionaryclose in class Dictionaryprivate java.util.Map loadDictFile(DictionaryFile file) throws JWNLException
JWNLExceptionprivate void putTable(POS pos, DictionaryFileType fileType, java.util.Map table)
private java.util.Map getTable(POS pos, DictionaryFileType fileType)
public int getUsageCount(long offset,
java.lang.String lemma)
public java.lang.String getSenseKey(long offset,
java.lang.String lemma)