[Spambayes-checkins] spambayes/spambayes UserInterface.py, 1.32, 1.33

Richie Hindle richiehindle at users.sourceforge.net
Tue Nov 25 18:57:01 EST 2003


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv29964

Modified Files:
	UserInterface.py 
Log Message:
More robust code for parsing evidence headers.  Copes with ';' and ': '
being part of a clue.


Index: UserInterface.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/UserInterface.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** UserInterface.py	3 Oct 2003 02:37:10 -0000	1.32
--- UserInterface.py	25 Nov 2003 23:56:59 -0000	1.33
***************
*** 335,342 ****
                  # classified.
                  clues = []
!                 evidence = mo.group(1).strip().split(';')
!                 for clue in evidence:
!                     word, prob = clue.strip().split(': ')
!                     clues.append((word.strip("'"), prob))
                  cluesTable = self._fillCluesTable(clues)
  
--- 335,341 ----
                  # classified.
                  clues = []
!                 evidence = re.findall(r"'(.+?)': ([^;]+)(?:;|$)", mo.group(1))
!                 for word, prob in evidence:
!                     clues.append((word, prob))
                  cluesTable = self._fillCluesTable(clues)
  





More information about the Spambayes-checkins mailing list