From: Dan Christensen <jdc@uwo.ca>
To: ding@gnus.org
Subject: Re: training spam filter
Date: Tue, 15 Dec 2015 12:17:44 -0500 [thread overview]
Message-ID: <87a8pbk4w7.fsf@uwo.ca> (raw)
In-Reply-To: <87vb7zyd0g.fsf@roche-blanche.net>
On Dec 15, 2015, Peter Münster <pmlists@free.fr> wrote:
> On Mon, Dec 14 2015, Dan Christensen wrote:
>
>> I currently have a keystroke that trains my spam filter, and moves the
>> article away,
>
> Could you post that piece of code please?
It's below.
Dan
; This is copied from someone else, and then modified by me.
; Search for *** below for where customization is needed.
(setq rgb/gnus-spam-groups '("nnfolder:spam" "nnimap+foo:spam"))
(defun rgb/gnus-treat-ham-or-spam (&optional n)
"Handle SpamAssassin misses (in ham groups) and false
positives (if in spam group)"
(interactive "P")
(let* ((ham-or-spam (if (member gnus-newsgroup-name rgb/gnus-spam-groups)
"ham"
"spam"))
(prompt (format "Treating article %%s as %s...%%s" ham-or-spam))
(pipe (format "sa --%s" ham-or-spam))
; Where to move the message after processing: ***
(group (if (equal ham-or-spam "ham") "nnimap+foo:Inbox" "nnimap+foo:spam")))
(save-excursion
(dolist (article (gnus-summary-work-articles n))
(message prompt article "")
(gnus-summary-goto-subject article)
(gnus-summary-show-raw-article)
(if (equal ham-or-spam "spam")
(gnus-summary-mark-article article gnus-expirable-mark t)
(gnus-summary-mark-article article gnus-unread-mark t))
; t arg is a recent addition, to ensure article is raw:
(gnus-summary-save-in-pipe pipe t)
;(message prompt article "done")
)
(gnus-summary-move-article nil group)))
(gnus-summary-expand-window)
(gnus-summary-next-subject 1)
(gnus-summary-recenter)
(gnus-summary-position-point)
(gnus-set-mode-line 'summary))
(define-key gnus-summary-mode-map [?$ ?$] 'rgb/gnus-treat-ham-or-spam)
On the machine that runs spamassassin, ~/bin/sa contains:
#!/bin/sh
# Usage: cat message | sa --spam [or --ham]
sa-learn $1 --no-sync
On another machine, ~/bin/sa contains: ***
#!/bin/sh
# Usage: cat message | sa --spam [or --ham]
ssh host.that.runs.spamassassin sa-learn $1 --no-sync
next prev parent reply other threads:[~2015-12-15 17:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 17:28 Possible ideas for "inbox zero" Lars Magne Ingebrigtsen
2015-12-14 22:09 ` Wes Hardaker
2015-12-14 22:26 ` Dan Christensen
2015-12-14 22:52 ` Xavier Maillard
2015-12-15 17:35 ` Nikolaus Rath
2015-12-14 22:54 ` Lars Magne Ingebrigtsen
2015-12-14 22:10 ` Dan Christensen
2015-12-14 22:48 ` Lars Magne Ingebrigtsen
2015-12-14 23:05 ` Adam Sjøgren
2015-12-15 14:58 ` training spam filter (was: Possible ideas for "inbox zero") Peter Münster
2015-12-15 17:17 ` Dan Christensen [this message]
2015-12-15 19:44 ` training spam filter Adam Sjøgren
2016-03-07 13:58 ` Ted Zlatanov
2016-03-07 14:11 ` Adam Sjøgren
2016-03-07 15:10 ` Ted Zlatanov
2016-03-07 16:36 ` Adam Sjøgren
2015-12-14 22:27 ` Possible ideas for "inbox zero" Xavier Maillard
2015-12-14 23:02 ` Adam Sjøgren
2015-12-14 23:24 ` Adam Sjøgren
2015-12-15 7:52 ` Russ Allbery
2015-12-15 14:55 ` Adam Sjøgren
2015-12-15 18:40 ` Russ Allbery
2015-12-20 0:36 ` Tim Landscheidt
2015-12-25 4:01 ` Tim Landscheidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8pbk4w7.fsf@uwo.ca \
--to=jdc@uwo.ca \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).