de.danielnaber.languagetool.rules
Class AbstractSimpleReplaceRule

Object
  extended by Rule
      extended by AbstractSimpleReplaceRule
Direct Known Subclasses:
RuSimpleReplaceRule, SimpleReplaceRule, SimpleReplaceRule, SimpleReplaceRule

public abstract class AbstractSimpleReplaceRule
extends Rule

A rule that matches words or phrases which should not be used and suggests correct ones instead. Loads the relevant words from rules//replace.txt, where is a code of the language.

Author:
Andriy Rysin

Constructor Summary
AbstractSimpleReplaceRule(ResourceBundle messages)
           
 
Method Summary
 String getDescription()
           
 String getEncoding()
           
abstract  String getFileName()
           
 String getId()
           
 Locale getLocale()
           
 String getShort()
           
 String getSuggestion()
           
 boolean isCaseSensitive()
          Indicates if the rule is case-sensitive.
 RuleMatch[] match(AnalyzedSentence text)
          Check whether the given text matches this error rule, i.e. whether the text contains this error.
 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.
 
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

AbstractSimpleReplaceRule

public AbstractSimpleReplaceRule(ResourceBundle messages)
                          throws IOException
Throws:
IOException
Method Detail

getFileName

public abstract String getFileName()

getEncoding

public String getEncoding()

isCaseSensitive

public boolean isCaseSensitive()
Indicates if the rule is case-sensitive. Default value is true.

Returns:
true if the rule is case-sensitive, false otherwise.

getLocale

public Locale getLocale()
Returns:
the locale used for case conversion when isCaseSensitive() is set to false.

getId

public String getId()
Specified by:
getId in class Rule

getDescription

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

getSuggestion

public String getSuggestion()

getShort

public String getShort()

match

public final RuleMatch[] match(AnalyzedSentence text)
Description copied from class: Rule
Check whether the given text matches this error rule, i.e. whether the text contains this error.

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

reset

public 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


Copyright © 2005-2009 Daniel Naber