edu.northwestern.at.morphadorner.corpuslinguistics.namerecognizer

## Class DefaultNameRecognizer

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

- All Implemented Interfaces:
    UsesLexicon, NameRecognizer, UsesLogger

      public class DefaultNameRecognizer
      extends AbstractNameRecognizer
      implements NameRecognizer, UsesLogger

  DefaultNameRecognizer extracts proper names from text.

- - ### Field Summary

    - ### Fields inherited from class edu.northwestern.at.morphadorner.corpuslinguistics.namerecognizer.AbstractNameRecognizer

      `lexicon, logger, names, partOfSpeechTagger, partOfSpeechTags, sentenceSplitter, wordTokenizer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultNameRecognizer()` Create default name recognizer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<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.
    `<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.
    `java.util.Set<java.lang.String>[]` | `findNames(java.lang.String text)` Returns names from text.
    `<T extends AdornedWord> boolean` | `validateNamePosition(java.util.List<java.util.List<T>> sentences, NamePosition namePosition)` Check name for validity.

    - ### Methods inherited from class edu.northwestern.at.morphadorner.corpuslinguistics.namerecognizer.AbstractNameRecognizer

      `close, getLexicon, getLogger, getPartOfSpeechTagger, namePositionToName, setLexicon, setLogger, setPartOfSpeechTagger`

    - ### 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.morphadorner.corpuslinguistics.namerecognizer.NameRecognizer

      `getLexicon, getPartOfSpeechTagger, setLexicon, setPartOfSpeechTagger`

    - ### Methods inherited from interface edu.northwestern.at.utils.logger.UsesLogger

      `getLogger, setLogger`

- - ### Constructor Detail

    - #### DefaultNameRecognizer

          public DefaultNameRecognizer()

      Create default name recognizer.

  - ### Method Detail

    - #### findNames

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

      Returns names from text.
      Specified by:
        `findNames` in interface `NameRecognizer`
      Specified by:
        `findNames` in class `AbstractNameRecognizer`
      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 <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`
      Specified by:
        `findNames` in class `AbstractNameRecognizer`
      Parameters:
        `sentences` - The list of sentences of adorned words from which to extract names.
      Returns:
        Array of Set of names and places. [0] = Set of proper names. [1] = Set of places.

    - #### findNamePositions

          public <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`
      Specified by:
        `findNamePositions` in class `AbstractNameRecognizer`
      Parameters:
        `sentences` - The list of sentences of adorned words from which to extract names.
      Returns:
        List of name positions of names and places. [0] = Positions of proper names. [1] = Position of places.

    - #### validateNamePosition

          public <T extends AdornedWord> boolean validateNamePosition(java.util.List<java.util.List<T>> sentences,
                                                             NamePosition namePosition)

      Check name for validity.
      Parameters:
        `sentences` - The collection of sentences.
        `namePosition` - The possibly updated name position.
      Returns:
        true if name is valid.