Ansh's Dictionary (#142)

Added a project of English Theasauras
This commit is contained in:
Ansh Dhingra 2020-08-29 11:49:35 +05:30 committed by GitHub
parent cbbd618e0b
commit 6e869244dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,9 @@
# English Theasauras
A simple and smart command-line dictionary that displays the definition of the words entered by the user.
## Usage
To start the dictionary type:
```bash
$ python app.py
```
ENJOY 🤩

33
English_Theasauras/app.py Normal file
View File

@ -0,0 +1,33 @@
import json
import difflib
from difflib import get_close_matches
data = json.load(open("data.json")) # Importing data from data.json
def show_def(word):
word = word.lower()
if word in data:
return data[word]
elif len(get_close_matches(word, data.keys())) > 0:
choice = input("Did you mean %s instead ? Enter Y for yes or N for no: " % get_close_matches(word, data.keys())[0])
if choice == "Y":
return data[get_close_matches(word, data.keys())[0]]
elif choice == "N":
return "The word doesn't exist. Please double check it!!"
else:
return "We didn't understand your entry!"
else:
return "The word doesn't exist. Please double check it!!"
word = input("Please enter your word: ")
output = show_def(word)
if type(output) == list:
for item in output:
print(item)
else:
print(output)

File diff suppressed because one or more lines are too long

View File

@ -28,6 +28,7 @@ So far, the following projects have been integrated to this repo:
|[Current City Weather](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Current_City_Weather) |[Jesse Bridge](https://github.com/jessebridge) |
|[Directory organizer](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Directory-organizer) | [Athul P](https://github.com/athulpn) |
|[DOH DIG](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/DOH-Dig/) | [Ryan](https://github.com/awsumco) |
|[English Theasaurus](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/English_Theasaurus/) | [Ansh Dhingra](https://github.com/anshdhinhgra47) |
|[Excel Files Merger](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Excel_Files_Merger) | [Andrei N](https://github.com/Andrei-Niculae)|
|[Excel to List](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Excel_to_ListofList) | [Nitish Srivastava](https://github.com/nitish-iiitd)|
|[Extended_ip_address_info](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/extended_ip_address_info) | [hafpaf](https://github.com/hafpaf)|