Template request | Bug report | Generate Data Product
Tags: #python #dictionary #project #word #snippet
Author: Sriniketh Jayasendil
Description: This notebook get world definition and translation from English using PyDictionary.
try:
from PyDictionary import PyDictionary
except ModuleNotFoundError:
!pip install PyDictionary
from PyDictionary import PyDictionary
- Enter the word in English
- Check the available language codes here
word = input("-> Enter the word to get all details: ") # Get the word from the user
lang_code = input(
"-> Enter the language that needs to be translated: "
) # Available language codes: https://developers.google.com/admin-sdk/directory/v1/languages [EN, FR, ES]
dictionary = PyDictionary() # Create a PyDictionary Model
print(word + " : ", end="")
meaning = dictionary.meaning(word)
print(meaning) # replace "earth" with any other word of your choice
print(word + " => " + dictionary.translate(word, lang_code))