net.sf.extjwnl.dictionary
Class FileBackedDictionary

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

public class FileBackedDictionary
extends AbstractCachingDictionary

A Dictionary that retrieves objects from the text files in the WordNet distribution directory.

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 CACHE_SIZE
          The default cache size.
static String DICTIONARY_ELEMENT_FACTORY
          The class of FileDictionaryElementFactory to use.
static String ENABLE_CACHING
          The value should be "true" or "false".
static String EXCEPTION_WORD_CACHE_SIZE
          Size of the exception cache.
static String FILE_MANAGER
          File manager install parameter.
static String INDEX_WORD_CACHE_SIZE
          Size of the index word cache.
static String MORPH
          Morphological processor class install parameter.
static String SYNSET_WORD_CACHE_SIZE
          Size of the synset cache.
 
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
FileBackedDictionary(Document doc)
           
 
Method Summary
 void close()
          Shut down the dictionary
 void delete()
           
 void edit()
          Puts the dictionary into edit mode.
 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.
protected  FileManager getFileManager()
          Returns the file manager that backs this 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.
 void save()
          Saves the dictionary.
 
Methods inherited from class net.sf.extjwnl.dictionary.AbstractCachingDictionary
addException, addIndexWord, addSynset, cacheAll, cacheException, cacheIndexWord, cachePOS, cacheSynset, clearCache, clearCache, clearException, clearIndexWord, clearSynset, 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, getDatabaseBackedInstance, getFileBackedInstance, getInstance, getInstance, getInstance, getMapBackedInstance, getMorphologicalProcessor, getRestoreDictionary, getVersion, isEditable, lookupAllIndexWords, lookupIndexWord, prepareQueryString, removeElement, 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
Morphological processor class install parameter. The value should be the class of MorphologicalProcessor to use.

See Also:
Constant Field Values

FILE_MANAGER

public static final String FILE_MANAGER
File manager install parameter. The value should be the class of FileManager to use.

See Also:
Constant Field Values

DICTIONARY_ELEMENT_FACTORY

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

See Also:
Constant Field Values

ENABLE_CACHING

public static final String ENABLE_CACHING
The value should be "true" or "false". The default is "true".

See Also:
Constant Field Values

CACHE_SIZE

public static final String CACHE_SIZE
The default cache size.

See Also:
Constant Field Values

INDEX_WORD_CACHE_SIZE

public static final String INDEX_WORD_CACHE_SIZE
Size of the index word cache. Overrides the default cache size

See Also:
Constant Field Values

SYNSET_WORD_CACHE_SIZE

public static final String SYNSET_WORD_CACHE_SIZE
Size of the synset cache. Overrides the default cache size

See Also:
Constant Field Values

EXCEPTION_WORD_CACHE_SIZE

public static final String EXCEPTION_WORD_CACHE_SIZE
Size of the exception cache. Overrides the default cache size

See Also:
Constant Field Values
Constructor Detail

FileBackedDictionary

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

close

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

Specified by:
close in class Dictionary

delete

public void delete()
            throws JWNLException
Overrides:
delete in class Dictionary
Throws:
JWNLException

getFileManager

protected FileManager getFileManager()
Returns the file manager that backs this database.

Returns:
the file manager that backs this database

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

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

getRandomIndexWord

public IndexWord getRandomIndexWord(POS pos)
                             throws JWNLException
Specified by:
getRandomIndexWord in class Dictionary
Throws:
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

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

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

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

edit

public void edit()
          throws JWNLException
Description copied from class: Dictionary
Puts the dictionary into edit mode.

Overrides:
edit in class AbstractCachingDictionary
Throws:
JWNLException - JWNLException

save

public void save()
          throws JWNLException
Description copied from class: Dictionary
Saves the dictionary.

Overrides:
save in class Dictionary
Throws:
JWNLException - JWNLException


Copyright © 2011. All Rights Reserved.