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.- Author:
- Marcin MiĆkowski
-
-
Constructor Summary
Constructors Constructor Description BitextRule()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description List<StringPair>
getCorrectBitextExamples()
Get example sentences that are correct and thus will not match this rule.List<IncorrectBitextExample>
getIncorrectBitextExamples()
Get example sentences that are incorrect and thus will match this rule.abstract String
getMessage()
static List<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(List<StringPair> correctExamples)
Set the examples that are correct and thus do not trigger the rule.void
setIncorrectBitextExamples(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
-
-
-
-
Method Detail
-
getRelevantRules
public static List<Class<? extends BitextRule>> getRelevantRules()
-
getMessage
public abstract String getMessage()
-
match
public abstract RuleMatch[] match(AnalyzedSentence sourceText, AnalyzedSentence targetText) throws IOException
- Throws:
IOException
-
match
@Nullable public @Nullable RuleMatch[] match(AnalyzedSentence sentence) throws IOException
This method makes no sense for bitext, thus it always returnsnull
.- Specified by:
match
in classRule
- Parameters:
sentence
- a pre-analyzed sentence- Returns:
- an array of
RuleMatch
objects - Throws:
IOException
-
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(List<StringPair> correctExamples)
Set the examples that are correct and thus do not trigger the rule.
-
getCorrectBitextExamples
public final List<StringPair> getCorrectBitextExamples()
Get example sentences that are correct and thus will not match this rule.
-
setIncorrectBitextExamples
public final void setIncorrectBitextExamples(List<IncorrectBitextExample> incorrectExamples)
Set the examples that are incorrect and thus do trigger the rule.
-
getIncorrectBitextExamples
public final List<IncorrectBitextExample> getIncorrectBitextExamples()
Get example sentences that are incorrect and thus will match this rule.
-
-