Is there a way to do a case-insensitive search in enchant?
I am trying to achieve the following:
import enchant
d = enchant.DictWithPWL("en_US","mywords.txt")
d.check("Alexandria")
True
d.check("alexandria")
False
Both cases should return True
I haven't found anywhere any information on setting Enchant for case-insensitive matching, so for the time being this is my solution, though it obviously decreases performance considerably:
if d.check(word) or d.check(word.capitalize()):
As per you example, it should return True
.
import enchant
d = enchant.DictWithPWL("en_US","/home/user/yourscript.py")
a=d.check("import")
print(a)
a=d.check("Import")
print(a)
Output:
True
True
You can try following link, you may get some other alternatives to achieve this http://pythonhosted.org/pyenchant/tutorial.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With