From 17905ace4456d88ea355b4f5f9bc79a0bafb3926 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 29 Nov 2022 10:16:30 +0100 Subject: [PATCH] Fix online classifier update --- tekuti/classifier.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tekuti/classifier.scm b/tekuti/classifier.scm index a8a57de..c248234 100644 --- a/tekuti/classifier.scm +++ b/tekuti/classifier.scm @@ -283,13 +283,19 @@ (assq-ref index 'master)))) (let ((removed-features (count-features removed)) (added-features (count-features added))) + ;; If a comment passes the spam filter, it gets added, and is + ;; presumed legitimate. It could then be reverted, in which + ;; case we should remove its features from the legitimate count + ;; and add them to the bogus count. (hash-for-each (lambda (k v) (remove-feature! legit-features k v) (add-feature! bogus-features k v)) removed-features) (hash-for-each (lambda (k v) - (add-feature! legit-features k v) - (remove-feature! bogus-features k v)) + ;; Asymmetry with removed-features; the + ;; comment wasn't previously marked bogus, so + ;; we just add its features to the legit set. + (add-feature! legit-features k v)) added-features) (update-bogosities! bogosities removed-features legit-features bogus-features)