I wrote a C++ version of the Norvig’s spelling corrector. The theory and other language implementations are in his website, and my version can be found at my github:
https://github.com/felipefarinon/spellingcorrector
I wrote a C++ version of the Norvig’s spelling corrector. The theory and other language implementations are in his website, and my version can be found at my github:
https://github.com/felipefarinon/spellingcorrector
19 Comments
HOLA… Q TAL…
Ps yo ando buscando opciones d como hacer un este proyecto pero poner agregarlo al openoffice con palabras de alguna lengua indigena…. y necesito material q me sirva de guía primero para entnder como se hace y dspués aterrizarlo al problema q quiero resolver…
Me pueds mandar x favor el código… O más o menos orientarme al respecto d q si es posible hacer esto que quiero… Desarrollar un corrector que tenga diccionarios de palabras en alguna lengua indigena y psoteriormente agregarlo al openoffice, o sólo se podrían agregar diccionarios???…
En vd necsito esta información y agradeceré me contest…
GRACIAS…
Para que coño quieres meter una lengua indigena si los tios estos no saben ni que es un ordenador !!
Habra gente que quiera aprender a usar alguno 🙂
Hi Felipe,
Well done, thank you.
How do you think is it possible to do some optimization to make code faster?
Best regards,
Oleg.
Hey Oleg,
Thank You 🙂
The code is actually running pretty fast but yes, it can still be improved, I think I will write another post in the blog just for that subject ok?
Regards,
Felipe Farinon.
Thanks for the code
I think there’s a bug in the code. The transposition edit should be
word.substr(0, i) + word[i+1] + word[i] + word.substr(i + 2) instead of word.substr(0, i) + word[i+1] + word.substr(i + 2)
Yes, there was, thank you for pointing it. The fixed code is at github.
podrias acesorarme para hacer un corrector ortografico en visual basic
podrias mandarme lo comentarios a mi correo o a cualquier persona que lea este mensaje lyvelasquez_09@yahoo.com
Awesome…thanks
nice code. 🙂
Hi, i got a problem with this program, can you tell me witch tool do you use ?
and what is the type of file for the last program , and his complete name ?
Thank you,
hey Felipe,
I would like to use ur code in a mex file on matlab. I am working on an OCR application and I want to implement ur code for post processing of words. The link for the word database is broken. Can you shoot me an update for that link on my email. Thanks in advance.
I am using this in my spell checking library libspellcheck (libspellcheck.codeplex.com)
I think you missed word[i] after word[i+1] in transposition section of edit(). As transposition assume to swap to adjacent. Please correct me if I am wrong. Great work though.
You are right, thank you for spotting it. This made the corrector fail in two of the tests listed by Norvig, the ones which had the word ‘peotry’ and ‘peotryy’.
I’m uploading the correction.
Hi Felipe, I took some parts of your code as well, thanks!
I think I found a little bug other than the one pointed by Yassine: in the load function the “++i” increment makes you skip the first letter of the first word of the dictionary file, leading you to record a wrong word.
Giulio
Hi Giulio, you are right as well. I’m uploading the correction.
You can write a spell corrector using elasticsearch. Here is the link https://arjunjs.wordpress.com/2017/04/12/elasticsearch-building-a-simple-spell-corrector-with-elasticsearch/ .
7 Trackbacks/Pingbacks
[…] in C++ In the spelling corrector article we read a whole file in memory and hold it’s data in a std::string object, and then we use a […]
[…] Felipe Farinon […]
[…] Felipe Farinon […]
[…] Felipe Farinon […]
[…] Felipe Farinon […]
[…] Felipe Farinon […]
[…] Felipe Farinon […]