public class Dictionary extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addWords(Collection<String> words)
批量加载新词条
|
void |
disableWords(Collection<String> words)
批量移除(屏蔽)词条
|
static Dictionary |
getSingleton()
获取词典单子实例
|
static void |
initial(Configuration cfg)
词典初始化
由于IK Analyzer的词典采用Dictionary类的静态方法进行词典初始化
只有当Dictionary类被实际调用时,才会开始载入词典,
这将延长首次分词操作的时间
该方法提供了一个在应用加载阶段就初始化字典的手段
|
boolean |
isStopWord(char[] charArray,
int begin,
int length)
判断是否是停止词
|
Hit |
matchInMainDict(char[] charArray)
检索匹配主词典
|
Hit |
matchInMainDict(char[] charArray,
int begin,
int length)
检索匹配主词典
|
Hit |
matchInQuantifierDict(char[] charArray,
int begin,
int length)
检索匹配量词词典
|
Hit |
matchWithHit(char[] charArray,
int currentIndex,
Hit matchedHit)
从已匹配的Hit中直接取出DictSegment,继续向下匹配
|
static void |
reloadDic(List<Reader> inputStreamReaderList)
重新更新词典
由于停用词等不经常变也不建议常增加,故这里只修改动态扩展词库
|
public static void initial(Configuration cfg)
public static Dictionary getSingleton()
public static void reloadDic(List<Reader> inputStreamReaderList)
inputStreamReaderList - 词典文件IO流集合public void addWords(Collection<String> words)
words - 词条列表public void disableWords(Collection<String> words)
public Hit matchInMainDict(char[] charArray)
public Hit matchInMainDict(char[] charArray, int begin, int length)
public Hit matchInQuantifierDict(char[] charArray, int begin, int length)
public Hit matchWithHit(char[] charArray, int currentIndex, Hit matchedHit)
public boolean isStopWord(char[] charArray,
int begin,
int length)
Copyright © 2019. All rights reserved.