Package net.didion.jwnl.dictionary
Class MapBackedDictionary
- java.lang.Object
-
- net.didion.jwnl.dictionary.Dictionary
-
- net.didion.jwnl.dictionary.MapBackedDictionary
-
- All Implemented Interfaces:
Installable
public class MapBackedDictionary extends Dictionary
ADictionary
backed byMap
s. Warning: this has huge memory requirements. Make sure to start the interpreter with a large enough free memory pool to accomodate this.
-
-
Constructor Summary
Constructors Constructor Description MapBackedDictionary()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Shut down the dictionaryExc
getException(POS pos, String derivation)
Lookupderivation
in the exceptions file of part-of-speechpos
and return an Exc object containing the results.Iterator
getExceptionIterator(POS pos)
Return an Iterator over all the Exceptions in the database.IndexWord
getIndexWord(POS pos, String lemma)
Look up a word in the database.Iterator
getIndexWordIterator(POS pos)
Return an Iterator over all the IndexWords of part-of-speech pos in the database.Iterator
getIndexWordIterator(POS pos, String substring)
Return an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.IndexWord
getRandomIndexWord(POS pos)
String
getSenseKey(long offset, String lemma)
Not implemented in Map yet.Synset
getSynsetAt(POS pos, long offset)
Return theSynset
at offsetoffset
from the database.Iterator
getSynsetIterator(POS pos)
Return an Iterator over all the Synsets of part-of-speech pos in the database.int
getUsageCount(long offset, String lemma)
Not implemented in Map yet.static void
install(String searchDir, Class dictionaryFileType)
static void
install(String searchDir, Class dictionaryFileType, MorphologicalProcessor morph)
void
install(Map params)
Install aMapBackedDictionary
from a map of parameters.-
Methods inherited from class net.didion.jwnl.dictionary.Dictionary
getInstance, getMorphologicalProcessor, lookupAllIndexWords, lookupIndexWord, prepareQueryString, setDictionary, uninstall
-
-
-
-
Field Detail
-
MORPH
public static final String MORPH
MorphologicalProcessor
class install parameter. The value should be the class ofMorphologicalProcessor
to use.- See Also:
- Constant Field Values
-
FILE_TYPE
public static final String FILE_TYPE
File type install parameter. The value should be * the name of the appropriate subclass ofDictionaryFileType
.- See Also:
- Constant Field Values
-
PATH
public static final String PATH
The path of the dictionary files- See Also:
- Constant Field Values
-
-
Method Detail
-
install
public static void install(String searchDir, Class dictionaryFileType) throws JWNLException
- Throws:
JWNLException
-
install
public static void install(String searchDir, Class dictionaryFileType, MorphologicalProcessor morph) throws JWNLException
- Throws:
JWNLException
-
install
public void install(Map params) throws JWNLException
Install aMapBackedDictionary
from a map of parameters. The parameters are chosen from the static variables above.- Throws:
JWNLException
-
getIndexWord
public IndexWord getIndexWord(POS pos, String lemma)
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
public Iterator getIndexWordIterator(POS pos, String substring)
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
public Iterator getIndexWordIterator(POS pos)
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
public IndexWord getRandomIndexWord(POS pos) throws JWNLException
- Specified by:
getRandomIndexWord
in classDictionary
- Throws:
JWNLException
-
getSynsetIterator
public Iterator getSynsetIterator(POS pos)
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
public Iterator getExceptionIterator(POS pos)
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
-
getSynsetAt
public Synset getSynsetAt(POS pos, long offset)
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
public Exc getException(POS pos, String derivation)
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
-
getUsageCount
public int getUsageCount(long offset, String lemma)
Not implemented in Map yet.
-
-