# -*- coding: utf-8 -*-
Str="文档"
wendang=[["你好",0,"搜索引擎",2],["搜索引擎",0,"技术",4,"窥视",6],["你好",0,"搜索",2,"技术",4]]
res={}
for s in wendang:
for j in range(0,len(s),2):
if s[j] not in res:
value=[]
res[s[j]]=value
value_1=res[s[j]]
temp=[]
temp.append(Str+"_"+str(wendang.index(s)+1))
temp.append(s[j+1])
value_1.append(temp)
res[s[j]]=value_1
print(res)
简单建立倒排索引Python实现
最新推荐文章于 2022-11-15 11:28:15 发布