net.didion.jwnl.dictionary
Class Dictionary

java.lang.Object
  extended by net.didion.jwnl.dictionary.Dictionary
All Implemented Interfaces:
Installable
Direct Known Subclasses:
AbstractCachingDictionary, MapBackedDictionary

public abstract class Dictionary
extends java.lang.Object
implements Installable

Abstract representation of a WordNet dictionary. See the architecture documentation for information on subclassing Dictionary.


Method Summary
abstract  void close()
          Shut down the dictionary
abstract  Exc getException(POS pos, java.lang.String derivation)
          Lookup derivation in the exceptions file of part-of-speech pos and return an Exc object containing the results.
abstract  java.util.Iterator getExceptionIterator(POS pos)
          Return an Iterator over all the Exceptions in the database.
abstract  IndexWord getIndexWord(POS pos, java.lang.String lemma)
          Look up a word in the database.
abstract  java.util.Iterator getIndexWordIterator(POS pos)
          Return an Iterator over all the IndexWords of part-of-speech pos in the database.
abstract  java.util.Iterator getIndexWordIterator(POS pos, java.lang.String substring)
          Return an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.
static Dictionary getInstance()
           
 MorphologicalProcessor getMorphologicalProcessor()
           
abstract  IndexWord getRandomIndexWord(POS pos)
           
abstract  java.lang.String getSenseKey(long offset, java.lang.String lemma)
          Gets the sense key for this combination.
abstract  Synset getSynsetAt(POS pos, long offset)
          Return the Synset at offset offset from the database.
abstract  java.util.Iterator getSynsetIterator(POS pos)
          Return an Iterator over all the Synsets of part-of-speech pos in the database.
abstract  int getUsageCount(long offset, java.lang.String lemma)
          Gets the usage count for this offset/lemma combination.
 IndexWordSet lookupAllIndexWords(java.lang.String lemma)
          Return a set of IndexWords, with each element in the set corresponding to a part-of-speech of word.
 IndexWord lookupIndexWord(POS pos, java.lang.String lemma)
          Main word lookup procedure.
static void uninstall()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.didion.jwnl.util.factory.Installable
install
 

Method Detail

getInstance

public static Dictionary getInstance()

uninstall

public static void uninstall()

getIndexWordIterator

public abstract java.util.Iterator getIndexWordIterator(POS pos)
                                                 throws JWNLException
Return an Iterator over all the IndexWords of part-of-speech pos in the database.

Parameters:
pos - The part-of-speech
Returns:
An iterator over IndexWords
Throws:
JWNLException

getIndexWordIterator

public abstract java.util.Iterator getIndexWordIterator(POS pos,
                                                        java.lang.String substring)
                                                 throws JWNLException
Return an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.

Parameters:
pos - The part-of-speech.
Returns:
An iterator over IndexWords.
Throws:
JWNLException

getIndexWord

public abstract IndexWord getIndexWord(POS pos,
                                       java.lang.String lemma)
                                throws JWNLException
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 lookupIndexWord(POS, String).

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

getRandomIndexWord

public abstract IndexWord getRandomIndexWord(POS pos)
                                      throws JWNLException
Throws:
JWNLException

getSynsetIterator

public abstract java.util.Iterator getSynsetIterator(POS pos)
                                              throws JWNLException
Return an Iterator over all the Synsets of part-of-speech pos in the database.

Parameters:
pos - The part-of-speech.
Returns:
An iterator over Synsets.
Throws:
JWNLException

getSynsetAt

public abstract Synset getSynsetAt(POS pos,
                                   long offset)
                            throws JWNLException
Return the Synset at offset offset from the database.

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

getExceptionIterator

public abstract java.util.Iterator getExceptionIterator(POS pos)
                                                 throws JWNLException
Return an Iterator over all the Exceptions in the database.

Parameters:
pos - the part-of-speech
Returns:
Iterator An iterator over Strings
Throws:
JWNLException

getException

public abstract Exc getException(POS pos,
                                 java.lang.String derivation)
                          throws JWNLException
Lookup derivation in the exceptions file of part-of-speech pos and return an Exc object containing the results.

Parameters:
pos - the exception file to look in
derivation - the word to look up
Returns:
Exc the Exc object
Throws:
JWNLException

close

public abstract void close()
Shut down the dictionary


getMorphologicalProcessor

public MorphologicalProcessor getMorphologicalProcessor()

lookupIndexWord

public IndexWord lookupIndexWord(POS pos,
                                 java.lang.String lemma)
                          throws JWNLException
Main word lookup procedure. First try a normal lookup. If that doesn't work, try looking up the stemmed form of the lemma.

Parameters:
pos - the part-of-speech of the word to look up
lemma - the lemma to look up
Returns:
IndexWord the IndexWord found by the lookup procedure, or null if an IndexWord is not found
Throws:
JWNLException

lookupAllIndexWords

public IndexWordSet lookupAllIndexWords(java.lang.String lemma)
                                 throws JWNLException
Return a set of IndexWords, with each element in the set corresponding to a part-of-speech of word.

Parameters:
lemma - the word for which to lookup senses
Returns:
An array of IndexWords, each of which is a sense of word
Throws:
JWNLException

getUsageCount

public abstract int getUsageCount(long offset,
                                  java.lang.String lemma)
Gets the usage count for this offset/lemma combination.

Parameters:
offset -
lemma -
Returns:

getSenseKey

public abstract java.lang.String getSenseKey(long offset,
                                             java.lang.String lemma)
Gets the sense key for this combination.

Parameters:
offset -
lemma -
Returns: