org.languagetool.rules.bitext
Class BitextRule

Object
  extended by Rule
      extended by BitextRule
Direct Known Subclasses:
BitextPatternRule, DifferentLengthRule, 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 the Rule.match(org.languagetool.AnalyzedSentence) method.

Author:
Marcin MiƂkowski

Constructor Summary
BitextRule()
           
 
Method Summary
 List<StringPair> getCorrectBitextExamples()
          Get example sentences that are correct and thus will not match this rule.
abstract  String getDescription()
           
abstract  String getId()
          An ASCII-only string used to identify the rule in e.g. configuration files.
 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 getSourceLang()
           
 RuleMatch[] match(AnalyzedSentence text)
          This method makes no sense for bitext, return null??
abstract  RuleMatch[] match(AnalyzedSentence sourceText, AnalyzedSentence targetText)
           
abstract  void reset()
          If a rule keeps its state over more than the check of one sentence, this must be implemented so the internal state is reset.
 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 setSourceLang(Language lang)
          Set the source language.
 
Methods inherited from class Rule
addRuleMatch, clearMatches, getCategory, getCorrectExamples, getIncorrectExamples, getMatches, getMatchesIndex, isDefaultOff, isInMatches, isInRemoved, isParagraphBackTrack, setAsDeleted, setCategory, setCorrectExamples, setDefaultOff, setIncorrectExamples, setParagraphBackTrack, supportsLanguage
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitextRule

public BitextRule()
Method Detail

getRelevantRules

public static List<Class<? extends BitextRule>> getRelevantRules()

getDescription

public abstract String getDescription()
Specified by:
getDescription in class Rule

getMessage

public abstract String getMessage()

getId

public abstract String getId()
Description copied from class: Rule
An ASCII-only string used to identify the rule in e.g. configuration files. This string is supposed to be unique and to stay the same in all upcoming versions of LanguageTool.

Specified by:
getId in class Rule

match

public abstract RuleMatch[] match(AnalyzedSentence sourceText,
                                  AnalyzedSentence targetText)
                           throws IOException
Throws:
IOException

reset

public abstract void reset()
Description copied from class: Rule
If a rule keeps its state over more than the check of one sentence, this must be implemented so the internal state is reset. It will be called before a new text is going to be checked.

Specified by:
reset in class Rule

match

public RuleMatch[] match(AnalyzedSentence text)
                  throws IOException
This method makes no sense for bitext, return null??

Specified by:
match in class Rule
Parameters:
text - a pre-analyzed sentence
Returns:
an array of RuleMatch object for each match.
Throws:
IOException

setSourceLang

public final void setSourceLang(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

getSourceLang

public final Language getSourceLang()

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.



Copyright © 2005-2011 Daniel Naber