Can someone tell me how can I get a list of all french/english dictionnary words in python ? My aim is to build a crossword game with a function. This function must have some letters in input and return all combinations of words existing in the dictionnary given these letters. Thanks.
Asked
Active
Viewed 2,824 times
0
-
3@Olivier Melançon -- It is related to Python, pyenchant is a dictionary specifically for Python. – Michael Swartz Mar 14 '18 at 03:31
-
@MichaelSwartz Enchant bills itself as a spellchecker system. It seems much more likely that a list of French words would be better-suited than a spellchecker (though this question, even if specialized to "Are there any French dictionary libraries," is still off-topic for SO) – Adam Smith Mar 14 '18 at 03:45
-
@Adam Smith --- It's also a dictionary. It works quite well in my jumble solver program. https://stackoverflow.com/questions/35757407/how-to-add-dictionary-to-pyenchant – Michael Swartz Mar 14 '18 at 03:50
-
2Hi everyone. I'm very new on StackOverflow and I don't understand why some users put this question on hold.I just want to know how can I find some libraries in python able to load all french words available in dictionnary and do some stuff with it. I really tried to find some solutions among existing questions on #stack, but I didn't. – Boubacar Traoré Mar 14 '18 at 09:35
1 Answers
3
The pyenchant dictionary is available in English, French, and other languages. When installing read the prompts, the installer looks for the directory with the python setup, that's where you want it. I use it in a jumble solver program I wrote.
https://pypi.python.org/pypi/pyenchant/
To use it do
import enchant
And this is hardly a complete picture and I'm not going to post the jumble solver code but here's some snippets on how I used it in the program. It should point you in the right direction on how to apply it. Also, there's stackoverflow posts on using pyenchant. That's how I found out about pyenchant.
# instantiate the pyenchant dictionary
checkword = enchant.Dict('en_US')
# if 'item2' is a dictionary word, load to list, make unique
if checkword.check(item2):
if item2 in words:
pass
else:
words.append(item2)

Michael Swartz
- 858
- 2
- 15
- 27
-
Thanks @Michael, your short code helped me. I've also found something matching better ! :-) – Boubacar Traoré Mar 14 '18 at 09:07
-