Package org.languagetool.rules.bitext
Class BitextRule
- java.lang.Object
-
- org.languagetool.rules.Rule
-
- org.languagetool.rules.bitext.BitextRule
-
- Direct Known Subclasses:
BitextPatternRule
,DifferentLengthRule
,DifferentPunctuationRule
,SameTranslationRule
public abstract class BitextRule extends Rule
Abstract bitext rule class. A BitextRule describes a language error and can test whether a given pre-analyzed pair of source and target text contains that error using theRule.match(org.languagetool.AnalyzedSentence)
method.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<StringPair>
correctExamples
private java.util.List<IncorrectBitextExample>
incorrectExamples
private Language
sourceLanguage
-
Constructor Summary
Constructors Constructor Description BitextRule()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.List<StringPair>
getCorrectBitextExamples()
Get example sentences that are correct and thus will not match this rule.java.util.List<IncorrectBitextExample>
getIncorrectBitextExamples()
Get example sentences that are incorrect and thus will match this rule.abstract java.lang.String
getMessage()
static java.util.List<java.lang.Class<? extends BitextRule>>
getRelevantRules()
Language
getSourceLanguage()
@Nullable RuleMatch[]
match(AnalyzedSentence sentence)
This method makes no sense for bitext, thus it always returnsnull
.abstract RuleMatch[]
match(AnalyzedSentence sourceText, AnalyzedSentence targetText)
void
setCorrectBitextExamples(java.util.List<StringPair> correctExamples)
Set the examples that are correct and thus do not trigger the rule.void
setIncorrectBitextExamples(java.util.List<IncorrectBitextExample> incorrectExamples)
Set the examples that are incorrect and thus do trigger the rule.void
setSourceLanguage(Language lang)
Set the source language.-
Methods inherited from class org.languagetool.rules.Rule
addExamplePair, estimateContextForSureMatch, getAntiPatterns, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getDescription, getErrorTriggeringExamples, getId, 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
-
correctExamples
private java.util.List<StringPair> correctExamples
-
incorrectExamples
private java.util.List<IncorrectBitextExample> incorrectExamples
-
sourceLanguage
private Language sourceLanguage
-
-
Method Detail
-
getRelevantRules
public static java.util.List<java.lang.Class<? extends BitextRule>> getRelevantRules()
-
getMessage
public abstract java.lang.String getMessage()
-
match
public abstract RuleMatch[] match(AnalyzedSentence sourceText, AnalyzedSentence targetText) throws java.io.IOException
- Throws:
java.io.IOException
-
match
@Nullable public @Nullable RuleMatch[] match(AnalyzedSentence sentence) throws java.io.IOException
This method makes no sense for bitext, thus it always returnsnull
.
-
setSourceLanguage
public final void setSourceLanguage(Language lang)
Set the source language. If the language is not supported by LT, you need to use the default tokenizers etc.- Parameters:
lang
- Source Language
-
getSourceLanguage
public final Language getSourceLanguage()
-
setCorrectBitextExamples
public final void setCorrectBitextExamples(java.util.List<StringPair> correctExamples)
Set the examples that are correct and thus do not trigger the rule.
-
getCorrectBitextExamples
public final java.util.List<StringPair> getCorrectBitextExamples()
Get example sentences that are correct and thus will not match this rule.
-
setIncorrectBitextExamples
public final void setIncorrectBitextExamples(java.util.List<IncorrectBitextExample> incorrectExamples)
Set the examples that are incorrect and thus do trigger the rule.
-
getIncorrectBitextExamples
public final java.util.List<IncorrectBitextExample> getIncorrectBitextExamples()
Get example sentences that are incorrect and thus will match this rule.
-
-