Debian Codegraph @

doc/source/reference/commands/normalize.rst

raw
1 .. -*- rst -*-
2
3 .. groonga-command
4 .. database: commands_normalize
5
6 ``normalize``
7 =============
8
9 .. note::
10
11 This command is an experimental feature.
12
13 This command may be changed in the future.
14
15 Summary
16 -------
17
18 ``normalize`` command normalizes text by the specified normalizer.
19
20 There is no need to create table to use ``normalize`` command.
21 It is useful for you to check the results of normalizer.
22
23 Syntax
24 --------
25
26 This command takes three parameters.
27
28 ``normalizer`` and ``string`` are required. Others are optional::
29
30 normalize normalizer
31 string
32 [flags=NONE]
33
34 Usage
35 -----
36
37 Here is a simple example of ``normalize`` command.
38
39 .. groonga-command
40 .. include:: ../../example/reference/commands/normalize/normalizer_auto_ascii.log
41 .. normalize NormalizerAuto "aBcDe 123"
42
43 Parameters
44 ----------
45
46 This section describes parameters of ``normalizer``.
47
48 Required parameters
49 ^^^^^^^^^^^^^^^^^^^
50
51 There are required parameters, ``normalizer`` and ``string``.
52
53 ``normalizer``
54 """"""""""""""
55
56 Specifies the normalizer name. ``normalize`` command uses the
57 normalizer that is named ``normalizer``.
58
59 See :doc:`/reference/normalizers` about built-in normalizers.
60
61 Here is an example to use built-in ``NormalizerAuto`` normalizer.
62
63 TODO
64
65 If you want to use other normalizers, you need to register additional
66 normalizer plugin by :doc:`register` command. For example, you can use
67 MySQL compatible normalizer by registering `groonga-normalizer-mysql
68 <https://github.com/groonga/groonga-normalizer-mysql>`_.
69
70 ``string``
71 """"""""""
72
73 Specifies any string which you want to normalize.
74
75 If you want to include spaces in ``string``, you need to quote
76 ``string`` by single quotation (``'``) or double quotation (``"``).
77
78 Here is an example to use spaces in ``string``.
79
80 TODO
81
82 Optional parameters
83 ^^^^^^^^^^^^^^^^^^^
84
85 There are optional parameters.
86
87 ``flags``
88 """""""""
89
90 Specifies a normalization customize options. You can specify
91 multiple options separated by "``|``". For example,
92 ``REMOVE_BLANK|WITH_TYPES``.
93
94 Here are available flags.
95
96 .. list-table::
97 :header-rows: 1
98
99 * - Flag
100 - Description
101 * - ``NONE``
102 - Just ignored.
103 * - ``REMOVE_BLANK``
104 - TODO
105 * - ``WITH_TYPES``
106 - TODO
107 * - ``WITH_CHECKS``
108 - If we specify this flag, Groonga output position of character before normalizing.
109 Note that these positions of character before normalizing are a relative position
110 against a previous character.
111 * - ``REMOVE_TOKENIZED_DELIMITER``
112 - TODO
113
114 Here is an example that uses ``REMOVE_BLANK``.
115
116 TODO
117
118 Here is an example that uses ``WITH_TYPES``.
119
120 TODO
121
122 Here is an example that uses ``WITH_CHECKS``.
123
124 .. groonga-command
125 .. include:: ../../example/reference/commands/normalize/normalizer_auto_with_checks.log
126 .. normalize NormalizerAuto " A  B   C" WITH_CHECKS
127
128 Here is an example that uses ``REMOVE_TOKENIZED_DELIMITER``.
129
130 TODO
131
132 Return value
133 ------------
134
135 ::
136
137 [HEADER, normalized_text]
138
139 ``HEADER``
140
141 See :doc:`/reference/command/output_format` about ``HEADER``.
142
143 ``normalized_text``
144
145 ``normalized_text`` is an object that has the following attributes.
146
147 .. list-table::
148 :header-rows: 1
149
150 * - Name
151 - Description
152 * - ``normalized``
153 - The normalized text.
154 * - ``types``
155 - An array of types of the normalized text. The N-th ``types`` shows
156 the type of the N-th character in ``normalized``.
157
158 See also
159 --------
160
161 * :doc:`/reference/normalizers`