1

I want to delete all words, which are not English, from the text file.

I have done some research about the topic on google and have found a python tool which is named pyenchant for this task. I have tested some English words on pyenchant but unfortunately, it does not function it supposed to do. It cannot recognize some English words such as "codependence".

>>> import enchant
>>> d = enchant.Dict("en_US")
>>> d.check("codependence")
False

I am wondering that is there any tool to delete non-english words from a text file. Any advice will be appreciated. Thanks.

2

This is not really an answer; it's just that it's too big to be a comment.

pyenchant:

Python bindings for the Enchant spellchecker. ... Enchant is used to check the spelling of words and suggest corrections for words that are miss-spelled. It can use many popular spellchecking packages to perform this task, including ispell, aspell and MySpell.

First step - did you try other spell checkers, or other English dictionaries for the same spell checker?


Second: Googling for pyenchant alternative gives this Reddit page, which says

Here's another option that looks superior, however: https://github.com/blatinier/pyhunspell

Although I am unsure , as Pyenchant is simply a wrapper around Enchant, which is still being maintained, and Pyecnahnt as it stands does not seem to be the problem - the dictionary does. It would still be worthwhile to give this a try, though.


See also pyenchant is unmaintained: path forward? which recommends PyHunShell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.