edu.northwestern.at.morphadorner.corpuslinguistics.thesaurus

## Class WordnetThesaurus

- java.lang.Object
- - edu.northwestern.at.utils.IsCloseableObject
  - - edu.northwestern.at.morphadorner.corpuslinguistics.thesaurus.AbstractThesaurus
    - - edu.northwestern.at.morphadorner.corpuslinguistics.thesaurus.WordnetThesaurus

- All Implemented Interfaces:
    Thesaurus, IsCloseable, UsesLogger
  Direct Known Subclasses:
    DefaultThesaurus

      public class WordnetThesaurus
      extends AbstractThesaurus
      implements Thesaurus

  Implements a thesaurus using Wordnet.

  This uses the Jaws interface to WordNet written by Brett Spell. See http://engr.smu.edu/~tspell/ for details.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.String` | `DATABASE_DIRECTORY` Property specifying the location of the WordNet data directory.
    `protected static java.lang.String` | `defaultDataDirectory` Default data directory.
    `protected edu.smu.tspell.wordnet.WordNetDatabase` | `wordnetData` WordNet data.

    - ### Fields inherited from class edu.northwestern.at.morphadorner.corpuslinguistics.thesaurus.AbstractThesaurus

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WordnetThesaurus()` Create a WordNet object.
    `WordnetThesaurus(java.lang.String dataDirectory)` Create a WordNet object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.List<java.lang.String>` | `getAntonyms(java.lang.String word)` Get antonyms.
    `java.util.List<java.lang.String>` | `getAntonyms(java.lang.String word, java.lang.String wordClass)` Get antonyms.
    `java.util.List<java.lang.String>` | `getSynonyms(java.lang.String word)` Get synonyms.
    `java.util.List<java.lang.String>` | `getSynonyms(java.lang.String word, java.lang.String wordClass)` Get synonyms.
    `protected edu.smu.tspell.wordnet.SynsetType` | `getWordClassSynsetType(java.lang.String wordClass)` Convert word class to Wordnet word synset type.
    `protected java.lang.String` | `getWordNetDataDirectory()` Get location of WordNet data files.
    `protected void` | `setWordNetDataDirectory(java.lang.String wordNetDataDirectory)` Set location of WordNet data files.

    - ### Methods inherited from class edu.northwestern.at.morphadorner.corpuslinguistics.thesaurus.AbstractThesaurus

      `getLogger, setLogger`

    - ### Methods inherited from class edu.northwestern.at.utils.IsCloseableObject

      `close`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface edu.northwestern.at.utils.IsCloseable

      `close`

- - ### Field Detail

    - #### DATABASE_DIRECTORY

          protected static final java.lang.String DATABASE_DIRECTORY

      Property specifying the location of the WordNet data directory.
      See Also:
        Constant Field Values

    - #### defaultDataDirectory

          protected static java.lang.String defaultDataDirectory

      Default data directory.

    - #### wordnetData

          protected edu.smu.tspell.wordnet.WordNetDatabase wordnetData

      WordNet data.

  - ### Constructor Detail

    - #### WordnetThesaurus

          public WordnetThesaurus()
                           throws java.io.IOException,
                                  java.io.FileNotFoundException

      Create a WordNet object.
      Throws:
        `java.io.IOException`
        `java.io.FileNotFoundException`

    - #### WordnetThesaurus

          public WordnetThesaurus(java.lang.String dataDirectory)
                           throws java.io.IOException,
                                  java.io.FileNotFoundException

      Create a WordNet object.
      Parameters:
        `dataDirectory` - Data containing WordNet data files.
      Throws:
        `java.io.IOException`
        `java.io.FileNotFoundException`

  - ### Method Detail

    - #### setWordNetDataDirectory

          protected void setWordNetDataDirectory(java.lang.String wordNetDataDirectory)

      Set location of WordNet data files.
      Parameters:
        `wordNetDataDirectory` - The WordNet data directory.

    - #### getWordNetDataDirectory

          protected java.lang.String getWordNetDataDirectory()

      Get location of WordNet data files.
      Returns:
        The WordNet data directory.

    - #### getSynonyms

          public java.util.List<java.lang.String> getSynonyms(java.lang.String word)

      Get synonyms.
      Specified by:
        `getSynonyms` in interface `Thesaurus`
      Specified by:
        `getSynonyms` in class `AbstractThesaurus`
      Parameters:
        `word` - Word for which to find synonyms.
      Returns:
        String list containing synonyms.

    - #### getSynonyms

          public java.util.List<java.lang.String> getSynonyms(java.lang.String word,
                                                     java.lang.String wordClass)

      Get synonyms.
      Specified by:
        `getSynonyms` in interface `Thesaurus`
      Parameters:
        `word` - Word for which to find synonyms.
        `wordClass` - Major word class.
      Returns:
        String list containing synonyms.

    - #### getAntonyms

          public java.util.List<java.lang.String> getAntonyms(java.lang.String word)

      Get antonyms.
      Specified by:
        `getAntonyms` in interface `Thesaurus`
      Specified by:
        `getAntonyms` in class `AbstractThesaurus`
      Parameters:
        `word` - Word for which to find antonyms.
      Returns:
        String list containing antonyms.

    - #### getAntonyms

          public java.util.List<java.lang.String> getAntonyms(java.lang.String word,
                                                     java.lang.String wordClass)

      Get antonyms.
      Specified by:
        `getAntonyms` in interface `Thesaurus`
      Parameters:
        `word` - Word for which to find antonyms.
        `wordClass` - Major word class. Null for all word classes.
      Returns:
        String list containing antonyms.

    - #### getWordClassSynsetType

          protected edu.smu.tspell.wordnet.SynsetType getWordClassSynsetType(java.lang.String wordClass)

      Convert word class to Wordnet word synset type.
      Parameters:
        `wordClass` - Word class. May be one of noun, verb, adjective, adverb, or may be null.
      Returns:
        Wordnet synset type. null if wordclass unrecognized or word class was null.