edu.northwestern.at.morphadorner.tools.taggertrainer

## Interface TaggerRule

- All Known Implementing Classes:
    AbstractTaggerRule

      public interface TaggerRule

  A Part of Speech Tagger rule interface.

  This defines an interface for rule-based part of speech tag replacment in a tagged corpus. Each rule locates all the words in a corpus tagged with a specific original part of speech tag and satisfying a specific condition. When the condition is satisfied, the rule replaces the original tag with a replacement tag.

  The original tag, the replacement tag, and the condition for replacement are fixed during rule instantiation. The replacement conditions may involve the spelling and/or tag of a word as well as the word's position with respect to other words and their tags in the corpus.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `applies(int site, java.util.List<TrainingWord> trainingData)` See if this rule applies to a training site.
    `int` | `apply(int[] sites, java.util.List<TrainingWord> trainingData)` Apply this rule to a a list of training sites.
    `boolean` | `apply(int site, java.util.List<TrainingWord> trainingData)` Apply this rule to a specific training site.
    `int` | `apply(java.util.List<TrainingWord> trainingData)` Apply this rule to all training data.
    `java.lang.String` | `getOriginalTag()` Return original tag.
    `java.lang.String` | `getReplacementTag()` Return replacement tag.

- - ### Method Detail

    - #### apply

          int apply(java.util.List<TrainingWord> trainingData)

      Apply this rule to all training data.
      Parameters:
        `trainingData` - Training data as a list.
      Returns:
        count of sites to which rule was successfully applied.

    - #### apply

          boolean apply(int site,
                      java.util.List<TrainingWord> trainingData)

      Apply this rule to a specific training site.
      Parameters:
        `site` - Index (0-based) of training site at which to apply rule.
        `trainingData` - Training data as a list.
      Returns:
        true if rule was successfully applied.

    - #### apply

          int apply(int[] sites,
                  java.util.List<TrainingWord> trainingData)

      Apply this rule to a a list of training sites.
      Parameters:
        `sites` - Indices (0-based) of training sites at which to apply rule.
        `trainingData` - Training data as a list.
      Returns:
        count of sites to which rule was successfully applied.

    - #### applies

          int applies(int site,
                    java.util.List<TrainingWord> trainingData)

      See if this rule applies to a training site.
      Parameters:
        `site` - Index (0-based) of training site at which to check that rule applies.
        `trainingData` - Training data.
      Returns:
        = -1: rule changes correct tag to incorrect. = 0: rule leaves correct tag alone, or rule does not apply to specified site. = 1: rule changes incorrect tag to correct.

    - #### getOriginalTag

          java.lang.String getOriginalTag()

      Return original tag.
      Returns:
        The tag which this rule may replace.

    - #### getReplacementTag

          java.lang.String getReplacementTag()

      Return replacement tag.
      Returns:
        The tag with which this rule replace the existing tag.