Skip to content

Latest commit

 

History

History
93 lines (72 loc) · 5.05 KB

README.md

File metadata and controls

93 lines (72 loc) · 5.05 KB

Wut? 🤔

demo.mp4

Description:

A CLI application written in python as a part of my CS50P final project, to find word meanings, pronunciation, synonyms, antonyms and other details quickly and easily. The project also allows users to bookmark, review and delete searched words.


What is it?

Wut is a CLI application written in python and uses the free dictionary api to fetch the data and display the search results along with a verbal audio pronunciation.

Why?

Sometimes while reading some articles or reading documentation or even while chatting with your friends, you might jump across wild words that you have no idea about or you are unsure of. The two options here are either to just ignore that it happened or open up a search engine or a dictionary and search for the word. Here's where Wut? comes to rescue, saving those few but important clicks, keystrokes and time.
Since it is a command line application, you just have to enter the word and let the program do it's job, within a second you get the results along with it's pronunciation. And as humans, since we are likely to forget things with time the user can also bookmark the searched word and it's meaning for later review.

How is it implemented?

Wut? uses the python requests library to make a get request to the free dictionary API with the given word as command line argument (enforced using argparser) to fetch the data. The fetched data is properly formatted and then displayed on the user's terminal window using the rich library in a neat and colorful manner. Wut? uses English to IPA library to display the phonetics of the searched word. The project makes use of the Google Text-to-Speech library with play sound to play the pronunciation of the searched word.

Wut? also provides the users an option to bookmark the searched word and also to view the bookmarked words by saving the search results to a bookmarks.json file in user's preferred directory.
Wut? also has error checking to ensure that the user would not jump into a screen full of errors. For ensuring that the bookmarks.json file is of correct format a schema.json file is present which validates the bookmarks file using jsonschema library.

A number of tests to test the functions of Wut? is present in test_project.py file to ensure that all cases are handled properly.


How to run Wut?

Well it's pretty easy.

Make sure python, pip and git is installed by running these commands

python --version # This should return the installed python version
pip --version # This should return the installed pip version
git --version # This should return the installed git version

If not installed, install them from python.org and git-scm.

Now clone the repository and change directory into Wut

git clone https://github.com/devadathanmb/wut.git
cd wut

Now install the required libraries by running

pip install -r requirements.txt

That's it. You are ready to go.

Wut has three flags at present.

  1. For searching for a word
python project.py -w <word to be searched>
# Example:
python project.py -w hello
  1. For displaying the bookmarked words
python project.py -bw <path to bookmarks.json>
# Example:
python project.py -bw /home/me/wut/
  1. For displaying the bookmarked word along with it's details
python project.py -bm <path to bookmarks.json>
# Example:
python project.py -bm /home/me/wut/
  1. For deleting a bookmarked word
python project.py -d <word> <path to bookmarks.json>
# Example:
python project.py -d sus /home/me/wut/
  1. And to print the usage and for help
python project.py -h

Known Issues

Since the application uses free dictionary api to make the GET requests, the output is completely dependent on the response from the API. The API is known to be missing several words and also is known to be down at times during heavy traffic (the program displays a connection error in such cases).
In such cases the only option is to try again later or just search for the word on the web.


Future plans

  1. The code of the program is currently pretty long and there is definitely scope of refactoring it to a certain extend.
  2. bookmarks.json file can get pretty long if the number of bookmarked words are high. This can be avoided by saving it somewhere on the cloud or using a better format to save bookmarks locally. This feature also can be introduced later.