cfinke / Typo.js

A client-side JavaScript spellchecker that uses Hunspell-style dictionaries.
Other
501 stars 110 forks source link

en_GB dictionaries not working #55

Closed tyrex1975 closed 7 years ago

tyrex1975 commented 7 years ago

I'm having problems with typo.js when using the en_GB dictionaries downloaded from here: https://cgit.freedesktop.org/libreoffice/dictionaries/tree/en

It would seem that check() is returning TRUE for every word I pass, even random characters like 'wefwef'.

Looking at the code it would appear that the compound rule check (lines 675-684 in typo.js) passes due to two blank compoundRules existing after the en_GB definition files have been parsed.

if (typeof ruleCodes === 'undefined') {
    // Check if this might be a compound word.
    if ("COMPOUNDMIN" in this.flags && word.length >= this.flags.COMPOUNDMIN) {
        for (i = 0, _len = this.compoundRules.length; i < _len; i++) {
            if (word.match(this.compoundRules[i])) {
                return true;
            }
        }
    }
}

Is this an easy fix?

Thank you for a great product by the way!

tyrex1975 commented 7 years ago

Thank you very much 👍