public class FileBackedDictionary extends AbstractCachingDictionary
Dictionary
that retrieves objects from the text files
in the WordNet distribution directory.Modifier and Type | Field and Description |
---|---|
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.
|
Constructor and Description |
---|
FileBackedDictionary() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Shut down the dictionary
|
FileDictionaryElementFactory |
getDictionaryElementFactory() |
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 |
getExceptionIterator(POS pos)
Return an Iterator over all the Exceptions in the database.
|
protected FileManager |
getFileManager()
Get the file manager that backs this 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) |
Synset |
getSynsetAt(POS pos,
long offset)
Return the
Synset at offset offset from the database. |
Iterator |
getSynsetIterator(POS pos)
Return an Iterator over all the Synsets of part-of-speech pos
in the database.
|
static void |
install(FileManager fileManager,
FileDictionaryElementFactory factory)
Construct a Dictionary that retrieves file data from
fileManager . |
static void |
install(FileManager fileManager,
FileDictionaryElementFactory factory,
boolean enableCaching) |
static void |
install(FileManager fileManager,
MorphologicalProcessor morph,
FileDictionaryElementFactory factory)
Construct a Dictionary that retrieves file data from
fileManager . |
static void |
install(FileManager fileManager,
MorphologicalProcessor morph,
FileDictionaryElementFactory factory,
boolean enableCaching) |
void |
install(Map params)
Install a FileBackedDictionary from a map of parameters.
|
cacheException, cacheIndexWord, cacheSynset, clearCache, clearCache, getCacheCapacity, getCachedException, getCachedIndexWord, getCachedSynset, getCacheSizes, isCachingEnabled, setCacheCapacity, setCacheCapacity, setCachingEnabled
getInstance, getMorphologicalProcessor, lookupAllIndexWords, lookupIndexWord, prepareQueryString, setDictionary, uninstall
public static final String MORPH
public static final String FILE_MANAGER
public static final String DICTIONARY_ELEMENT_FACTORY
public static final String ENABLE_CACHING
public static final String CACHE_SIZE
public static final String INDEX_WORD_CACHE_SIZE
public static final String SYNSET_WORD_CACHE_SIZE
public static final String EXCEPTION_WORD_CACHE_SIZE
public static void install(FileManager fileManager, FileDictionaryElementFactory factory)
fileManager
.
A client can use this to create a Dictionary backed by a RemoteFileManager.RemoteFileManager
public static void install(FileManager fileManager, MorphologicalProcessor morph, FileDictionaryElementFactory factory)
fileManager
.
If enableCaching is true, lookup operations will check the relavant cache before
doing a lookup and will cache their results after doing a lookup.public static void install(FileManager fileManager, FileDictionaryElementFactory factory, boolean enableCaching)
public static void install(FileManager fileManager, MorphologicalProcessor morph, FileDictionaryElementFactory factory, boolean enableCaching)
public void install(Map params) throws JWNLException
JWNLException
public void close()
Dictionary
close
in class Dictionary
protected FileManager getFileManager()
public FileDictionaryElementFactory getDictionaryElementFactory()
public Iterator getIndexWordIterator(POS pos) throws JWNLException
Dictionary
getIndexWordIterator
in class Dictionary
pos
- The part-of-speechIndexWord
sJWNLException
public Iterator getIndexWordIterator(POS pos, String substring) throws JWNLException
Dictionary
getIndexWordIterator
in class Dictionary
pos
- The part-of-speech.IndexWord
s.JWNLException
public IndexWord getIndexWord(POS pos, String lemma) throws JWNLException
Dictionary
Dictionary.lookupIndexWord(POS, String)
.getIndexWord
in class Dictionary
pos
- The part-of-speech.lemma
- The orthographic representation of the word.null
if
no such entry exists.JWNLException
public IndexWord getRandomIndexWord(POS pos) throws JWNLException
getRandomIndexWord
in class Dictionary
JWNLException
public Iterator getSynsetIterator(POS pos)
Dictionary
getSynsetIterator
in class Dictionary
pos
- The part-of-speech.Synset
s.public Synset getSynsetAt(POS pos, long offset) throws JWNLException
Dictionary
Synset
at offset offset
from the database.getSynsetAt
in class Dictionary
pos
- The part-of-speech file to look inoffset
- The offset of the synset in the fileJWNLException
public Iterator getExceptionIterator(POS pos)
Dictionary
getExceptionIterator
in class Dictionary
pos
- the part-of-speechString
spublic Exc getException(POS pos, String derivation) throws JWNLException
Dictionary
derivation
in the exceptions file of part-of-speech
pos
and return an Exc object containing the results.getException
in class Dictionary
pos
- the exception file to look inderivation
- the word to look upJWNLException
Copyright © 2023. All rights reserved.