A python package which allows you to add, delete, search, autocomplete and display words in a trie hosted on MongoDB
- Python (>3.6)
- Pymongo
Run the following code in terminal (MacOS / Linux)
pip3 install shawlTrie
Run the following code in terminal (MacOS / Linux)
$ python3 -m shawlTrie
>> Enter task (add, search, autocomplete, delete, display):
Adds a word to the trie
>> Enter task (add, search, autocomplete, delete, display): add
>> Type word to add: application
>> Word has been added successfully!
Returns true if word exists in trie. Otherwise, returns false
>> Enter task (add, search, autocomplete, delete, display): add
>> Type word to search: application
>> True
Returns a list of autocomplete suggestions
>> Enter task (add, search, autocomplete, delete, display): autocomplete
>> Type prefix to autocomplete: app
>> ['apple', 'application', 'app']
Deletes a word from the trie
>> Enter task (add, search, autocomplete, delete, display): delete
>> Type word to delete: application
>> Word deleted successfully!
Displays all the words in the trie
>> Enter task (add, search, autocomplete, delete, display): display
>> ['apple', 'application', 'app', 'bath']