elasticsearch-analysis-jieba

码农软件 · 软件分类 · 中文分词库 · 2019-08-29 06:41:22

软件介绍

结巴分词插件(for elasticsearch),目前支持0.90.*以上版本

----------------------------------------------------
| Jieba Chinese Analysis Plugin | ElasticSearch    |
----------------------------------------------------
| 0.0.1-SNAPSHOT (master)       | 0.90.*           |
----------------------------------------------------

支持两种分词模式(seg_mode):

  1. index 索引模式,搜索引擎建立索引阶段使用该模式
  2. search 搜索模式,搜索时采用该种模式分词

使用说明

创建mapping

#!/bin/bash curl -XDELETE '0:9200/test/';echo curl -XPUT '0:9200/test/' -d ' {  "index" : {  "number_of_shards": 1,  "number_of_replicas": 0,  "analysis" : {  "analyzer" : {  "jieba_search" : {  "type" : "jieba",  "seg_mode" : "search",  "stop" : true  },  "jieba_index" : {  "type" : "jieba",  "seg_mode" : "index",  "stop" : true  }  }  }  } }';echo 

test

# index mode curl '0:9200/test/_analyze?analyzer=jieba_index' -d '中华人民共和国';echo 

结果:

{ "tokens": [ { "token": "中华", "start_offset": 0, "end_offset": 2, "type": "word", "position": 1 }, { "token": "华人", "start_offset": 1, "end_offset": 3, "type": "word", "position": 2 }, { "token": "人民", "start_offset": 2, "end_offset": 4, "type": "word", "position": 3 }, { "token": "共和", "start_offset": 4, "end_offset": 6, "type": "word", "position": 4 }, { "token": "共和国", "start_offset": 4, "end_offset": 7, "type": "word", "position": 5 }, { "token": "中华人民共和国", "start_offset": 0, "end_offset": 7, "type": "word", "position": 6 } ] } 
# search mode curl '0:9200/test/_analyze?analyzer=jieba_search' -d '中华人民共和国';echo 

结果:

{ "tokens": [ { "token": "中华人民共和国", "start_offset": 0, "end_offset": 7, "type": "word", "position": 1 } ] } 

本文地址:https://www.codercto.com/soft/d/13399.html

Linux程序设计

Linux程序设计

Neil Matthew、Richard Stones / 陈健、宋健建 / 人民邮电出版社 / 201005 / 99.00元

时至今日,Linux系统已经从一个个人作品发展为可以用于各种关键任务的成熟、高效和稳定的操作系统,因为具备跨平台、开源、支持众多应用软件和网络协议等优点,它得到了各大主流软硬件厂商的支持,也成为广大程序设计人员理想的开发平台。 本书是Linux程序设计领域的经典名著,以简单易懂、内容全面和示例丰富而受到广泛好评。中文版前两版出版后,在国内的Linux爱好者和程序员中也引起了强烈反响,这一热潮......一起来看看 《Linux程序设计》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具