Back to LanguageTool Homepage - Privacy - Imprint

Why do rules look so different on my computer and on web

Hello

If you take a grammar rule like for example ‘find repeated word’, in my grammar file it looks like this (I’ve taken out the example sentences)

and\p{L}+ and\p{L}+

Then when I see the same rule on the LT site at

http://community.languagetool.org/rule/show/ENGLISH_WORD_REPEAT_RULE?lang=en

I click on ‘sourcecode’ and I get a rule which looks completely different (like a different coding language) Here is a small extract

mport org.languagetool.rules.WordRepeatRule;
26
27 /**
28 * Avoid false alarms in the word repetition rule.
29 */
30 public class EnglishWordRepeatRule extends WordRepeatRule {
31
32 public EnglishWordRepeatRule(final ResourceBundle messages, final Language language) {
33 super(messages, language);
34 }
35
36 @Override
37 public String getId() {
38 return “ENGLISH_WORD_REPEAT_RULE”;
39 }
40
41 @Override
42 public boolean ignore(AnalyzedTokenReadings[] tokens, int position) {
43 if (wordRepetitionOf(“had”, tokens, position)) {
44 return true; // “If I had had time, I would have gone to see him.”

My question is simply why the same rule looks so different. Doesn’t the site and the downloaded software use the same rules?

Thanks

That’s because these are two different rules. The first rule detects the repetition of two words (“at the at the end”), the other one detects a simple repetition (“at at the end”).

http://community.languagetool.org/rule/show/PHRASE_REPETITION?lang=en
http://community.languagetool.org/rule/show/ENGLISH_WORD_REPEAT_RULE?lang=en

On Sa 16.02.2013, 13:01:33 you wrote:

My question is simply why the same rule looks so different. Doesn’t the
site and the downloaded software use the same rules?

These are two totally different rules:

PHRASE_REPETITION - matches e.g. “at the at the”
ENGLISH_WORD_REPEAT_RULE - matches e.g. “will will”

One is implemented in Java, the other one in XML.

The web page for your XML rule is here:
http://community.languagetool.org/rule/show/PHRASE_REPETITION?lang=en&subId=1

Regards
Daniel


http://www.danielnaber.de

Thanks Daniel

I guess the rules on the computer are in XML

Hi Gulp 21

I didn’t notice that they were not encoding exactly the same rule but my question concerned more Java and XML as Daniel answered.

Thanks anyway