Токенизатор UAX URL email
Токенизатор uax_url_email похож на токенизатор standard, за исключением того, что он распознаёт URL-адреса и электронные адреса как отдельные токены.
Пример вывода
resp = client.indices.analyze(
tokenizer="uax_url_email",
text="Email me at john.smith@global-international.com",
)
print(resp) response = client.indices.analyze(
body: {
tokenizer: 'uax_url_email',
text: 'Email me at john.smith@global-international.com'
}
)
puts response const response = await client.indices.analyze({
tokenizer: "uax_url_email",
text: "Email me at john.smith@global-international.com",
});
console.log(response); POST _analyze
{
"tokenizer": "uax_url_email",
"text": "Email me at john.smith@global-international.com"
} Предложение выше даст следующие термины:
[ Email, me, at, john.smith@global-international.com ]
в то время как токенизатор standard даст:
[ Email, me, at, john.smith, global, international.com ]
Конфигурация
Токенизатор uax_url_email принимает следующие параметры:
| | Максимальная длина токена. Если токен превышает эту длину, он разбивается на интервалы |
Пример конфигурации
В этом примере мы настраиваем токенизатор uax_url_email с максимальной длиной токена max_token_length в 5 (для демонстрационных целей):
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "uax_url_email",
"max_token_length": 5
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="john.smith@global-international.com",
)
print(resp1) response = client.indices.create(
index: 'my-index-000001',
body: {
settings: {
analysis: {
analyzer: {
my_analyzer: {
tokenizer: 'my_tokenizer'
}
},
tokenizer: {
my_tokenizer: {
type: 'uax_url_email',
max_token_length: 5
}
}
}
}
}
)
puts response
response = client.indices.analyze(
index: 'my-index-000001',
body: {
analyzer: 'my_analyzer',
text: 'john.smith@global-international.com'
}
)
puts response const response = await client.indices.create({
index: "my-index-000001",
settings: {
analysis: {
analyzer: {
my_analyzer: {
tokenizer: "my_tokenizer",
},
},
tokenizer: {
my_tokenizer: {
type: "uax_url_email",
max_token_length: 5,
},
},
},
},
});
console.log(response);
const response1 = await client.indices.analyze({
index: "my-index-000001",
analyzer: "my_analyzer",
text: "john.smith@global-international.com",
});
console.log(response1); PUT my-index-000001
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "uax_url_email",
"max_token_length": 5
}
}
}
}
}
POST my-index-000001/_analyze
{
"analyzer": "my_analyzer",
"text": "john.smith@global-international.com"
} Этот пример даёт следующие термины:
[ john, smith, globa, l, inter, natio, nal.c, om ]
© 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-uaxurlemail-tokenizer.html