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

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


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

Modified Files:
      Tag: Zope-2_4-branch
	GlobbingLexicon.py 
Log Message:
Added new unit test framework, changed several test suites to use it.


=== Packages/SearchIndex/GlobbingLexicon.py 1.9.32.1 => 1.9.32.2 ===
     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