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
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 the
Rule.match(org.languagetool.AnalyzedSentence) method.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<StringPair> private List<IncorrectBitextExample> private Language -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal List<StringPair> Get example sentences that are correct and thus will not match this rule.final List<IncorrectBitextExample> Get example sentences that are incorrect and thus will match this rule.abstract Stringstatic List<Class<? extends BitextRule>> final Language@Nullable RuleMatch[]match(AnalyzedSentence sentence) This method makes no sense for bitext, thus it always returnsnull.abstract RuleMatch[]match(AnalyzedSentence sourceText, AnalyzedSentence targetText) final voidsetCorrectBitextExamples(List<StringPair> correctExamples) Set the examples that are correct and thus do not trigger the rule.final voidsetIncorrectBitextExamples(List<IncorrectBitextExample> incorrectExamples) Set the examples that are incorrect and thus do trigger the rule.final voidsetSourceLanguage(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 Details
-
correctExamples
-
incorrectExamples
-
sourceLanguage
-
-
Constructor Details
-
BitextRule
public BitextRule()
-
-
Method Details
-
getRelevantRules
-
getMessage
-
match
public abstract RuleMatch[] match(AnalyzedSentence sourceText, AnalyzedSentence targetText) throws IOException - Throws:
IOException
-
match
This method makes no sense for bitext, thus it always returnsnull.- Specified by:
matchin classRule- Parameters:
sentence- a pre-analyzed sentence- Returns:
- an array of
RuleMatchobjects - Throws:
IOException
-
setSourceLanguage
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
-
setCorrectBitextExamples
Set the examples that are correct and thus do not trigger the rule. -
getCorrectBitextExamples
Get example sentences that are correct and thus will not match this rule. -
setIncorrectBitextExamples
Set the examples that are incorrect and thus do trigger the rule. -
getIncorrectBitextExamples
Get example sentences that are incorrect and thus will match this rule.
-