ElasticSearch(四) ElasticSearch中文分词插件IK的简单测试
先来一个简单的测试
# curl -XPOST "http://192.168.9.155:9200/_analyze?analyzer=standard&pretty" -d 'PHP是世界上最好的语言' //_analyze表示分析分词;analyzer=standard,表示分词方式standard; -d表示测试的一段文字
测试结果
{
"tokens" : [
{
"token" : "php",
"start_offset" : ,
"end_offset" : ,
"type" : "<ALPHANUM>",
"position" :
},
{
"token" : "是",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
},
{
"token" : "世",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
},
{
"token" : "界",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
},
{
"token" : "上",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
},
{
"token" : "最",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
},
{
"token" : "好",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
},
{
"token" : "的",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
},
{
"token" : "语",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
},
{
"token" : "言",
"start_offset" : ,
"end_offset" : ,
"type" : "<IDEOGRAPHIC>",
"position" :
}
]
}
接下来使用我们的IK
ik 带有两个分词器
ik_max_word :会将文本做最细粒度的拆分;尽可能多的拆分出词语,拼接各种可能的组合 。
ik_smart:会做最粗粒度的拆分;已被分出的词语将不会再次被其它词语占有 。
curl -XPOST "http://192.168.9.155:9200/_analyze?analyzer=ik_smart&pretty" -d 'PHP是世界上最好的语言' //ik_smart方式
{
"tokens" : [
{
"token" : "php",
"start_offset" : ,
"end_offset" : ,
"type" : "ENGLISH",
"position" :
},
{
"token" : "世界上",
"start_offset" : ,
"end_offset" : ,
"type" : "CN_WORD",
"position" :
},
{
"token" : "最好",
"start_offset" : ,
"end_offset" : ,
"type" : "CN_WORD",
"position" :
},
{
"token" : "语言",
"start_offset" : ,
"end_offset" : ,
"type" : "CN_WORD",
"position" :
}
]
}
curl -XPOST "http://192.168.9.155:9200/_analyze?analyzer=ik_max_word&pretty" -d 'PHP是世界上最好的语言' //ik_max_word方式
{
"tokens" : [
{
"token" : "php",
"start_offset" : ,
"end_offset" : ,
"type" : "ENGLISH",
"position" :
},
{
"token" : "世界上",
"start_offset" : ,
"end_offset" : ,
"type" : "CN_WORD",
"position" :
},
{
"token" : "世界",
"start_offset" : ,
"end_offset" : ,
"type" : "CN_WORD",
"position" :
},
{
"token" : "上",
"start_offset" : ,
"end_offset" : ,
"type" : "CN_CHAR",
"position" :
},
{
"token" : "最好",
"start_offset" : ,
"end_offset" : ,
"type" : "CN_WORD",
"position" :
},
{
"token" : "语言",
"start_offset" : ,
"end_offset" : ,
"type" : "CN_WORD",
"position" :
}
]
}
区别很明显~
ElasticSearch(四) ElasticSearch中文分词插件IK的简单测试的更多相关文章
- Elasticsearch如何安装中文分词插件ik
elasticsearch-analysis-ik 是一款中文的分词插件,支持自定义词库. 安装步骤: 1.到github网站下载源代码,网站地址为:https://github.com/medcl/ ...
- ElasticSearch(三) ElasticSearch中文分词插件IK的安装
正因为Elasticsearch 内置的分词器对中文不友好,会把中文分成单个字来进行全文检索,所以我们需要借助中文分词插件来解决这个问题. 一.安装maven管理工具 Elasticsearch 要使 ...
- Elasticsearch安装中文分词插件ik
Elasticsearch默认提供的分词器,会把每一个汉字分开,而不是我们想要的依据关键词来分词.比如: curl -XPOST "http://localhost:9200/userinf ...
- ElasticSearch 中文分词插件ik 的使用
下载 IK 的版本要与 Elasticsearch 的版本一致,因此下载 7.1.0 版本. 安装 1.中文分词插件下载地址:https://github.com/medcl/elasticsearc ...
- 如何在Elasticsearch中安装中文分词器(IK)和拼音分词器?
声明:我使用的Elasticsearch的版本是5.4.0,安装分词器前请先安装maven 一:安装maven https://github.com/apache/maven 说明: 安装maven需 ...
- ElasticSearch-5.0.0安装中文分词插件IK
Install IK 源码地址:https://github.com/medcl/elasticsearch-analysis-ik,git clone下来. 1.compile mvn packag ...
- 如何在Elasticsearch中安装中文分词器(IK+pinyin)
如果直接使用Elasticsearch的朋友在处理中文内容的搜索时,肯定会遇到很尴尬的问题--中文词语被分成了一个一个的汉字,当用Kibana作图的时候,按照term来分组,结果一个汉字被分成了一组. ...
- ElasticSearch搜索引擎安装配置中文分词器IK插件
近几篇ElasticSearch系列: 1.阿里云服务器Linux系统安装配置ElasticSearch搜索引擎 2.Linux系统中ElasticSearch搜索引擎安装配置Head插件 3.Ela ...
- 沉淀再出发:ElasticSearch的中文分词器ik
沉淀再出发:ElasticSearch的中文分词器ik 一.前言 为什么要在elasticsearch中要使用ik这样的中文分词呢,那是因为es提供的分词是英文分词,对于中文的分词就做的非常不好了 ...
随机推荐
- panzer 电力项目十一--hibernate操作大文本字段Blob和Clob
hibernate操作大文本字段Blob和Clob解决方案: 1.大文本字段Blob和Clob(流); 2.截串存取 第一步: 创建新表:Elec_CommonMsg_Content create t ...
- SPS读书笔记1——均值比较(T检验,方差检验,非参数检验汇总)
均值比较.单样本T检验(One-sample Test))目的:检验单个变量的均值与给定的某个常数是否一致.)判断标准:p<0.05;t>1.98即认为是有显著差异的..独立样本T检验(I ...
- uid-datepicker
$("#txtPODate").daterangepicker({singleDatePicker: true,showDropdowns: true,minDate:'01/01 ...
- 11.Curator扩展库
Recipes组件包含了丰富的Curator应用的组件.但是这些并不是ZooKeeper Recipe的全部.大量的分布式应用已经抽象出了许许多多的的Recipe,其中有些还是可以通过Cura ...
- 170502、linux下配置jdk8
1.下载源码包jdk-8u45-linux-x64.tar.gz(省略) 2.解压 tar -zxvf jdk-8u45-linux-x64.tar.gz 3.配置jdk vi /etc/profil ...
- C# 一、语法结构、注释、命名空间、Main入口点、变量与常量、运算符、流程控制(循环)
一.代码结构 1)一个 C# 程序主要包括以下部分: 命名空间声明(Namespace declaration) 一个 class Class 方法 Class 属性 一个 Main 方法 语句(St ...
- xcode6 下载
百度云下载 http://pan.baidu.com/s/1qWpuIC0提取码:ip9o 苹果下载: http://adcdownload.apple.com//wwdc_2014/xcode_6_ ...
- postfix邮箱服务器修改附件大小限制遇到的问题与解决
Q1:邮件大小限制为30M,发送的附件大小为25M,发送后提示邮件大小超过限制 A:邮箱客户端在发送邮件时会把附件进行base64转码,转码之后邮件大小会超过附件+正文的大小,所以10M的附件在经过转 ...
- tomcat启动报错:注释指定的bean类.与现有的冲突.相同的名称和类
错误: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/business/config ...
- CentOS7安装MySQL 5.7
1.源码包下载 wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.20.tar.gz 2.编译安装 安装依赖包: y ...