[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG - Normalizer.py:1.1.2.3 BaseStopWords.py:1.1.2.8 BaseThesaurus.py:1.1.2.4

Andreas Jung andreas@digicool.com
Sun, 3 Feb 2002 14:15:00 -0500


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG
In directory cvs.zope.org:/tmp/cvs-serv2020

Modified Files:
      Tag: ajung-textindexng-branch
	Normalizer.py BaseStopWords.py BaseThesaurus.py 
Log Message:
minor adjustements


=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/Normalizer.py 1.1.2.2 => 1.1.2.3 ===
 from BaseNormalizer import BaseNormalizer
 
-
 class Normalizer(Persistent, BaseNormalizer):
     pass


=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/BaseStopWords.py 1.1.2.7 => 1.1.2.8 ===
 
         for l in lines: 
+            if l.startswith('#'): continue
      
             l = l.strip()
             if l:


=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/BaseThesaurus.py 1.1.2.3 => 1.1.2.4 ===
         self.readThesaurus(filename)
 
-        self.keys       = self._thesaurus.keys
-        self.values     = self._thesaurus.values
-        self.items      = self._thesaurus.items
-        self.has_key    = self._thesaurus.has_key
+
+    def keys(self):        return self._thesaurus.keys()
+    def values(self):      return self._thesaurus.values()
+    def items(self):       return self._thesaurus.items()
+    def has_key(self,k):   return self._thesaurus.has_key(k)
 
 
     def __setitem__(self,k,v):
@@ -60,14 +61,17 @@
             formats require a different parser.
         """
 
-        if not append: self.clear()
+        try:        
+            f = os.path.join(_basedir,'thesauri',fname) 
+            lines = open(f).readlines()
+        except:
+            try: lines = open(fname).readlines()
+            except: raise
 
-        lines = open(fname).readlines()
         for l in lines: 
+            if l.startswith('#'): continue
      
-            l = l.strip()
-            
-            fields = l.split(' ',1)
+            fields = l.strip().split(' ',1)
             if len(fields) != 2: continue
 
             key = fields[0]