edu.smu.tspell.wordnet
Class WordNetDatabase

java.lang.Object
  extended byedu.smu.tspell.wordnet.WordNetDatabase
Direct Known Subclasses:
FileDatabase

public abstract class WordNetDatabase
extends Object

A concrete implementation of this class provides access to the WordNet database information.


Constructor Summary
WordNetDatabase()
          No-argument constructor.
 
Method Summary
abstract  String[] getBaseFormCandidates(String inflection, SynsetType type)
          Returns lemma representing word forms that might be present in WordNet.
static WordNetDatabase getFileInstance()
          Returns an implementation of this class that can access the WordNet database by searching files on the local file system.
 Synset[] getSynsets(String wordForm)
          Returns all synsets that contain the specified word form or a morphological variation of that word form.
 Synset[] getSynsets(String wordForm, SynsetType type)
          Returns only the synsets of a particular type (e.g., noun) that contain a word form or morphological variation of that form.
abstract  Synset[] getSynsets(String wordForm, SynsetType type, boolean useMorphology)
          Returns only the synsets of a particular type (e.g., noun) that contain a word form matching the specified text or one of that word form's variants.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordNetDatabase

public WordNetDatabase()
No-argument constructor.

Method Detail

getSynsets

public Synset[] getSynsets(String wordForm)
                    throws WordNetException
Returns all synsets that contain the specified word form or a morphological variation of that word form.

Parameters:
wordForm - Text representing a word or collocation (phrase).
Returns:
All synsets that contain the specified word form.
Throws:
WordNetException - An error occurred retrieving the data.

getSynsets

public Synset[] getSynsets(String wordForm,
                           SynsetType type)
Returns only the synsets of a particular type (e.g., noun) that contain a word form or morphological variation of that form.

Parameters:
wordForm - Text representing a word or collocation (phrase).
type - Type of synsets (e.g., noun) to return; if this argument is null, all synsets will be returned that contain the specified word form.
Returns:
Synsets that contain the specified word form or a morphological variation of that word form. If the category argument is specified, only synsets of that type will be returned, otherwise all synsets containing the form are returned.
Throws:
WordNetException - An error occurred retrieving the data.

getSynsets

public abstract Synset[] getSynsets(String wordForm,
                                    SynsetType type,
                                    boolean useMorphology)
                             throws WordNetException
Returns only the synsets of a particular type (e.g., noun) that contain a word form matching the specified text or one of that word form's variants. The caller can request that variants be by specifying that WordNet's morphology rules should be applied when determining which synsets to return. For example, if the caller requests that noun synsets be returned that contain the word form "masses" and the caller also requests that morphological processing be used, this method will return all noun synsets that contain either "masses" or "mass". That's due to the fact that one of WordNet's morphology rules, specifically a detachment rule, produces "mass" as a candidate form of "masses" as a result of stripping the "es" suffix.

Parameters:
wordForm - Text representing a word or collocation (phrase).
type - Type of synsets (e.g., noun) to return; if this argument is null, all synsets will be returned that contain the specified word form.
useMorphology - When true, indicates that this method should return synsets that contain any morphological variation of the specified word form; conversely, a value of false returns in only synsets being returned that contain the word for exactly as it is specified. In other words, specifying false indicates that an exact-match-only approach should be used to determine which synsets to return.
Returns:
Synsets that contain the specified word form. If the category argument is specified, only synsets of that type will be returned, otherwise all synsets containing the form are returned.
Throws:
WordNetException - An error occurred retrieving the data.

getBaseFormCandidates

public abstract String[] getBaseFormCandidates(String inflection,
                                               SynsetType type)
Returns lemma representing word forms that might be present in WordNet. For example, if "geese" is passed to this method along with a parameter that indicates that noun forms should be returned it will return the base form of "goose".

Parameters:
inflection - Irregular inflection for which to return root words.
type - Syntactic type for which to perform the lookup.
Returns:
Root word(s) from which the inflection is derived.
See Also:
WordNet morphological processing, Format of WordNet database files ("Exception List File Format")

getFileInstance

public static WordNetDatabase getFileInstance()
Returns an implementation of this class that can access the WordNet database by searching files on the local file system.

You can specify the directory location of those files by setting the wordnet.database.dir system property.

Returns:
Instance of this class that can be used to read the WordNet database stored on the local file system.