Class SimilarNameRule


  • public class SimilarNameRule
    extends org.languagetool.rules.TextLevelRule
    Search for names similar to ones used before in the same text, as these might be typos. Note: this rule if off by default, as it only works on known names and the internal dictionary doesn't know that many names.
    Since:
    3.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int MAX_DIFF  
      private static int MIN_LENGTH  
      • Fields inherited from class org.languagetool.rules.Rule

        messages
    • Constructor Summary

      Constructors 
      Constructor Description
      SimilarNameRule​(java.util.ResourceBundle messages)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDescription()  
      java.lang.String getId()  
      org.languagetool.rules.RuleMatch[] match​(java.util.List<org.languagetool.AnalyzedSentence> sentences)  
      int minToCheckParagraph()  
      private @Nullable java.lang.String similarName​(java.lang.String nameHere, java.util.Set<java.lang.String> namesSoFar)  
      • Methods inherited from class org.languagetool.rules.TextLevelRule

        estimateContextForSureMatch, match, match
      • Methods inherited from class org.languagetool.rules.Rule

        addExamplePair, getAntiPatterns, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getErrorTriggeringExamples, getIncorrectExamples, getLocQualityIssueType, getMaxConfigurableValue, getMinConfigurableValue, getSentenceWithImmunization, getUrl, hasConfigurableValue, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isOfficeDefaultOff, isOfficeDefaultOn, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setErrorTriggeringExamples, setIncorrectExamples, setLocQualityIssueType, setOfficeDefaultOff, setOfficeDefaultOn, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimilarNameRule

        public SimilarNameRule​(java.util.ResourceBundle messages)
    • Method Detail

      • getId

        public java.lang.String getId()
        Specified by:
        getId in class org.languagetool.rules.Rule
      • getDescription

        public java.lang.String getDescription()
        Specified by:
        getDescription in class org.languagetool.rules.Rule
      • match

        public org.languagetool.rules.RuleMatch[] match​(java.util.List<org.languagetool.AnalyzedSentence> sentences)
                                                 throws java.io.IOException
        Specified by:
        match in class org.languagetool.rules.TextLevelRule
        Throws:
        java.io.IOException
      • similarName

        @Nullable
        private @Nullable java.lang.String similarName​(java.lang.String nameHere,
                                                       java.util.Set<java.lang.String> namesSoFar)
      • minToCheckParagraph

        public int minToCheckParagraph()
        Specified by:
        minToCheckParagraph in class org.languagetool.rules.TextLevelRule