Package net.didion.jwnl.dictionary
Class MapBackedDictionary
java.lang.Object
net.didion.jwnl.dictionary.Dictionary
net.didion.jwnl.dictionary.MapBackedDictionary
- All Implemented Interfaces:
Installable
A
Dictionary
backed by Map
s. Warning: this has huge memory requirements.
Make sure to start the interpreter with a large enough free memory pool to accomodate this.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final MessageLog
private static final Random
Random number generator used by getRandomIndexWord()private Map
static final String
File type install parameter.static final String
MorphologicalProcessor
class install parameter.static final String
The path of the dictionary files -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
MapBackedDictionary
(DictionaryCatalogSet files, MorphologicalProcessor morph) Create aMapBackedDictionary
with the specified set of files. -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
void
close()
Shut down the dictionarygetException
(POS pos, String derivation) Lookupderivation
in the exceptions file of part-of-speechpos
and return an Exc object containing the results.getExceptionIterator
(POS pos) Return an Iterator over all the Exceptions in the database.getIndexWord
(POS pos, String lemma) Look up a word in the database.getIndexWordIterator
(POS pos) Return an Iterator over all the IndexWords of part-of-speech pos in the database.getIndexWordIterator
(POS pos, String substring) Return an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.private Iterator
getIterator
(Map map) getRandomIndexWord
(POS pos) getSenseKey
(long offset, String lemma) Not implemented in Map yet.getSynsetAt
(POS pos, long offset) Return theSynset
at offsetoffset
from the database.getSynsetIterator
(POS pos) Return an Iterator over all the Synsets of part-of-speech pos in the database.private Map
getTable
(POS pos, DictionaryFileType fileType) int
getUsageCount
(long offset, String lemma) Not implemented in Map yet.static void
static void
install
(String searchDir, Class dictionaryFileType, MorphologicalProcessor morph) void
Install aMapBackedDictionary
from a map of parameters.private Map
loadDictFile
(DictionaryFile file) private void
putTable
(POS pos, DictionaryFileType fileType, Map table) Use table for lookups to the file represented by pos and fileType.Methods inherited from class net.didion.jwnl.dictionary.Dictionary
getInstance, getMorphologicalProcessor, lookupAllIndexWords, lookupIndexWord, prepareQueryString, setDictionary, uninstall
-
Field Details
-
_log
-
MORPH
MorphologicalProcessor
class install parameter. The value should be the class ofMorphologicalProcessor
to use.- See Also:
-
FILE_TYPE
File type install parameter. The value should be * the name of the appropriate subclass ofDictionaryFileType
.- See Also:
-
PATH
The path of the dictionary files- See Also:
-
_rand
Random number generator used by getRandomIndexWord() -
_tableMap
-
-
Constructor Details
-
MapBackedDictionary
public MapBackedDictionary() -
MapBackedDictionary
private MapBackedDictionary(DictionaryCatalogSet files, MorphologicalProcessor morph) throws JWNLException Create aMapBackedDictionary
with the specified set of files.- Throws:
JWNLException
-
-
Method Details
-
install
- Throws:
JWNLException
-
install
public static void install(String searchDir, Class dictionaryFileType, MorphologicalProcessor morph) throws JWNLException - Throws:
JWNLException
-
install
Install aMapBackedDictionary
from a map of parameters. The parameters are chosen from the static variables above.- Throws:
JWNLException
-
checkFileType
-
getIndexWord
Description copied from class:Dictionary
Look up a word in the database. The search is case-independent, and phrases are separated by spaces ("look up", not "look_up"). Note: this method does not subject lemma to any morphological processing. If you want this, useDictionary.lookupIndexWord(POS, String)
.- Specified by:
getIndexWord
in classDictionary
- Parameters:
pos
- The part-of-speech.lemma
- The orthographic representation of the word.- Returns:
- An IndexWord representing the word, or
null
if no such entry exists.
-
getIndexWordIterator
Description copied from class:Dictionary
Return an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.- Specified by:
getIndexWordIterator
in classDictionary
- Parameters:
pos
- The part-of-speech.- Returns:
- An iterator over
IndexWord
s.
-
getIndexWordIterator
Description copied from class:Dictionary
Return an Iterator over all the IndexWords of part-of-speech pos in the database.- Specified by:
getIndexWordIterator
in classDictionary
- Parameters:
pos
- The part-of-speech- Returns:
- An iterator over
IndexWord
s
-
getRandomIndexWord
- Specified by:
getRandomIndexWord
in classDictionary
- Throws:
JWNLException
-
getSynsetIterator
Description copied from class:Dictionary
Return an Iterator over all the Synsets of part-of-speech pos in the database.- Specified by:
getSynsetIterator
in classDictionary
- Parameters:
pos
- The part-of-speech.- Returns:
- An iterator over
Synset
s.
-
getExceptionIterator
Description copied from class:Dictionary
Return an Iterator over all the Exceptions in the database.- Specified by:
getExceptionIterator
in classDictionary
- Parameters:
pos
- the part-of-speech- Returns:
- Iterator An iterator over
String
s
-
getIterator
-
getSynsetAt
Description copied from class:Dictionary
Return theSynset
at offsetoffset
from the database.- Specified by:
getSynsetAt
in classDictionary
- Parameters:
pos
- The part-of-speech file to look inoffset
- The offset of the synset in the file- Returns:
- A synset containing the parsed line from the database
-
getException
Description copied from class:Dictionary
Lookupderivation
in the exceptions file of part-of-speechpos
and return an Exc object containing the results.- Specified by:
getException
in classDictionary
- Parameters:
pos
- the exception file to look inderivation
- the word to look up- Returns:
- Exc the Exc object
-
close
public void close()Description copied from class:Dictionary
Shut down the dictionary- Specified by:
close
in classDictionary
-
loadDictFile
- Throws:
JWNLException
-
putTable
Use table for lookups to the file represented by pos and fileType. -
getTable
-
getUsageCount
Not implemented in Map yet. -
getSenseKey
Not implemented in Map yet.
-