| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
.. groonga-command |
| 4 |
.. database: tokenizers |
| 5 |
|
| 6 |
.. _token-regexp: |
| 7 |
|
| 8 |
``TokenRegexp`` |
| 9 |
=============== |
| 10 |
|
| 11 |
Summary |
| 12 |
------- |
| 13 |
|
| 14 |
.. versionadded:: 5.0.1 |
| 15 |
|
| 16 |
.. caution:: |
| 17 |
|
| 18 |
This tokenizer is experimental. Specification may be changed. |
| 19 |
|
| 20 |
.. caution:: |
| 21 |
|
| 22 |
This tokenizer can be used only with UTF-8. You can't use this |
| 23 |
tokenizer with EUC-JP, Shift_JIS and so on. |
| 24 |
|
| 25 |
``TokenRegexp`` is a tokenizer for supporting regular expression |
| 26 |
search by index. |
| 27 |
|
| 28 |
Syntax |
| 29 |
------ |
| 30 |
|
| 31 |
``TokenRegexp`` hasn't parameter:: |
| 32 |
|
| 33 |
TokenRegexp |
| 34 |
|
| 35 |
Usage |
| 36 |
----- |
| 37 |
|
| 38 |
In general, regular expression search is evaluated as sequential |
| 39 |
search. But the following cases can be evaluated as index search: |
| 40 |
|
| 41 |
* Literal only case such as ``hello`` |
| 42 |
* The beginning of text and literal case such as ``\A/home/alice`` |
| 43 |
* The end of text and literal case such as ``\.txt\z`` |
| 44 |
|
| 45 |
In most cases, index search is faster than sequential search. |
| 46 |
|
| 47 |
``TokenRegexp`` is based on bigram tokenize method. ``TokenRegexp`` |
| 48 |
adds the beginning of text mark (``U+FFEF``) at the begging of text |
| 49 |
and the end of text mark (``U+FFF0``) to the end of text when you |
| 50 |
index text: |
| 51 |
|
| 52 |
.. groonga-command |
| 53 |
.. include:: ../../example/reference/tokenizers/token-regexp-add.log |
| 54 |
.. tokenize TokenRegexp "/home/alice/test.txt" NormalizerAuto --mode ADD |