edu.northwestern.at.morphadorner.tools.punktabbreviationdetector

## Class PunktTokenCounter

- java.lang.Object
- - edu.northwestern.at.morphadorner.tools.punktabbreviationdetector.PunktTokenCounter

-     public class PunktTokenCounter
      extends java.lang.Object

  Punkt token counter.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected double` | `abbreviationThreshold` Threshold for considering a token to be an abbreviation.
    `protected java.lang.StringBuilder` | `b`
    `protected java.util.Map<java.lang.String,java.lang.Integer>` | `c`
    `protected static int` | `CANDIDATE_1`
    `protected static int` | `CANDIDATE_2`
    `protected java.util.Set<java.lang.String>` | `candidates`
    `protected boolean` | `ignoreAbbreviationPenalty` Allow disabling the abbreviation penalty heuristic, which exponentially disadvantages words that are sometimes found without a final period.
    `protected int` | `n`
    `protected static int` | `START`
    `protected int` | `state`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PunktTokenCounter()` Create Punkt token count with default settings.
    `PunktTokenCounter(double abbreviationThreshhold, boolean ignoreAbbreviationPenalty)` Create Punkt token counter.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `count(PunktToken t)`
    `protected void` | `finish()`
    `java.util.Set<java.lang.String>` | `getAbbreviations()` Get set of detected abbreviations.
    `java.util.Set<java.lang.String>` | `getCandidates()` Return set of abbreviation candidates.
    `int` | `getCount(java.lang.String tokenString)` Get count for a token string.
    `int` | `getN()` Return total number of stored tokens.
    `protected void` | `inc(java.lang.String s)`
    `protected boolean` | `isAnAbbreviation(java.lang.String candidate)` Determine if abbreviation candidate is actually an abbreviation.
    `protected boolean` | `isPeriod(PunktToken token)` Check if token is a period.

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

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

- - ### Field Detail

    - #### START

          protected static final int START

      See Also:
        Constant Field Values

    - #### CANDIDATE_1

          protected static final int CANDIDATE_1

      See Also:
        Constant Field Values

    - #### CANDIDATE_2

          protected static final int CANDIDATE_2

      See Also:
        Constant Field Values

    - #### state

          protected int state

    - #### b

          protected java.lang.StringBuilder b

    - #### c

          protected java.util.Map<java.lang.String,java.lang.Integer> c

    - #### candidates

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

    - #### n

          protected int n

    - #### abbreviationThreshold

          protected double abbreviationThreshold

      Threshold for considering a token to be an abbreviation.

    - #### ignoreAbbreviationPenalty

          protected boolean ignoreAbbreviationPenalty

      Allow disabling the abbreviation penalty heuristic, which exponentially disadvantages words that are sometimes found without a final period.

  - ### Constructor Detail

    - #### PunktTokenCounter

          PunktTokenCounter(double abbreviationThreshhold,
                           boolean ignoreAbbreviationPenalty)

      Create Punkt token counter.
      Parameters:
        `abbreviationThreshhold` - Threshold for considering a token to be an abbreviation. 0.3D is the usual value.
        `ignoreAbbreviationPenalty` - True to allow disabling the abbreviation penalty heuristic. Usually false.

    - #### PunktTokenCounter

          PunktTokenCounter()

      Create Punkt token count with default settings.

  - ### Method Detail

    - #### count

          protected void count(PunktToken t)

    - #### finish

          protected void finish()

    - #### isPeriod

          protected boolean isPeriod(PunktToken token)

      Check if token is a period.
      Parameters:
        `token` - The token to check.
      Returns:
        True if token is a period.

    - #### inc

          protected void inc(java.lang.String s)

    - #### getCount

          public int getCount(java.lang.String tokenString)

      Get count for a token string.
      Parameters:
        `tokenString` - Token string for which to get the count.
      Returns:
        The token count.

    - #### getN

          public int getN()

      Return total number of stored tokens.
      Returns:
        Total number of stored tokens.

    - #### getCandidates

          public java.util.Set<java.lang.String> getCandidates()

      Return set of abbreviation candidates.
      Returns:
        String set of abbreviation candidates.

    - #### getAbbreviations

          public java.util.Set<java.lang.String> getAbbreviations()

      Get set of detected abbreviations.
      Returns:
        String set of detected abbreviations.

    - #### isAnAbbreviation

          protected boolean isAnAbbreviation(java.lang.String candidate)

      Determine if abbreviation candidate is actually an abbreviation.
      Parameters:
        `candidate` - Candidate abbreviation token.
      Returns:
        true if candidate is an abbreviation, false otherwise.