/glossary

Personal Glossary to keep track of new words in a simplest possible way!

Primary LanguageGo

Personal CLI Glossary

I encounter new English words every single day, I decided to put bigger pressure on learning them. With Glossary you can add a new English word and its definition to the database, simply typing aw my_word in the terminal.


Found it useful? Want more updates?

Show your support by giving a ⭐



How does it work?

Repository contains already built, executable file - glossary. It is the most convenient to create a new alias in your shell config file, e.g. .zshrc, .bashrc, .bash_profile.
I added it to my .zshrc config with the following line: alias aw="./development/words/glossary"
Depending on where did you clone this repository on your local machine, path my differ - change it as needed.

Now I can add new word ( hello in this case) to the new_words.txt file, simply typing aw hello
It runs without a docker container, so it is not stored in the database yet, and definition isn't assigned.

I can also run docker containers with the following command: docker compose up
^ It requires docker and docker compose configured.

Now with docker containers running, I can send a POST request to localhost:8080/fetch.
It takes all words from new_words.txt and puts them into words.txt file.
It also scraps the web (https://www.dictionary.com) and saves its definition in the key-value database
Of course, it also validates if words are being repeated and don't save them if so.

Send a GET request to localhost:8080/<word> to see definition of particular words. Send a POST request to localhost:8080/<word> to add a word and its definition to database. (Only with docker running)

Plans

Someday I wish to nicely display all the words on a website, currently I am not willing to code front-end though. Actual functionality is enough for my current needs.

If someone is willing to code front-end, I can work on this project a little bit more and create much better API.

Of course, words.txt are going to steady be updated with new words.
If you want to add your own words, feel free to do it in new_words.txt file and create a PR.


I am aware that code in this project is awful. I didn't want to spend too much time on building it. I just wanted to create a simple program to save a new words that I encounter while reading English books. It took me just few hours to create, without caring about architecture and clean code.