首页 > 其他 > 详细

15.1 自定义分词器

时间:2019-06-16 21:38:03      阅读:97      评论:0      收藏:0      [点我收藏+]
创建自定义分词器
技术分享图片技术分享图片
测试分词器
技术分享图片技术分享图片
DELETE /test_analyzer
PUT /test_analyzer
{
  "settings": {
    "analysis": {
      "char_filter": {
        "sign_to_word": {
          "type": "mapping",
          "mappings": ["&=> and","+=>add"]
        }
      },
      "filter": {
        "my_stopwords": {
          "type": "stop",
          "stopwords": ["the", "a", "her", "his"]
        }
      },
      "analyzer": {
        "my_analyzer": {
          "type": "custom",
          "char_filter": ["html_strip", "sign_to_word"],
          "tokenizer": "standard",
          "filter": ["lowercase", "my_stopwords"]
        }
      }
    }
  }
}
 
GET /test_analyzer/_analyze
{
  "text": "ruru is a her <a href/> HAHA!!!",
  "analyzer": "my_analyzer"
}

15.1 自定义分词器

原文:https://www.cnblogs.com/cc299/p/11032848.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!