使用PostMan测试IK分词

本文档介绍了如何使用PostMan工具来测试Elasticsearch中的IK分词器。首先,需要安装Elasticsearch和PostMan,接着安装IK分词插件。在指定目录下创建analysis-ik目录。然后启动ES服务和PostMan。在PostMan中配置请求头和请求体,设置分词模式为ik_max_word或ik_smart,演示了ik_smart的分词效果。最后展示请求返回的分词结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
        }
    ]
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值