7.8.19. TokenUnigram — Groonga v16.0.4 documentation

Skip to main content
`Ctrl`+`K`

# 7.8.19. `TokenUnigram`

## 7.8.19.1. Summary

`TokenUnigram` is similar to TokenBigram. The differences between them is token unit.

## 7.8.19.2. Syntax

`TokenUnigram` hasn’t parameter:

    TokenUnigram

## 7.8.19.3. Usage

If normalizer is used, `TokenUnigram` uses white-space-separate like tokenize method for ASCII characters. `TokenUnigram` uses unigram tokenize method for non-ASCII characters.

If `TokenUnigram` tokenize non-ASCII charactors, `TokenUnigram` uses 1 character per token as below example.

Execution example:

    tokenize TokenUnigram "日本語の勉強" NormalizerAuto
    # [
    #   [
    #     0,
    #     1337566253.89858,
    #     0.000355720520019531
    #   ],
    #   [
    #     {
    #       "value": "日",
    #       "position": 0,
    #       "force_prefix": false,
    #       "force_prefix_search": false
    #     },
    #     {
    #       "value": "本",
    #       "position": 1,
    #       "force_prefix": false,
    #       "force_prefix_search": false
    #     },
    #     {
    #       "value": "語",
    #       "position": 2,
    #       "force_prefix": false,
    #       "force_prefix_search": false
    #     },
    #     {
    #       "value": "の",
    #       "position": 3,
    #       "force_prefix": false,
    #       "force_prefix_search": false
    #     },
    #     {
    #       "value": "勉",
    #       "position": 4,
    #       "force_prefix": false,
    #       "force_prefix_search": false
    #     },
    #     {
    #       "value": "強",
    #       "position": 5,
    #       "force_prefix": false,
    #       "force_prefix_search": false
    #     }
    #   ]
    # ]