edu.northwestern.at.morphadorner.corpuslinguistics.postagger.smoothing.contextual

## Class DeletedInterpolationContextualSmoother

- java.lang.Object
- - edu.northwestern.at.utils.IsCloseableObject
  - - edu.northwestern.at.morphadorner.corpuslinguistics.postagger.smoothing.contextual.AbstractContextualSmoother
    - - edu.northwestern.at.morphadorner.corpuslinguistics.postagger.smoothing.contextual.DeletedInterpolationContextualSmoother

- All Implemented Interfaces:
    ContextualSmoother, UsesLogger

      public class DeletedInterpolationContextualSmoother
      extends AbstractContextualSmoother
      implements ContextualSmoother

  DeletedInterpolation contextual smoother.

  A contextual smoother which a weighted combination of unigram and bigram probabilities (for a bigram tagger) or unigram bigram, and trigram probabilities (for a trigram tagger).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected double[]` | `bigramWeights` Bigram weights for lexical smoothing.
    `protected double[]` | `trigramWeights` Trigram weights for lexical smoothing.

    - ### Fields inherited from class edu.northwestern.at.morphadorner.corpuslinguistics.postagger.smoothing.contextual.AbstractContextualSmoother

      `cachedContextualProbabilities, logger, partOfSpeechTagger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeletedInterpolationContextualSmoother()` Create a deleted interpolation contextual smoother.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Probability` | `contextualProbability(java.lang.String tag, java.lang.String previousTag)` Compute contextual probability of a tag given the previous tag.
    `Probability` | `contextualProbability(java.lang.String tag, java.lang.String previousTag, java.lang.String previousPreviousTag)` Compute contextual probability of a tag given the previous tags.
    `java.lang.String` | `toString()` Description of this smoother for display.

    - ### Methods inherited from class edu.northwestern.at.morphadorner.corpuslinguistics.postagger.smoothing.contextual.AbstractContextualSmoother

      `cachedProbabilitiesCount, clearCachedProbabilities, getLogger, setLogger, setPartOfSpeechTagger`

    - ### Methods inherited from class edu.northwestern.at.utils.IsCloseableObject

      `close`

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

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

    - ### Methods inherited from interface edu.northwestern.at.morphadorner.corpuslinguistics.postagger.smoothing.contextual.ContextualSmoother

      `cachedProbabilitiesCount, clearCachedProbabilities, setPartOfSpeechTagger`

- - ### Field Detail

    - #### bigramWeights

          protected double[] bigramWeights

      Bigram weights for lexical smoothing.

    - #### trigramWeights

          protected double[] trigramWeights

      Trigram weights for lexical smoothing.

  - ### Constructor Detail

    - #### DeletedInterpolationContextualSmoother

          public DeletedInterpolationContextualSmoother()

      Create a deleted interpolation contextual smoother.

  - ### Method Detail

    - #### contextualProbability

          public Probability contextualProbability(java.lang.String tag,
                                          java.lang.String previousTag)

      Compute contextual probability of a tag given the previous tag.
      Specified by:
        `contextualProbability` in interface `ContextualSmoother`
      Specified by:
        `contextualProbability` in class `AbstractContextualSmoother`
      Parameters:
        `tag` - The current tag.
        `previousTag` - The previous tag.
      Returns:
        The probability of the current tag given the previous tag, e.g, p( tag | previousTag ).

        We compute the contextual probability p( tag | previousTag ) using weights determined by deleted interpolation. The smoothed contextual probability is given by:

        > p*( tag | previousTag ) = l1 * p( tag ) + l2 * p( previousTag , tag )

        where l1 and l2 are the unigram and bigram weights respectively.

    - #### contextualProbability

          public Probability contextualProbability(java.lang.String tag,
                                          java.lang.String previousTag,
                                          java.lang.String previousPreviousTag)

      Compute contextual probability of a tag given the previous tags.
      Specified by:
        `contextualProbability` in interface `ContextualSmoother`
      Parameters:
        `tag` - The current tag.
        `previousTag` - The previous tag.
        `previousPreviousTag` - The previous tag of the previous tag.
      Returns:
        The probability of the current tag given the previous two tags, e.g, p( tag | prevTag , prevPrevTag ).

        We compute the contextual probability p( tag | previousPreviousTag , previousTag ) using weights determined by deleted interpolation. The smoothed contextual probability is given by:

        > p*( tag | previousPreviousTag , previousTag ) = l1 * p( tag ) + l2 * p( previousTag , tag ) + l3 * o( previousPreviousTag , previousTag , tag )

        where l1, l2, and l3 are the unigram, bigram, and trigram weights respectively.

    - #### toString

          public java.lang.String toString()

      Description of this smoother for display.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        Description of this smoother.