Back to LanguageTool Homepage - Privacy - Imprint

LanguageTool not detecting correctly

Hello,

I am trying to correct spellings. I have some duplicated letter words such as “cooffeeeeeee”. So I am trying to get the actual word. If I enter “cooooooooooffffeeeeee”, instead of giving me “coffee”, it gives me “come” word instead.

However, word “cofee” gives me correct word i.e “coffee”.

I am using this code:

JLanguageTool languageTool = new JLanguageTool(new BritishEnglish());
        for (Rule rule : languageTool.getAllRules()) {
            if (!rule.isDictionaryBasedSpellingRule()) {
                languageTool.disableRule(rule.getId());
            }
        }

        try {
            fWord = rec(w);
            List<RuleMatch> matches = languageTool.check(fWord);
            for (RuleMatch match : matches) {
                fWord = match.getSuggestedReplacements().get(0);
            }
        } catch (IOException x) {
        }

Getting good suggestions for cooooooooooffffeeeeee is not a use case for LanguageTool. You could try replacing repetitions before you give the word to LT.

oh yes I am doing it, I am removing repeated letters, so e.g. that word after the repeated characters are removed becomes “cofe”, but then this cofe is detected as “come” by language tool. you can try it.

UPDATE:

also the word “uperr” gives me “up err” for some reasons instead of giving me “upper”.

come is closer to cofe than to coffee, that’s how it currently works.

tip: check with both single and double letters (EG: “cot” and “coot” have clearly different pronouncements, which I believe to be part of how LT checks an unrecognized word)