|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.gwu.wordnet.FileBackedDictionary
A DictionaryDatabase
that retrieves objects from the text files in the WordNet distribution
directory.
A FileBackedDictionary
has an lookupIndexWord
with the same parameters would return the same value
(==
as well as equals
), as would traversal of two Pointer
s
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.
edu.brandeis.cs.steele.util.DictionaryDatabase
,
edu.brandeis.cs.steele.util.Cache
,
edu.brandeis.cs.steele.util.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)
Searches the base word (lemma) of the given string 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.
RemoteFileManager
public 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 DictionaryDatabase
pos
- 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 DictionaryDatabase
pos
- 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 DictionaryDatabase
pos
- The part-of-speech.
IndexWord
s.public java.util.Enumeration synsets(POS pos)
DictionaryDatabase
synsets
in interface DictionaryDatabase
pos
- The part-of-speech.
Synset
s.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |