TRIETOOL(1)
πΈ NAME πΈ
okay so bestie, this is TRIETOOL(1), straight out of the General Commands Manual, and it's about trietool β the trie manipulation tool. that's the whole name. short, sweet, powerful. π
β¨ SYNOPSIS β¨
trietool [ options ] trie command arg ...
π DESCRIPTION π
trietool is literally the command-line tool for manipulating double-array trie data, no cap. You can use it to query, add and remove words in a trie. it's giving data-structure royalty and honestly? we love to see it. π
π¦ The Trie π¦
The trie argument specifies the name of the trie you wanna manipulate. A trie is stored in a file with a .tri extension. BUT β plot twist β to create a brand new trie, you need to prepare a file with an .abm extension first, describing the Unicode ranges of the alphabet set of the trie. The ABM defines a set of vectors that map Unicode characters into a continuous range of integers, and those mapped integers get used as the internal alphabet for the trie. This mapping is lowkey iconic because it improves space allocation within the trie data, regardless of how non-continuous the character set you're using is β since the mapped range is always continuous. slay. β¨
The ABM file is a plain text file, and each line lists a range of 32-bit Unicodes to be added to the alphabet set, in this format:
[0xSSSS,0xTTTT]
where 0xSSSS and 0xTTTT are hexadecimal values of the starting and ending character code for the range, respectively. periodt. π
Example time π β for a dictionary that contains only English words without any punctuations, you could prepare trie.abm like this:
[0x0041,0x005a]
[0x0061,0x007a]
The first line lists the ASCII codes for A-Z, and the second one's for a-z. cute!
β οΈ No more than 255 alphabets are allowed in a trie. that's the ceiling, bestie, we do not exceed it.
The .tri file you create will incorporate the ABM data. So the .abm file is not required after the first creation β it will just be ignored. bye felicia. π
π COMMANDS π
Available commands are:
π add word data ...
Add word to the trie, associated with integer data. You can give an arbitrary number of words-data pairs. Two arguments get read at a time β the first is treated as the word, and the second as the data. simple as that. β¨
π§ add-list [ options ] list-file
Add words with their associated data, listed in list-file, to the trie. The list-file must be a text file listing one word per line. The associated data can be put after the word on the same line, separated with a tab (\t) character. And if the data field is omitted? A default value of -1 gets used instead. π
Options available for this command:
-e,--encoding encβ specify the character encoding of the list-file contents, such asUTF-8. If you omit it, the current locale codeset is assumed.
π delete word ...
Delete word from the trie. You can give an arbitrary number of words to delete. gone, reduced to atoms. π
π¦ delete-list [ options ] list-file
Delete the words listed in list-file from the trie. The list-file must be a text file listing one word per line.
Options available for this command:
-e,--encoding encβ specify the character encoding of the list-file contents, such asUTF-8. If omitted, the current locale codeset is assumed.
β query word
Search for word in the trie. If the word exists, its associated data is printed to standard output. Otherwise, an error message is printed to standard error, with nothing printed to standard output. vibe check: failed, but gracefully. π
πΈ list
List all the words in the trie to standard output. The output lists one word-data pair per line, separated with a tab (\t) character β the exact format appropriate for being a list-file for the add-list command. it's giving self-sustaining ecosystem, honestly obsessed. π«Ά
π OPTIONS π
This program follows the usual GNU command line syntax, with long options starting with two dashes (--). A summary of options is included below. π
-p,--path dirβ set trie directory to dir [default=.]-h,--helpβ show summary of options.-V,--versionβ show version of program.
π«Ά AUTHOR π«Ά
libdatrie was written by Theppitak Karoonboonyanan.
This manual page was written by Theppitak Karoonboonyanan <theppitak@gmail.com>. π
and that's the whole page, bestie! it's TRIETOOL(1) from the General Commands Manual, December 2008 edition, and it lives in the libdatrie cinematic universe. go forth and manipulate your tries. πβ¨π¦
π¦ where this page comes from
- alpine 3.24: libdatrie-doc 0.2.14-r1 Β· LGPL-2.1-or-later
- arch rolling: libdatrie 0.2.14-1 Β· LGPL-2.1-or-later
- centos-stream 10: libdatrie-devel 0.2.13-11.el10 Β· LGPL-2.1-or-later
- centos-stream 9: libdatrie-devel 0.2.13-4.el9 Β· LGPLv2+
- centos-stream 9: libdatrie-devel 0.2.13-4.el9 Β· LGPLv2+
- debian bookworm: libdatrie1-bin 0.2.13-2+b1 Β· LGPL-2.1-or-later
- debian trixie: libdatrie1-bin 0.2.13-3+b1 Β· LGPL-2.1-or-later
- fedora 43: libdatrie-devel 0.2.13-12.fc43 Β· LGPL-2.1-or-later
- fedora 43: libdatrie-devel 0.2.13-12.fc43 Β· LGPL-2.1-or-later
- fedora 44: libdatrie-devel 0.2.14-2.fc44 Β· LGPL-2.1-or-later
- fedora 44: libdatrie-devel 0.2.14-2.fc44 Β· LGPL-2.1-or-later
- nixos 26.05: libdatrie 2019-12-20
- nixpkgs unstable: libdatrie 2019-12-20
- opensuse-leap 16.0: libdatrie-devel 0.2.13-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: libdatrie-devel 0.2.13-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: libdatrie-devel 0.2.13-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: libdatrie-devel 0.2.13-160000.3.2 Β· LGPL-2.1-only
- ubuntu jammy: libdatrie1-bin 0.2.13-2 Β· LGPL-2.1-or-later
- ubuntu noble: libdatrie1-bin 0.2.13-3build1 Β· LGPL-2.1-or-later
- ubuntu questing: libdatrie1-bin 0.2.13-4
- ubuntu resolute: libdatrie1-bin 0.2.14-1 Β· LGPL-2.1-or-later
- ubuntu stonking: libdatrie1-bin 0.2.14-2 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms