edu.northwestern.at.morphadorner.corpuslinguistics.abbreviations

## Class Abbreviations

- java.lang.Object
- - edu.northwestern.at.morphadorner.corpuslinguistics.abbreviations.Abbreviations

-     public class Abbreviations
      extends java.lang.Object

  Abbreviation lists and pattern matchers.

  Holds a list of common abbreviations along with information about whether each abbreviation can normally end a sentence or not. Also provides patterns and methods for determining if a string is a possible abbreviation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.util.regex.Matcher` | `abbreviationMatcher`
    `protected static java.util.regex.Pattern` | `abbreviationPattern`
    `protected UTF8Properties` | `abbreviations`
    `static java.lang.String` | `defaultAbbreviationPattern`
    `protected static java.lang.String` | `defaultAbbreviationsFileName`
    `protected static java.util.regex.Matcher` | `initialMatcher`
    `protected static java.util.regex.Pattern` | `initialPattern`
    `protected static java.util.regex.Matcher` | `possessiveInitialMatcher`
    `protected static java.util.regex.Pattern` | `possessiveInitialPattern`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Abbreviations()` Create abbreviation detector.
    `Abbreviations(java.lang.String langCode)` Create abbreviation detector for specified ISO language code.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `createAbbreviationsPattern(UTF8Properties abbreviations)` Create abbreviations pattern from list of abbreviations.
    `UTF8Properties` | `getAbbreviations()` Return current abbreviations.
    `int` | `getAbbreviationsCount()` Get count of known abbreviations.
    `boolean` | `isAbbreviation(java.lang.String str)` Checks if string is a probable abbreviation.
    `boolean` | `isEOSAbbreviation(java.lang.String str)` Checks if string is an abbreviation on which a sentence can end.
    `static boolean` | `isInitial(java.lang.String str)` Checks if string is an initial.
    `boolean` | `isKnownAbbreviation(java.lang.String str)` Checks if string is a known abbreviation.
    `static boolean` | `isPossessiveInitial(java.lang.String str)` Checks if string is a possible possessive initial.
    `boolean` | `loadAbbreviations(java.lang.String abbreviationsURL)` Load abbreviations list from a properties file.
    `static UTF8Properties` | `loadAbbreviationsFromResource(java.lang.String langCode)` Load abbreviations list from resource properties file.

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

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

- - ### Field Detail

    - #### defaultAbbreviationPattern

          public static java.lang.String defaultAbbreviationPattern

    - #### abbreviationPattern

          protected static java.util.regex.Pattern abbreviationPattern

    - #### abbreviationMatcher

          protected static java.util.regex.Matcher abbreviationMatcher

    - #### initialPattern

          protected static java.util.regex.Pattern initialPattern

    - #### initialMatcher

          protected static java.util.regex.Matcher initialMatcher

    - #### possessiveInitialPattern

          protected static java.util.regex.Pattern possessiveInitialPattern

    - #### possessiveInitialMatcher

          protected static java.util.regex.Matcher possessiveInitialMatcher

    - #### abbreviations

          protected UTF8Properties abbreviations

    - #### defaultAbbreviationsFileName

          protected static final java.lang.String defaultAbbreviationsFileName

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Abbreviations

          public Abbreviations()

      Create abbreviation detector. Assumes English.

    - #### Abbreviations

          public Abbreviations(java.lang.String langCode)

      Create abbreviation detector for specified ISO language code.
      Parameters:
        `langCode` - ISO language code.

  - ### Method Detail

    - #### loadAbbreviationsFromResource

          public static UTF8Properties loadAbbreviationsFromResource(java.lang.String langCode)

      Load abbreviations list from resource properties file.

      Each line in the UTF8 abbreviations property file takes the form:

      `abbrev.=n`

      where a value of 1 for n indicates the abbreviation can normally end a sentence and a value of 0 for n indicates the abbreviation normally cannot end a sentence.

      if there is not a resource file for the given language code, the abbreviations list will be empty.

    - #### loadAbbreviations

          public boolean loadAbbreviations(java.lang.String abbreviationsURL)

      Load abbreviations list from a properties file.
      Parameters:
        `abbreviationsURL` - Abbreviations URL.
      Returns:
        true if abbreviations loaded OK, false if error occurred.

        Each line in the UTF8 abbreviations property file takes the form:

        `abbrev.=n`

        where a value of 1 for n indicates the abbreviation can normally end a sentence and a value of 0 for n indicates the abbreviation normally cannot end a sentence.

    - #### isKnownAbbreviation

          public boolean isKnownAbbreviation(java.lang.String str)

      Checks if string is a known abbreviation.
      Parameters:
        `str` - The string to check.
      Returns:
        true if "str" is on the known abbreviations list.

    - #### isAbbreviation

          public boolean isAbbreviation(java.lang.String str)

      Checks if string is a probable abbreviation.
      Parameters:
        `str` - The string to check.
      Returns:
        true if "str" is probably an abbreviation .

        A string is declared to be a probable abbreviation if if appears in the abbreviation list or matches the abbreviation pattern.

    - #### isEOSAbbreviation

          public boolean isEOSAbbreviation(java.lang.String str)

      Checks if string is an abbreviation on which a sentence can end.
      Parameters:
        `str` - The string to check.
      Returns:
        true if "str" is an possible sentence-ending abbreviation .

        A string is declared to be a probable sentence-ending abbreviation if it appears in the abbreviation list and it has a sentence-ending value of 1.

    - #### isInitial

          public static boolean isInitial(java.lang.String str)

      Checks if string is an initial.
      Parameters:
        `str` - The string to check.
      Returns:
        true if "str" is an abbreviation .

        A string is an initial when it takes the form "L." where L is a capital letter.

    - #### isPossessiveInitial

          public static boolean isPossessiveInitial(java.lang.String str)

      Checks if string is a possible possessive initial.
      Parameters:
        `str` - The string to check.
      Returns:
        true if "str" is a possible possessive initial .

        A string is an possible possessive initial when it takes the form "L.'s" where L is a capital letter.

    - #### getAbbreviationsCount

          public int getAbbreviationsCount()

      Get count of known abbreviations.
      Returns:
        Count of known abbreviations.

    - #### getAbbreviations

          public UTF8Properties getAbbreviations()

      Return current abbreviations.
      Returns:
        Abbreviations.

    - #### createAbbreviationsPattern

          public static java.lang.String createAbbreviationsPattern(UTF8Properties abbreviations)

      Create abbreviations pattern from list of abbreviations.
      Parameters:
        `abbreviations` - Abbreviations for which to create pattern.
      Returns:
        Pattern to match input abbreviations.