In: Computer Science
Here is the code in python:
import json
from difflib import get_close_matches
# Loading data from json file
data = json.load(open("dictionary.json"))
def translate(w):
# convert it to lower case
w = w.lower()
if w in data:
print("\n",w,":",data[w])
# Driver code
word = input("Enter the sentence: ")
word = word.split()
for i in word:
output = translate(i)
JSON file named as dictionary.json
{
"python": "Python is an interpreted, high-level and general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python's design philosophy emphasizes code readability with its notable use of significant whitespace.",
"human": "Humans (Homo sapiens) are highly intelligent primates that have become the dominant species on Earth",
"city":"A city is a large human settlement. It can be defined as a permanent and densely settled place with administratively defined boundaries whose members work primarily on non-agricultural tasks."
}
Here in the json file for demo purpose i took three words and its meaning. please update it according to your requirement or you can also download premade json english dictionarys.
Output: