Package org.languagetool.rules.br
Class TopoReplaceRule
- java.lang.Object
-
- org.languagetool.rules.Rule
-
- org.languagetool.rules.br.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 fromrules/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
-
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-conversionjava.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
-
-
-
-
Field Detail
-
BRETON_TOPO
public static final java.lang.String BRETON_TOPO
- See Also:
- Constant Field Values
-
FILE_NAME
private static final java.lang.String FILE_NAME
- See Also:
- Constant Field Values
-
FILE_ENCODING
private static final java.lang.String FILE_ENCODING
- See Also:
- Constant Field Values
-
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
-
-
Method Detail
-
getId
public final java.lang.String getId()
- Specified by:
getId
in classorg.languagetool.rules.Rule
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in classorg.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 asAbstractSimpleReplaceRule.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 classorg.languagetool.rules.Rule
-
-