[minlsh] Use an iterator to compute the result set
authorSimon Chabot <simon.chabot@logilab.fr>
Tue, 06 Nov 2012 10:46:30 +0100
changeset 68 a8bea044b5e1
parent 67 e37a33ec5b41
child 69 477442625b03
[minlsh] Use an iterator to compute the result set Don't load all the results at onceā€¦
minhashing.py
--- a/minhashing.py	Tue Nov 06 10:45:10 2012 +0100
+++ b/minhashing.py	Tue Nov 06 10:46:30 2012 +0100
@@ -184,9 +184,9 @@
             print "Progress : %.3f" % (r * 100. / self.sigmatrix.shape[0])
 
         if 0 <= sentenceid < self.sigmatrix.shape[1]:
-            return set(tuple(v) for v in buckets.values()
+            return set(tuple(v) for v in buckets.itervalues()
                        if len(v) > 1 and sentenceid in v)
-        return set(tuple(v) for v in buckets.values() if len(v) > 1)
+        return set(tuple(v) for v in buckets.itervalues() if len(v) > 1)
 
 if __name__ == '__main__':
     from cubes.alignment.normalize import (loadlemmas, simplify)