Developer Notes

Practical notes, advises on application development (java, seam, android, google api)

TinyMCE JMySpell and Jazzy spellchecker implementation

Posted by Andrey Chorniy on January 5, 2010

In my previous post I was asked about the “May be JMySpell is a better backend.”  On that moment I don’t know the answer – JMySpell library was new to me.

So, I download and implement spellchecker with JMySpell to get the answer.  Now JSpellChecker support 3 spellchecker engines (google, Jazzy and JMySpell) and I can briefly compare them all.

Google engine is easy to start with (you don’t need to  have any dictionaries) but it doesn’t give you the guarantee that it will be stable and you will not overcome the limit of requests. Jazzy engine looks like most advanced engine but it’s not easy to prepare dictionaries (Mozilla dictionaries could be used with some manipulations). The advantage of JMySpell is that it can use OpenOffice dictionaries. (You can download any dictionary from OpenOffice wiki). On my view Jazzy have more settings for spellchecker object than JMySpell, but actually I don’t do really deep comparison in quality of spell-checking.

Here is excerpt from the official JMySpell site:

This allows us to use the dictionaries from OpenOffice.org in Java applications, whether they’re J2SE applications or J2EE web applications. Since at the moment there is only one 100% Java Open-Source spell checker (Jazzy), and the inclusion of dictionaries, particularly the Spanish dictionary, is difficult, the objective of this project is to fill this gap.

Here is the list of changes for the https://sourceforge.net/projects/jspellchecker/ project

  1. Code refactored to support different implementations of spell-checkers. new class TinyMCESpellCheckerServlet define request reading, delegate spell-checking to abstract methods and write response in JSON
  2. JMySpell spellchecker implementation has been added (JMySpellCheckerServlet)
  3. Servlet paths changed to (please update tiny_mce config scripts)
    • jazzy servlet path become “/jazzy-spellchecker”
    • google servlet path become “/google-spellchecker”
    • new JMySpell servlet path has been added “/jmyspell-spellchecker”
  4. Location of dictionaries in the “spellchecker” application reorganized
    jazzy dictionaries should be located under “/WEB-INF/dictionaries/jazzy” before it was “/WEB-INF/dictionaries”
    JMySpell dictionaries should be located under “/WEB-INF/dictionaries/jmyspell” in form of zip files named to correspond to the language attribute in TinyMCE config script

Here is the example configuration


tinyMCE.init({
 theme : "advanced",
 mode : "textareas",
 plugins : "spellchecker",
 theme_advanced_buttons3_add : "spellchecker",
 spellchecker_languages : "+English=en-us,Swedish=sv"
 spellchecker_rpc_url    : "/spellchecker/jmyspell-spellchecker", //spellcheck url for jazzy use /spellchecker/jazzy-spellchecker

the following files should be present in the “/WEB-INF/dictionaries/jmyspell” directory

  • en-us.zip
  • sv.zip

On the moment I tested JMySpell en-us dictionary from TinyMCE and it works fine. And I’m looking forward to perform more QA for JMySpell spellchecker engine and probably it’s possible to do with help of community, since I’m not linguist. The authors of JMySpell states that their library implements MySpell algorithm (which was used by OpenOffice as spellchecker engine before version 2.02). On the moment OpenOffice use Hunspell spellchecker library. Few words about Hunspell

  • Improved suggestion using n-gram similarity, rule and dictionary based pronounciation data.
  • Morphological analysis, stemming and generation.
  • Hunspell is based on MySpell and works also with MySpell dictionaries.
Advertisement

12 Responses to “TinyMCE JMySpell and Jazzy spellchecker implementation”

  1. Where is the source? I cant find the files on http://sourceforge.net/projects/jspellchecker/files/

  2. Andrey Chorniy said

    they are available via SVN
    svn co https://jspellchecker.svn.sourceforge.net/svnroot/jspellchecker jspellchecker

    you can find that and more info in the previous spellchecker-related post at
    http://achorniy.wordpress.com/2009/08/11/tinymce-spellchecker-in-java/

    • for who doesn’t have an SVN client: (register and) login into sourceforge and download tarball from root SNV directory.

    • Krish said

      Hi Andrey…i was able to sucessfully incorporate it however it does not seem to work in IE properly. It does not highlight all the mispelled words. I tried to figure out the problem it seems the problem is with the _markWords function of editor_plugin.js file(in spellchecker plugin folder of tinymce). Specifically the condition if(rx.test(v)) evaluates to true and false differently in both the browsers. I was wondering if you were able to make it work in IE also?

      • Andrey Chorniy said

        For sure it works in IE. it actually was tested in IE first. I suppose the problem could be with newer tinymce version initially
        majorVersion : ’3′,
        minorVersion : ’2.0.1′,
        releaseDate : ’2008-09-17′,

  3. Hello,
    i’ve found that not all dictionaries from OO are working.
    I’ve been using Italian or German from this page http://wiki.services.openoffice.org/wiki/Dictionaries and to make them work I had to update the .aff file inside the .zip bundle by moving the “SET xxxxxx” directive at first line (after comments).
    Is an assumtion of Jmyspell to look for SET on first line, but sometime isn’t (you can find it also in middle of the file).

    cheers Lorenzo

  4. [...] TinyMCE JMySpell and Jazzy spellchecker implementation [...]

  5. yuraz said

    Could you please explain in more detail, step by step, JMySpell and TinyMCE implementation?

    • Andrey Chorniy said

      Please check the http://achorniy.wordpress.com/2009/08/11/tinymce-spellchecker-in-java/ – I’ve added integration steps here

      • yuraz said

        Thank you, but still I can’t figure how to implement this with wordpress built in tinymce

  6. trialot said

    I suppose that the .zip files are not needed and that the .aff and .dic files can be used (myspell does the same in unix installations).

    Can you confirm?

    Furthermore, a hunspell java api is existent. Easy to extend the project to hunspell. Is that coming? Or can I propose a change (i will not test that, since using myspell/google) and leave the testing to someone interested…..

    A comment (!)….open office is using .oxt extension files. Just a TIP : download them and rename them as .zip file. That is all (or clean up some files…).

    And…when having yast or similar stuff….just use yast to install lost of packages (just make symlinks on the linux box). Easy to upgrade….

  7. Mitch said

    Hi..thanks for this..it works great..Is there anyway to add an ‘add to dictionary’ feature or are the dictionaries locked down? I need to be able to spell check medical terms.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.