Rechercher une page de manuel

Chercher une autre page de manuel:


Langue: en

Version: OCTOBER 2006 (mandriva - 01/05/08)

Section: 1 (Commandes utilisateur)


trietool - trie manipulation tool


trietool [options] trie command arg...


trietool is the command-line tool for manipulating double-array trie data. It can be used to query, add and remove words in trie data.


The trie argument specifies the name of the trie to manipulate. Tries are stored in a set of files with the same name but different extentions, namely `.sbm', `.br' and `.tl'.

To create a new trie, one need to prepare the file with `.sbm' extension, describing the single-byte alphabet set of the trie. The SBM defines a vector that maps hexadecimal character encodings to a continuous range of integers. The mapped integers will be used as internal alphabet for the trie. Such mapping can improve the space allocation within the trie data, regardless of non-continuity of the character set being used, as the mapped range is always continuous.

The SBM file is a plain text file, with each line listing a range of 8-bit character encodings to be added to the alphabet set, in the format:


where `0xSS' and `0xTT' are hexadecimal values of starting and ending character code for the range, respectively.

For example, for a dictionary that contains only English words witout any punctuations, one may prepare `trie.sbm' as:


The first line lists the ASCII codes for A-Z, and the second for a-z.


Available commands are:
add word data ...
Add word to trie, associated with integer data. Arbitrary number of words-data pairs can be given. Two arguments will be read at a time, the first will be treated as word, and the second as data.
add-list list-file
Add words with associated data listed in list-file to trie. The list-file must be a text file listing one word per line. The associated data can be put after the word in the same line, separated with tab (`\t') character. If the data field is omitted, a default value (-1) will be used instead.
delete word ...
Delete word from trie. Arbitrary number of words to delete can be given.
delete-list list-file
Delete words listed in list-file from trie. The list-file must be a text file listing one word per line.
query word
Search for word in trie. If word exists, its associated data is printed to standard output. Otherwise, error message is printed to standard error, with nothing printed to standard output.
List all words in trie to standard output. The output lists one word-data pair per line, separated with tab (`\t') character, the format appropriate for being list-file for the add-list command.


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.


libdatrie was written by Theppitak Karoonboonyanan.

This manual page was written by Theppitak Karoonboonyanan <>.

Rien ni personne n'a tout à fait tort :
même une horloge arrêtée a raison deux fois par jour.
-+- John Steinbeck -+-