To check a word's spelling is correct i.e whether such a word exists in English, all you have to do is this: import enchant You can use a dedicated spellchecking library in Python called enchant What's the best approach here? Are there any maintained libraries? Do I need to download a dictionary and check against it? Otherwise I might need to manually add certain terms to the dictionary. If it can deal with legal terms that would be a big plus.Spell correcting won't work in all cases because a lot of the errors are OCR issues that are too far off to fix. Most of the errors will be picked up anyway as words that appear too seldom (though not all.). I'm just using this to exclude words during preprocessing for document classification. Accuracy needs to be above 90%, but not higher than that.The unit test would want True on an input of "car" and False on an input of "ijjk". A function that accepts a string (word) and returns a boolean whether the word is valid English of not.Python: check whether a word is spelled correctly Also suggests Pyenchant which isn't maintained. Spell Checker for Python Uses pyenchant which isn't maintained anymore. Often referenced and quite interesting, but also a spelling corrector, and accuracy isn't quite good enough, though I'll probably use this in combination with an checker. Python Spell Checker This is a spelling corrector, given two strings. Python spell checker using a trie This question is more about the data structure. I've looked at previous answers and they all seem to be outdated now or not applicable:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |