lundi 8 août 2016

Python - How to generate a list of randomly misspelled words for testing spelling algorithm?

I'm looking to test the spelling algorithm I've developed.

I want to replace some of the correctly spelled words with random spelling mistakes, to see if my algo is able to detect them.

So essentially, I am looking to (1) create a random 'spelling error' generator; (2) apply spelling error to random words in list.

For example

Correct_lst = ["hello", "world","sunny","rainbow","banana","splits"]

Testing_lst = ["heeelloo", "world", "sun ny", "rainbow","bananasplits"]

"heeeello" = spelling error;

"sun ny" = spacing error; and

"bananasplits = merging error.

Thanks alot if you could give me some suggestions.




Aucun commentaire:

Enregistrer un commentaire