edu.mit.jwi
Interface IDictionary

All Superinterfaces:
IClosable, IHasCharset, IHasLifecycle, IHasVersion
All Known Subinterfaces:
ICachingDictionary, IDataSourceDictionary, IRAMDictionary
All Known Implementing Classes:
CachingDictionary, DataSourceDictionary, Dictionary, RAMDictionary

public interface IDictionary
extends IHasVersion, IHasLifecycle, IHasCharset

Objects that implement this interface are intended as the main entry point to accessing Wordnet data. The dictionary must be opened by calling open() before it is used, otherwise its methods throw an IllegalStateException.

Since:
JWI 1.0
Version:
2.4.0
Author:
Mark A. Finlayson

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.mit.jwi.data.IHasLifecycle
IHasLifecycle.LifecycleState, IHasLifecycle.ObjectClosedException, IHasLifecycle.ObjectOpenException
 
Method Summary
 IExceptionEntry getExceptionEntry(IExceptionEntryID id)
          Retrieves the exception entry for the specified id from the database.
 IExceptionEntry getExceptionEntry(java.lang.String surfaceForm, POS pos)
          Retrieves the exception entry for the specified surface form and part of speech from the database.
 java.util.Iterator<IExceptionEntry> getExceptionEntryIterator(POS pos)
          Returns an iterator that will iterate over all exception entries of the specified part of speech.
 IIndexWord getIndexWord(IIndexWordID id)
          Retrieves the specified index word object from the database.
 IIndexWord getIndexWord(java.lang.String lemma, POS pos)
          This method is identical to getIndexWord(IIndexWordID) and is provided as a convenience.
 java.util.Iterator<IIndexWord> getIndexWordIterator(POS pos)
          Returns an iterator that will iterate over all index words of the specified part of speech.
 ISenseEntry getSenseEntry(ISenseKey key)
          Retrieves the sense entry for the specified sense key from the database.
 java.util.Iterator<ISenseEntry> getSenseEntryIterator()
          Returns an iterator that will iterate over all sense entries in the dictionary.
 ISynset getSynset(ISynsetID id)
          Retrieves the synset with the specified id from the database.
 java.util.Iterator<ISynset> getSynsetIterator(POS pos)
          Returns an iterator that will iterate over all synsets of the specified part of speech.
 IWord getWord(ISenseKey key)
          Retrieves the word with the specified sense key from the database.
 IWord getWord(IWordID id)
          Retrieves the word with the specified id from the database.
 void setCharset(java.nio.charset.Charset charset)
          Sets the character set associated with this dictionary.
 
Methods inherited from interface edu.mit.jwi.item.IHasVersion
getVersion
 
Methods inherited from interface edu.mit.jwi.data.IHasLifecycle
isOpen, open
 
Methods inherited from interface edu.mit.jwi.data.IClosable
close
 
Methods inherited from interface edu.mit.jwi.data.IHasCharset
getCharset
 

Method Detail

setCharset

void setCharset(java.nio.charset.Charset charset)
Sets the character set associated with this dictionary. The character set may be null.

Parameters:
charset - the possibly null character set to use when decoding files.
Since:
JWI 2.3.4

getIndexWord

IIndexWord getIndexWord(java.lang.String lemma,
                        POS pos)
This method is identical to getIndexWord(IIndexWordID) and is provided as a convenience.

Parameters:
lemma - the lemma for the index word requested; may not be null, empty, or all whitespace
pos - the part of speech; may not be null
Returns:
the index word corresponding to the specified lemma and part of speech, or null if none is found
Throws:
java.lang.NullPointerException - if either argument is null
java.lang.IllegalArgumentException - if the specified lemma is empty or all whitespace
Since:
JWI 1.0

getIndexWord

IIndexWord getIndexWord(IIndexWordID id)
Retrieves the specified index word object from the database. If the specified lemma/part of speech combination is not found, returns null.

Note: This call does no stemming on the specified lemma, it is taken as specified. That is, if you submit the word "dogs", it will search for "dogs", not "dog"; in the standard Wordnet distribution, there is no entry for "dogs" and therefore the call will return null. This is in contrast to the Wordnet API provided by Princeton. If you want your searches to capture morphological variation, use the descendants of the IStemmer class.

