Back to LanguageTool Homepage - Privacy - Imprint

Spellchecker lookup

(Ruud Baars) #1

Is there a way to check whether a word in in the LT spellchecker dictionary? This to prevent get 2 errors on one word: one from the spellchecker, one from the rule.

(Daniel Naber) #2

The easiest way is to add the word into the text area at (although not as the first word of a sentence) - if it gets a red marker, it's a spelling error, i.e. it's not in the dictionary.

(Ruud Baars) #3

The question was not clear. I meant from within a grammar rule. I want to prevent a double issue on a word by spellchecker as well as a rule.
Something like

(Tiago F. Santos) #4

Try adding the priority settings to

  public int getPriorityForId(String id) {
switch (id) {
  case "FRAGMENT_TWO_ARTICLES":     return 50;
  case "DEGREE_MINUTES_SECONDS":    return 20;
  case "INTERJECTIONS_PUNTUATION":  return  5;
  case "UNPAIRED_BRACKETS":         return -5;
  case "HUNSPELL_RULE":             return -50;
  case "CRASE_CONFUSION":           return -55;
  case "FINAL_STOPS":               return -75;
  case "T-V_DISTINCTION":           return -100;
  case "T-V_DISTINCTION_ALL":       return -101;
  case "REPEATED_WORDS":            return -210;
  case "REPEATED_WORDS_3X":         return -211;
  case "WIKIPEDIA_COMMON_ERRORS":   return -500;
  case "TOO_LONG_SENTENCE":         return -1000;
  case "CACOPHONY":                 return -2000;
return 0;

(Ruud Baars) #5

I am sorry, but I don't understand this at all. Java programming is not my thing. I was just asking for a way to consult the spelling dictionary from the XML.
What is your answer about?

(Tiago F. Santos) #6

I believe there is no way to do it via XML coding, at the moment.

You don't have to "code". I added a priorities sample to moments ago.
Just add more lines like the one below.

case "INREKENING_A": return 11;

Consider 0 the default rule priority. The higher the number, the higher the priority. If you want to simply make spellchecking lower than all the grammar rules, change (uncomment (delete // )) this line:

// case "HUNSPELL_RULE": return -1;

for this line

case "MORFOLOGIK_RULE_NL_NL": return -1;

(Ruud Baars) #7

So this is a kind of error reporting priority? But I still don't get what it does, sorry. is there documentation on this?
For now, could you please revert the change you made, until I understand what is being done? I will not touch any Java rule myself; I am not (longer) a programmer.

(Tiago F. Santos) #8


I tried to make it easy for you but sure.

Not sure what that means, but Ok. Done.

(Ruud Baars) #9

Thanks. You just overestimated my knowledge. Programming in Java is a bit too much, and the environment too complex. I will not alter any code without being able to compile and test, so I will have to stay away from those tasks.
It is great to know these priorities exist however. Might come around to think about it. But there is a lot more to be done. Thanks for the info.

(Tiago F. Santos) #10

No problem. Always glad to help. Regards.

(Curon Davies) #11

I think what you're asking for is how to only match a rule that uses a regex if there is a word is in the dictionary? I haven't tried it, but it looks like suppress_misspelled="yes" on the suggestion element is what you're after, which is detailed here:

There are some examples in the English grammar.xml

(Ruud Baars) #12

It does look a bit like it, but it is different. Will think about this.