org.languagetool.rules
Class WordRepeatBeginningRule

Object
  extended by Rule
      extended by WordRepeatBeginningRule
Direct Known Subclasses:
EnglishWordRepeatBeginningRule, GermanWordRepeatBeginningRule

public class WordRepeatBeginningRule
extends Rule

Check if three successive sentences begin with the same word, e.g. "I am Max. I am living in Germany. I like ice cream.", and if two successive sentences begin with the same adverb, e.g. "Furthermore, he is ill. Furthermore, he likes her."

Author:
Markus Brenneis

Constructor Summary
WordRepeatBeginningRule(ResourceBundle messages, Language language)
           
 
Method Summary
 String getDescription()
           
 String getId()
          An ASCII-only string used to identify the rule in e.g. configuration files.
 boolean isAdverb(String token)
           
 boolean isException(String token)
           
 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

WordRepeatBeginningRule

public WordRepeatBeginningRule(ResourceBundle messages,
                               Language language)
Method Detail

getId

public 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

getDescription

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

isAdverb

public boolean isAdverb(String token)

isException

public boolean isException(String token)

match

public 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-2011 Daniel Naber