Skip to content

Commit

Permalink
Use the izip import
Browse files Browse the repository at this point in the history
  • Loading branch information
xim committed Feb 28, 2012
1 parent e771691 commit dcdf509
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nltk/metrics/scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def accuracy(reference, test):
"""
if len(reference) != len(test):
raise ValueError("Lists must have the same length.")
return float(sum(x == y for x, y in zip(reference, test))) / len(test)
return float(sum(x == y for x, y in izip(reference, test))) / len(test)

def precision(reference, test):
"""
Expand Down Expand Up @@ -131,7 +131,7 @@ def log_likelihood(reference, test):

# Return the average value of dist.logprob(val).
total_likelihood = sum(dist.logprob(val)
for (val, dist) in zip(reference, test))
for (val, dist) in izip(reference, test))
return total_likelihood/len(reference)

def approxrand(a, b, **kwargs):
Expand Down

0 comments on commit dcdf509

Please sign in to comment.