Elasticsearch中文分詞器(elasticsearch-analysis-ik)

中文分詞器

  • 安裝IK分詞器(支持中文分詞)
    • IK分詞器提供了源代碼(maven項目), 經過打包生成zip文件

{
  "analyzer": "ik_max_word",
  "text":     "我是中國人"
}

  • 測試結果
{
  "tokens": [
    {
      "token": "我",
      "start_offset": 0,
      "end_offset": 1,
      "type": "CN_CHAR",
      "position": 0
    },
    {
      "token": "是",
      "start_offset": 1,
      "end_offset": 2,
      "type": "CN_CHAR",
      "position": 1
    },
    {
      "token": "中國人",
      "start_offset": 2,
      "end_offset": 5,
      "type": "CN_WORD",
      "position": 2
    },
    {
      "token": "中國",
      "start_offset": 2,
      "end_offset": 4,
      "type": "CN_WORD",
      "position": 3
    },
    {
      "token": "國人",
      "start_offset": 3,
      "end_offset": 5,
      "type": "CN_WORD",
      "position": 4
    }
  ]
}
相關文章
相關標籤/搜索