[Zope-CVS] CVS: Products/ZCTextIndex - IPipelineElement.py:1.1.2.2 ISplitter.py:1.1.2.2 Lexicon.py:1.1.2.2
Barry Warsaw
barry@wooz.org
Thu, 2 May 2002 14:56:36 -0400
Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv18342
Modified Files:
Tag: TextIndexDS9-branch
IPipelineElement.py ISplitter.py Lexicon.py
Log Message:
Change all the interfaces from using __call__() to using process().
__call__()'s are too expensive and too cute.
=== Products/ZCTextIndex/IPipelineElement.py 1.1.2.1 => 1.1.2.2 ===
class IPipelineElement(Interface):
- def __call__(source):
+ def process(source):
"""Provide a text processing step.
Process a source sequence of words into a result sequence.
=== Products/ZCTextIndex/ISplitter.py 1.1.2.1 => 1.1.2.2 ===
#
##############################################################################
-"""
-
-Revision information:
-$Id$
-"""
from Interface import Base as Interface
class ISplitter(Interface):
"""A splitter."""
- def __call__(text):
+ def process(text):
"""Run the splitter over the input text, returning a list of terms."""
=== Products/ZCTextIndex/Lexicon.py 1.1.2.1 => 1.1.2.2 ===
def sourceToWordIds(self, text):
- last = self.__splitter(text)
+ last = self.__splitter.process(text)
for element in self.__pipeline:
- last = element(last)
+ last = element.process(last)
wids = []
for word in last:
wids.append(self._getWordIdCreate(word))
return wids
def termToWordIds(self, text):
- last = self.__splitter(text)
+ last = self.__splitter.process(text)
for element in self.__pipeline:
- last = element(last)
+ last = element.process(last)
wids = []
for word in last:
wid = self.__wids.get(word)