DEV Community

Nersissiian
Nersissiian

Posted on

Lexicon: AI-powered terminal dictionary you’ll actually enjoy using

Ever found yourself breaking your flow just to Google a word?

As a developer, I spend most of my day in the terminal. Jumping to a browser just to look up a definition always felt like an unnecessary context switch. I wanted a dictionary that lived where I already work — fast, clean, and optionally powered by AI.

That's why I built Lexicon.

What is Lexicon?

Lexicon is a Python CLI dictionary that provides instant word definitions, examples, synonyms, and AI-powered explanations directly from your terminal.

Features

  • Instant word lookups
  • Clean and colorful terminal output using Rich
  • AI-powered explanations with the --ai flag
  • Web lookup fallback with the --web flag
  • Offline support for common vocabulary
  • Lightweight and easy to use

Quick Start

pip install lexicon-cli

lexicon "ephemeral"

lexicon --ai "quantum entanglement"
Enter fullscreen mode Exit fullscreen mode

For AI-powered explanations, set your OPENAI_API_KEY environment variable.

Built With

  • Python
  • Click
  • Rich
  • OpenAI API
  • Requests
  • BeautifulSoup4

Example of the core lookup flow:

def lookup(word, use_ai=False, use_web=False):
    if use_ai:
        return ai_explain(word)
    if use_web:
        return web_scrape(word)
    return local_dictionary.get(word)
Enter fullscreen mode Exit fullscreen mode

Why I Built It

Most dictionary tools are either too minimal, require a browser, or depend entirely on an internet connection.

Lexicon aims to combine:

  • Fast terminal-native experience
  • Beautiful output
  • Offline functionality
  • AI-enhanced explanations when needed

Whether you're reading documentation, learning a new concept, or exploring unfamiliar terminology, Lexicon keeps you focused without leaving your workflow.

Roadmap

Planned features include:

  • Pronunciation audio playback
  • Multi-language support
  • Local caching for repeated lookups
  • Additional dictionary providers
  • Improved AI explanation modes

The project is open source and contributions are welcome.

GitHub: https://github.com/Nersisiian/Lexicon

If you find it useful, consider giving the repository a star.

What terminal tools help you stay productive and avoid context switching?

Top comments (0)