Spell fix
[yaz-moved-to-github.git] / doc / yaz-icu-man.xml
1 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"
2  "http://www.oasis-open.org/docbook/xml/4.1/docbookx.dtd"
3 [
4      <!ENTITY % local SYSTEM "local.ent">
5      %local;
6      <!ENTITY % entities SYSTEM "entities.ent">
7      %entities;
8      <!ENTITY % idcommon SYSTEM "common/common.ent">
9      %idcommon;
10 ]>
11 <refentry id="yaz-icu">
12  <refentryinfo>
13   <productname>YAZ</productname>
14   <productnumber>&version;</productnumber>
15  </refentryinfo>
16  
17  <refmeta>
18   <refentrytitle>yaz-icu</refentrytitle>
19   <manvolnum>1</manvolnum>
20  </refmeta>
21  
22  <refnamediv>
23   <refname>yaz-icu</refname>
24   <refpurpose>YAZ ICU utility</refpurpose>
25  </refnamediv>
26
27  <refsynopsisdiv>
28   <cmdsynopsis>
29    <command>yaz-icu</command>
30    <arg choice="opt" rep="repeat">commands</arg>
31    <arg>-c <replaceable>config</replaceable></arg>
32    <arg>-p <replaceable>opt</replaceable></arg>
33    <arg>-s</arg>
34    <arg>-x</arg>
35   </cmdsynopsis>
36  </refsynopsisdiv>
37  
38  <refsect1><title>DESCRIPTION</title>
39   <para>
40    <command>yaz-icu</command> is utility which demonstrates 
41    the ICU chain module of yaz. (<filename>yaz/icu.h</filename>).
42   </para>
43  </refsect1>
44
45  <refsect1><title>OPTIONS</title>
46   <variablelist>
47    <varlistentry>
48     <term>-c <replaceable>config</replaceable></term>
49     <listitem><para>
50       Specifies the file containing ICU chain configuration
51       which is XML based.
52      </para></listitem>
53    </varlistentry>
54
55    <varlistentry>
56     <term>-p <replaceable>type</replaceable></term>
57     <listitem><para>
58       Specifies extra information to be printed about the ICU system.
59       If <replaceable>type</replaceable> is <literal>c</literal>
60       then ICU converters are printed. 
61       If <replaceable>type</replaceable> is <literal>l</literal>
62       available locales are printed.
63       If <replaceable>type</replaceable> is <literal>t</literal>
64       available transliterators are printed.
65      </para></listitem>
66    </varlistentry>
67
68    <varlistentry>
69     <term>-s</term>
70     <listitem><para>
71       Specifies that output should include sort key as well. Note that
72       sort key differs between ICU versions.
73      </para></listitem>
74    </varlistentry>
75
76    <varlistentry>
77     <term>-x</term>
78     <listitem><para>
79       Specifies that output should be XML based rather than
80       "text" based.
81      </para></listitem>
82    </varlistentry>
83
84   </variablelist>
85  </refsect1>
86  <refsect1><title>ICU chain configuration</title>
87   <para>
88    The ICU chain configuration speicifies one or more rules to convert
89    text data into tokens. The configuration format is XML based.
90   </para>
91   <para>
92    The toplevel element must be named <literal>icu_chain</literal>.
93    The <literal>icu_chain</literal> element has one required attribute
94    <literal>locale</literal> which specifies the ICU locale to be used
95    in the conversion steps.
96   </para>
97   <para>
98    The <literal>icu_chain</literal> element must include elements where
99    each element specifies a conversion step. The conversion is performed
100    in the order in which the conversion steps are specified.
101    Each conversion element takes one attribute: <literal>rule</literal>
102    which serves as argument to the conversion step.
103   </para>
104   <para>
105    The following conversion elements are available:
106    
107    <variablelist>
108     <varlistentry>
109      <term>casemap</term>
110      <listitem><para>
111        Converts case and rule specifies how:
112
113        <variablelist>
114         <varlistentry>
115          <term>l</term>
116          <listitem>
117           <para>Lowercase using ICU function u_strToLower. </para>
118          </listitem>
119         </varlistentry>
120
121         <varlistentry>
122          <term>u</term>
123          <listitem>
124           <para>Upper case using ICU function u_strToUpper.</para>
125          </listitem>
126         </varlistentry>
127         
128         <varlistentry>
129          <term>t</term>
130          <listitem>
131           <para>To title using UCU function u_strToTitle.</para>
132          </listitem>
133         </varlistentry>
134
135         <varlistentry>
136          <term>f</term>
137          <listitem>
138           <para>Fold case using ICU function u_strFoldCase.</para>
139          </listitem>
140         </varlistentry>
141         
142        </variablelist>
143       </para></listitem>
144     </varlistentry>
145
146     <varlistentry>
147      <term>display</term>
148      <listitem><para>
149        This is a meta step which specifies that a term/token is to
150        be displayed. This term is retrieved in an application
151        using function icu_chain_token_display (<filename>yaz/icu.h</filename>).
152       </para></listitem>
153     </varlistentry>
154     
155     <varlistentry>
156      <term>transform</term>
157      <listitem><para>
158        Specifies an ICU transform rule using a transliterator
159        Identifier.
160        The rule attribute is the transliterator Identifier.
161        See  <ulink url="&url.icu.transform;">ICU Transforms</ulink> for
162        more information.
163       </para></listitem>
164     </varlistentry>
165     
166     <varlistentry>
167      <term>transliterate</term>
168      <listitem><para>
169        Specifies a rule-based transliterator.
170        The rule attribute is the custom transformation rule to be used.
171        See <ulink url="&url.icu.transform;">ICU Transforms</ulink> for
172        more information.
173       </para></listitem>
174     </varlistentry>
175     
176     <varlistentry>
177      <term>tokenize</term>
178      <listitem><para>
179        Breaks / tokenizes a string into components using
180        ICU functions ubrk_open, ubrk_setText, .. . The rule is
181        one of:
182        <variablelist>
183         <varlistentry>
184          <term>l</term>
185          <listitem>
186           <para>Line. ICU: UBRK_LINE.</para>
187          </listitem>
188         </varlistentry>
189
190         <varlistentry>
191          <term>s</term>
192          <listitem>
193           <para>Sentence. ICU: UBRK_SENTENCE.</para>
194          </listitem>
195         </varlistentry>
196         
197         <varlistentry>
198          <term>w</term>
199          <listitem>
200           <para>Word. ICU: UBRK_WORD.</para>
201          </listitem>
202         </varlistentry>
203
204         <varlistentry>
205          <term>c</term>
206          <listitem>
207           <para>Character. ICU: UBRK_CHARACTER.</para>
208          </listitem>
209         </varlistentry>
210
211         <varlistentry>
212          <term>t</term>
213          <listitem>
214           <para>Title. ICU: UBRK_TITLE.</para>
215          </listitem>
216         </varlistentry>
217
218        </variablelist>
219       </para></listitem>
220     </varlistentry>
221     
222    </variablelist>
223    
224   </para>
225  </refsect1>
226  <refsect1><title>EXAMPLES</title>
227   <para>
228    The following command analyzes text in file <filename>text</filename>
229    using ICU chain configuration <filename>chain.xml</filename>:
230    <screen>
231     cat text | yaz-icu -c chain.xml
232    </screen>
233    The chain.xml might look as follows:
234     <screen><![CDATA[
235 <icu_chain locale="en">
236   <transform rule="[:Control:] Any-Remove"/>
237   <tokenize rule="w"/>
238   <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
239   <transliterate rule="xy -> z"/>
240   <display/>
241   <casemap rule="l"/>
242 </icu_chain>
243 ]]>
244    </screen>
245   </para>
246  </refsect1>
247  <refsect1><title>SEE ALSO</title>
248   <para>
249    <citerefentry>
250     <refentrytitle>yaz</refentrytitle>
251     <manvolnum>7</manvolnum>
252    </citerefentry>
253   </para>
254   <para>
255    <ulink url="&url.icu;">ICU Home</ulink>
256   </para>
257   <para>
258    <ulink url="&url.icu.transform;">ICU Transforms</ulink>
259   </para>
260  </refsect1>
261 </refentry>
262
263 <!-- Keep this comment at the end of the file
264 Local variables:
265 mode: sgml
266 sgml-omittag:t
267 sgml-shorttag:t
268 sgml-minimize-attributes:nil
269 sgml-always-quote-attributes:t
270 sgml-indent-step:1
271 sgml-indent-data:t
272 sgml-parent-document:nil
273 sgml-local-catalogs: nil
274 sgml-namecase-general:t
275 End:
276 -->