openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
656 stars 386 forks source link

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

Open stephanegigandet opened 7 years ago

stephanegigandet commented 7 years ago

What

Mockups

Backend documentation

Part of

teolemon commented 7 years ago

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

stephanegigandet commented 6 years ago

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?

teolemon commented 6 years ago

Weird, I assume it was free at the time ?

stephanegigandet commented 6 years ago

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

teolemon commented 6 years ago

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

stephanegigandet commented 6 years ago

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"]

teolemon commented 3 weeks ago

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