[PATCH v3 5/7] Introduce _notmuch_message_has_term()
[notmuch-archives.git] / ca / 5374b6edc102dcefdf1250c36148c475d508d7
1 Return-Path: <jrollins@finestructure.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id C64E5431FBD\r
6         for <notmuch@notmuchmail.org>; Tue,  5 Mar 2013 22:43:37 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id mhhgBVPnpSRb for <notmuch@notmuchmail.org>;\r
16         Tue,  5 Mar 2013 22:43:18 -0800 (PST)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id 22F35431FAF\r
20         for <notmuch@notmuchmail.org>; Tue,  5 Mar 2013 22:43:18 -0800 (PST)\r
21 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
22         by fire-doxen-postvirus (Postfix) with ESMTP id A27E22E50C8D\r
23         for <notmuch@notmuchmail.org>; Tue,  5 Mar 2013 22:43:17 -0800 (PST)\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
25 Received: from finestructure.net (cpe-76-166-145-133.socal.res.rr.com\r
26         [76.166.145.133]) (Authenticated sender: jrollins)\r
27         by fire-doxen-submit (Postfix) with ESMTP id 791C62E507D2\r
28         for <notmuch@notmuchmail.org>; Tue,  5 Mar 2013 22:43:15 -0800 (PST)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id E029362216; Tue,  5 Mar 2013 22:43:14 -0800 (PST)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: notspam: a notmuch interface to spamassassin\r
34 User-Agent: Notmuch/0.15+8~gd4a7374 (http://notmuchmail.org) Emacs/24.2.1\r
35         (x86_64-pc-linux-gnu)\r
36 Date: Tue, 05 Mar 2013 22:43:12 -0800\r
37 Message-ID: <87sj49gha7.fsf@servo.finestructure.net>\r
38 MIME-Version: 1.0\r
39 Content-Type: multipart/signed; boundary="=-=-=";\r
40         micalg=pgp-sha256; protocol="application/pgp-signature"\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Wed, 06 Mar 2013 06:43:40 -0000\r
54 \r
55 --=-=-=\r
56 Content-Type: text/plain\r
57 \r
58 Hey, folks.  I put together a little python program as an interface\r
59 between notmuch and spamassassin (sa) that I thought others might be\r
60 interested in:\r
61 \r
62 git://finestructure.net/notspam\r
63 \r
64 It's only dependencies are a running local sa daemon and python-notmuch.\r
65 It's pretty straightforward: it's just a single python script that has\r
66 two main functions 'learn' and 'tag'.  'Learn' takes a notmuch search\r
67 and pipes the resulting messages into sa (via sa-learn) to be classified\r
68 as ham or spam.  'Tag' takes a notmuch search and passes the resulting\r
69 messages through the sa classifier (via spamc) to be tagged as ham or\r
70 spam.\r
71 \r
72 Here's how I've been using it:\r
73 \r
74  * Tag spam manually with the tag 'spam'.  It's good to have done this\r
75    for a while to build up a good amount of manual classification.\r
76 \r
77  * Once you've got some manual classification, teach sa:\r
78 \r
79    notspam learn spam tag:spam\r
80    notspam learn ham not tag:spam\r
81 \r
82    Everything after the meat ('spam'/'ham') are the notmuch search\r
83    terms.  Rerun this periodically to update, but you might want to\r
84    restrict the search a little so sa-learn doesn't eat a lot of\r
85    overhead reprocessing old messages that haven't changed\r
86    classification.\r
87 \r
88  * Call 'notspam tag' in your post-new hook (all my new messages are\r
89    tagged 'new' initially):\r
90 \r
91    notspam tag --spam=spamd tag:new\r
92 \r
93    I give the sa-classified mail a different tag so it's easy to\r
94    distinguish what was classified by me and what was classified by sa.\r
95 \r
96 Pretty simple.  See 'notspam help' for more info.\r
97 \r
98 Right now it's geared specifically for sa, but it would be easy to\r
99 expand it to handle arbitrary learn/classify commands.  If there's any\r
100 further interest in this, I would be happy to help push on it more.\r
101 \r
102 jamie.\r
103 \r
104 PS: if anyone has any suggestions for Bayesian classifiers better than\r
105 sa I'm all ears.  I'm not so happy with sa at the moment.  It misses a\r
106 lot more spam than I would like.  Maybe I just haven't tweaked it out\r
107 yet, in which case if anyone has any suggestions on how to improve sa's\r
108 classification I'm also all ears.\r
109 \r
110 --=-=-=\r
111 Content-Type: application/pgp-signature\r
112 \r
113 -----BEGIN PGP SIGNATURE-----\r
114 Version: GnuPG v1.4.12 (GNU/Linux)\r
115 \r
116 iQIcBAEBCAAGBQJRNuWAAAoJEO00zqvie6q8OdwP/27j7evFUi1nU2YVmFIiPM2+\r
117 S0AYVUd+WhWkTcHtaTw52G7iBI6nWwY2/01Itt35TToVhHpkbIu4LEcCdOIc+Lmx\r
118 xfZ9cNy6brXNqveMSmF69haiVsenMfbl606aZcrQjEoQyk7AClxqnKxorihJD/LP\r
119 uNt7aCZhi+hzRCCHq+Xeb8n4vPBHQ602KGhqaC8zJ1zgeGfFj9Zi5S0ZuMPkozJF\r
120 0JFHyXcnlcFGKInGZ0ShSYQmvg3VDNnYk8uHRGSUdtUdFZbXg9gtDm23Ppsj6kaM\r
121 +k8g2z3fUunF4K043tyJsbsCbQkRtnXv5k3BAGNytkxwpoqOb8W9uT/f8wmbRuni\r
122 hImYfkG6qvxKPVcnz2Xgz/6kVfca04tD+PlFlo311i3d2hocu751mRfzEDm+Ffwc\r
123 kGbyzUoFR0/Jc+Fon7C3I7h0kw/A9fjc5kJELGoeKW7v293nu7MppJ9iJResSXBG\r
124 l25f77Z3cWXUklL9I249Cf/WHcOO3MMf84XsUemiLrRag872rdzK1IHLc5aOmrwd\r
125 2tS0goxSPo6+2h1JW0KMTiOEmAv3oxW109bYC9EDeQOpQ2a0RoAlokGNFtr0p4Ac\r
126 dupPrUPS303ES3c5WmGyF88Yt8MfwhLY4Kx7oSgjxa7G4M8s1LSpSscnn8VtcXpp\r
127 QRodps2Eb25NQ6qGQlIi\r
128 =CXJB\r
129 -----END PGP SIGNATURE-----\r
130 --=-=-=--\r