Re: new python error in sbfilter.py

Skip Montanaro <[email protected]> Thu, 9 Mar 2017 07:23:38 -0600
Newsgroups gmane.mail.spam.spambayes.general
Message-ID <CANc-5UyUQGP_ArJhZ-r64x=cHsj-iqi=WcT43ogV4-F+Rjo77w@mail.gmail.com>
--===============8159461208581490892==
Content-Type: multipart/alternative; boundary=f403045d8e8e2fd797054a4c2776

--f403045d8e8e2fd797054a4c2776
Content-Type: text/plain; charset=UTF-8

Fred,

It looks like your training database is corrupt. At the very end of the
long traceback, the message indicates that the count of messages (ham or
spam) in which a particular word appears is greater than the number of
messages in that particular category. I think you should be able to just
retrain from scratch on your existing database.

Skip

On Mar 8, 2017 7:11 PM, "Fred Smith" <[email protected]> wrote:

> Hi
>
> All of a sudden this past week I'm getting this whenever a message is
> sent to sb_filter to be retrained:
>
> File "/usr/bin/sb_filter.py", line 5, in <module>
>     pkg_resources.run_script('spambayes==1.1a6', 'sb_filter.py')
>   File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 540, in
> run_script
>     self.require(requires)[0].run_script(script_name, ns)
>   File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1455, in
> run_script
>     execfile(script_filename, namespace, namespace)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.
> 7.egg/EGG-INFO/scripts/sb_filter.py", line 277, in <module>
>     main()
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.
> 7.egg/EGG-INFO/scripts/sb_filter.py", line 268, in main
>     action(msg)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.
> 7.egg/EGG-INFO/scripts/sb_filter.py", line 186, in filter
>     return self.h.filter(msg)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.7.egg/spambayes/hammie.py",
> line 149, in filter
>     debug, train)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.7.egg/spambayes/hammie.py",
> line 104, in score_and_filter
>     prob, clues = self._scoremsg(msg, True)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.7.egg/spambayes/hammie.py",
> line 33, in _scoremsg
>     return self.bayes.spamprob(tokenize(msg), evidence)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.
> 7.egg/spambayes/classifier.py", line 169, in chi2_spamprob
>     clues = self._getclues(wordstream)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.
> 7.egg/spambayes/classifier.py", line 472, in _getclues
>     tup = self._worddistanceget(word)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.
> 7.egg/spambayes/classifier.py", line 487, in _worddistanceget
>     prob = self.probability(record)
>   File "/usr/lib/python2.7/site-packages/spambayes-1.1a6-py2.
> 7.egg/spambayes/classifier.py", line 287, in probability
>     assert hamcount <= nham, "Token seen in more ham than ham trained."
> AssertionError: Token seen in more ham than ham trained.
>
>
> It is possible I got a python update, but I wasn't paying attention, so
> I'm not at all sure.
>
> I'm NOT a python guru, so I'd appreciate any guidance any of you can
> provide.
>
> thanks in advance!
>
> Fred
> --
> ---- Fred Smith -- [email protected]
> -----------------------------
>                     The Lord detests the way of the wicked
>                   but he loves those who pursue righteousness.
> ----------------------------- Proverbs 15:9 (niv)
> -----------------------------
> _______________________________________________
> [email protected]
> https://mail.python.org/mailman/listinfo/spambayes
> Info/Unsubscribe: http://mail.python.org/mailman/listinfo/spambayes
> Check the FAQ before asking: http://spambayes.sf.net/faq.html
>

