Skip to content

Add interactive TUI browser subcommand (python -m wn browse) #283

@Salah-Sal

Description

@Salah-Sal

Is your feature request related to a problem? Please describe.

Yes. I'm frequently frustrated when I need to explore wordnet relationships and hierarchies because it requires:

  • Writing Python scripts for every query
  • Understanding the full API before getting started
  • Mentally reconstructing hierarchies from programmatic output

This creates significant barriers for linguists, students, and researchers without programming backgrounds who want to explore semantic relationships visually. Even for developers, quick lookups during development require context-switching to write and run code.

Describe the solution you'd like

I'd like an interactive Text User Interface (TUI) browser accessible via a new subcommand:

python -m wn browse              # Launch interactive TUI
python -m wn browse --lang en    # Browse specific lexicon

Key features:

  • Visual tree navigation: Use arrow keys to explore hypernym/hyponym hierarchies
  • Interactive search: Type a word → see all senses → select one → explore relationships
  • Full-text search: Find synsets by searching definitions
  • Multi-language: Browse any installed lexicon
  • Export: Save tree views to files for documentation

User experience:
Type "dog" → Select sense → View tree (↑hypernyms, ↓hyponyms) → Navigate with arrows → Press Enter on any synset to re-root the tree there.

Technical approach:

  • Optional dependencies (Rich, Textual) via pip install wn[tui]
  • New wn/browser/ module with adapter to bridge TUI → wn API
  • Leverages existing wn.Synset methods (.hypernyms(), .hyponyms(), .definition())
  • SQL backend provides 10-100x faster queries than in-memory alternatives

Describe alternatives you've considered

  1. Separate package (wn-tui): Would work but harder to discover and requires separate maintenance
  2. Web interface only: Already have wn.web for that use case; TUI serves different niche (terminal-native, no server)
  3. Enhanced CLI with flags: Less intuitive than interactive navigation; doesn't provide visual feedback
  4. Keep using NLTK-based standalone tool: Works but doesn't leverage wn's superior SQL backend and multi-language support

Additional context

  • Proof of concept: I have a working TUI using NLTK backend (~500 LOC) with navigation, search, export, and Arabic support. Ready to adapt for wn.
  • Unique feature: Would be the first interactive TUI in the Python wordnet ecosystem
  • Educational value: Visual tool for teaching semantic concepts in classrooms
  • Implementation timeline: 2-3 weeks for MVP
  • Commitment: I'm willing to implement, test, document, and maintain this feature long-term

Integration assessment: I've analyzed the technical feasibility in detail and found 90%+ API compatibility between requirements and existing wn.Synset interface. Happy to share the full technical design document if helpful.

here some screenshots:

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions