Stay Hungry,Stay Foolish!

index

Index

An index (plural: usually indexes, more rarely indices; see below) is a list of words or phrases ('headings') and associated pointers ('locators') to where useful material relating to that heading can be found in a document or collection of documents. Examples are an index in the back matter of a book and an index that serves as a library catalog.

 

 

 

forward & inverted index

https://www.cnblogs.com/softidea/p/9852048.html

正排索引(forward index)与倒排索引(inverted index)
正排索引(前向索引) 正排索引也称为"前向索引"。

正向索引的结构如下:

       “文档1”的ID > 单词1:出现次数,出现位置列表;单词2:出现次数,出现位置列表;…………。

       “文档2”的ID > 此文档出现的关键词列表。

 

  一般是通过key,去找value。

 

       得到倒排索引的结构如下:

       “关键词1”:“文档1”的ID,“文档2”的ID,…………。

       “关键词2”:带有此关键词的文档ID列表。

 

  从词的关键字,去找文档。

 

倒排索引(Inverted Index)

https://www.cnblogs.com/GrantYu/p/3669062.html

倒排索引(Inverted Index)
 
倒排索引是一种索引结构,它存储了单词与单词自身在一个或多个文档中所在位置之间的映射。
倒排索引通常利用关联数组实现。它拥有两种表现形式:

inverted file index,其表现形式为 {词项,词项所在文档的ID}
full inverted index,其表现形式为 {词项,(词项所在文档的ID,在具体文档中的位置)}

具体实例,假设有三个文档:

    D0 = "it is what it is"
    D1 = "what is it"
    D2 = "it is a banana"

那么,采用inverted file index方式,结果是:
"a": {2}
"banana": {2}
"is": {0, 1, 2}
"it": {0, 1, 2}
"what": {0, 1}

采用full inverted index方式,结果是:

"a":      {(2, 2)}
"banana": {(2, 3)}
"is":     {(0, 1), (0, 4), (1, 1), (2, 1)}
"it":     {(0, 0), (0, 3), (1, 2), (2, 0)}
"what":   {(0, 2), (1, 0)}

 

Python module-Inverted Index

https://legacy.python.org/workshops/1996-11/papers/InvertedIndex.html

Text-search engines provide the ability to quickly search for documents that contain terms in textual data. Commercial text-search engines provide many capabilities but often have large overhead in process size, application complexity, and licensing cost. We have developed a Python module, InvertedIndex, that has a simple Python Application Programming Interface and that provides support for incremental indexing and for stopword, synonym, and stemming databases.

 

posted @ 2019-12-10 22:15  lightsong  阅读(371)  评论(0编辑  收藏  举报
Life Is Short, We Need Ship To Travel