--f403045d8e8e2fd797054a4c2776
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Fred,<div dir=3D"auto"><br></div><div dir=3D"auto">It loo=
ks like your training database is corrupt. At the very end of the long trac=
eback, the message indicates that the count of messages (ham or spam) in wh=
ich a particular word appears is greater than the number of messages in tha=
t particular category. I think you should be able to just retrain from scra=
tch on your existing database.</div><div dir=3D"auto"><br></div><div dir=3D=
"auto">Skip</div></div><div class=3D"gmail_extra"><br><div class=3D"gmail_q=
uote">On Mar 8, 2017 7:11 PM, &quot;Fred Smith&quot; &lt;<a href=3D"mailto:=
[email protected]">[email protected]</a>&gt; wrote:=
<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margin:=
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
All of a sudden this past week I&#39;m getting this whenever a message is<b=
r>
sent to sb_filter to be retrained:<br>
<br>
File &quot;/usr/bin/sb_filter.py&quot;, line 5, in &lt;module&gt;<br>
=C2=A0 =C2=A0 pkg_resources.run_script(&#39;<wbr>spambayes=3D=3D1.1a6&#39;,=
 &#39;sb_filter.py&#39;)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/pkg_resources.py&qu=
ot;, line 540, in run_script<br>
=C2=A0 =C2=A0 self.require(requires)[0].run_<wbr>script(script_name, ns)<br=
>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/pkg_resources.py&qu=
ot;, line 1455, in run_script<br>
=C2=A0 =C2=A0 execfile(script_filename, namespace, namespace)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/EGG-INFO/scripts/sb_<wbr>filter.py&quot;, line 277, in &lt;modu=
le&gt;<br>
=C2=A0 =C2=A0 main()<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/EGG-INFO/scripts/sb_<wbr>filter.py&quot;, line 268, in main<br>
=C2=A0 =C2=A0 action(msg)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/EGG-INFO/scripts/sb_<wbr>filter.py&quot;, line 186, in filter<b=
r>
=C2=A0 =C2=A0 return self.h.filter(msg)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/spambayes/hammie.py&quot;, line 149, in filter<br>
=C2=A0 =C2=A0 debug, train)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/spambayes/hammie.py&quot;, line 104, in score_and_filter<br>
=C2=A0 =C2=A0 prob, clues =3D self._scoremsg(msg, True)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/spambayes/hammie.py&quot;, line 33, in _scoremsg<br>
=C2=A0 =C2=A0 return self.bayes.spamprob(tokenize(<wbr>msg), evidence)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/spambayes/classifier.py&quot;<wbr>, line 169, in chi2_spamprob<=
br>
=C2=A0 =C2=A0 clues =3D self._getclues(wordstream)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/spambayes/classifier.py&quot;<wbr>, line 472, in _getclues<br>
=C2=A0 =C2=A0 tup =3D self._worddistanceget(word)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/spambayes/classifier.py&quot;<wbr>, line 487, in _worddistanceg=
et<br>
=C2=A0 =C2=A0 prob =3D self.probability(record)<br>
=C2=A0 File &quot;/usr/lib/python2.7/site-<wbr>packages/spambayes-1.1a6-py2=
.<wbr>7.egg/spambayes/classifier.py&quot;<wbr>, line 287, in probability<br=
>
=C2=A0 =C2=A0 assert hamcount &lt;=3D nham, &quot;Token seen in more ham th=
an ham trained.&quot;<br>
AssertionError: Token seen in more ham than ham trained.<br>
<br>
<br>
It is possible I got a python update, but I wasn&#39;t paying attention, so=
<br>
I&#39;m not at all sure.<br>
<br>
I&#39;m NOT a python guru, so I&#39;d appreciate any guidance any of you ca=
n<br>
provide.<br>
<br>
thanks in advance!<br>
<br>
Fred<br>
--<br>
---- Fred Smith -- <a href=3D"mailto:[email protected]">fredex@=
fcshome.stoneham.ma.us</a> -----------------------------<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 The L=
ord detests the way of the wicked<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 but he loves=
 those who pursue righteousness.<br>
----------------------------- Proverbs 15:9 (niv) -------------------------=
----<br>
______________________________<wbr>_________________<br>
<a href=3D"mailto:[email protected]">[email protected]</a><br>
<a href=3D"https://mail.python.org/mailman/listinfo/spambayes
Info/Unsubscribe" rel=3D"noreferrer" target=3D"_blank">https://mail.python.=
org/<wbr>mailman/listinfo/spambayes<br>
Info/Unsubscribe</a>: <a href=3D"http://mail.python.org/mailman/listinfo/sp=
ambayes" rel=3D"noreferrer" target=3D"_blank">http://mail.python.org/<wbr>m=
ailman/listinfo/spambayes</a><br>
Check the FAQ before asking: <a href=3D"http://spambayes.sf.net/faq.html" r=
el=3D"noreferrer" target=3D"_blank">http://spambayes.sf.net/faq.<wbr>html</=
a><br>
</blockquote></div></div>

--f403045d8e8e2fd797054a4c2776--

--===============8159461208581490892==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
[email protected]
https://mail.python.org/mailman/listinfo/spambayes
Info/Unsubscribe: http://mail.python.org/mailman/listinfo/spambayes
Check the FAQ before asking: http://spambayes.sf.net/faq.html
--===============8159461208581490892==--