[Zope-CVS] CVS: Products/ZCTextIndex - Splitter.py:1.1.2.2

Barry Warsaw barry@wooz.org
Thu, 2 May 2002 14:56:50 -0400


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

Modified Files:
      Tag: TextIndexDS9-branch
	Splitter.py 
Log Message:
Document the Splitter constructor.


=== Products/ZCTextIndex/Splitter.py 1.1.2.1 => 1.1.2.2 ===
     def __init__(self, splitterclass, synstop=None, encoding='latin1',
                  singlechar=0, index_numbers=0, maxlen=64, casefolding=1):
+        """Create an ISplitter instance.
+
+        XXX: double check these semantics.
+
+        splitterclass - a built-in splitter callable, usually a class like
+            ZopeSplitter or UnicodeSplitter.
+
+        synstop - a dictionary of synonyms and stopwords.  The keys are
+            strings (words) and the values are either another string (for
+            synonym substitution) or None (for stopword deletion).
+
+        encoding - an encoding name, e.g. 'latin1'.
+
+        singlechar - a flag indicating whether single characters should be
+            indexed.
+
+        index_numbers - a flag indicating whether numbers should be indexed.
+
+        maxlen - the longest term in characters to index (from 1 to 128).
+
+        casefolding - a flag indicating whether case should be folded.
+        """
         self.__class = splitterclass
         self.__synstop = synstop
         self.__encoding = encoding
@@ -28,7 +50,7 @@
         self.__maxlen = maxlen
         self.__casefolding = casefolding
 
-    def __call__(self, text):
+    def process(self, text):
         return self.__class(text,
                             self.__synstop, self.__encoding, self.__singlechar,
                             self.__index_numbers, self.__maxlen,