|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectRule
public abstract class Rule
Abstract rule class. A Rule drescribes a language error and can
test whether a given pre-analyzed text contains that error using the
match(de.danielnaber.languagetool.AnalyzedSentence) method.
| Constructor Summary | |
|---|---|
Rule()
Called by language-dependant rules. |
|
Rule(ResourceBundle messages)
Called by language-independant rules. |
|
| Method Summary | |
|---|---|
void |
addRuleMatch(RuleMatch r)
Method to add matches. |
void |
clearMatches()
|
Category |
getCategory()
|
List<String> |
getCorrectExamples()
Get example sentences that are correct and thus will not match this rule. |
abstract String |
getDescription()
|
abstract String |
getId()
|
List<IncorrectExample> |
getIncorrectExamples()
Get example sentences that are incorrect and thus will match this rule. |
List<RuleMatch> |
getMatches()
|
int |
getMatchesIndex()
|
boolean |
isDefaultOff()
Checks whether the rule has been turned off by default by the rule author. |
boolean |
isInMatches(int i)
|
boolean |
isInRemoved(RuleMatch r)
|
boolean |
isParagraphBackTrack()
|
abstract RuleMatch[] |
match(AnalyzedSentence text)
Check whether the given text matche this error rule, i.e. whether the text contains this error. |
abstract void |
reset()
If a rule keeps it state over more than the check of one sentence, this must be implemented so the internal state it reset. |
void |
setAsDeleted(int i)
Deletes (or disables) previously matched rule. |
void |
setCategory(Category category)
|
void |
setCorrectExamples(List<String> correctExamples)
TODO: Return the number of false positives to be expected. |
void |
setDefaultOff()
Turns the rule by default off. |
void |
setIncorrectExamples(List<IncorrectExample> incorrectExamples)
|
void |
setParagraphBackTrack(boolean backTrack)
|
boolean |
supportsLanguage(Language language)
Whether this rule can be used for text in the given language. |
| Methods inherited from class Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Rule()
public Rule(ResourceBundle messages)
| Method Detail |
|---|
public abstract String getId()
public abstract String getDescription()
public abstract RuleMatch[] match(AnalyzedSentence text)
throws IOException
text - a pre-analyzed sentence
IOExceptionpublic abstract void reset()
public boolean supportsLanguage(Language language)
public void setCorrectExamples(List<String> correctExamples)
public List<String> getCorrectExamples()
public void setIncorrectExamples(List<IncorrectExample> incorrectExamples)
public List<IncorrectExample> getIncorrectExamples()
public Category getCategory()
public void setCategory(Category category)
public boolean isParagraphBackTrack()
public void setParagraphBackTrack(boolean backTrack)
public final void addRuleMatch(RuleMatch r)
r - RuleMatch - matched rule added by check()public final void setAsDeleted(int i)
i - Index of the rule that should be deleted.public final boolean isInRemoved(RuleMatch r)
public final boolean isInMatches(int i)
public final void clearMatches()
public final int getMatchesIndex()
public final List<RuleMatch> getMatches()
public final boolean isDefaultOff()
public final void setDefaultOff()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||