edu.northwestern.at.morphadorner.corpuslinguistics.namerecognizer

## Class AbstractNameRecognizer

- java.lang.Object
- - edu.northwestern.at.utils.IsCloseableObject
  - - edu.northwestern.at.morphadorner.corpuslinguistics.namerecognizer.AbstractNameRecognizer

- All Implemented Interfaces:
    UsesLexicon, NameRecognizer, UsesLogger
  Direct Known Subclasses:
    DefaultNameRecognizer

      public abstract class AbstractNameRecognizer
      extends IsCloseableObject
      implements NameRecognizer, UsesLexicon, UsesLogger

  Abstract Name Recognizer.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Lexicon` | `lexicon` Lexicon used by name recognizer.
    `protected Logger` | `logger` Logger used for output.
    `protected Names` | `names` Built-in name lists.
    `protected PartOfSpeechTagger` | `partOfSpeechTagger` Part of speech tagger used to find noun phrases.
    `protected PartOfSpeechTags` | `partOfSpeechTags` Part of speech tags.
    `protected SentenceSplitter` | `sentenceSplitter` Sentence splitter.
    `protected WordTokenizer` | `wordTokenizer` Word tokenizer.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractNameRecognizer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the name recognizer.
    `abstract <T extends AdornedWord> java.util.List<NamePosition>[]` | `findNamePositions(java.util.List<java.util.List<T>> sentences)` Returns name positions in list of adorned word sentences.
    `abstract <T extends AdornedWord> java.util.Set<java.lang.String>[]` | `findNames(java.util.List<java.util.List<T>> sentences)` Returns names from list of adorned word sentences.
    `abstract java.util.Set<java.lang.String>[]` | `findNames(java.lang.String text)` Returns names from text.
    `Lexicon` | `getLexicon()` Get the word lexicon.
    `Logger` | `getLogger()` Get the logger.
    `PartOfSpeechTagger` | `getPartOfSpeechTagger()` Get part of speech tagger.
    `static <T extends AdornedWord> java.lang.String` | `namePositionToName(java.util.List<java.util.List<T>> sentences, NamePosition namePosition)` Get name from name position.
    `void` | `setLexicon(Lexicon lexicon)` Set the lexicon.
    `void` | `setLogger(Logger logger)` Set the logger.
    `void` | `setPartOfSpeechTagger(PartOfSpeechTagger posTagger)` Set part of speech tagger used to find noun phrases.

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

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

- - ### Field Detail

    - #### lexicon

          protected Lexicon lexicon

      Lexicon used by name recognizer.

    - #### partOfSpeechTagger

          protected PartOfSpeechTagger partOfSpeechTagger

      Part of speech tagger used to find noun phrases.

    - #### wordTokenizer

          protected WordTokenizer wordTokenizer

      Word tokenizer.

    - #### sentenceSplitter

          protected SentenceSplitter sentenceSplitter

      Sentence splitter.

    - #### partOfSpeechTags

          protected PartOfSpeechTags partOfSpeechTags

      Part of speech tags.

    - #### names

          protected Names names

      Built-in name lists.

    - #### logger

          protected Logger logger

      Logger used for output.

  - ### Constructor Detail

    - #### AbstractNameRecognizer

          public AbstractNameRecognizer()

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

    - #### getLexicon

          public Lexicon getLexicon()

      Get the word lexicon.
      Specified by:
        `getLexicon` in interface `UsesLexicon`
      Specified by:
        `getLexicon` in interface `NameRecognizer`
      Returns:
        The static word lexicon.

    - #### setLexicon

          public void setLexicon(Lexicon lexicon)

      Set the lexicon.
      Specified by:
        `setLexicon` in interface `UsesLexicon`
      Specified by:
        `setLexicon` in interface `NameRecognizer`
      Parameters:
        `lexicon` - Lexicon used for tagging.

    - #### getPartOfSpeechTagger

          public PartOfSpeechTagger getPartOfSpeechTagger()

      Get part of speech tagger.
      Specified by:
        `getPartOfSpeechTagger` in interface `NameRecognizer`
      Returns:
        The part of speech tagger.

    - #### setPartOfSpeechTagger

          public void setPartOfSpeechTagger(PartOfSpeechTagger posTagger)

      Set part of speech tagger used to find noun phrases.
      Specified by:
        `setPartOfSpeechTagger` in interface `NameRecognizer`
      Parameters:
        `posTagger` - The part of speech tagger.

    - #### namePositionToName

          public static <T extends AdornedWord> java.lang.String namePositionToName(java.util.List<java.util.List<T>> sentences,
                                                                    NamePosition namePosition)

      Get name from name position.
      Parameters:
        `sentences` - The collection of sentences.
        `namePosition` - The name position.
      Returns:
        The name string.

    - #### findNames

          public abstract java.util.Set<java.lang.String>[] findNames(java.lang.String text)

      Returns names from text.
      Specified by:
        `findNames` in interface `NameRecognizer`
      Parameters:
        `text` - The text from which to extract names.
      Returns:
        Array of Set of names and places as strings. [0] = Set of proper names. [1] = Set of places.

    - #### findNames

          public abstract <T extends AdornedWord> java.util.Set<java.lang.String>[] findNames(java.util.List<java.util.List<T>> sentences)

      Returns names from list of adorned word sentences.
      Specified by:
        `findNames` in interface `NameRecognizer`
      Parameters:
        `sentences` - The collection of sentences.
      Returns:
        Array of Set of names and places. [0] = Set of proper names. [1] = Set of places.

    - #### findNamePositions

          public abstract <T extends AdornedWord> java.util.List<NamePosition>[] findNamePositions(java.util.List<java.util.List<T>> sentences)

      Returns name positions in list of adorned word sentences.
      Specified by:
        `findNamePositions` in interface `NameRecognizer`
      Parameters:
        `sentences` - The collection of sentences.
      Returns:
        Array of Set of names and places. [0] = Set of proper names. [1] = Set of places.

    - #### close

          public void close()

      Close the name recognizer.
      Overrides:
        `close` in class `IsCloseableObject`