I've created a little spellchecker.
This script works in this way:
After reading each line of the text, realizes some corrections
thanks to a comparison between a dictionary and the text itself.
When it finds a word that doesn't exist in the dictionary, it corrects the words
(giving one or more suggestions) and pushes it into an array.
Here there's my problem:
I would like to give to the user the possibility to choose the correct word
among the words suggested. Something like this:
We found the word "wlak" in your text which isn't correct.
The suggested possibilities are:
1. walk
2. work
type the number associated to the word or 0 if you can't find the correct word.
Then I would like to replace the correct word on the original text (creating a new .txt).
How can I do this?
This script works in this way:
After reading each line of the text, realizes some corrections
thanks to a comparison between a dictionary and the text itself.
When it finds a word that doesn't exist in the dictionary, it corrects the words
(giving one or more suggestions) and pushes it into an array.
Here there's my problem:
I would like to give to the user the possibility to choose the correct word
among the words suggested. Something like this:
We found the word "wlak" in your text which isn't correct.
The suggested possibilities are:
1. walk
2. work
type the number associated to the word or 0 if you can't find the correct word.
Then I would like to replace the correct word on the original text (creating a new .txt).
How can I do this?