0

I thought about using

from PyDictionary import PyDictionary

word = input("enter a word: ")
dictionary = PyDictionary(word)

check = dictionary.getMeanings()

print(check)
input("press enter to exit")
Matthias
  • 12,873
  • 6
  • 42
  • 48
Nycelease
  • 23
  • 1
  • 6

2 Answers2

0

I saw this post a while ago: How to check if a word is an English word with Python?

>>> import enchant
>>> d = enchant.Dict("en_US")
>>> d.check("Hello")
True
>>> d.check("Helo")
False
>>> d.suggest("Helo")
['He lo', 'He-lo', 'Hello', 'Helot', 'Help', 'Halo', 'Hell', 'Held', 'Helm', 
'Hero', 
"He'll"]
>>>
RoadJDK
  • 11
  • 1
  • 3
  • i had a question what do >>> do – Nycelease Jun 15 '21 at 11:31
  • If you go to your terminal or cmd shell and enter `python` or `python3`, you get an interactive Python Console where you can run python code line by line. `>>>` simply just represents the code @RoadJDK has entered in the console and the lines which didn't start with `>>>` are the outputs of the code entered. – axelmukwena Sep 11 '22 at 08:32
0

if you have to use PyDictionary you can check the meaning of a word and wrap the return in a bool function:

from PyDictionary import PyDictonary
dictionary = PyDictionary()
valid_word = bool(dictionary.meaning("hdaoij")) # False
valid_word = bool(dictionary.meaning("hello")) # True

or

valid_word = bool(dictionary.meaning(input("enter a word: ")))

Otherwise, I would use the check function in enchant, in @RoadJDK's answer

Tom McLean
  • 5,583
  • 1
  • 11
  • 36