|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.extjwnl.dictionary.Dictionary
public abstract class Dictionary
Abstract representation of a WordNet dictionary. See the architecture documentation for information on subclassing Dictionary.
Nested Class Summary | |
---|---|
static class |
Dictionary.Version
Represents a version of WordNet. |
Field Summary | |
---|---|
static String |
CHECK_LEX_IDS_KEY
Whether to check and fix lexicographer ids, default true. |
protected HashMap<POS,Long> |
maxOffset
|
protected Map<String,Param> |
params
|
Constructor Summary | |
---|---|
protected |
Dictionary()
Create a Dictionary that does not do morphological processing. |
protected |
Dictionary(Document doc)
|
protected |
Dictionary(MorphologicalProcessor morph)
Create a Dictionary using the specified MorphologicalProcessor. |
Method Summary | |
---|---|
void |
addElement(DictionaryElement element)
Adds dictionary element to the dictionary. |
void |
addException(Exc exc)
Adds exception to the dictionary. |
void |
addIndexWord(IndexWord indexWord)
Adds index word to the dictionary. |
void |
addSynset(Synset synset)
Adds synset to the dictionary. |
abstract void |
close()
Shut down the dictionary |
Exc |
createException(POS pos,
String lemma,
List<String> exceptions)
Creates an exception in the dictionary. |
IndexWord |
createIndexWord(POS pos,
String lemma,
Synset synset)
Creates index word. |
Synset |
createSynset(POS pos)
Creates synset of the specified part of speech. |
void |
delete()
|
void |
edit()
Puts the dictionary into edit mode. |
static Dictionary |
getDatabaseBackedInstance(String dbURL)
Returns DatabaseBackedDictionary instance with default configuration. |
abstract 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. |
abstract Iterator<Exc> |
getExceptionIterator(POS pos)
Return an Iterator over all the Exceptions in the database. |
static Dictionary |
getFileBackedInstance(String dictionaryPath)
Returns FileBackedDictionary instance with default configuration. |
abstract IndexWord |
getIndexWord(POS pos,
String lemma)
Look up a word in the database. |
abstract Iterator<IndexWord> |
getIndexWordIterator(POS pos)
Return an Iterator over all the IndexWords of part-of-speech pos in the database. |
abstract 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. |
static Dictionary |
getInstance()
|
static Dictionary |
getInstance(InputSource properties)
Parses properties and creates a dictionary. |
static Dictionary |
getInstance(InputStream properties)
Parses a properties file and creates a dictionary. |
static Dictionary |
getMapBackedInstance(String dictionaryPath)
Returns MapBackedDictionary instance with default configuration. |
MorphologicalProcessor |
getMorphologicalProcessor()
|
abstract IndexWord |
getRandomIndexWord(POS pos)
|
static Dictionary |
getRestoreDictionary()
|
abstract Synset |
getSynsetAt(POS pos,
long offset)
Return the Synset at offset offset from the database. |
abstract Iterator<Synset> |
getSynsetIterator(POS pos)
Return an Iterator over all the Synsets of part-of-speech pos in the database. |
Dictionary.Version |
getVersion()
Returns the current WordNet version. |
boolean |
isEditable()
Returns whether the dictionary is editable. |
IndexWordSet |
lookupAllIndexWords(String lemma)
Return a set of IndexWord s, with each element in the set
corresponding to a part-of-speech of word. |
IndexWord |
lookupIndexWord(POS pos,
String lemma)
Main word lookup procedure. |
protected static String |
prepareQueryString(String lemma)
Prepares the lemma for being used in a lookup operation. |
void |
removeElement(DictionaryElement element)
Removes the dictionary element from the dictionary. |
void |
removeException(Exc exc)
Removes the exc from the dictionary. |
void |
removeIndexWord(IndexWord indexWord)
Removes indexWord from the dictionary. |
void |
removeSynset(Synset synset)
Removes synset from the dictionary. |
void |
save()
Saves the dictionary. |
static Dictionary |
setInstance(Dictionary dictionary)
|
void |
setMorphologicalProcessor(MorphologicalProcessor morph)
|
static void |
setRestoreDictionary(Dictionary dictionary)
|
static void |
uninstall()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CHECK_LEX_IDS_KEY
protected Map<String,Param> params
protected HashMap<POS,Long> maxOffset
Constructor Detail |
---|
protected Dictionary()
protected Dictionary(MorphologicalProcessor morph)
morph
- MorphologicalProcessor to useprotected Dictionary(Document doc) throws JWNLException
JWNLException
Method Detail |
---|
public static Dictionary getInstance()
public static Dictionary getInstance(InputStream properties) throws JWNLException
properties
- the properties file stream
JWNLException
- various JWNL exceptions, depending on where this failspublic static Dictionary getInstance(InputSource properties) throws JWNLException
properties
- input source with properties
JWNLException
- various JWNL exceptions, depending on where this failspublic static Dictionary getFileBackedInstance(String dictionaryPath) throws JWNLException
dictionaryPath
- dictionary path
JWNLException
- JWNLExceptionpublic static Dictionary getMapBackedInstance(String dictionaryPath) throws JWNLException
dictionaryPath
- dictionary path
JWNLException
- JWNLExceptionpublic static Dictionary getDatabaseBackedInstance(String dbURL) throws JWNLException
dbURL
- database url
JWNLException
- JWNLExceptionpublic static Dictionary setInstance(Dictionary dictionary)
public static void uninstall()
public static void setRestoreDictionary(Dictionary dictionary)
public static Dictionary getRestoreDictionary()
public abstract Iterator<IndexWord> getIndexWordIterator(POS pos) throws JWNLException
pos
- The part-of-speech
IndexWord
s
JWNLException
- JWNLExceptionpublic abstract Iterator<IndexWord> getIndexWordIterator(POS pos, String substring) throws JWNLException
pos
- The part-of-speech.substring
- substring
IndexWord
s.
JWNLException
- JWNLExceptionpublic abstract IndexWord getIndexWord(POS pos, String lemma) throws JWNLException
lookupIndexWord(POS, String)
.
pos
- The part-of-speech.lemma
- The orthographic representation of the word.
null
if
no such entry exists.
JWNLException
- JWNLExceptionpublic abstract IndexWord getRandomIndexWord(POS pos) throws JWNLException
JWNLException
public abstract Iterator<Synset> getSynsetIterator(POS pos) throws JWNLException
pos
- The part-of-speech.
Synset
s.
JWNLException
- JWNLExceptionpublic abstract Synset getSynsetAt(POS pos, long offset) throws JWNLException
Synset
at offset offset from the database.
pos
- The part-of-speech file to look inoffset
- The offset of the synset in the file
JWNLException
- JWNLExceptionpublic abstract Iterator<Exc> getExceptionIterator(POS pos) throws JWNLException
pos
- the part-of-speech
Exc
s
JWNLException
- JWNLExceptionpublic abstract Exc getException(POS pos, String derivation) throws JWNLException
pos
- the exception file to look inderivation
- the word to look up
JWNLException
- JWNLExceptionpublic abstract void close()
public MorphologicalProcessor getMorphologicalProcessor()
public void setMorphologicalProcessor(MorphologicalProcessor morph)
public IndexWord lookupIndexWord(POS pos, String lemma) throws JWNLException
pos
- the part-of-speech of the word to look uplemma
- the lemma to look up
JWNLException
- JWNLExceptionpublic IndexWordSet lookupAllIndexWords(String lemma) throws JWNLException
IndexWord
s, with each element in the set
corresponding to a part-of-speech of word.
lemma
- the word for which to lookup senses
JWNLException
- JWNLExceptionpublic Dictionary.Version getVersion()
public boolean isEditable()
public void edit() throws JWNLException
JWNLException
- JWNLExceptionpublic void save() throws JWNLException
JWNLException
- JWNLExceptionpublic void delete() throws JWNLException
JWNLException
public void addElement(DictionaryElement element) throws JWNLException
element
- element to add
JWNLException
- JWNLExceptionpublic void removeElement(DictionaryElement element) throws JWNLException
element
- element to be removed
JWNLException
- JWNLExceptionpublic Exc createException(POS pos, String lemma, List<String> exceptions) throws JWNLException
pos
- exception part of speechlemma
- exception lemmaexceptions
- list of base forms
JWNLException
- JWNLExceptionpublic void addException(Exc exc) throws JWNLException
exc
- exception to add
JWNLException
- JWNLExceptionpublic void removeException(Exc exc) throws JWNLException
exc
- exc to be removed
JWNLException
- JWNLExceptionpublic Synset createSynset(POS pos) throws JWNLException
pos
- part of speech
JWNLException
- JWNLExceptionpublic void addSynset(Synset synset) throws JWNLException
synset
- synset to add
JWNLException
- JWNLExceptionpublic void removeSynset(Synset synset) throws JWNLException
synset
- synset to remove
JWNLException
- JWNLExceptionpublic IndexWord createIndexWord(POS pos, String lemma, Synset synset) throws JWNLException
pos
- part of speechlemma
- lemmasynset
- synset
JWNLException
- JWNLExceptionpublic void addIndexWord(IndexWord indexWord) throws JWNLException
indexWord
- index word to add
JWNLException
- JWNLExceptionpublic void removeIndexWord(IndexWord indexWord) throws JWNLException
indexWord
- index word to remove
JWNLException
- JWNLExceptionprotected static String prepareQueryString(String lemma)
lemma
- the lemma to be prepared
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |