|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.brandeis.cs.steele.wn.FileBackedDictionary
public class FileBackedDictionary
A DictionaryDatabase that retrieves objects from the text
files in the WordNet distribution directory.
A FileBackedDictionary has an entity cache. The
entity cache is used to resolve multiple temporally contiguous lookups of
the same entity to the same object -- for example, successive calls to
lookupIndexWord with the same parameters would return the
same value (== as well as equals), as would
traversal of two Pointers that shared the same target. The
current implementation uses an LRU cache, so it's possible for two
different objects to represent the same entity, if their retrieval is
separated by other database operations. The LRU cache will be replaced by
a cache based on WeakHashMap, once JDK 1.2 becomes more widely available.
Cache,
LRUCache| Nested Class Summary | |
|---|---|
protected class |
FileBackedDictionary.DatabaseKey
|
| Field Summary | |
|---|---|
protected FileManagerInterface |
db
|
protected int |
DEFAULT_CACHE_CAPACITY
|
protected Cache |
entityCache
|
protected static java.lang.String[] |
POS_FILENAME_ROOTS
|
protected static POS[] |
POS_KEYS
|
| Constructor Summary | |
|---|---|
FileBackedDictionary()
Construct a dictionary backed by a set of files contained in the default WN search directory. |
|
FileBackedDictionary(FileManagerInterface fileManager)
Construct a DictionaryDatabase that retrieves file data from fileManager. |
|
FileBackedDictionary(java.lang.String searchDirectory)
Construct a dictionary backed by a set of files contained in searchDirectory. |
|
| Method Summary | |
|---|---|
protected static java.lang.String |
getDatabaseSuffixName(POS pos)
|
protected static java.lang.String |
getDataFilename(POS pos)
|
protected static java.lang.String |
getExceptionsFilename(POS pos)
|
protected static java.lang.String |
getIndexFilename(POS pos)
|
protected IndexWord |
getIndexWordAt(POS pos,
long offset)
|
Synset |
getSynsetAt(POS pos,
long offset)
|
protected Synset |
getSynsetAt(POS pos,
long offset,
java.lang.String line)
|
java.lang.String |
lookupBaseForm(POS pos,
java.lang.String derivation)
Return the base form of an exceptional derivation, if an entry for it exists in the database. |
IndexWord |
lookupIndexWord(POS pos,
java.lang.String string)
Look up a word in the database. |
java.util.Enumeration |
searchIndexWords(POS pos,
java.lang.String substring)
Return an enumeration of all the IndexWords whose lemmas contain substring as a substring. |
void |
setEntityCache(Cache cache)
Set the dictionary's entity cache. |
java.util.Enumeration |
synsets(POS pos)
Return an enumeration over all the Synsets in the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final FileManagerInterface db
protected final int DEFAULT_CACHE_CAPACITY
protected Cache entityCache
protected static final POS[] POS_KEYS
protected static final java.lang.String[] POS_FILENAME_ROOTS
| Constructor Detail |
|---|
public FileBackedDictionary(FileManagerInterface fileManager)
fileManager. A client can use this to create a
DictionaryDatabase backed by a RemoteFileManager.
RemoteFileManagerpublic FileBackedDictionary()
FileManager for a description of the location of the default search directory.
public FileBackedDictionary(java.lang.String searchDirectory)
| Method Detail |
|---|
public void setEntityCache(Cache cache)
protected static java.lang.String getDatabaseSuffixName(POS pos)
protected static java.lang.String getDataFilename(POS pos)
protected static java.lang.String getIndexFilename(POS pos)
protected static java.lang.String getExceptionsFilename(POS pos)
protected IndexWord getIndexWordAt(POS pos,
long offset)
protected Synset getSynsetAt(POS pos,
long offset,
java.lang.String line)
public Synset getSynsetAt(POS pos,
long offset)
public IndexWord lookupIndexWord(POS pos,
java.lang.String string)
DictionaryDatabase
lookupIndexWord in interface DictionaryDatabasepos - The part-of-speech.string - The orthographic representation of the word.
null if no such entry exists.
public java.lang.String lookupBaseForm(POS pos,
java.lang.String derivation)
DictionaryDatabase
lookupBaseForm in interface DictionaryDatabasepos - The part-of-speech.derivation - The inflected form of the word.
public java.util.Enumeration searchIndexWords(POS pos,
java.lang.String substring)
DictionaryDatabase
searchIndexWords in interface DictionaryDatabasepos - The part-of-speech.
IndexWords.public java.util.Enumeration synsets(POS pos)
DictionaryDatabase
synsets in interface DictionaryDatabasepos - The part-of-speech.
Synsets.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||