org.wltea.analyzer.dic
类 Dictionary

java.lang.Object
  继承者 org.wltea.analyzer.dic.Dictionary

public class Dictionary
extends java.lang.Object

词典管理类,单子模式


方法摘要
 void addWords(java.util.Collection<java.lang.String> words)
          批量加载新词条
 void disableWords(java.util.Collection<java.lang.String> words)
          批量移除(屏蔽)词条
static Dictionary getSingleton()
          获取词典单子实例
static Dictionary 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,继续向下匹配
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

initial

public static Dictionary initial(Configuration cfg)
词典初始化 由于IK Analyzer的词典采用Dictionary类的静态方法进行词典初始化 只有当Dictionary类被实际调用时,才会开始载入词典, 这将延长首次分词操作的时间 该方法提供了一个在应用加载阶段就初始化字典的手段

返回:
Dictionary

getSingleton

public static Dictionary getSingleton()
获取词典单子实例

返回:
Dictionary 单例对象

addWords

public void addWords(java.util.Collection<java.lang.String> words)
批量加载新词条

参数:
words - Collection词条列表

disableWords

public void disableWords(java.util.Collection<java.lang.String> words)
批量移除(屏蔽)词条

参数:
words -

matchInMainDict

public Hit matchInMainDict(char[] charArray)
检索匹配主词典

参数:
charArray -
返回:
Hit 匹配结果描述

matchInMainDict

public Hit matchInMainDict(char[] charArray,
                           int begin,
                           int length)
检索匹配主词典

参数:
charArray -
begin -
length -
返回:
Hit 匹配结果描述

matchInQuantifierDict

public Hit matchInQuantifierDict(char[] charArray,
                                 int begin,
                                 int length)
检索匹配量词词典

参数:
charArray -
begin -
length -
返回:
Hit 匹配结果描述

matchWithHit

public Hit matchWithHit(char[] charArray,
                        int currentIndex,
                        Hit matchedHit)
从已匹配的Hit中直接取出DictSegment,继续向下匹配

参数:
charArray -
currentIndex -
matchedHit -
返回:
Hit

isStopWord

public boolean isStopWord(char[] charArray,
                          int begin,
                          int length)
判断是否是停止词

参数:
charArray -
begin -
length -
返回:
boolean