From: Arnd Kohrs <kohrs@acm.org>
Cc: <Horst.Winkler@epost.de>
Subject: Re: Scoring on x-header
Date: 01 Apr 2001 19:10:15 +0200 [thread overview]
Message-ID: <xljelvca6mg.fsf@abyss.eurecom.fr> (raw)
In-Reply-To: <9a03fe.19c.1@horst.earlydream.de> (Horst Winkler's message of "Thu, 29 Mar 2001 19:46:55 +0200")
>>>>> "HW" == Horst Winkler <earlydream@gmx.de> 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
next prev parent reply other threads:[~2001-04-01 17:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-29 17:46 Horst Winkler
2001-03-29 21:06 ` Kai Großjohann
2001-04-01 17:10 ` Arnd Kohrs [this message]
2001-04-02 19:37 ` Horst Winkler
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=xljelvca6mg.fsf@abyss.eurecom.fr \
--to=kohrs@acm.org \
--cc=Horst.Winkler@epost.de \
/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).