数据挖掘以及搜索引擎经典pptchap6.ppt_第1页
数据挖掘以及搜索引擎经典pptchap6.ppt_第2页
数据挖掘以及搜索引擎经典pptchap6.ppt_第3页
数据挖掘以及搜索引擎经典pptchap6.ppt_第4页
数据挖掘以及搜索引擎经典pptchap6.ppt_第5页
已阅读5页,还剩30页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

文件索引建立,为什么需要索引,对海量数据,全文存储在检索上太耗时,无法再内存中进行操作。 索引可以快速的对包含关键词的文档进行定位,查询时间可以和文档长度无关,只和查询词长度有关。,和数据库索引的区别,数据库只索引某几项,而信息检索需要都索引。因为数据库的查询句是固定的,而信息检索是变化的。 索引是基于未来可能查询的“项”(terms). 来自文本中的所有词。,Indexes: 实现方法,有代表性的方法 Bitmaps (位图) Signature files (签字文件) Inverted files (倒排文件) 索引要素 词 :Dictionary (lexicon) 元数据 document ids word positions,No positional data indexed,Indexes: Bitmaps,本质上是文档的向量表示,若文档包含某一特征词,则对应的位置上标记1,否则为0.,Signature Files,对每个项,给出长度为s的向量(hash函数值) 把一篇文档中的所有词的向量进行OR操作,得到的向量为文档的签名。 长文档肯定成为问题,解决的方法是分块签字。,Signature File Example,Signature File Example,Indexes: Signature Files,查询方法 若查询词可以在文档中找到签名对应的1,则认为文档中包含这个项。,Indexes: 倒排文档,目前最常用的索引方法 起源为书中术语检索的方法 Eg. Computer page 8, line 12,Inverted Files,Inverted Files,Word-Level Inverted File,倒排文档的搜索算法,Find query elements (terms) in the lexicon Retrieve postings for each lexicon entry Manipulate postings according to the retrieval model,Word-Level Inverted File,Query: 1.porridge & pot (BOOL) 2.“porridge pot” (BOOL) 3. porridge pot (VSM),Lexicon词汇表,Posting 记录表,Answer,倒排文件的建立,采用合适的数据结构,建立检索词汇表。对英文主要采用被称为trie的数据结构。 1) 前面给出的词汇和记录表在一起的形式。但可能词汇表本身很大 2) 词汇表和记录表分开,用指针给出对应关系。 3)词汇表和记录表分开,但没有直接连接指针,而是中间用一个数据结构把两者联系起来。,词汇表结构,基于 Heaps 的定理,可能词汇表的尺寸很大. 常采用两种方法存放 Hash table O(1) 查找时间和接近常数时间的处理冲突。 扩展比较麻烦 B-Tree 可以利用磁盘存储空间.查找时间快。 O(log n) 的查找时间,易于扩展。 Trie,In-memory Inversion Algorithm,Create an empty lexicon For each document d in the collection, Read document, parse into terms For each indexing term t, fd,t = frequency of t in d If t is not in lexicon, insert it Append to postings list for t Output each postings list into inverted file For each term, start new file entry Append each to the entry Compress entry Write entry out to file.,长文档的处理,分成若干块(chunk)处理 利用归并算法形成最后的索引,Idea 1: Partition the text,Invert a chunk of the text at a time Then, merge each sub-indexes into one complete index,Trie,In IR we need to record the position that a word appear in a document and the time it appears. We hope we can check if a word w in a document in O(|w|) time regardness how many words in the document.,trie,令S是取自的n个串的集合,d = | |,满足S中任意串不是另一串的前缀。S的一个标准trie是一有序树,满足: 除根外,每个定点的标记是中的字符 T中的内部顶点的排序按的顺序 T有n个叶子顶点,从根到叶子的路径的顶点标记对应S中的一个串。,n=8,The searching algorithm,Starting at the root, follow the path that matches the chars of the word in a trie. If a leaf node is reached, success else there is no the word in the trie,Record the position of a word in a trie,A compressed trie,s 下标 数组的起终下标,s,e,e,b,e,ar,ll,id,u,y,ll,hear,ll,to,ck,p,中文的trie怎么做,拼音 ? 汉字组合 汉语词典 和中文的分词有关?,Summary,Common implementations of indexes Bitmap, signature file, inverted file Common index components Lexicon & postings Inverted Search Algorithm Inversion algorithm Inverted file access optimizations co

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论