小编Gur*_*ngh的帖子

在 Python 中查找嵌套列表的交集?

def query_RR(postings, qtext): 
words = tokenize(qtext) 
allpostings = [postings[w] for w in words]
for a in allpostings: 
print a.keys()
Run Code Online (Sandbox Code Playgroud)

这是查询的结果 [0, 2, 3, 4, 6] [1, 4, 5] [0, 2, 4] [4, 5]

该查询采用用户输入的术语 ('qtext'),对每个标记进行标记化并生成发布列表。

发布列表是嵌套字典的列表(例如 [{0 : 0.68426, 1: 0.26423}, {2: 0.6842332, 0: 0.9823}]。我正在尝试使用键找到这些嵌套字典的交集

python intersection list

1
推荐指数
1
解决办法
743
查看次数

标签 统计

intersection ×1

list ×1

python ×1