问题描述
我目前正在尝试将一个列表的每个元素与另一个列表的每个元素进行比较。时间复杂度为N * N,这是性能的障碍。
循环如下:
#fin_textt is a list which contains strings
for i in (range(len(fin_textt))):
for j in range(i+1,len(fin_textt)):
if(fuzz.ratio(fin_textt[i],fin_textt[j])<90):
continue
else:
dup.append((fin_textt[i],fin_textt[j]))#all reviews which are very similar and have a value 90 and above
在10k数据集上运行上述代码时,给出输出所花费的时间非常大。 请帮助我优化此设置并提高性能。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)