openfoodfacts-server icon indicating copy to clipboard operation
openfoodfacts-server copied to clipboard

Prevention - Add an ingredients spell checker in the product edit form

Open stephanegigandet opened this issue 7 years ago • 6 comments

What

  • [ ] Create a dictionary of ingredients, and add some javascript magic to have ingredient spell checked and corrected.
  • [ ] Maybe with this plugin: http://www.javascriptspellcheck.com/jquery-spell-check/

Part of

  • #5537

stephanegigandet avatar Nov 10 '17 10:11 stephanegigandet

2 interesting modes: http://www.javascriptspellcheck.com/JavaScript_Spell_As_You_Type_Demo http://www.javascriptspellcheck.com/AJAX_SpellCheck_Demo

teolemon avatar Nov 10 '17 10:11 teolemon

So, I'm looking at javascript spellcheck plugins. The one linked above is perfect, except it's not free and it's not open source.

Next best candidate I found is http://jquery-spellchecker.badsyntax.co/ It requires php pspell to be installed on the backend.

But it's old (5 years) and not maintained.

I found many other spell checking libraries / plugins for javascript, but they all seem very old and unmaintained.

Any suggestions?

stephanegigandet avatar Feb 12 '18 10:02 stephanegigandet

Weird, I assume it was free at the time ?

teolemon avatar Feb 12 '18 11:02 teolemon

No, it's just that I'm used to "jquery something" libraries to be free and open source.

stephanegigandet avatar Feb 12 '18 11:02 stephanegigandet

https://github.com/brandonaaron/jquery-spellcheck Google seems to have a spellcheck API, but not suited to our needs for custom lists, I guess

teolemon avatar Feb 12 '18 11:02 teolemon

So, we could try to use the badsyntax javascript from http://jquery-spellchecker.badsyntax.co/html.html , and instead of using the php pspell backend, we create a perl backend that mimics the pspell api. I tried to capture the API call, the response seems simple enough, just a list of the mispellings and suggestions:

First call to get the mispellings:

{"outcome":"success","data":[["denounncing","Noo","consequencse's","caonsequences"]]}

2nd call to get the suggestions:

["denouncing","renouncing","announcing","trouncing","denounce","tenoning","demonizing","defencing","denounced","denounces"]

stephanegigandet avatar Aug 09 '18 14:08 stephanegigandet

https://wiki.openfoodfacts.org/%E2%9C%8D%EF%B8%8F_Ingredients_Spellcheck

teolemon avatar Oct 18 '24 10:10 teolemon