edu.northwestern.at.morphadorner.corpuslinguistics.lemmatizer

## Class DefaultLemmatizerRule

- java.lang.Object
- - edu.northwestern.at.morphadorner.corpuslinguistics.lemmatizer.DefaultLemmatizerRule

- All Implemented Interfaces:
    LemmatizerRule

      public class DefaultLemmatizerRule
      extends java.lang.Object
      implements LemmatizerRule

  A Lemmatizer Rule which uses regular expressions.

  A lemmarizer rule specifies a string substitution pattern used as part of the process of reducing an elaborated morphological form to its base form (lemma).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.regex.Pattern` | `compiledSource` Compiled source pattern matcher.
    `protected int` | `direction`
    `static int` | `LEFT` Match direction (LEFT or RIGHT).
    `protected int` | `matchLength` Minimum match length.
    `protected boolean` | `mustMatchDictionaryEntry` Must match dictionary entry.
    `protected java.lang.String` | `replacement` Replacement string.
    `static int` | `RIGHT`
    `protected java.lang.String` | `ruleText` Original rule text.
    `protected java.lang.String` | `source` Source pattern string to match.
    `protected static java.util.regex.Pattern` | `VCRMatcher` Compiled VCR string matcher.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultLemmatizerRule(java.lang.String ruleText)` Create a lemmatizer rule.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `apply(java.lang.String s)` Apply a lemmatization rule to a string.
    `java.lang.String` | `apply(java.lang.String s, java.util.Set<java.lang.String> dictionary)` Apply a lemmatization rule to a string.
    `java.lang.String` | `toString()` Return string version of rule.

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

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

- - ### Field Detail

    - #### ruleText

          protected java.lang.String ruleText

      Original rule text.

    - #### source

          protected java.lang.String source

      Source pattern string to match.

    - #### compiledSource

          protected java.util.regex.Pattern compiledSource

      Compiled source pattern matcher.

    - #### replacement

          protected java.lang.String replacement

      Replacement string.

    - #### VCRMatcher

          protected static final java.util.regex.Pattern VCRMatcher

      Compiled VCR string matcher.

    - #### LEFT

          public static final int LEFT

      Match direction (LEFT or RIGHT).
      See Also:
        Constant Field Values

    - #### RIGHT

          public static final int RIGHT

      See Also:
        Constant Field Values

    - #### direction

          protected int direction

    - #### matchLength

          protected int matchLength

      Minimum match length.

    - #### mustMatchDictionaryEntry

          protected boolean mustMatchDictionaryEntry

      Must match dictionary entry.

  - ### Constructor Detail

    - #### DefaultLemmatizerRule

          public DefaultLemmatizerRule(java.lang.String ruleText)

      Create a lemmatizer rule.
      Parameters:
        `ruleText` - The rule text.

  - ### Method Detail

    - #### apply

          public java.lang.String apply(java.lang.String s,
                               java.util.Set<java.lang.String> dictionary)

      Apply a lemmatization rule to a string.
      Specified by:
        `apply` in interface `LemmatizerRule`
      Parameters:
        `s` - String to which to apply rule.
        `dictionary` - List of known words.
      Returns:
        String after rule applied.

    - #### apply

          public java.lang.String apply(java.lang.String s)

      Apply a lemmatization rule to a string.
      Specified by:
        `apply` in interface `LemmatizerRule`
      Parameters:
        `s` - String to which to apply rule.
      Returns:
        String after rule applied.

    - #### toString

          public java.lang.String toString()

      Return string version of rule.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        String version of rule. Dictionary lookup not marked.