空格分词器

编辑

whitespace 分词器在遇到空格字符时将文本分解为词项。

示例输出

编辑
resp = client.indices.analyze(
    tokenizer="whitespace",
    text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
response = client.indices.analyze(
  body: {
    tokenizer: 'whitespace',
    text: "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
  }
)
puts response
const response = await client.indices.analyze({
  tokenizer: "whitespace",
  text: "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
});
console.log(response);
POST _analyze
{
  "tokenizer": "whitespace",
  "text": "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
}

上面的句子将产生以下词项

[ The, 2, QUICK, Brown-Foxes, jumped, over, the, lazy, dog's, bone. ]

配置

编辑

whitespace 分词器接受以下参数

max_token_length

最大词项长度。如果看到的词项超过此长度,则会在 max_token_length 间隔处进行拆分。默认为 255