Gnus development mailing list
 help / color / mirror / Atom feed
* Scoring on x-header
@ 2001-03-29 17:46 Horst Winkler
  2001-03-29 21:06 ` Kai Großjohann
  2001-04-01 17:10 ` Arnd Kohrs
  0 siblings, 2 replies; 4+ messages in thread
From: Horst Winkler @ 2001-03-29 17:46 UTC (permalink / raw)


Hi all,

first some information for you.
I use Hamster, a little local newsserver under W2k.  With
some tools he's able to repair OjE-shit or copy articles
to a local group and some other fine things.

One of these things is scoring.  After doing this he add
an x-header to every article:
X-Hamster-Info: Score="n"
"n" may be "0" up to "+9999"
or a string like:
Score=(none-import) for a copy of an article and others.

What I want to do is to set "gnus-summary-default-score" to "n"
if possible or something like:
If "X-Hamster-Info" (score=>10) THEN gnus-score=10
   ElseIf           [score=>20) THEN gnus-score=20
and so on.

Thamks Horst

-- 
www.earlydream.de (für Hundefreunde)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Scoring on x-header
  2001-03-29 17:46 Scoring on x-header Horst Winkler
@ 2001-03-29 21:06 ` Kai Großjohann
  2001-04-01 17:10 ` Arnd Kohrs
  1 sibling, 0 replies; 4+ messages in thread
From: Kai Großjohann @ 2001-03-29 21:06 UTC (permalink / raw)
  Cc: Horst.Winkler

On Thu, 29 Mar 2001, Horst Winkler wrote:

> One of these things is scoring.  After doing this he add
> an x-header to every article:
> X-Hamster-Info: Score="n"
> "n" may be "0" up to "+9999"
> or a string like:
> Score=(none-import) for a copy of an article and others.

It's already possible to score on some header contents, for example
the Lines header.  But here, you have to use a regex first to extract
part of the header content.  I have no idea how this works.  Thoughts?

kai
-- 
Be indiscrete.  Do it continuously.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Scoring on x-header
  2001-03-29 17:46 Scoring on x-header Horst Winkler
  2001-03-29 21:06 ` Kai Großjohann
@ 2001-04-01 17:10 ` Arnd Kohrs
  2001-04-02 19:37   ` Horst Winkler
  1 sibling, 1 reply; 4+ messages in thread
From: Arnd Kohrs @ 2001-04-01 17:10 UTC (permalink / raw)
  Cc: Horst.Winkler


>>>>> "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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Scoring on x-header
  2001-04-01 17:10 ` Arnd Kohrs
@ 2001-04-02 19:37   ` Horst Winkler
  0 siblings, 0 replies; 4+ messages in thread
From: Horst Winkler @ 2001-04-02 19:37 UTC (permalink / raw)


* Hi "Arnd" you said:

> 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.

[helpfull code ...]

First thanks for your answer. It seems to be the help I need.
But I'm an absolutly newbie in using Xemacs and Gnus. My second problem
is the English language. May be enough for smalltalk;-)

I found string-to-number in Info-file but it matched if there are only
leading whitespaces. How can I say: Go, for example, 6 columns right
and than string-to-number.

I hope you understand what I want to say.

greetings Horst

-- 
www.earlydream.de (für Hundefreunde)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-04-02 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-29 17:46 Scoring on x-header Horst Winkler
2001-03-29 21:06 ` Kai Großjohann
2001-04-01 17:10 ` Arnd Kohrs
2001-04-02 19:37   ` Horst Winkler

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).