Omit sort key by default in yaz-icu's output
[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. The rule attribute is the
159        custom transformation rule to be used. This is a text based format
160        which is offered by the ICU transform system. See
161        <ulink url="&url.icu.transform;">ICU Transforms</ulink> for
162        more information.
163       </para></listitem>
164     </varlistentry>
165     
166     <varlistentry>
167      <term>tokenize</term>
168      <listitem><para>
169        Breaks / tokenizes a string into components using
170        ICU functions ubrk_open, ubrk_setText, .. . The rule is
171        one of:
172        <variablelist>
173         <varlistentry>
174          <term>l</term>
175          <listitem>
176           <para>Line. ICU: UBRK_LINE.</para>
177          </listitem>
178         </varlistentry>
179
180         <varlistentry>
181          <term>s</term>
182          <listitem>
183           <para>Sentence. ICU: UBRK_SENTENCE.</para>
184          </listitem>
185         </varlistentry>
186         
187         <varlistentry>
188          <term>w</term>
189          <listitem>
190           <para>Word. ICU: UBRK_WORD.</para>
191          </listitem>
192         </varlistentry>
193
194         <varlistentry>
195          <term>c</term>
196          <listitem>
197           <para>Character. ICU: UBRK_CHARACTER.</para>
198          </listitem>
199         </varlistentry>
200
201         <varlistentry>
202          <term>t</term>
203          <listitem>
204           <para>Title. ICU: UBRK_TITLE.</para>
205          </listitem>
206         </varlistentry>
207
208        </variablelist>
209       </para></listitem>
210     </varlistentry>
211     
212    </variablelist>
213    
214   </para>
215  </refsect1>
216  <refsect1><title>EXAMPLES</title>
217   <para>
218    The following command analyzes text in file <filename>text</filename>
219    using ICU chain configuration <filename>chain.xml</filename>:
220    <screen>
221     cat text | yaz-icu -c chain.xml
222    </screen>
223    The chain.xml might look as follows:
224     <screen><![CDATA[
225 <icu_chain locale="en">
226   <transform rule="[:Control:] Any-Remove"/>
227   <tokenize rule="w"/>
228   <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
229   <display/>
230   <casemap rule="l"/>
231 </icu_chain>
232 ]]>
233    </screen>
234   </para>
235  </refsect1>
236  <refsect1><title>SEE ALSO</title>
237   <para>
238    <citerefentry>
239     <refentrytitle>yaz</refentrytitle>
240     <manvolnum>7</manvolnum>
241    </citerefentry>
242   </para>
243   <para>
244    <ulink url="&url.icu;">ICU Home</ulink>
245   </para>
246   <para>
247    <ulink url="&url.icu.transform;">ICU Transforms</ulink>
248   </para>
249  </refsect1>
250 </refentry>
251
252 <!-- Keep this comment at the end of the file
253 Local variables:
254 mode: sgml
255 sgml-omittag:t
256 sgml-shorttag:t
257 sgml-minimize-attributes:nil
258 sgml-always-quote-attributes:t
259 sgml-indent-step:1
260 sgml-indent-data:t
261 sgml-parent-document:nil
262 sgml-local-catalogs: nil
263 sgml-namecase-general:t
264 End:
265 -->