A command-line dictionary application built in Go that provides word definitions, pronunciations, and examples using the Free Dictionary API.
- 🔍 Real-time word lookup - Get definitions for any English word
- 📚 Comprehensive results - Shows definitions, pronunciations, examples, and part of speech
- ⚡ Smart caching - Caches results for 5 minutes to improve performance
- 🔄 Continuous mode - Keep searching without restarting the app
- 🛡️ Graceful shutdown - Clean exit with Ctrl+C
- Go 1.19 or higher
git clone https://github.com/trynax/Dictionary.git
cd Dictionary
make build .
make run
-
Start the application:
cmd.exe
-
Search for words:
Search for a word... hello hello /həˈloʊ/ EXCLAMATION 1. used as a greeting or to begin a phone conversation Example: hello there, Katie! NOUN 1. an utterance of 'hello'; a greeting Example: she was getting polite nods and hellos from people
-
Exit the application:
- Press
Ctrl+C
or close the terminal
- Press
This application uses the Free Dictionary API to fetch word definitions.
Endpoint: https://api.dictionaryapi.dev/api/v2/entries/en/{word}
- Uses
sync.Map
for thread-safe caching - Cache entries expire after 5 minutes
- Automatic cleanup with goroutines
- Graceful handling of API failures
- Network timeout management
- Invalid word input handling
- Concurrent cache cleanup
- Efficient JSON unmarshaling
- Minimal memory footprint
- Standard Library Only - No external dependencies required
- Uses Go's built-in
net/http
,encoding/json
, andsync
packages
Search for a word...
programming
programming /ˈproʊɡræmɪŋ/
NOUN
1. the process or activity of writing computer programs
Example: software programming requires logical thinking
VERB
1. present participle of program
Example: I am programming a new application
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Implement word history tracking
- Add pronunciation audio playback
- Export definitions to file
- Add fuzzy search for misspelled words
This project is licensed under the MIT License - see the LICENSE file for details.
- Free Dictionary API for providing the word data
- Go community for excellent documentation and examples
trynax - GitHub Profile
Built with ❤️ using Go