[Zope-Checkins] CVS: Packages/SearchIndex - GlobbingLexicon.py:1.11

Evan Simpson evan@cvs.zope.org
Mon, 6 Aug 2001 13:27:31 -0400


Update of /cvs-repository/Packages/SearchIndex
In directory cvs.zope.org:/tmp/cvs-serv2303

Modified Files:
	GlobbingLexicon.py 
Log Message:
Merge unit test changes from 2.4 branch


=== Packages/SearchIndex/GlobbingLexicon.py 1.10 => 1.11 ===
     def createDigrams(self, word):
         """Returns a list with the set of digrams in the word."""
-        digrams = []
+        digrams = list(word)
+        digrams.append(self.eow)
+        last = self.eow
 
-        digrams.append(self.eow + word[0])    # Mark the beginning
-
-        for i in range(1,len(word)):
-            digrams.append(word[i-1:i+1])
-
-        digrams[-1] = digrams[-1] + self.eow  # Mark the end
+        for i in range(len(digrams)):
+            last, digrams[i] = digrams[i], last + digrams[i]
 
         return digrams