mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
parent
cbbd618e0b
commit
6e869244dd
9
English_Theasauras/README.md
Normal file
9
English_Theasauras/README.md
Normal 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
33
English_Theasauras/app.py
Normal 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)
|
||||
|
1
English_Theasauras/data.json
Normal file
1
English_Theasauras/data.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -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)|
|
||||
|
|
Loading…
Reference in New Issue
Block a user