Skip to main content

tricli

tricli is a python library that allows everybody to perform operations on my trie data structure. Note that the trie data structure is global and the same at any given moment for everyone.

tricli (given by the last three letters of its name) is meant to be used inside of the terminal as a command-line interface (CLI) and NOT inside of your code files.

Also note that the trie in tricli is case-sensitive, meaning that "Hello" and "hello" are considered to be two different words!

How to install

To install, go into your terminal and do :

pip install tricli

Make sure you are using Python 3 and pip3 if needed.

tricli operations

With tricli, you can add a word to trie, delete a word from the trie, clear the trie by removing all of its words, have the trie displayed to you, and get autocomplete suggestions for a given prefix string.

Avoid stopping a command while it is running (should only take a few seconds), because that may lead to your requested operation not being processed by the server.

With that in mind, let's take a closer look at each of these operations.

Add

Self-explanatory - the add operation adds a word to the trie.

Here's how you do that from your terminal :

tricli add WORD

where WORD is the word you want to add. If WORD is already inside the trie, nothing will happen.

Delete

The delete operation removes a word from the trie.

From terminal :

tricli delete WORD

where WORD is the word you want to delete. If WORD is not in the trie, then you will get a message saying that the operation failed. Note that if WORD is a prefix of other words in the trie, those other words will NOT get deleted.

The search operation lets you know whether a word is inside of the trie or not.

Like such :

tricli search WORD

where WORD is the string you want to search for. If WORD is in the trie, you will get back True otherwise you will get False.

Clear

The clear operation removes all words inside of the trie. Just do (no parameters) :

tricli clear

Display

The display operation shows you the trie (more specifically, the words in a trie) in an indentational format to make it easy for you to understand.

As an example, say you have added the words "she", "sheet", "sheets", and "shot" (in that order) inside of your trie. Perform display by :

tricli display 

and you can expect to see back :

she
  sheet
   sheets
shot

This indentation style becomes clear and intuitive with this example. Essentially the display method prints out the words in the trie based on their prefix, and indents on a word to show that this word can be made by adding characters at the end of above words.

Autocomplete

Lastly, the autocomplete function gives you the ability to type in a prefix string (regardless of whether its an actual word), and see if any words in the trie have that prefix.

Let's see this with the same example we used in display. First run :

tricli autocomplete sh 

where "sh" can be replaced with any prefix string. Here we are looking for all of the words in the trie with the prefix "sh". You can then expect to get back :

['she', 'sheet', 'sheets', 'shot']

Final Remarks

That's it for the CLI. Hope you enjoy it. Feel free to email questions to anish.lakkapragada@gmail.com!

Metadata

Release files for tricli 2.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tricli 2.1.9
File Size Uploaded
tricli-2.1.9.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tricli 2.1.9
File Interpreter ABI Platform
tricli-2.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / tricli-2.1.9.tar.gz

Download URL tricli-2.1.9.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5d2caab9f1cb84b1c118ab522e0b7c45c768e49d95f08f93d9251d076478ca35
BLAKE2b-256 checksum
How to use checksums
c5996b7bc6c73370c214166a639c22000ceed5e89f58d7b1c2bef9cbc246f567
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / tricli-2.1.9-py3-none-any.whl

Download URL tricli-2.1.9-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36ef36008ba0927b8d6be328659089eefb7335d45f10ce3187a554f0e762fe18
BLAKE2b-256 checksum
How to use checksums
8831d16364de82614368541cfd001b48473b7abdc858aac4c5a6e45c7d4e3489
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

2.1.9 This release

2 release files

2.1.8

2 release files

2.1.7

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.2

2 release files

2.1.0

1 release file

2.0.9

1 release file

2.0.6

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page