Class AbstractWordCoherencyRule


  • public abstract class AbstractWordCoherencyRule
    extends TextLevelRule
    A rule that matches words for which two different spellings are used throughout the document.

    Note that this should not be used for language variations like American English vs. British English or German "alte Rechtschreibung" vs. "neue Rechtschreibung" -- that's the task of a spell checker.

    Since:
    2.7
    Author:
    Daniel Naber
    • Method Detail

      • getWordMap

        protected abstract Map<String,​Set<String>> getWordMap()
        Maps words in both directions, e.g. "aufwendig -> aufwändig" and "aufwändig -> aufwendig".
        Since:
        3.0
      • getMessage

        protected abstract String getMessage​(String word1,
                                             String word2)
        Get the message shown to the user if the rule matches.
      • minToCheckParagraph

        public int minToCheckParagraph()
        Description copied from class: TextLevelRule
        Gives back the minimum number of paragraphs to check to give back a correct result. Only used by LO office extension.
        • n == -1 --> need to check full text (use only if really needed / bad performance) examples: AbstractWordCoherencyRule, GenericUnpairedBracketsRule, ...
        • n == 0 --> need only to check the current paragraph examples: MultipleWhitespaceRule, LongParagraphRule, ...
        • n >= 1 --> need only to check n paragraphs around the current paragraph examples: ParagraphRepeatBeginningRule (n == 1), WordRepeatBeginningRule (n == 2), ...
        Specified by:
        minToCheckParagraph in class TextLevelRule