[Zope-CVS] CVS: Products/ZCTextIndex - Index.py:1.1.2.17

Tim Peters tim.one@comcast.net
Fri, 3 May 2002 01:34:02 -0400


Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv26137

Modified Files:
      Tag: TextIndexDS9-branch
	Index.py 
Log Message:
_get_frequencies():  Now it's natural to map() doc_term_weight over
the counts instead of calling it "by hand" len(d) times.


=== Products/ZCTextIndex/Index.py 1.1.2.16 => 1.1.2.17 ===
         Wsquares = 0.
         freqs = []
-        for count in d.values():
-            f = doc_term_weight(count)
+        for f in map(doc_term_weight, d.values()):
             Wsquares += f * f
             freqs.append(scaled_int(f))
         return d.keys(), freqs, scaled_int(math.sqrt(Wsquares))