Фильтр токенов Apostrophe
Удаляет все символы после апострофа, включая сам апостроф.
Этот фильтр включён в встроенный анализатор языка турецкого Elasticsearch. Он использует ApostropheFilter Lucene, созданный для турецкого языка.
Пример
Следующий запрос API анализа демонстрирует работу фильтра токенов Apostrophe.
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"apostrophe"
],
text="Istanbul'a veya Istanbul'dan",
)
print(resp) response = client.indices.analyze(
body: {
tokenizer: 'standard',
filter: [
'apostrophe'
],
text: "Istanbul'a veya Istanbul'dan"
}
)
puts response const response = await client.indices.analyze({
tokenizer: "standard",
filter: ["apostrophe"],
text: "Istanbul'a veya Istanbul'dan",
});
console.log(response); GET /_analyze
{
"tokenizer" : "standard",
"filter" : ["apostrophe"],
"text" : "Istanbul'a veya Istanbul'dan"
} Фильтр генерирует следующие токены:
[ Istanbul, veya, Istanbul ]
Добавление в анализатор
Следующий запрос API создания индекса использует фильтр токенов Apostrophe для настройки нового пользовательского анализатора.
resp = client.indices.create(
index="apostrophe_example",
settings={
"analysis": {
"analyzer": {
"standard_apostrophe": {
"tokenizer": "standard",
"filter": [
"apostrophe"
]
}
}
}
},
)
print(resp) response = client.indices.create(
index: 'apostrophe_example',
body: {
settings: {
analysis: {
analyzer: {
standard_apostrophe: {
tokenizer: 'standard',
filter: [
'apostrophe'
]
}
}
}
}
}
)
puts response const response = await client.indices.create({
index: "apostrophe_example",
settings: {
analysis: {
analyzer: {
standard_apostrophe: {
tokenizer: "standard",
filter: ["apostrophe"],
},
},
},
},
});
console.log(response); PUT /apostrophe_example
{
"settings": {
"analysis": {
"analyzer": {
"standard_apostrophe": {
"tokenizer": "standard",
"filter": [ "apostrophe" ]
}
}
}
}
}
© 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-apostrophe-tokenfilter.html