有没有更快的方法来计算两个元组列表之间匹配的第二个元素的数量?
我有这样的元组,我基本上一次循环一个元组:
lstup1 = [('but', '00004722-r'), ('he', '000000NULL'), ('was', '02697725-v'), ('always', '00020280-r'), ('persuade', '00766418-v'), ('out', '02061487-a')]
lstup2 = [(u'But', u'000000NULL'), (u'he', u'000000NULL'), (u'was', u'000000NULL'), (u'always', u'00019339-r'), (u'persuade', u'00766418-v'), (u'out', u'00232862-r')]
for i,j in izip(lstup1,lstup2):
if i[1] == j[1]:
correct+=1
if j[1][-4:] == "NULL"
null+=1
count+=1
print "Accuracy =", str(correct/count), "with", str(null), "NULL tags"