Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
khalildh committed Sep 6, 2017
0 parents commit 33a329b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from difflib import get_close_matches
import json

data = json.load(open("data.json"))

#print(data)



# def askForInput():
# word = input("A word to define\n")
# print(data[word])
#
# askForInput()


def translate(w):
w = w.lower()
matches = get_close_matches(w, data.keys(), 1)
print(matches)
if w in data:
return data[w]
elif len(matches) != 0:
return matches[0]
else:
return "The word doesn't exist. Please double check it."

word = input("Enter word: ")

print(translate(word))
1 change: 1 addition & 0 deletions data.json

Large diffs are not rendered by default.

0 comments on commit 33a329b

Please sign in to comment.