Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
南宫伊儿
elasticsearch-analysis-ik
提交
a542bbc2
E
elasticsearch-analysis-ik
项目概览
南宫伊儿
/
elasticsearch-analysis-ik
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
elasticsearch-analysis-ik
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a542bbc2
编写于
11月 12, 2013
作者:
weixin_43283383
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lowercased before check the some dict
上级
6480991b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
12 deletion
+17
-12
README.textile
README.textile
+7
-2
pom.xml
pom.xml
+2
-2
src/main/java/org/wltea/analyzer/dic/Dictionary.java
src/main/java/org/wltea/analyzer/dic/Dictionary.java
+8
-8
未找到文件。
README.textile
浏览文件 @
a542bbc2
...
@@ -35,7 +35,7 @@ https://github.com/medcl/elasticsearch-analysis-ik/blob/master/config/ik/IKAnaly
...
@@ -35,7 +35,7 @@ https://github.com/medcl/elasticsearch-analysis-ik/blob/master/config/ik/IKAnaly
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<properties>
<comment>IK Analyzer 扩展配置</comment>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">custom/mydict.dic;custom/single_word_low_freq.dic</entry>
<entry key="ext_dict">custom/mydict.dic;custom/single_word_low_freq.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords">custom/ext_stopword.dic</entry>
<entry key="ext_stopwords">custom/ext_stopword.dic</entry>
...
@@ -197,4 +197,9 @@ here is the query result
...
@@ -197,4 +197,9 @@ here is the query result
</pre>
</pre>
have fun.
have fun.
\ No newline at end of file
常见问题:
1.自定义词典为什么没有生效?
清确保你的扩展词典的文本格式为UTF8编码
\ No newline at end of file
pom.xml
浏览文件 @
a542bbc2
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.elasticsearch
</groupId>
<groupId>
org.elasticsearch
</groupId>
<artifactId>
elasticsearch-analysis-ik
</artifactId>
<artifactId>
elasticsearch-analysis-ik
</artifactId>
<version>
1.2.
3
</version>
<version>
1.2.
4
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<description>
IK Analyzer for ElasticSearch
</description>
<description>
IK Analyzer for ElasticSearch
</description>
<inceptionYear>
2009
</inceptionYear>
<inceptionYear>
2009
</inceptionYear>
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
</parent>
</parent>
<properties>
<properties>
<elasticsearch.version>
0.90.
6
</elasticsearch.version>
<elasticsearch.version>
0.90.
2
</elasticsearch.version>
</properties>
</properties>
<repositories>
<repositories>
...
...
src/main/java/org/wltea/analyzer/dic/Dictionary.java
浏览文件 @
a542bbc2
...
@@ -25,14 +25,14 @@
...
@@ -25,14 +25,14 @@
*/
*/
package
org.wltea.analyzer.dic
;
package
org.wltea.analyzer.dic
;
import
java.io.*
;
import
java.util.Collection
;
import
java.util.List
;
import
org.elasticsearch.common.logging.ESLogger
;
import
org.elasticsearch.common.logging.ESLogger
;
import
org.elasticsearch.common.logging.Loggers
;
import
org.elasticsearch.common.logging.Loggers
;
import
org.wltea.analyzer.cfg.Configuration
;
import
org.wltea.analyzer.cfg.Configuration
;
import
java.io.*
;
import
java.util.Collection
;
import
java.util.List
;
/**
/**
* 词典管理类,单子模式
* 词典管理类,单子模式
*/
*/
...
@@ -152,7 +152,7 @@ public class Dictionary {
...
@@ -152,7 +152,7 @@ public class Dictionary {
* @return Hit 匹配结果描述
* @return Hit 匹配结果描述
*/
*/
public
Hit
matchInMainDict
(
char
[]
charArray
,
int
begin
,
int
length
){
public
Hit
matchInMainDict
(
char
[]
charArray
,
int
begin
,
int
length
){
return
singleton
.
_MainDict
.
match
(
charArray
,
begin
,
length
);
return
singleton
.
_MainDict
.
match
(
String
.
valueOf
(
charArray
).
trim
().
toLowerCase
().
toCharArray
()
,
begin
,
length
);
}
}
/**
/**
...
@@ -160,7 +160,7 @@ public class Dictionary {
...
@@ -160,7 +160,7 @@ public class Dictionary {
* @return Hit 匹配结果描述
* @return Hit 匹配结果描述
*/
*/
public
Hit
matchInQuantifierDict
(
char
[]
charArray
,
int
begin
,
int
length
){
public
Hit
matchInQuantifierDict
(
char
[]
charArray
,
int
begin
,
int
length
){
return
singleton
.
_QuantifierDict
.
match
(
charArray
,
begin
,
length
);
return
singleton
.
_QuantifierDict
.
match
(
String
.
valueOf
(
charArray
).
trim
().
toLowerCase
().
toCharArray
()
,
begin
,
length
);
}
}
...
@@ -179,7 +179,7 @@ public class Dictionary {
...
@@ -179,7 +179,7 @@ public class Dictionary {
* @return boolean
* @return boolean
*/
*/
public
boolean
isStopWord
(
char
[]
charArray
,
int
begin
,
int
length
){
public
boolean
isStopWord
(
char
[]
charArray
,
int
begin
,
int
length
){
return
singleton
.
_StopWords
.
match
(
charArray
,
begin
,
length
).
isMatch
();
return
singleton
.
_StopWords
.
match
(
String
.
valueOf
(
charArray
).
trim
().
toLowerCase
().
toCharArray
()
,
begin
,
length
).
isMatch
();
}
}
/**
/**
...
@@ -253,7 +253,7 @@ public class Dictionary {
...
@@ -253,7 +253,7 @@ public class Dictionary {
String
theWord
=
null
;
String
theWord
=
null
;
do
{
do
{
theWord
=
br
.
readLine
();
theWord
=
br
.
readLine
();
if
(
theWord
!=
null
&&
!
""
.
equals
(
theWord
.
trim
()))
{
if
(
theWord
!=
null
&&
!
""
.
equals
(
theWord
.
trim
()))
{
//加载扩展词典数据到主内存词典中
//加载扩展词典数据到主内存词典中
_MainDict
.
fillSegment
(
theWord
.
trim
().
toLowerCase
().
toCharArray
());
_MainDict
.
fillSegment
(
theWord
.
trim
().
toLowerCase
().
toCharArray
());
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录