1YAZ-ICU(1) Commands YAZ-ICU(1)
2
3
4
6 yaz-icu - YAZ ICU utility
7
9 yaz-icu [-c config] [-p opt] [-s] [-x] [infile]
10
12 yaz-icu is a utility which demonstrates the ICU chain module of yaz.
13 (yaz/icu.h).
14
15 The utility can be used in two ways. It may read some text using an XML
16 configuration for configuring ICU and show text analysis. This mode is
17 triggered by option -c which specifies the configuration to be used.
18 The input file is read from standard input or from a file if infile is
19 specified.
20
21 The utility may also show ICU information. This is triggered by option
22 -p.
23
25 -c config
26 Specifies the file containing ICU chain configuration which is XML
27 based.
28
29 -p type
30 Specifies extra information to be printed about the ICU system. If
31 type is c then ICU converters are printed. If type is l, then
32 available locales are printed. If type is t, then available
33 transliterators are printed.
34
35 -s
36 Specifies that output should include sort key as well. Note that
37 sort key differs between ICU versions.
38
39 -x
40 Specifies that output should be XML based rather than "text" based.
41
43 The ICU chain configuration specifies one or more rules to convert text
44 data into tokens. The configuration format is XML based.
45
46 The toplevel element must be named icu_chain. The icu_chain element has
47 one required attribute locale which specifies the ICU locale to be used
48 in the conversion steps.
49
50 The icu_chain element must include elements where each element
51 specifies a conversion step. The conversion is performed in the order
52 in which the conversion steps are specified. Each conversion element
53 takes one attribute: rule which serves as argument to the conversion
54 step.
55
56 The following conversion elements are available:
57
58 casemap
59 Converts case (and rule specifies how):
60
61 l
62 Lower case using ICU function u_strToLower.
63
64 u
65 Upper case using ICU function u_strToUpper.
66
67 t
68 To title using ICU function u_strToTitle.
69
70 f
71 Fold case using ICU function u_strFoldCase.
72
73
74 display
75 This is a meta step which specifies that a term/token is to be
76 displayed. This term is retrieved in an application using function
77 icu_chain_token_display (yaz/icu.h).
78
79 transform
80 Specifies an ICU transform rule using a transliterator Identifier.
81 The rule attribute is the transliterator Identifier. See ICU
82 Transforms[1] for more information.
83
84 transliterate
85 Specifies a rule-based transliterator. The rule attribute is the
86 custom transformation rule to be used. See ICU Transforms[1] for
87 more information.
88
89 tokenize
90 Breaks / tokenizes a string into components using ICU functions
91 ubrk_open, ubrk_setText, .. . The rule is one of:
92
93 l
94 Line. ICU: UBRK_LINE.
95
96 s
97 Sentence. ICU: UBRK_SENTENCE.
98
99 w
100 Word. ICU: UBRK_WORD.
101
102 c
103 Character. ICU: UBRK_CHARACTER.
104
105 t
106 Title. ICU: UBRK_TITLE.
107
108
109 join
110 Joins tokens into one string. The rule attribute is the joining
111 string, which may be empty. The join conversion element was added
112 in YAZ 4.2.49.
113
115 The following command analyzes text in file text using ICU chain
116 configuration chain.xml:
117
118 cat text | yaz-icu -c chain.xml
119
120
121 The chain.xml might look as follows:
122
123 <icu_chain locale="en">
124 <transform rule="[:Control:] Any-Remove"/>
125 <tokenize rule="w"/>
126 <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
127 <transliterate rule="xy > z;"/>
128 <display/>
129 <casemap rule="l"/>
130 </icu_chain>
131
132
133
134
136 yaz(7)
137
138 ICU Home[2]
139
140 ICU Transforms[1]
141
143 1. ICU Transforms
144 http://userguide.icu-project.org/transforms/general
145
146 2. ICU Home
147 http://www.icu-project.org/
148
149
150
151YAZ 5.14.11 10/09/2015 YAZ-ICU(1)