pip install PyDictionary
from PyDictionary import PyDictionary
# Initialize the PyDictionary
dictionary = PyDictionary()
# Function to fetch the meaning of a word
def fetch_meaning(word):
try:
meanings = dictionary.meaning(word)
if meanings:
for part_of_speech, definition_list in meanings.items():
print(f"{part_of_speech}:")
for definition in definition_list:
print(f" - {definition}")
else:
print(f"Meaning not found for '{word}'")
except Exception as e:
print(f"An error occurred: {e}")
# Simple CLI interface for word lookup
while True:
user_input = input("Enter a word to lookup (or 'exit' to quit): ").strip()
if user_input.lower() == 'exit':
break
fetch_meaning(user_input)
Verb:
- enter or assume a certain state or condition
- undergo a change or development
- come into existence
- enhance the appearance of
Meaning not found for ''
Meaning not found for ''