UAX URL 电子邮件分词器
编辑UAX URL 电子邮件分词器编辑
uax_url_email
分词器类似于 standard
分词器,不同之处在于它将 URL 和电子邮件地址识别为单个词条。
示例输出编辑
response = client.indices.analyze( body: { tokenizer: 'uax_url_email', text: 'Email me at [email protected]' } ) puts response
POST _analyze { "tokenizer": "uax_url_email", "text": "Email me at [email protected]" }
上面的句子将产生以下词条
[ Email, me, at, [email protected] ]
而 standard
分词器将产生
[ Email, me, at, john.smith, global, international.com ]
配置编辑
uax_url_email
分词器接受以下参数
|
最大词条长度。如果看到的词条超过此长度,则会在 |
示例配置编辑
在本例中,我们将 uax_url_email
分词器的 max_token_length
配置为 5(用于演示目的)
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: '[email protected]' } ) puts response
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": "[email protected]" }
上面的示例产生以下词条
[ john, smith, globa, l, inter, natio, nal.c, om ]