| Modifier and Type | Method and Description |
|---|---|
static TreeMap<String,CoreDictionary.Attribute> |
IOUtil.loadDictionary(String... pathArray)
加载词典,词典必须遵守HanLP核心词典格式
|
| Modifier and Type | Method and Description |
|---|---|
static void |
IOUtil.loadDictionary(BufferedReader br,
TreeMap<String,CoreDictionary.Attribute> storage,
boolean isCSV,
Nature defaultNature)
将一个BufferedReader中的词条加载到词典
|
| Modifier and Type | Field and Description |
|---|---|
DoubleArrayTrie<CoreDictionary.Attribute> |
DynamicCustomDictionary.dat
用于储存文件中的词条
|
BinTrie<CoreDictionary.Attribute> |
DynamicCustomDictionary.trie
用于储存用户动态插入词条的二分trie树
|
static DoubleArrayTrie<CoreDictionary.Attribute> |
CoreDictionary.trie |
| Modifier and Type | Method and Description |
|---|---|
static CoreDictionary.Attribute |
CoreDictionary.Attribute.create(ByteArray byteArray,
Nature[] natureIndexArray)
从字节流中加载
|
static CoreDictionary.Attribute |
CoreDictionary.Attribute.create(String natureWithFrequency) |
static CoreDictionary.Attribute |
CoreDictionary.get(int wordID)
获取条目
|
static CoreDictionary.Attribute |
CustomDictionary.get(String key)
查单词
|
CoreDictionary.Attribute |
DynamicCustomDictionary.get(String key)
查单词
|
static CoreDictionary.Attribute |
CoreDictionary.get(String key)
获取条目
|
| Modifier and Type | Method and Description |
|---|---|
static LinkedList<Map.Entry<String,CoreDictionary.Attribute>> |
CustomDictionary.commonPrefixSearch(char[] chars,
int begin)
前缀查询
|
LinkedList<Map.Entry<String,CoreDictionary.Attribute>> |
DynamicCustomDictionary.commonPrefixSearch(char[] chars,
int begin)
前缀查询
|
static LinkedList<Map.Entry<String,CoreDictionary.Attribute>> |
CustomDictionary.commonPrefixSearch(String key)
前缀查询
|
LinkedList<Map.Entry<String,CoreDictionary.Attribute>> |
DynamicCustomDictionary.commonPrefixSearch(String key)
前缀查询
|
static BinTrie<CoreDictionary.Attribute> |
CustomDictionary.getTrie()
Deprecated.
谨慎操作,有可能废弃此接口
|
BinTrie<CoreDictionary.Attribute> |
DynamicCustomDictionary.getTrie()
Deprecated.
谨慎操作,有可能废弃此接口
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
CustomDictionary.load(String path,
Nature defaultNature,
TreeMap<String,CoreDictionary.Attribute> map,
LinkedHashSet<Nature> customNatureCollector)
加载用户词典(追加)
|
static boolean |
DynamicCustomDictionary.load(String path,
Nature defaultNature,
TreeMap<String,CoreDictionary.Attribute> map,
LinkedHashSet<Nature> customNatureCollector)
加载用户词典(追加)
|
static boolean |
CustomDictionary.loadDat(String path,
DoubleArrayTrie<CoreDictionary.Attribute> dat) |
static boolean |
DynamicCustomDictionary.loadDat(String path,
DoubleArrayTrie<CoreDictionary.Attribute> dat) |
static boolean |
CustomDictionary.loadDat(String path,
String[] customDicPath,
DoubleArrayTrie<CoreDictionary.Attribute> dat)
从磁盘加载双数组
|
static boolean |
DynamicCustomDictionary.loadDat(String path,
String[] customDicPath,
DoubleArrayTrie<CoreDictionary.Attribute> dat)
从磁盘加载双数组
|
static boolean |
CustomDictionary.loadMainDictionary(String mainPath,
String[] path,
DoubleArrayTrie<CoreDictionary.Attribute> dat,
boolean isCache)
加载词典
|
static boolean |
DynamicCustomDictionary.loadMainDictionary(String mainPath,
String[] path,
DoubleArrayTrie<CoreDictionary.Attribute> dat,
boolean isCache)
加载词典
|
static void |
CustomDictionary.parseLongestText(String text,
AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
最长匹配
|
void |
DynamicCustomDictionary.parseLongestText(String text,
AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
最长匹配
|
static void |
CustomDictionary.parseText(char[] text,
AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
解析一段文本(目前采用了BinTrie+DAT的混合储存形式,此方法可以统一两个数据结构)
|
void |
DynamicCustomDictionary.parseText(char[] text,
AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
解析一段文本(目前采用了BinTrie+DAT的混合储存形式,此方法可以统一两个数据结构)
|
static void |
CustomDictionary.parseText(String text,
AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
解析一段文本(目前采用了BinTrie+DAT的混合储存形式,此方法可以统一两个数据结构)
|
void |
DynamicCustomDictionary.parseText(String text,
AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
解析一段文本(目前采用了BinTrie+DAT的混合储存形式,此方法可以统一两个数据结构)
|
| Constructor and Description |
|---|
DynamicCustomDictionary(DoubleArrayTrie<CoreDictionary.Attribute> dat,
BinTrie<CoreDictionary.Attribute> trie,
String[] path)
使用高级数据结构构造词典对象,并加载指定路径的词典
|
DynamicCustomDictionary(DoubleArrayTrie<CoreDictionary.Attribute> dat,
BinTrie<CoreDictionary.Attribute> trie,
String[] path)
使用高级数据结构构造词典对象,并加载指定路径的词典
|
| Modifier and Type | Field and Description |
|---|---|
static CoreDictionary.Attribute |
NRConstant.ATTRIBUTE
本词典专注的词的属性
|
static CoreDictionary.Attribute |
PersonDictionary.ATTRIBUTE |
| Modifier and Type | Method and Description |
|---|---|
static CoreDictionary.Attribute |
CharacterBasedSegment.guessAttribute(Term term)
查询或猜测一个词语的属性,
先查词典,然后对字母、数字串的属性进行判断,最后猜测未登录词
|
| Modifier and Type | Method and Description |
|---|---|
protected List<Vertex> |
Segment.combineByCustomDictionary(List<Vertex> vertexList,
DoubleArrayTrie<CoreDictionary.Attribute> dat)
使用用户词典合并粗分结果
|
protected List<Vertex> |
Segment.combineByCustomDictionary(List<Vertex> vertexList,
DoubleArrayTrie<CoreDictionary.Attribute> dat,
WordNet wordNetAll)
使用用户词典合并粗分结果,并将用户词语收集到全词图中
|
| Modifier and Type | Field and Description |
|---|---|
CoreDictionary.Attribute |
Vertex.attribute
词的属性,谨慎修改属性内部的数据,因为会影响到字典
如果要修改,应当new一个Attribute |
| Modifier and Type | Method and Description |
|---|---|
CoreDictionary.Attribute |
Vertex.getAttribute()
获取词的属性
|
| Constructor and Description |
|---|
Vertex(char realWord,
CoreDictionary.Attribute attribute) |
Vertex(String realWord,
CoreDictionary.Attribute attribute)
真实词与编译词相同时候的构造函数
|
Vertex(String realWord,
CoreDictionary.Attribute attribute,
int wordID) |
Vertex(String word,
String realWord,
CoreDictionary.Attribute attribute)
最复杂的构造函数
|
Vertex(String word,
String realWord,
CoreDictionary.Attribute attribute,
int wordID) |
| Constructor and Description |
|---|
Vertex(Map.Entry<String,CoreDictionary.Attribute> entry)
通过一个键值对方便地构造节点
|
| Modifier and Type | Field and Description |
|---|---|
DoubleArrayTrie<CoreDictionary.Attribute> |
DoubleArrayTrieSegment.trie
分词用到的trie树,可以直接赋值为自己的trie树(赋值操作不保证线程安全)
|
| Modifier and Type | Method and Description |
|---|---|
AhoCorasickDoubleArrayTrie<CoreDictionary.Attribute> |
AhoCorasickDoubleArrayTrieSegment.getTrie() |
| Modifier and Type | Method and Description |
|---|---|
void |
AhoCorasickDoubleArrayTrieSegment.setTrie(AhoCorasickDoubleArrayTrie<CoreDictionary.Attribute> trie) |
| Constructor and Description |
|---|
AhoCorasickDoubleArrayTrieSegment(AhoCorasickDoubleArrayTrie<CoreDictionary.Attribute> trie) |
AhoCorasickDoubleArrayTrieSegment(TreeMap<String,CoreDictionary.Attribute> dictionary) |
DoubleArrayTrieSegment(DoubleArrayTrie<CoreDictionary.Attribute> trie)
根据自己的trie树构造分词器
|
| Modifier and Type | Method and Description |
|---|---|
DoubleArrayTrie<CoreDictionary.Attribute> |
ViterbiSegment.getDat() |
| Modifier and Type | Method and Description |
|---|---|
void |
ViterbiSegment.setDat(DoubleArrayTrie<CoreDictionary.Attribute> dat) |
| Modifier and Type | Method and Description |
|---|---|
protected List<CoreDictionary.Attribute> |
AbstractLexicalAnalyzer.combineWithCustomDictionary(List<String> vertexList)
使用用户词典合并粗分结果
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
AbstractLexicalAnalyzer.acceptCustomWord(int begin,
int end,
CoreDictionary.Attribute value)
Deprecated.
自1.6.7起废弃,强制模式下为最长匹配,否则按分词结果合并
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
AbstractLexicalAnalyzer.segment(String sentence,
String normalized,
List<String> wordList,
List<CoreDictionary.Attribute> attributeList)
分词
|
| Modifier and Type | Method and Description |
|---|---|
static CoreDictionary.Attribute |
LexiconUtility.getAttribute(String word)
从HanLP的词库中提取某个单词的属性(包括核心词典和用户词典)
|
static CoreDictionary.Attribute |
LexiconUtility.getAttribute(Term term)
从HanLP的词库中提取某个单词的属性(包括核心词典和用户词典)
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
LexiconUtility.setAttribute(String word,
CoreDictionary.Attribute attribute)
设置某个单词的属性
|
Copyright © 2014–2021 码农场. All rights reserved.