f48850416c73a989442b45205f11bdff227c20e5
[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>-x</arg>
34   </cmdsynopsis>
35  </refsynopsisdiv>
36  
37  <refsect1><title>DESCRIPTION</title>
38   <para>
39    <command>yaz-icu</command> is utility which demonstrates 
40    the ICU chain module of yaz. (<filename>yaz/icu.h</filename>).
41   </para>
42  </refsect1>
43
44  <refsect1><title>OPTIONS</title>
45   <variablelist>
46    <varlistentry>
47     <term>-c <replaceable>config</replaceable></term>
48     <listitem><para>
49       Specifies the file containing ICU chain configuration
50       which is XML based.
51      </para></listitem>
52    </varlistentry>
53
54    <varlistentry>
55     <term>-p <replaceable>type</replaceable></term>
56     <listitem><para>
57       Specifies extra information to be printed about the ICU system.
58       If <replaceable>type</replaceable> is <literal>c</literal>
59       then ICU converters are printed. 
60       If <replaceable>type</replaceable> is <literal>l</literal>
61       available locales are printed.
62       If <replaceable>type</replaceable> is <literal>t</literal>
63       available transliterators are printed.
64      </para></listitem>
65    </varlistentry>
66
67    <varlistentry>
68     <term>-x <replaceable>config</replaceable></term>
69     <listitem><para>
70       Specifies that output should be XML based rather than
71       "text" based.
72      </para></listitem>
73    </varlistentry>
74
75   </variablelist>
76  </refsect1>
77  <refsect1><title>ICU chain configuration</title>
78   <para>
79    The ICU chain configuration speicifies one or more rules to convert
80    text data into tokens. The configuration format is XML based.
81   </para>
82   <para>
83    The toplevel element must be named <literal>icu_chain</literal>.
84    The <literal>icu_chain</literal> element has one required attribute
85    <literal>locale</literal> which specifies the ICU locale to be used
86    in the conversion steps.
87   </para>
88   <para>
89    The <literal>icu_chain</literal> element must include elements where
90    each element specifies a conversion step. The conversion is performed
91    in the order in which the conversion steps are specified.
92    Each conversion element takes one attribute: <literal>rule</literal>
93    which serves as argument to the conversion step.
94   </para>
95   <para>
96    The following conversion elements are available:
97    
98    <variablelist>
99     <varlistentry>
100      <term>casemap</term>
101      <listitem><para>
102        Converts case and rule specifies how:
103
104        <variablelist>
105         <varlistentry>
106          <term>l</term>
107          <listitem>
108           <para>Lowercase using ICU function u_strToLower. </para>
109          </listitem>
110         </varlistentry>
111
112         <varlistentry>
113          <term>u</term>
114          <listitem>
115           <para>Upper case using ICU function u_strToUpper.</para>
116          </listitem>
117         </varlistentry>
118         
119         <varlistentry>
120          <term>t</term>
121          <listitem>
122           <para>To title using UCU function u_strToTitle.</para>
123          </listitem>
124         </varlistentry>
125
126         <varlistentry>
127          <term>f</term>
128          <listitem>
129           <para>Fold case using ICU function u_strFoldCase.</para>
130          </listitem>
131         </varlistentry>
132         
133        </variablelist>
134       </para></listitem>
135     </varlistentry>
136
137     <varlistentry>
138      <term>display</term>
139      <listitem><para>
140        This is a meta step which specifies that a term/token is to
141        be displayed. This term is retrieved in an application
142        using function icu_chain_token_display (<filename>yaz/icu.h</filename>).
143       </para></listitem>
144     </varlistentry>
145     
146     <varlistentry>
147      <term>transform</term>
148      <listitem><para>
149        Specifies an ICU transform rule. The rule attribute is the
150        custom transformation rule to be used. This is a text based format
151        which is offered by the ICU transform system. See
152        <ulink url="&url.icu.transform;">ICU Transforms</ulink> for
153        more information.
154       </para></listitem>
155     </varlistentry>
156     
157     <varlistentry>
158      <term>tokenize</term>
159      <listitem><para>
160        Breaks / tokenizes a string into components using
161        ICU functions ubrk_open, ubrk_setText, .. . The rule is
162        one of:
163        <variablelist>
164         <varlistentry>
165          <term>l</term>
166          <listitem>
167           <para>Line. ICU: UBRK_LINE.</para>
168          </listitem>
169         </varlistentry>
170
171         <varlistentry>
172          <term>s</term>
173          <listitem>
174           <para>Sentence. ICU: UBRK_SENTENCE.</para>
175          </listitem>
176         </varlistentry>
177         
178         <varlistentry>
179          <term>w</term>
180          <listitem>
181           <para>Word. ICU: UBRK_WORD.</para>
182          </listitem>
183         </varlistentry>
184
185         <varlistentry>
186          <term>c</term>
187          <listitem>
188           <para>Character. ICU: UBRK_CHARACTER.</para>
189          </listitem>
190         </varlistentry>
191
192         <varlistentry>
193          <term>t</term>
194          <listitem>
195           <para>Title. ICU: UBRK_TITLE.</para>
196          </listitem>
197         </varlistentry>
198
199        </variablelist>
200       </para></listitem>
201     </varlistentry>
202     
203    </variablelist>
204    
205   </para>
206  </refsect1>
207  <refsect1><title>EXAMPLES</title>
208   <para>
209    The following command analyzes text in file <filename>text</filename>
210    using ICU chain configuration <filename>chain.xml</filename>:
211    <screen>
212     cat text | yaz-icu -c chain.xml
213    </screen>
214    The chain.xml might look as follows:
215     <screen><![CDATA[
216 <icu_chain locale="en">
217   <transform rule="[:Control:] Any-Remove"/>
218   <tokenize rule="w"/>
219   <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
220   <display/>
221   <casemap rule="l"/>
222 </icu_chain>
223 ]]>
224    </screen>
225   </para>
226  </refsect1>
227  <refsect1><title>SEE ALSO</title>
228   <para>
229    <citerefentry>
230     <refentrytitle>yaz</refentrytitle>
231     <manvolnum>7</manvolnum>
232    </citerefentry>
233   </para>
234   <para>
235    <ulink url="&url.icu;">ICU Home</ulink>
236   </para>
237   <para>
238    <ulink url="&url.icu.transform;">ICU Transforms</ulink>
239   </para>
240  </refsect1>
241 </refentry>
242
243 <!-- Keep this comment at the end of the file
244 Local variables:
245 mode: sgml
246 sgml-omittag:t
247 sgml-shorttag:t
248 sgml-minimize-attributes:nil
249 sgml-always-quote-attributes:t
250 sgml-indent-step:1
251 sgml-indent-data:t
252 sgml-parent-document:nil
253 sgml-local-catalogs: nil
254 sgml-namecase-general:t
255 End:
256 -->