Анализатор пробелов
Анализатор whitespace разбивает текст на термины всякий раз, когда встречается символ пробела.
Пример вывода
resp = client.indices.analyze(
analyzer="whitespace",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp) response = client.indices.analyze(
body: {
analyzer: 'whitespace',
text: "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
}
)
puts response const response = await client.indices.analyze({
analyzer: "whitespace",
text: "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
});
console.log(response); POST _analyze
{
"analyzer": "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 не настраивается.
Определение
Он состоит из:
- Токенизатор
Если вам нужно настроить whitespace анализатор, то необходимо пересоздать его как custom анализатор и изменить его, обычно добавив фильтры токенов. Это пересоздаст встроенный whitespace анализатор, и вы можете использовать его в качестве отправной точки для дальнейшей настройки:
resp = client.indices.create(
index="whitespace_example",
settings={
"analysis": {
"analyzer": {
"rebuilt_whitespace": {
"tokenizer": "whitespace",
"filter": []
}
}
}
},
)
print(resp) response = client.indices.create(
index: 'whitespace_example',
body: {
settings: {
analysis: {
analyzer: {
rebuilt_whitespace: {
tokenizer: 'whitespace',
filter: []
}
}
}
}
}
)
puts response const response = await client.indices.create({
index: "whitespace_example",
settings: {
analysis: {
analyzer: {
rebuilt_whitespace: {
tokenizer: "whitespace",
filter: [],
},
},
},
},
});
console.log(response); PUT /whitespace_example
{
"settings": {
"analysis": {
"analyzer": {
"rebuilt_whitespace": {
"tokenizer": "whitespace",
"filter": [
]
}
}
}
}
} | Здесь вы добавите любые фильтры токенов. |
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/analysis-whitespace-analyzer.html