Class TopoReplaceRule


  • public class TopoReplaceRule
    extends org.languagetool.rules.Rule
    A rule that matches place names in French which should be translated in Breton. Loads the list of words from rules/br/topo.txt. This class is mostly copied from ro/SimpleReplaceRules.java.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Locale BR_LOCALE  
      static java.lang.String BRETON_TOPO  
      private static java.lang.String FILE_ENCODING  
      private static java.lang.String FILE_NAME  
      private static java.util.List<java.util.Map<java.lang.String,​java.lang.String>> wrongWords  
      • Fields inherited from class org.languagetool.rules.Rule

        messages
    • Constructor Summary

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void addToQueue​(org.languagetool.AnalyzedTokenReadings token, java.util.Queue<org.languagetool.AnalyzedTokenReadings> prevTokens)  
      java.lang.String getDescription()  
      java.lang.String getId()  
      java.util.Locale getLocale()
      locale used on case-conversion
      java.lang.String getShort()  
      java.lang.String getSuggestion()  
      java.lang.String getSuggestionsSeparator()  
      java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getWrongWords()  
      boolean isCaseSensitive()  
      private static java.util.List<java.util.Map<java.lang.String,​java.lang.String>> loadWords​(java.io.InputStream stream)
      Load the list of words.
      org.languagetool.rules.RuleMatch[] match​(org.languagetool.AnalyzedSentence sentence)  
      • Methods inherited from class org.languagetool.rules.Rule

        addExamplePair, estimateContextForSureMatch, 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
    • Field Detail

      • BR_LOCALE

        private static final java.util.Locale BR_LOCALE
      • wrongWords

        private static final java.util.List<java.util.Map<java.lang.String,​java.lang.String>> wrongWords
    • Constructor Detail

      • TopoReplaceRule

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

      • getId

        public final 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
      • getShort

        public java.lang.String getShort()
      • getSuggestion

        public java.lang.String getSuggestion()
      • getSuggestionsSeparator

        public java.lang.String getSuggestionsSeparator()
        Returns:
        the word used to separate multiple suggestions; used only before last suggestion, the rest are comma-separated.
      • isCaseSensitive

        public boolean isCaseSensitive()
      • getLocale

        public java.util.Locale getLocale()
        locale used on case-conversion
      • getWrongWords

        public java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getWrongWords()
        Returns:
        the list of wrong words for which this rule can suggest correction. The list cannot be modified.
      • loadWords

        private static java.util.List<java.util.Map<java.lang.String,​java.lang.String>> loadWords​(java.io.InputStream stream)
        Load the list of words. Same as AbstractSimpleReplaceRule.loadFromPath(java.lang.String) but allows multiple words.
        Parameters:
        stream - the stream to load.
        Returns:
        the list of maps containing the error-corrections pairs. The n-th map contains key strings of (n+1) words.
      • addToQueue

        private void addToQueue​(org.languagetool.AnalyzedTokenReadings token,
                                java.util.Queue<org.languagetool.AnalyzedTokenReadings> prevTokens)
      • match

        public org.languagetool.rules.RuleMatch[] match​(org.languagetool.AnalyzedSentence sentence)
        Specified by:
        match in class org.languagetool.rules.Rule