Double-Array Trie分词词典简述
http://www.xuebuyuan.com/1991441.html
一、TRIE树简介(以下简称T树)
check[base[s] + c] == s
t = base[s] + c;
if check[t] = s then
next state = t;
else
fail;
endifProcedure daInsertBranch(String key)
begin
index = root_index;
for i = 0 to key.length()
begin
character c = key.get(i)
t = base[index] + c; 1
[ 。。。此处执行冲突处理。。。]
check[t] = index; 2
index = t;
end
base[t] *= -1;
end
Procedure intdaFindBase(character c, int oldbase_index)
begin
if check[ base[oldbase_index] + c ] != 0 then
begin
foreach character a in ALPHABET(字母表)
begin
if check[ base[oldbase_index] + a ] != 0 then
Add a to child_list;
end
Add c to child_list;
base[oldbase_index]++;
while ( not fit each character )
begin
base[oldbase_index]++;
end
end
return base[oldbase_index];
end
// 重新分配
Procedure intdaRelocateBase (int old_index, int new_index)
begin
//拷贝所有节点到新的位置,并修改被拷贝节点的所有子节点的check值以保证
//在移动之后仍然是其子节点
foreach character c in child_list
begin
copy cell from old_index to new_index
begin
get all childs of old_index;
check[child] = new_index;
end
//释放所有旧的节点
free old_index cell;
end
base[oldbase_index] = newbase;
end
冲突处理位于3)构造中的 2 前面
Double-Array Trie分词词典简述的更多相关文章
- 双数组字典树(Double Array Trie)
参考文献 1.双数组字典树(DATrie)详解及实现 2.小白详解Trie树 3.论文<基于双数组Trie树算法的字典改进和实现> DAT的基本内容介绍这里就不展开说了,从Trie过来的同 ...
- double array trie 插入结点总结
双数组Trie树索引的可操作性研究.pdf 提示:任一状态点的移动,会影响其Trie树中父节点的base值的选择以及兄弟结点位置的变动,而兄弟结点的移动又须变更相应的子节点的check值. 设待插入的 ...
- sphinx索引分析——文件格式和字典是double array trie 检索树,索引存储 – 多路归并排序,文档id压缩 – Variable Byte Coding
1 概述 这是基于开源的sphinx全文检索引擎的架构代码分析,本篇主要描述index索引服务的分析.当前分析的版本 sphinx-2.0.4 2 index 功能 3 文件表 4 索引文件结构 4. ...
- Double Array Trie 的Python实现
不多介绍,可自行Google,或者其它关键词: "datrie" 放代码链接: double_array_trie.py 因为也是一段学习代码,参考的文章都记在里面了,主要参考gi ...
- 【转】B树、B-树、B+树、B*树、红黑树、 二叉排序树、trie树Double Array 字典查找树简介
B 树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right): 2.所有结点存储一个关键字: 3.非叶子结点的左指针指向小于其关键字的子树,右指针指向大于其关键字的子树: 如: ...
- NLP+词法系列(二)︱中文分词技术简述、深度学习分词实践(CIPS2016、超多案例)
摘录自:CIPS2016 中文信息处理报告<第一章 词法和句法分析研究进展.现状及趋势>P4 CIPS2016 中文信息处理报告下载链接:http://cips-upload.bj.bce ...
- Save and read double array in a binary file
;} 32 bytes read 9.5 -3.4 1 2.1 "
- Solr 5.x集成中文分词word,mmseg4j
使用标准分词器,如图: 使用word分词器 下载word-1.3.jar,注意solr的版本和word分词的版本 将文件word-1.3.jar拷贝至文件夹C:\workspace\Tomcat7.0 ...
- 双数组trie树的基本构造及简单优化
一 基本构造 Trie树是搜索树的一种,来自英文单词"Retrieval"的简写,可以建立有效的数据检索组织结构,是中文匹配分词算法中词典的一种常见实现.它本质上是一个确定的有限状 ...
随机推荐
- Codeforces Round #258 (Div. 2) E. Devu and Flowers 容斥
E. Devu and Flowers 题目连接: http://codeforces.com/contest/451/problem/E Description Devu wants to deco ...
- spring-boot parent变更为依赖方式
原parent继承方式 <parent> <groupId>org.springframework.boot</groupId> <artifactId> ...
- spring-boot 速成(6) 整合disconf
spring-boot虽然不推荐使用xml文件做为配置文件,但是并没有把路堵死,所以与disconf的整合,仍旧可以沿用之前的xml方式来处理. 一.在Application类上用注解导入xml pa ...
- 让IIS支持10万并发
适用的IIS版本:IIS 7.0, IIS 7.5, IIS 8.0 适用的Windows版本:Windows Server 2008, Windows Server 2008 R2, Windows ...
- HDU 4751 Divide Groups (2013南京网络赛1004题,判断二分图)
Divide Groups Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- Both - Either - Neither English Grammar
http://www.grammar.cl/english/both-either-neither.htm Both, Either, Neither Summary Chart We use bot ...
- leetcode 题解 || Valid Parentheses 问题
problem: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if ...
- 华为正在力挺的NB-IoT是什么鬼! - 全文
NB-IoT,Niubility Internet of Thing,即牛掰的物联网技术. 关于物联网,小编想从2款很有趣的应用说起. 这不是在播限制级.这是Nake Labs推出的3D健身镜,这款智 ...
- 使用HttpClient消费ASP.NET Web API服务
本篇体验使用HttpClient消费ASP.NET Web API服务,例子比较简单. 依次点击"文件","新建","项目". 选择&quo ...
- ArcGIS Desktop水文计算
根据DEM数据,可以做流域.流向.等级河流划分. 网络资源的方位位置: , Click here to visit. 一.一些概念 二.水文分析工具集概念