Class DisambiguationPatternRule


  • public class DisambiguationPatternRule
    extends AbstractPatternRule
    A Rule that describes a pattern of words or part-of-speech tags used for disambiguation.
    • Constructor Detail

      • DisambiguationPatternRule

        public DisambiguationPatternRule​(java.lang.String id,
                                         java.lang.String description,
                                         Language language,
                                         java.util.List<PatternToken> patternTokens,
                                         java.lang.String disambiguatedPOS,
                                         Match posSelect,
                                         DisambiguationPatternRule.DisambiguatorAction disambAction)
        Parameters:
        id - Id of the Rule
        language - Language of the Rule
        description - Description to be shown (name)
        disambAction - the action to be executed on found token(s)
        Since:
        public since 2.5
    • Method Detail

      • 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 java.io.IOException
        Performs disambiguation on the source sentence.
        Parameters:
        sentence - AnalyzedSentence Sentence to be disambiguated.
        Returns:
        AnalyzedSentence Disambiguated sentence (might be unchanged).
        Throws:
        java.io.IOException
      • setUntouchedExamples

        public void setUntouchedExamples​(java.util.List<java.lang.String> untouchedExamples)
      • getUntouchedExamples

        public java.util.List<java.lang.String> getUntouchedExamples()
      • getNewTokenReadings

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

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

        @Nullable
        public @Nullable java.lang.String getDisambiguatedPOS()
        Since:
        2.3