From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/35551 Path: main.gmane.org!not-for-mail From: Arnd Kohrs Newsgroups: gmane.emacs.gnus.general Subject: Re: Scoring on x-header Date: 01 Apr 2001 19:10:15 +0200 Sender: Arnd.Kohrs@eurecom.fr Message-ID: References: <9a03fe.19c.1@horst.earlydream.de> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035171277 3694 80.91.224.250 (21 Oct 2002 03:34:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 03:34:37 +0000 (UTC) Cc: Return-Path: Original-Received: (qmail 17258 invoked by alias); 1 Apr 2001 17:10:26 -0000 Original-Received: (qmail 17253 invoked from network); 1 Apr 2001 17:10:26 -0000 Original-Received: from monza.eurecom.fr (postfix@193.55.113.133) by gnus.org with SMTP; 1 Apr 2001 17:10:26 -0000 Original-Received: from abyss.eurecom.fr (abyss.eurecom.fr [193.55.114.67]) by monza.eurecom.fr (Postfix) with ESMTP id B12C818D8E; Sun, 1 Apr 2001 19:10:17 +0200 (MET DST) Original-Received: (from kohrs@localhost) by abyss.eurecom.fr (8.9.3/8.9.3) id TAA10224; Sun, 1 Apr 2001 19:10:15 +0200 (MET DST) X-Authentication-Warning: abyss.eurecom.fr: kohrs set sender to kohrs@abyss.eurecom.fr using -f Original-To: ding@gnus.org X-Face: 1ETYv*X5`lW"hk(KWE,1u!/CnnMxdgn[B^=m*EUHa->O^!+d3x]l[_W$Y)E#1~_=+Ty..'B,|Am/!zh|sy6VS5&_x:7WjiJQgIsqct%a{s^F8jsI|(bKyplR'$FYjrg6Vu}kPbk&||'b99Yps%x?{NIMx?[YF2-K[IF*CLg:U0H/E}*'&$"c4"HCrHR;?Uk\%U}TBTb;GFrr**>=q3C@8_0]&!)`vc~Q#b`k`\]F=3#g4w)9pxI|qjPK:lTRU`UTb-w]mZ4OU6 X-Mailer: Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.4 In-Reply-To: <9a03fe.19c.1@horst.earlydream.de> (Horst Winkler's message of "Thu, 29 Mar 2001 19:46:55 +0200") User-Agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.4 Original-Lines: 65 Xref: main.gmane.org gmane.emacs.gnus.general:35551 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:35551 >>>>> "HW" == Horst Winkler writes: HW> One of these things is scoring. After doing this he add an HW> x-header to every article: X-Hamster-Info: Score="n" "n" may be HW> "0" up to "+9999" or a string like: Score=(none-import) for a HW> copy of an article and others. HW> What I want to do is to set "gnus-summary-default-score" to "n" HW> if possible or something like: If "X-Hamster-Info" (score=>10) HW> THEN gnus-score=10 HW> ElseIf [score=>20) THEN gnus-score=20 HW> and so on. Hi, I faced a similar problem. For my nntmf backend for reading Motley Fool message boards I wanted to score the articles depending on the number of recommendations the articles received by other readers. The number of recommendations is returned by the backend in an extra-header "X-Gnus-TMF-Recommendations". After studying the scoring grammar I concluded that what I wanted, could not be accomplished with what existed in gnus (but I don't remember why). The following code generates a score from an extra header and adds it to a the article's score. I think it can easily adapted for your problem. Cheers, Arnd. (defvar nntmf-recommendation-to-score-factor nil) (defun nntmf-recommendations-to-score (&optional trace) "Add scores depending on TMF recommendations to the articles." (interactive) (let ((factor nntmf-recommendation-to-score-factor) header art-score tmf-rec article-number tmf-score) (dolist (header gnus-newsgroup-headers) (when (setq tmf-rec (cdr (assq 'X-Gnus-TMF-Recommendations (mail-header-extra header)))) (setq tmf-rec (string-to-number tmf-rec)) (setq article-number (mail-header-number header)) (unless factor ;; In large discussion groups with many articles and ;; therefore high article numbers it is assumed that the ;; articles receive apriori a higher number of ;; recommendations. Therefore the factor is adapted using ;; the log, so that the tmf-recommendations do not outweigh ;; the other gnus-score components. (setq factor (* (1+ (round (log10 article-number))) 100))) (setq tmf-score (* factor tmf-rec)) (if (setq art-score (assq article-number gnus-newsgroup-scored)) (setcdr art-score (+ (cdr art-score) tmf-score)) (push (cons article-number tmf-score) gnus-newsgroup-scored)) )))) (add-hook 'gnus-summary-generate-hook 'nntmf-recommendations-to-score) (add-to-list 'gnus-extra-headers 'X-Gnus-TMF-Recommendations) (add-to-list 'nnmail-extra-headers 'X-Gnus-TMF-Recommendations) -- Arnd Kohrs - Institut Eurecom - http://www.eurecom.fr/~kohrs The Active WebMuseum: Your personalized access to art paintings. Visit now -> http://www.eurecom.fr/~kohrs/museum.html