UAX URL Email Tokenizer

uax_url_email tokenizer 类似 standard tokenizer,只不过它会把 URLemail 地址当成一个词元。

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.4/analysis-uaxurlemail-tokenizer.html

译文链接 : http://www.apache.wiki/pages/editpage.action?pageId=10028865

贡献者 : 陈益雷ApacheCNApache中文网

输出示例

  1. POST _analyze
  2. {
  3. "tokenizer": "uax_url_email",
  4. "text": "Email me at john.smith@global-international.com"
  5. }

上面的句子会生成如下的词元:

  1. [ Email, me, at, john.smith@global-international.com ]

standard tokenizer 会生成:

  1. [ Email, me, at, john.smith, global, international.com ]

配置

uax_url_email tokenizer 接受以下参数:

max_token_length 单个 token 的最大长度。如果一个 token 超过这个长度,则以 max_token_length 为间隔分割。默认值是 255.。

配置示例

下面的例子中,我们配置标准分词器的 max_token_length 为 5 (便于展示):

  1. PUT my_index
  2. {
  3. "settings": {
  4. "analysis": {
  5. "analyzer": {
  6. "my_analyzer": {
  7. "tokenizer": "my_tokenizer"
  8. }
  9. },
  10. "tokenizer": {
  11. "my_tokenizer": {
  12. "type": "uax_url_email",
  13. "max_token_length": 5
  14. }
  15. }
  16. }
  17. }
  18. }
  19. POST my_index/_analyze
  20. {
  21. "analyzer": "my_analyzer",
  22. "text": "john.smith@global-international.com"
  23. }

输出如下:

  1. [ john, smith, globa, l, inter, natio, nal.c, om ]