1、安裝ES、PostMan
2、安裝IK分詞器,目錄如下:注意新建目錄:analysis-ik
3、啓動ES
4、啓動PostMan
5、配置請求頭,請求體,請求時有兩種分詞效果:一種是ik_max_word(最大分詞)和ik_smart(最小分詞),下面是最小分詞
5、請求結果如下:
{
"tokens": [
{
"token": "2020年",
"start_offset": 0,
"end_offset": 5,
"type": "TYPE_CQUAN",
"position": 0
},
{
"token": "的",
"start_offset": 5,
"end_offset": 6,
"type": "CN_CHAR",
"position": 1
},
{
"token": "四月份",
"start_offset": 6,
"end_offset": 9,
"type": "CN_WORD",
"position": 2
},
{
"token": "中國",
"start_offset": 9,
"end_offset": 11,
"type": "CN_WORD",
"position": 3
},
{
"token": "終於",
"start_offset": 11,
"end_offset": 13,
"type": "CN_WORD",
"position": 4
},
{
"token": "舉",
"start_offset": 13,
"end_offset": 14,
"type": "CN_CHAR",
"position": 5
},
{
"token": "全國",
"start_offset": 14,
"end_offset": 16,
"type": "CN_WORD",
"position": 6
},
{
"token": "之力",
"start_offset": 16,
"end_offset": 18,
"type": "CN_WORD",
"position": 7
},
{
"token": "戰",
"start_offset": 18,
"end_offset": 19,
"type": "CN_CHAR",
"position": 8
},
{
"token": "勝了",
"start_offset": 19,
"end_offset": 21,
"type": "CN_WORD",
"position": 9
},
{
"token": "新",
"start_offset": 21,
"end_offset": 22,
"type": "CN_CHAR",
"position": 10
},
{
"token": "冠",
"start_offset": 22,
"end_offset": 23,
"type": "CN_CHAR",
"position": 11
},
{
"token": "病毒",
"start_offset": 23,
"end_offset": 25,
"type": "CN_WORD",
"position": 12
}
]
}