net.sf.extjwnl.dictionary
Class DatabaseBackedDictionary

java.lang.Object
  extended by net.sf.extjwnl.dictionary.Dictionary
      extended by net.sf.extjwnl.dictionary.AbstractCachingDictionary
          extended by net.sf.extjwnl.dictionary.DatabaseBackedDictionary

public class DatabaseBackedDictionary
extends AbstractCachingDictionary

Database-backed dictionary.

Author:
John Didion , Aliaksandr Autayeu

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.extjwnl.dictionary.Dictionary
Dictionary.Version
 
Field Summary
static String DATABASE_MANAGER
          Database manager install parameter.
static String DICTIONARY_ELEMENT_FACTORY
          The class of DatabaseDictionaryElementFactory to use.
static String MORPH
          MorphologicalProcessor class install parameter.
 
Fields inherited from class net.sf.extjwnl.dictionary.AbstractCachingDictionary
isCachingEnabled
 
Fields inherited from class net.sf.extjwnl.dictionary.Dictionary
CHECK_LEX_IDS_KEY, maxOffset, params
 
Constructor Summary
DatabaseBackedDictionary(Document doc)
           
 
Method Summary
 void close()
          Shut down the dictionary
 Exc getException(POS pos, String derivation)
          Lookup derivation in the exceptions file of part-of-speech pos and return an Exc object containing the results.
 Iterator<Exc> 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<IndexWord> getIndexWordIterator(POS pos)
          Return an Iterator over all the IndexWords of part-of-speech pos in the database.
 Iterator<IndexWord> 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)
           
 Synset getSynsetAt(POS pos, long offset)
          Return the Synset at offset offset from the database.
 Iterator<Synset> getSynsetIterator(POS pos)
          Return an Iterator over all the Synsets of part-of-speech pos in the database.
 
Methods inherited from class net.sf.extjwnl.dictionary.AbstractCachingDictionary
addException, addIndexWord, addSynset, cacheAll, cacheException, cacheIndexWord, cachePOS, cacheSynset, clearCache, clearCache, clearException, clearIndexWord, clearSynset, edit, getCacheCapacity, getCachedException, getCachedIndexWord, getCachedSynset, getCacheSizes, isCachingEnabled, removeException, removeIndexWord, removeSynset, setCacheCapacity, setCacheCapacity, setCachingEnabled
 
Methods inherited from class net.sf.extjwnl.dictionary.Dictionary
addElement, createException, createIndexWord, createSynset, delete, getDatabaseBackedInstance, getFileBackedInstance, getInstance, getInstance, getInstance, getMapBackedInstance, getMorphologicalProcessor, getRestoreDictionary, getVersion, isEditable, lookupAllIndexWords, lookupIndexWord, prepareQueryString, removeElement, save, setInstance, setMorphologicalProcessor, setRestoreDictionary, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MORPH

public static final String MORPH
MorphologicalProcessor class install parameter. The value should be the class of MorphologicalProcessor to use.

See Also:
Constant Field Values

DICTIONARY_ELEMENT_FACTORY

public static final String DICTIONARY_ELEMENT_FACTORY
The class of DatabaseDictionaryElementFactory to use.

See Also:
Constant Field Values

DATABASE_MANAGER

public static final String DATABASE_MANAGER
Database manager install parameter. The value should be the class of DatabaseManager to use.

See Also:
Constant Field Values
Constructor Detail

DatabaseBackedDictionary

public DatabaseBackedDictionary(Document doc)
                         throws JWNLException
Throws:
JWNLException
Method Detail

getIndexWord

public IndexWord getIndexWord(POS pos,
                              String lemma)
                       throws JWNLException
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, use Dictionary.lookupIndexWord(POS, String).

Specified by:
getIndexWord in class Dictionary
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.
Throws:
JWNLException - JWNLException

getIndexWordIterator

public Iterator<IndexWord> getIndexWordIterator(POS pos)
                                         throws JWNLException
Description copied from class: Dictionary
Return an Iterator over all the IndexWords of part-of-speech pos in the database.

Overrides:
getIndexWordIterator in class AbstractCachingDictionary
Parameters:
pos - The part-of-speech
Returns:
An iterator over IndexWords
Throws:
JWNLException - JWNLException

getIndexWordIterator

public Iterator<IndexWord> getIndexWordIterator(POS pos,
                                                String substring)
                                         throws JWNLException
Description copied from class: Dictionary
Return an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.

Overrides:
getIndexWordIterator in class AbstractCachingDictionary
Parameters:
pos - The part-of-speech.
substring - substring
Returns:
An iterator over IndexWords.
Throws:
JWNLException - JWNLException

getRandomIndexWord

public IndexWord getRandomIndexWord(POS pos)
                             throws JWNLException
Specified by:
getRandomIndexWord in class Dictionary
Throws:
JWNLException

getSynsetAt

public Synset getSynsetAt(POS pos,
                          long offset)
                   throws JWNLException
Description copied from class: Dictionary
Return the Synset at offset offset from the database.

Specified by:
getSynsetAt in class Dictionary
Parameters:
pos - The part-of-speech file to look in
offset - The offset of the synset in the file
Returns:
A synset containing the parsed line from the database
Throws:
JWNLException - JWNLException

getSynsetIterator

public Iterator<Synset> getSynsetIterator(POS pos)
                                   throws JWNLException
Description copied from class: Dictionary
Return an Iterator over all the Synsets of part-of-speech pos in the database.

Overrides:
getSynsetIterator in class AbstractCachingDictionary
Parameters:
pos - The part-of-speech.
Returns:
An iterator over Synsets.
Throws:
JWNLException - JWNLException

getException

public Exc getException(POS pos,
                        String derivation)
                 throws JWNLException
Description copied from class: Dictionary
Lookup derivation in the exceptions file of part-of-speech pos and return an Exc object containing the results.

Specified by:
getException in class Dictionary
Parameters:
pos - the exception file to look in
derivation - the word to look up
Returns:
Exc the Exc object
Throws:
JWNLException - JWNLException

getExceptionIterator

public Iterator<Exc> getExceptionIterator(POS pos)
                                   throws JWNLException
Description copied from class: Dictionary
Return an Iterator over all the Exceptions in the database.

Overrides:
getExceptionIterator in class AbstractCachingDictionary
Parameters:
pos - the part-of-speech
Returns:
Iterator An iterator over Excs
Throws:
JWNLException - JWNLException

close

public void close()
Description copied from class: Dictionary
Shut down the dictionary

Specified by:
close in class Dictionary


Copyright © 2011. All Rights Reserved.