π Overview A C++ implementation of an auto-complete system using the Trie data structure. This project provides real-time word suggestions as the user types, with multiple sorting options (frequency, length, lexicographical order). It supports dynamic dictionary updates, case insensitivity, and robust error handling.
β¨ Features β Prefix-based suggestions β Get word completions in real-time. β Multiple sorting methods:
Frequency-based (most searched words first)
Shortest-first (BFS traversal)
Lexicographical order (DFS traversal) β Dynamic dictionary management:
Add new words
Delete existing words
Auto-save changes to file β Case-insensitive matching β Works with "Car", "CAR", or "car". β Exact match highlighting β Bold or colorize exact matches. β Error handling β Handles invalid inputs gracefully.
π Project Structure AutoComplete_Project/ βββ src/ # Source code
β βββ Trie.cpp # Trie implementation
β βββ Trie.h # Trie header
β βββAppStart.cpp # Core logic
β βββAppStart.h #Core header
β βββ AutoComplete.cpp #The main function
β βββ main.cpp # CLI interface
βββ data/ # Dictionary files
β βββ dictionary.txt # Default word list
β βββ searchedWord.txt # The words that the user searched about
βββ README.md # This file
-
Entering a Prefix Enter a prefix: ca Choose sorting method:
-
Frequency (default)
-
Shortest-first (BFS)
-
Lexicographical (DFS) => 2
Output: car cat care cart -
Adding/Deleting Words Options:
-
Search suggestions
-
Add a word
-
Delete a word
-
Display Dectionary
2 Enter word to add: coffee "coffee" added successfully!
π§ Extending the Project
- GUI Integration: Use Qt or ImGui for a graphical interface.
- Persistent Frequency Tracking: Store word frequencies in a file.
- Multilingual Support: Extend for non-English characters.
π€ Contributers
- Gehad Ebrahim
- Tassnim Shellah
- Habiba Osama
- Lina Hisham
- Dalia Ahmed
- Sondos Khalid
- Sara Mohsen
β Star this repo if you find it useful! π Share with others who might benefit!
π Why Trie? The Trie data structure is ideal for auto-complete because: β Fast prefix searches β O(L) where L is the length of the prefix. β Memory-efficient β Shares common prefixes among words. β Scalable β Handles large dictionaries efficiently.