小曹谈技术之索引&词典结构
来源:互联网 发布:mac 读取exe 编辑:程序博客网 时间:2024/04/30 09:42
基于散列表的索引结构,全匹配
速度快,实现简单,但是不支持部分匹配。
基于前缀树,后缀树的索引结构,部分匹配
一个前缀树(Prefix tree)的实现
http://whiteboxcomputing.com/java/prefix_tree/
In addition to the efficiency, triealso provides flexibility in searching for the closest path in case that thekey is misspelled. For example, by skipping a certain character in the keywhile walking, we can fix the insertion kind of typo. By walking toward all theimmediate children of one node without consuming a character from the key, wecan fix the deletion typo, or even substitution typo if we just drop the keycharacter that has no branch to go and descend to all the immediate children ofthe current node.
一个双Trie树的实现,datrie
http://linux.thai.net/~thep/datrie/datrie.html
Static Double Array Trie (DASTrie):Windows平台可用!
http://www.chokkan.org/software/dastrie/
后缀树
http://www.allisons.org/ll/AlgDS/Tree/Suffix/
可以用来高效地解决求多个字串的最大公共字串,一个字串的最大重复字串等问题。
与前缀树不同,前缀树是预先对待匹配的模式进行处理,建立前缀树。而后缀树是对待处理的文本进行处理!对待处理的文本建立后缀树。
后缀树快速构建算法
http://www.blogjava.net/Files/zellux/SuffixT1withFigs.rar
后缀树的实现:
http://sfxdisk.dead-inside.org/
http://mila.cs.technion.ac.il/~yona/suffix_tree/
倒排索引(Inverted Index)
倒排索引是支持快速找到词(一个词或者多个词)在哪些文件出现过的一种索引结构。Lucene实现的就是倒排索引。
http://lucene.apache.org/
索引的压缩(Compression)
当索引太大了时,需要进行索引的压缩。
常用的压缩方法:
文本压缩: Huffman编码
前缀压缩:Prefix compression,将没有分支的一条路径上的所有顺序节点合并为一个节点。
Suffix Compression
[Aoe1989] alsosuggested a storage compression strategy, by splitting non-branching suffixesinto single string storages, calledtail, so that the restnon-branching steps are reduced into mere string comparison.
With the two separate data structures,double-array branches and suffix-spool tail, key insertion and deletionalgorithms must be modified accordingly.
倒排索引的压缩:
相关论文
Inverted Index Algorithm and Compression Inverted Index
Inverted Index Compression Using Word-Aligned Binary Codes
InvertedIndex Compression and Query Processing with Optimized Document Ordering
索引的清理(Prune)
在大规模数据检索时,当索引太大时,内存中放不下,有必要对索引中的内容进行清理,去掉无用的或者不重要的部分。例如,有些文档,不管怎么检索,都不会被检索结果列出来。
另外,还有一些垃圾网页、作弊网页等,为了提高索引的质量,提升索引检索的性能,提高检索结果的质量,都有必要对建立的索引进行清理工作。
静态索引清理Static Index Pruning
Static Index Pruning for Information Retrieval Systems
http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=C64771EDA9815C9C34D59DBD5358D32E?doi=10.1.1.58.8759&rep=rep1&type=pdf
Entropy-BasedStatic Index Pruning
http://www.springerlink.com/index/20519nq3141n4x33.pdf
动态索引清理 Dynamic Index Pruning
Dynamic indexpruning for effective caching
http://portal.acm.org/citation.cfm?id=1321592
树 vs.数组
在前面介绍了前缀树和后缀树,实际在实现中,前缀数组和后缀数组会更加实用。而且相比于树,数组会占用的空间更小一些。编程实现更简单一些。用数组的话,查找指定的子节点很快,只要 O(1);但是比较费空间。用链表的话,省空间,但是查找子节点比较慢,只能线性地查找。
用倍增算法构造后缀数组,O(n log n)
http://imlazy.ycool.com/post.2011825.html
后缀树和后缀数组
http://imlazy.ycool.com/post.2011818.html
实际上,后缀树就是这种形式:
后缀数组是这种形式:
T11 = i
T8 = ippi
T5 = issippi
T2 = ississippi
T1 = mississippi
T10 = pi
T9 = ppi
T7 = sippi
T4 = sissippi
T6 = ssippi
T3 = ssissippi
多模式匹配
AC算法
http://www.cppblog.com/mythit/archive/2009/04/21/80633.html
自动机理论建立一个Trie数,然后加入类似于KMP的前进数组,这里是fail状态转移,加快多模式匹配的速度。
下面转载一篇百度技术blog上写的多模式匹配的文章:
(一下没找到,等找到后再帖上来-_-!)
to be continued
- 小曹谈技术之索引&词典结构
- lucene结构详解之五词典(tis)及词典索引(tii)信息
- 词典结构
- Java编程词典之打印技术
- lucene索引结构(四)-词典(Term Dictionary)索引文件结构分析
- 汉日词典结构的研究(三)---隐关键字定长双索引的结构
- 词典存储结构分析
- 类Hash结构词典
- Elasticsearch之结构化索引。
- 教育技术术语词典
- 搜索引擎技术内幕之索引
- 全文索引--自定义chinese_lexer词典
- SQL Server2008存储结构之聚集索引
- SQLServer索引结构及其使用之二
- SQLServer索引结构及其使用之三
- SQLServer索引结构及其使用之四
- SQLServer索引结构及其使用之五
- SQLServer索引结构及其使用之六
- 如何成为顶级的程序员
- 在aspx里嵌入播放器.这个是播放flash视频的
- 文本与二进制内容的存取操作
- JS复制文本框内容
- 关于跳过flex的sandbox实现访问本地资源的解决方案
- 小曹谈技术之索引&词典结构
- ibatis对存储过程的调用
- C# 加密方式汇总(摘自http://www.cnblogs.com/heimirror/archive/2008/10/13/1309728.html)
- 耐心乐观精气神
- fscanf返回值
- Windows,Linux启动机制简介
- VC调试总结 zz http://www.cppblog.com/kevinlynx/archive/2008/04/24/47998.html 博客。
- Visual C++ C runtime库名称分析
- Lucene 单域多条件查询