Package net.didion.jwnl.dictionary
Class DatabaseBackedDictionary
- java.lang.Object
-
- net.didion.jwnl.dictionary.Dictionary
-
- net.didion.jwnl.dictionary.AbstractCachingDictionary
-
- net.didion.jwnl.dictionary.DatabaseBackedDictionary
-
- All Implemented Interfaces:
Installable
public class DatabaseBackedDictionary extends AbstractCachingDictionary
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classDatabaseBackedDictionary.DatabaseElementIteratorprivate classDatabaseBackedDictionary.ExceptionIteratorprivate classDatabaseBackedDictionary.IndexWordIteratorprivate classDatabaseBackedDictionary.SynsetIterator
-
Field Summary
Fields Modifier and Type Field Description private DatabaseManager_dbManagerprivate DatabaseDictionaryElementFactory_elementFactorystatic java.lang.StringDATABASE_MANAGERstatic java.lang.StringDICTIONARY_ELEMENT_FACTORYstatic java.lang.StringMORPHMorphologicalProcessorclass install parameter.
-
Constructor Summary
Constructors Modifier Constructor Description DatabaseBackedDictionary()privateDatabaseBackedDictionary(MorphologicalProcessor morph, DatabaseDictionaryElementFactory elementFactory, DatabaseManager dbManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Shut down the dictionaryExcgetException(POS pos, java.lang.String derivation)Lookupderivationin the exceptions file of part-of-speechposand return an Exc object containing the results.java.util.IteratorgetExceptionIterator(POS pos)Return an Iterator over all the Exceptions in the database.IndexWordgetIndexWord(POS pos, java.lang.String lemma)Look up a word in the database.java.util.IteratorgetIndexWordIterator(POS pos)Return an Iterator over all the IndexWords of part-of-speech pos in the database.java.util.IteratorgetIndexWordIterator(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.IndexWordgetRandomIndexWord(POS pos)java.lang.StringgetSenseKey(long offset, java.lang.String lemma)Not implemented in DB yet.SynsetgetSynsetAt(POS pos, long offset)Return theSynsetat offsetoffsetfrom the database.java.util.IteratorgetSynsetIterator(POS pos)Return an Iterator over all the Synsets of part-of-speech pos in the database.intgetUsageCount(long offset, java.lang.String lemma)Not implemented in DB yet.voidinstall(java.util.Map params)-
Methods inherited from class net.didion.jwnl.dictionary.AbstractCachingDictionary
cacheException, cacheIndexWord, cacheSynset, clearCache, clearCache, getCacheCapacity, getCachedException, getCachedIndexWord, getCachedSynset, getCacheSizes, isCachingEnabled, setCacheCapacity, setCacheCapacity, setCachingEnabled
-
Methods inherited from class net.didion.jwnl.dictionary.Dictionary
getInstance, getMorphologicalProcessor, lookupAllIndexWords, lookupIndexWord, prepareQueryString, setDictionary, uninstall
-
-
-
-
Field Detail
-
MORPH
public static final java.lang.String MORPH
MorphologicalProcessorclass install parameter. The value should be the class ofMorphologicalProcessorto use.- See Also:
- Constant Field Values
-
DICTIONARY_ELEMENT_FACTORY
public static final java.lang.String DICTIONARY_ELEMENT_FACTORY
- See Also:
- Constant Field Values
-
DATABASE_MANAGER
public static final java.lang.String DATABASE_MANAGER
- See Also:
- Constant Field Values
-
_elementFactory
private DatabaseDictionaryElementFactory _elementFactory
-
_dbManager
private DatabaseManager _dbManager
-
-
Constructor Detail
-
DatabaseBackedDictionary
public DatabaseBackedDictionary()
-
DatabaseBackedDictionary
private DatabaseBackedDictionary(MorphologicalProcessor morph, DatabaseDictionaryElementFactory elementFactory, DatabaseManager dbManager)
-
-
Method Detail
-
install
public void install(java.util.Map params) throws JWNLException- Throws:
JWNLException
-
getIndexWord
public IndexWord getIndexWord(POS pos, java.lang.String lemma) throws JWNLException
Description copied from class:DictionaryLook 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:
getIndexWordin classDictionary- Parameters:
pos- The part-of-speech.lemma- The orthographic representation of the word.- Returns:
- An IndexWord representing the word, or
nullif no such entry exists. - Throws:
JWNLException
-
getIndexWordIterator
public java.util.Iterator getIndexWordIterator(POS pos) throws JWNLException
Description copied from class:DictionaryReturn an Iterator over all the IndexWords of part-of-speech pos in the database.- Specified by:
getIndexWordIteratorin classDictionary- Parameters:
pos- The part-of-speech- Returns:
- An iterator over
IndexWords - Throws:
JWNLException
-
getIndexWordIterator
public java.util.Iterator getIndexWordIterator(POS pos, java.lang.String substring) throws JWNLException
Description copied from class:DictionaryReturn an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.- Specified by:
getIndexWordIteratorin classDictionary- Parameters:
pos- The part-of-speech.- Returns:
- An iterator over
IndexWords. - Throws:
JWNLException
-
getRandomIndexWord
public IndexWord getRandomIndexWord(POS pos) throws JWNLException
- Specified by:
getRandomIndexWordin classDictionary- Throws:
JWNLException
-
getSynsetAt
public Synset getSynsetAt(POS pos, long offset) throws JWNLException
Description copied from class:DictionaryReturn theSynsetat offsetoffsetfrom the database.- Specified by:
getSynsetAtin 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
- Throws:
JWNLException
-
getSynsetIterator
public java.util.Iterator getSynsetIterator(POS pos) throws JWNLException
Description copied from class:DictionaryReturn an Iterator over all the Synsets of part-of-speech pos in the database.- Specified by:
getSynsetIteratorin classDictionary- Parameters:
pos- The part-of-speech.- Returns:
- An iterator over
Synsets. - Throws:
JWNLException
-
getException
public Exc getException(POS pos, java.lang.String derivation) throws JWNLException
Description copied from class:DictionaryLookupderivationin the exceptions file of part-of-speechposand return an Exc object containing the results.- Specified by:
getExceptionin classDictionary- Parameters:
pos- the exception file to look inderivation- the word to look up- Returns:
- Exc the Exc object
- Throws:
JWNLException
-
getExceptionIterator
public java.util.Iterator getExceptionIterator(POS pos) throws JWNLException
Description copied from class:DictionaryReturn an Iterator over all the Exceptions in the database.- Specified by:
getExceptionIteratorin classDictionary- Parameters:
pos- the part-of-speech- Returns:
- Iterator An iterator over
Strings - Throws:
JWNLException
-
close
public void close()
Description copied from class:DictionaryShut down the dictionary- Specified by:
closein classDictionary
-
getUsageCount
public int getUsageCount(long offset, java.lang.String lemma)Not implemented in DB yet.
-
getSenseKey
public java.lang.String getSenseKey(long offset, java.lang.String lemma)Not implemented in DB yet.
-
-