org.cogroo.tools.checker.rules.applier
Class RulesApplier

java.lang.Object
  extended by org.cogroo.tools.checker.rules.applier.RulesApplier
All Implemented Interfaces:
GenericChecker<Sentence>, TypedChecker

public final class RulesApplier
extends Object
implements TypedChecker

Applies error rules to a Sentence object.

Author:
Marcelo Suzumura (base version and appliers), Fábio Wang Gusukuma (phrase local and subject-verb appliers), William Colen

Constructor Summary
RulesApplier(RulesTreesProvider rulesTreesProvider, CogrooTagDictionary dictionary)
           
 
Method Summary
 List<Mistake> check(Sentence sentence)
          Applies all active rules described in Rules.xml given a sentence properly tokenized, tagged, chunked and shallow parsed.
 void filterIgnoredRules(List<Mistake> rules)
           
 List<String> getCategories()
           
 String getIdPrefix()
          Each checker should have IDs with a fixed prefix so CheckerComposite can route the ignore message to the correct checker.
 int getPriority()
          Priority of this checker.
 Collection<RuleDefinition> getRulesDefinition()
          Returns the descriptions of the rules implemented by this checker.
 void ignore(String ruleID)
          The checker should ignore the rule with the given id.
 void resetIgnored()
          Reset all ignored rules
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RulesApplier

public RulesApplier(RulesTreesProvider rulesTreesProvider,
                    CogrooTagDictionary dictionary)
Method Detail

check

public List<Mistake> check(Sentence sentence)
Applies all active rules described in Rules.xml given a sentence properly tokenized, tagged, chunked and shallow parsed.

Specified by:
check in interface GenericChecker<Sentence>
Parameters:
sentence - a tokenized, tagged, chunked and shallow parsed sentence.
dictionary - a word and tag dictionary
Returns:
a list containing all the mistakes found in the sentence. Each mistake can be localized between the character indexes given in the span field of the mistake.

ignore

public void ignore(String ruleID)
Description copied from interface: GenericChecker
The checker should ignore the rule with the given id. IDs of a checker have a fixed prefix.

Specified by:
ignore in interface GenericChecker<Sentence>
Parameters:
ruleID - the rule id to be ignored

resetIgnored

public void resetIgnored()
Description copied from interface: GenericChecker
Reset all ignored rules

Specified by:
resetIgnored in interface GenericChecker<Sentence>

filterIgnoredRules

public void filterIgnoredRules(List<Mistake> rules)

getCategories

public List<String> getCategories()

getIdPrefix

public String getIdPrefix()
Description copied from interface: GenericChecker
Each checker should have IDs with a fixed prefix so CheckerComposite can route the ignore message to the correct checker.

Specified by:
getIdPrefix in interface GenericChecker<Sentence>
Returns:
the id prefix

getPriority

public int getPriority()
Description copied from interface: GenericChecker
Priority of this checker. The higher is the number the higher is its priority

Specified by:
getPriority in interface GenericChecker<Sentence>
Returns:
the priority of this checker

getRulesDefinition

public Collection<RuleDefinition> getRulesDefinition()
Description copied from interface: GenericChecker
Returns the descriptions of the rules implemented by this checker.

Specified by:
getRulesDefinition in interface GenericChecker<Sentence>
Returns:
a list of descriptions


Copyright © 2012-2013 CoGrOO. All Rights Reserved.