elasticsearch pinyin 拼音分词器

匿名 (未验证) 提交于 2019-12-03 00:40:02

安装pinyin分词
地址:https://github.com/medcl/elasticsearch-analysis-pinyin

PUT py_test {   "index" : {         "analysis" : {             "analyzer" : {                 "pinyin_analyzer" : {                     "tokenizer" : "my_pinyin",                     "filter" : "word_delimiter"                     }             },             "tokenizer" : {                 "my_pinyin" : {                     "type" : "pinyin",                     "first_letter" : "none",                     "padding_char" : " "                 }             }         }     } }
GET py_test/_analyze {   "text":"刘德华",   "analyzer":"pinyin_analyzer" }

得到

{   "tokens": [     {       "token": "liu",       "start_offset": 0,       "end_offset": 1,       "type": "word",       "position": 0     },     {       "token": "ldh",       "start_offset": 0,       "end_offset": 3,       "type": "word",       "position": 0     },     {       "token": "de",       "start_offset": 1,       "end_offset": 2,       "type": "word",       "position": 1     },     {       "token": "hua",       "start_offset": 2,       "end_offset": 3,       "type": "word",       "position": 2     }   ] }

原文:https://www.cnblogs.com/jiqing9006/p/9277104.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!