wooorm/nspell

Call stack size exceeded

vahaknp opened this issue · 5 comments

Hi, I'm trying to create a chrome extension Armenian spellchecker using NSpell as the underlying technology and bundling it with webpack, but whenever I load in the dictionary-hyw as a string or buffer, I get:

    at String.replace (<anonymous>)
    at V (VM433 contentscript.js:23)
   ...

It seems to work just fine with dictionary-en, so I'm not sure what it is about the Armenian Western dictionary that is causing this. Any help would be greatly appreciated!

I think the trouble comes from having a very large .aff file. I tried deleting more than half of the .dic file, but it didn't help, but when I deleted most of the .aff file, it managed to load properly.

I think I tracked it down to this line, and that fact that it's recursive: https://github.com/wooorm/nspell/blob/main/lib/util/apply.js#L46

Sometimes, dictionaries do weird stuff, unfortunately.

There’s some stuff here that could be better too, but I unfortunately don’t have time in the foreseeable future to really dig in. Sorry.
FWIW, nodehun is native, so it can’t be bundled into JavaScript.

Probably fixed by #32, or it may be dictionary specific.
Feel free to open a new issue if the problem persists

That didn't seem to fix it 😞 still getting:

Uncaught RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    ...