Hi,

GenericUnpairedBracketsRule detects quotes that do not get closed etc. 
So what it does isn't overly complicated, but its implementation is a 
bit convoluted. I think that's mostly because a quote can be opened in 
one sentence and closed in another one and that's not an error. But our 
rules only get single sentences.

GenericUnpairedBracketsRule calls Rule.setAsDeleted(), a method that is 
only used from GenericUnpairedBracketsRule. Rule again has a field 
"List<RuleMatch> removedMatches", which adds state to the Rule object, 
which should just be a static rule that doesn't change once created. 
There are more methods like Rule.isInRemoved() which only seem to be 
used for GenericUnpairedBracketsRule.

What about adding a new type of rule that doesn't get a single sentence, 
but the complete text (as a List of AnalyzedSentence objects)? This way 
the rule can iterate over the complete text and doesn't need to keep its 
state between sentences. It won't need to implement reset() either.

I haven't tried yet whether this works as expected, I wanted to ask for 
your opinion first.

Regards
  Daniel


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to