Class DisambiguationPatternRule

java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.patterns.AbstractPatternRule
org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule

public class DisambiguationPatternRule extends AbstractPatternRule
A Rule that describes a pattern of words or part-of-speech tags used for disambiguation.
Author:
Marcin MiƂkowski
  • Constructor Details

  • Method Details

    • setNewInterpretations

      public final void setNewInterpretations(AnalyzedToken[] newReadings)
      Used to add new interpretations.
      Parameters:
      newReadings - An array of AnalyzedTokens. The length of the array should be the same as the number of the tokens matched and selected by <marker>...</marker> elements.
    • replace

      public final AnalyzedSentence replace(AnalyzedSentence sentence) throws IOException
      Performs disambiguation on the source sentence.
      Parameters:
      sentence - AnalyzedSentence Sentence to be disambiguated.
      Returns:
      AnalyzedSentence Disambiguated sentence (might be unchanged).
      Throws:
      IOException
    • setExamples

      public void setExamples(List<DisambiguatedExample> examples)
    • getExamples

      public List<DisambiguatedExample> getExamples()
    • setUntouchedExamples

      public void setUntouchedExamples(List<String> untouchedExamples)
    • getUntouchedExamples

      public List<String> getUntouchedExamples()
    • getAction

      Since:
      2.3
    • getNewTokenReadings

      public AnalyzedToken[] getNewTokenReadings()
      Since:
      2.3
    • getMatchElement

      @Nullable public @Nullable Match getMatchElement()
      Since:
      2.3
    • getDisambiguatedPOS

      @Nullable public @Nullable String getDisambiguatedPOS()
      Since:
      2.3