edu.northwestern.at.morphadorner.corpuslinguistics.lemmatizer

## Class AbstractLemmatizer

- java.lang.Object
- - edu.northwestern.at.utils.IsCloseableObject
  - - edu.northwestern.at.morphadorner.corpuslinguistics.lemmatizer.AbstractLemmatizer

- All Implemented Interfaces:
    Lemmatizer, UsesLogger
  Direct Known Subclasses:
    AbstractStemmerLemmatizer, RuleBasedLemmatizer

      public abstract class AbstractLemmatizer
      extends IsCloseableObject
      implements Lemmatizer, UsesLogger

  Abstract Lemmatizer.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Set<java.lang.String>` | `dictionary` The dictionary.
    `protected char` | `lemmaSeparator` Default lemma separator is vertical bar character,
    `protected java.lang.String` | `lemmaSeparatorString`
    `protected Lexicon` | `lexicon` The lexicon.
    `protected Logger` | `logger` Logger used for output.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractLemmatizer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cantLemmatize(java.lang.String spelling)` Check for words that cannot be lemmatized.
    `int` | `countLemmata(java.lang.String lemma)` Get number of lemmata comprising this lemma.
    `java.lang.String` | `getLemmaSeparator()` Get the lemma separator string,
    `Logger` | `getLogger()` Get the logger.
    `boolean` | `isCompoundLemma(java.lang.String lemma)` Check if lemma is compound lemma.
    `java.lang.String` | `joinLemmata(java.lang.String[] lemmata)` Join separate lemmata into a compound lemma.
    `java.lang.String` | `joinLemmata(java.lang.String[] lemmata, java.lang.String separator)` Join separate lemmata into a compound lemma.
    `abstract java.lang.String` | `lemmatize(java.lang.String spelling)` Returns a lemma given a spelling.
    `abstract java.lang.String` | `lemmatize(java.lang.String spelling, java.lang.String wordClass)` Returns a lemma given a spelling and a part of speech.
    `void` | `setDictionary(java.util.Set<java.lang.String> dictionary)` Set the dictionary for checking lemmata.
    `void` | `setLexicon(Lexicon lexicon)` Set the lexicon.
    `void` | `setLogger(Logger logger)` Set the logger.
    `java.lang.String[]` | `splitLemma(java.lang.String lemma)` Split compound lemma into separate lemmata.

    - ### 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`

- - ### Field Detail

    - #### lemmaSeparator

          protected char lemmaSeparator

      Default lemma separator is vertical bar character,

    - #### lemmaSeparatorString

          protected java.lang.String lemmaSeparatorString

    - #### logger

          protected Logger logger

      Logger used for output.

    - #### lexicon

          protected Lexicon lexicon

      The lexicon.

    - #### dictionary

          protected java.util.Set<java.lang.String> dictionary

      The dictionary.

  - ### Constructor Detail

    - #### AbstractLemmatizer

          public AbstractLemmatizer()

  - ### Method Detail

    - #### getLogger

          public Logger getLogger()

      Get the logger.
      Specified by:
        `getLogger` in interface `UsesLogger`
      Returns:
        The logger.

    - #### setLogger

          public void setLogger(Logger logger)

      Set the logger.
      Specified by:
        `setLogger` in interface `UsesLogger`
      Parameters:
        `logger` - The logger.

    - #### setLexicon

          public void setLexicon(Lexicon lexicon)

      Set the lexicon.
      Specified by:
        `setLexicon` in interface `Lemmatizer`
      Parameters:
        `lexicon` - The lexicon.

    - #### setDictionary

          public void setDictionary(java.util.Set<java.lang.String> dictionary)

      Set the dictionary for checking lemmata.
      Specified by:
        `setDictionary` in interface `Lemmatizer`
      Parameters:
        `dictionary` - The dictionary as a string set. May be null.

    - #### lemmatize

          public abstract java.lang.String lemmatize(java.lang.String spelling)

      Returns a lemma given a spelling.
      Specified by:
        `lemmatize` in interface `Lemmatizer`
      Parameters:
        `spelling` - The spelling.
      Returns:
        The lemma. "*" is returned if the lemma cannot be found.

    - #### lemmatize

          public abstract java.lang.String lemmatize(java.lang.String spelling,
                                   java.lang.String wordClass)

      Returns a lemma given a spelling and a part of speech.
      Specified by:
        `lemmatize` in interface `Lemmatizer`
      Parameters:
        `spelling` - The spelling.
        `wordClass` - The word class.
      Returns:
        The lemma. "*" is returned if the lemma cannot be found.

        The word class should be a major word class as defined in `PartOfSpeech`.

    - #### cantLemmatize

          public boolean cantLemmatize(java.lang.String spelling)

      Check for words that cannot be lemmatized.
      Specified by:
        `cantLemmatize` in interface `Lemmatizer`
      Parameters:
        `spelling` - The spelling to be lemmatized.
      Returns:
        true if spelling is not a lemmatizable word -- e.g., it contains punctuation, is a number, or is a Roman numeral.

    - #### getLemmaSeparator

          public java.lang.String getLemmaSeparator()

      Get the lemma separator string,
      Specified by:
        `getLemmaSeparator` in interface `Lemmatizer`
      Returns:
        String to separate lemmata in compound lemma.

    - #### joinLemmata

          public java.lang.String joinLemmata(java.lang.String[] lemmata,
                                     java.lang.String separator)

      Join separate lemmata into a compound lemma.
      Specified by:
        `joinLemmata` in interface `Lemmatizer`
      Parameters:
        `lemmata` - String array of lemmata.
        `separator` - String to separate lemmata.
      Returns:
        String containing joined lemmata. The lemmata are separated by the specified separator character.

    - #### joinLemmata

          public java.lang.String joinLemmata(java.lang.String[] lemmata)

      Join separate lemmata into a compound lemma.
      Specified by:
        `joinLemmata` in interface `Lemmatizer`
      Parameters:
        `lemmata` - String array of part of speech lemmas.
      Returns:
        String containing joined lemmata. The lemmata are separated by the default separator character.

    - #### splitLemma

          public java.lang.String[] splitLemma(java.lang.String lemma)

      Split compound lemma into separate lemmata.
      Specified by:
        `splitLemma` in interface `Lemmatizer`
      Parameters:
        `lemma` - The compound lemma.
      Returns:
        String array of lemmata. Only one entry if lemma is not a compound lemma.

    - #### isCompoundLemma

          public boolean isCompoundLemma(java.lang.String lemma)

      Check if lemma is compound lemma.
      Specified by:
        `isCompoundLemma` in interface `Lemmatizer`
      Parameters:
        `lemma` - The lemma.
      Returns:
        true if lemma is compound lemma.

    - #### countLemmata

          public int countLemmata(java.lang.String lemma)

      Get number of lemmata comprising this lemma.
      Specified by:
        `countLemmata` in interface `Lemmatizer`
      Parameters:
        `lemma` - The lemma.
      Returns:
        Count of individual lemmata comprising this lemma.