Parameters:
id - the id of the index word to search for; may not be null
Returns:
the index word, if found; null otherwise
Throws:
java.lang.NullPointerException - if the argument is null
Since:
JWI 1.0

getIndexWordIterator

java.util.Iterator<IIndexWord> getIndexWordIterator(POS pos)
Returns an iterator that will iterate over all index words of the specified part of speech.

Parameters:
pos - the part of speech over which to iterate; may not be null
Returns:
an iterator that will iterate over all index words of the specified part of speech
Throws:
java.lang.NullPointerException - if the argument is null
Since:
JWI 1.0

getWord

IWord getWord(IWordID id)
Retrieves the word with the specified id from the database. If the specified word is not found, returns null

Parameters:
id - the id of the word to search for; may not be null
Returns:
the word, if found; null otherwise
Throws:
java.lang.NullPointerException - if the argument is null
Since:
JWI 1.0

getWord

IWord getWord(ISenseKey key)
Retrieves the word with the specified sense key from the database. If the specified word is not found, returns null

Parameters:
key - the sense key of the word to search for; may not be null
Returns:
the word, if found; null otherwise
Throws:
java.lang.NullPointerException - if the argument is null
Since:
JWI 1.0

getSynset

ISynset getSynset(ISynsetID id)
Retrieves the synset with the specified id from the database. If the specified synset is not found, returns null

Parameters:
id - the id of the synset to search for; may not be null
Returns:
the synset, if found; null otherwise
Throws:
java.lang.NullPointerException - if the argument is null
Since:
JWI 1.0

getSynsetIterator

java.util.Iterator<ISynset> getSynsetIterator(POS pos)
Returns an iterator that will iterate over all synsets of the specified part of speech.

Parameters:
pos - the part of speech over which to iterate; may not be null
Returns:
an iterator that will iterate over all synsets of the specified part of speech
Throws:
java.lang.NullPointerException - if the argument is null
Since:
JWI 1.0

getSenseEntry

ISenseEntry getSenseEntry(ISenseKey key)
Retrieves the sense entry for the specified sense key from the database. If the specified sense key has no associated sense entry, returns null

Parameters:
key - the sense key of the entry to search for; may not be null
Returns:
the entry, if found; null otherwise
Throws:
java.lang.NullPointerException - if the argument is null
Since:
JWI 1.0

getSenseEntryIterator

java.util.Iterator<ISenseEntry> getSenseEntryIterator()
Returns an iterator that will iterate over all sense entries in the dictionary.

Returns:
an iterator that will iterate over all sense entries
Since:
JWI 1.0

getExceptionEntry

IExceptionEntry getExceptionEntry(java.lang.String surfaceForm,
                                  POS pos)
Retrieves the exception entry for the specified surface form and part of speech from the database. If the specified surface form/ part of speech pair has no associated exception entry, returns null

Parameters:
surfaceForm - the surface form to be looked up; may not be null , empty, or all whitespace
pos - the part of speech; may not be null
Returns:
the entry, if found; null otherwise
Throws:
java.lang.NullPointerException - if either argument is null
java.lang.IllegalArgumentException - if the specified surface form is empty or all whitespace
Since:
JWI 1.0

getExceptionEntry

IExceptionEntry getExceptionEntry(IExceptionEntryID id)
Retrieves the exception entry for the specified id from the database. If the specified id is not found, returns null

Parameters:
id - the exception entry id of the entry to search for; may not be null
Returns:
the exception entry for the specified id
Since:
JWI 1.1

getExceptionEntryIterator

java.util.Iterator<IExceptionEntry> getExceptionEntryIterator(POS pos)
Returns an iterator that will iterate over all exception entries of the specified part of speech.

Parameters:
pos - the part of speech over which to iterate; may not be null
Returns:
an iterator that will iterate over all exception entries of the specified part of speech
Throws:
java.lang.NullPointerException - if the argument is null
Since:
JWI 1.0


Copyright © 2007-2013 Massachusetts Institute of Technology. All Rights Reserved.