1
.\" Hey, EMACS: -*- nroff -*-
2
.\" First parameter, NAME, should be all caps
3
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
4
.\" other parameters are allowed: see man(7), man(1)
5
.TH TRIETOOL 1 "OCTOBER 2006"
6
.\" Please adjust this date whenever revising the manpage.
8
.\" Some roff macros, for reference:
9
.\" .nh disable hyphenation
10
.\" .hy enable hyphenation
11
.\" .ad l left justify
12
.\" .ad b justify to both left and right margins
13
.\" .nf disable filling
14
.\" .fi enable filling
15
.\" .br insert line break
16
.\" .sp <n> insert n+1 empty lines
17
.\" for manpage-specific macros, see man(7)
19
trietool \- trie manipulation tool
22
.RI [ options ] " trie command arg" ...
24
\fBtrietool\fP is the command-line tool for manipulating double-array trie
25
data. It can be used to query, add and remove words in trie data.
28
The \fItrie\fP argument specifies the name of the trie to manipulate.
29
Tries are stored in a set of files with the same name but different
30
extentions, namely `.sbm', `.br' and `.tl'.
32
To create a new trie, one need to prepare the file with `.sbm' extension,
33
describing the single-byte alphabet set of the trie. The SBM defines a
34
vector that maps hexadecimal character encodings to a continuous range of
35
integers. The mapped integers will be used as internal alphabet for the trie.
36
Such mapping can improve the space allocation within the trie data, regardless
37
of non-continuity of the character set being used, as the mapped range is
40
The SBM file is a plain text file, with each line listing a range of 8-bit
41
character encodings to be added to the alphabet set, in the format:
47
where `0xSS' and `0xTT' are hexadecimal values of starting and ending
48
character code for the range, respectively.
50
For example, for a dictionary that contains only English words witout any
51
punctuations, one may prepare `\fItrie\fP.sbm' as:
58
The first line lists the ASCII codes for A-Z, and the second for a-z.
60
Available commands are:
62
\fBadd\fP \fIword data\fP ...
63
Add \fIword\fP to trie, associated with integer \fIdata\fP. Arbitrary number of
64
words-data pairs can be given. Two arguments will be read at a time, the first
65
will be treated as \fIword\fP, and the second as \fIdata\fP.
67
\fBadd-list\fP \fIlist-file\fP
68
Add words with associated data listed in \fIlist-file\fP to trie. The
69
\fIlist-file\fP must be a text file listing one word per line. The associated
70
data can be put after the word in the same line, separated with tab (`\\t')
71
character. If the data field is omitted, a default value (\-1) will be used
74
\fBdelete\fP \fIword\fP ...
75
Delete \fIword\fP from trie. Arbitrary number of words to delete can be given.
77
\fBdelete-list\fP \fIlist-file\fP
78
Delete words listed in \fIlist-file\fP from trie. The \fIlist-file\fP must be
79
a text file listing one word per line.
81
\fBquery\fP \fIword\fP
82
Search for \fIword\fP in trie. If \fIword\fP exists, its associated data
83
is printed to standard output. Otherwise, error message is printed to standard
84
error, with nothing printed to standard output.
87
List all words in trie to standard output. The output lists one word-data pair
88
per line, separated with tab (`\\t') character, the format appropriate for
89
being \fIlist-file\fP for the \fBadd-list\fP command.
91
This program follows the usual GNU command line syntax, with long
92
options starting with two dashes (`\-\-').
93
A summary of options is included below.
95
.B \-p, \-\-path \fIdir\fP
96
Set trie directory to \fIdir\fP [default=`.']
99
Show summary of options.
102
Show version of program.
105
libdatrie was written by Theppitak Karoonboonyanan.
107
This manual page was written by Theppitak Karoonboonyanan <thep@linux.thai.net>.