edu.northwestern.at.morphadorner.corpuslinguistics.namestandardizer

## Class AbstractNameStandardizer

- java.lang.Object
- - edu.northwestern.at.utils.IsCloseableObject
  - - edu.northwestern.at.morphadorner.corpuslinguistics.namestandardizer.AbstractNameStandardizer

- All Implemented Interfaces:
    NameStandardizer, UsesLogger
  Direct Known Subclasses:
    DefaultNameStandardizer

      public abstract class AbstractNameStandardizer
      extends IsCloseableObject
      implements NameStandardizer, UsesLogger

  Abstract Name Standardizer.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static TernaryTrie` | `consonantTrie` Consonant trie.
    `protected Logger` | `logger` Logger used for output.
    `protected static TernaryTrie` | `nameTrie` Proper name trie.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractNameStandardizer()` Create abstract name matcher.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `dontStandardize(java.lang.String properName)` Check if we should not standardize a name.
    `Logger` | `getLogger()` Get the logger.
    `int` | `getNumberOfNames()` Return number of names.
    `void` | `loadNames(java.util.Collection<java.lang.String> properNamesCollection)` Load names from a collection of names.
    `void` | `loadNames(java.lang.String lexiconFileName)` Load name data from lexicon file.
    `void` | `loadNamesFromLexicon(Lexicon lexicon)` Load names from a lexicon.
    `java.lang.String` | `preprocessProperName(java.lang.String properName)` Preprocess proper name.
    `void` | `setLogger(Logger logger)` Set the logger.
    `java.lang.String` | `standardizeProperName(java.lang.String properName)` Returns standardized proper name given a proper name.

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

    - #### nameTrie

          protected static TernaryTrie nameTrie

      Proper name trie.

    - #### consonantTrie

          protected static TernaryTrie consonantTrie

      Consonant trie.

    - #### logger

          protected Logger logger

      Logger used for output.

  - ### Constructor Detail

    - #### AbstractNameStandardizer

          public AbstractNameStandardizer()

      Create abstract name matcher.

  - ### Method Detail

    - #### loadNames

          public void loadNames(java.lang.String lexiconFileName)
                         throws java.io.IOException

      Load name data from lexicon file.
      Specified by:
        `loadNames` in interface `NameStandardizer`
      Parameters:
        `lexiconFileName` - Lexicon containing name data.
      Throws:
        `java.io.IOException`

    - #### loadNamesFromLexicon

          public void loadNamesFromLexicon(Lexicon lexicon)
                                    throws java.io.IOException

      Load names from a lexicon.
      Specified by:
        `loadNamesFromLexicon` in interface `NameStandardizer`
      Parameters:
        `lexicon` - The lexicon from which to load names.
      Throws:
        `java.io.IOException`

    - #### loadNames

          public void loadNames(java.util.Collection<java.lang.String> properNamesCollection)

      Load names from a collection of names.
      Specified by:
        `loadNames` in interface `NameStandardizer`
      Parameters:
        `properNamesCollection` - Collection containing proper names.

    - #### getNumberOfNames

          public int getNumberOfNames()

      Return number of names.
      Specified by:
        `getNumberOfNames` in interface `NameStandardizer`
      Returns:
        Number of names in names trie.

    - #### dontStandardize

          public boolean dontStandardize(java.lang.String properName)

      Check if we should not standardize a name.
      Specified by:
        `dontStandardize` in interface `NameStandardizer`
      Parameters:
        `properName` - Name to check.
      Returns:
        True to avoid standardizing name.

        Names that contain periods are not standardized by default.

    - #### standardizeProperName

          public java.lang.String standardizeProperName(java.lang.String properName)

      Returns standardized proper name given a proper name.
      Specified by:
        `standardizeProperName` in interface `NameStandardizer`
      Parameters:
        `properName` - The proper name.
      Returns:
        The standard proper name.

    - #### preprocessProperName

          public java.lang.String preprocessProperName(java.lang.String properName)

      Preprocess proper name.
      Specified by:
        `preprocessProperName` in interface `NameStandardizer`
      Parameters:
        `properName` - Proper name to preprocess.
      Returns:
        Preprocessed proper name.

        By default, no preprocessing is applied; the original proper name is returned unchanged.

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