当前位置: 代码迷 >> 综合 >> IKanalyzer的ik_smart和ik_max_word的区别
  详细解决方案

IKanalyzer的ik_smart和ik_max_word的区别

热度:17   发布时间:2024-02-23 05:21:22.0

用kibana测试以“中国共产党”为例

 

ik_max_word测试:

GET _analyze
{"analyzer": "ik_max_word", "text":"中国共产党"
}结果:{"tokens" : [{"token" : "中国共产党","start_offset" : 0,"end_offset" : 5,"type" : "CN_WORD","position" : 0},{"token" : "中国","start_offset" : 0,"end_offset" : 2,"type" : "CN_WORD","position" : 1},{"token" : "国共","start_offset" : 1,"end_offset" : 3,"type" : "CN_WORD","position" : 2},{"token" : "共产党","start_offset" : 2,"end_offset" : 5,"type" : "CN_WORD","position" : 3},{"token" : "共产","start_offset" : 2,"end_offset" : 4,"type" : "CN_WORD","position" : 4},{"token" : "党","start_offset" : 4,"end_offset" : 5,"type" : "CN_CHAR","position" : 5}]
}

 

ik_smart测试:

GET _analyze
{"analyzer": "ik_smart", "text":"中国共产党"
}结果:{"tokens" : [{"token" : "中国共产党","start_offset" : 0,"end_offset" : 5,"type" : "CN_WORD","position" : 0}]
}

由上结果测试总结:

  • ik_max_word:最细粒度划分
  • ik_smart:最少切分