cfinke / Typo.js

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

Zulu dictionary hangs browser #7

Closed dbolton closed 13 years ago

dbolton commented 13 years ago

var dictionary = new Typo("zu_ZA", affData, dicData); var is_spelled_correctly = dictionary.check("hamba")

browser hangs when loading the dictionary (sometimes it gives an alert asking if you want to stop the script)

I used the Zulu dictionary and affix files provided by OpenOffice.org and Mozilla https://addons.mozilla.org/thunderbird/downloads/latest/46490/addon-46490-latest.xpi?src=addondetail (if you change the .xpi file extension to .zip you can decompress the files) (here's the source page: https://addons.mozilla.org/en-US/thunderbird/addon/zulu-spell-checker/ )

cfinke commented 13 years ago

Probably related to the 2,200 affix rules; the English dictionary only has ~200.

Can I ask what kind of project that you're working on that is allowing you to discover these bugs?

cfinke commented 13 years ago

Actually, it looks like that specific Zulu .dic file also contains the entire .aff file at the end, probably by accident. If you remove that, the dictionary loads without freezing the browser (although it does take a while due to the size of the legitimate dictionary).

dbolton commented 13 years ago

I'm creating a spell checker that works with music lyrics. No notation software I'm aware of has a spell checker. JavaScript is the language I'm most comfortable with (and excellent at parsing MusicXML files), so I was excited when I read your blog post.

Initially I was hoping to post the spell checker on the web, but the size of the dictionary files make that less practical (at least in it's current form since it loads the dictionary files every time you open a MusicXML file to check the spelling of the lyrics).