Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* better gnus-thread-score-function
@ 2003-01-30 15:24 Hubert Canon
       [not found] ` <m3k7gkc7ln.fsf@quimbies.gnus.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Hubert Canon @ 2003-01-30 15:24 UTC (permalink / raw)



Hi all !

[please excuse me english, it is not my mother tongue]

I use adaptive scoring and I sort by total thread score. I didn't find
a suitable gnus-thread-score-function. I used to use '+ but it gives
too much importance to big threads, and 'max is not so good because
one good author in a bad thread lift it up too much. So I tried to do
my own : I wanted to give the thread the mean score.

Here is my try :

(defvar my-gnus-thread-score-function-divisor
;;; we hope that there will not be more than 100000 articles in a thread
  100000)
(defun my-gnus-thread-score-function-nb-articles (x)
  (floor (+ 0.5 (* (- x (floor x))
                   my-gnus-thread-score-function-divisor))))
(defun my-gnus-thread-score-function (article-score &rest subthread-scores)
;;; the result is the mean with the number of articles in the
;;; thread in the fractionnal part.
  (if subthread-scores
      (let ((total-article-number
             (apply '+ 1.0 (mapcar 'my-gnus-thread-score-function-nb-articles
                                   subthread-scores))))
        (+ (ceiling
            (apply '+ article-score subthread-scores)
            total-article-number)
           (/ total-article-number
              my-gnus-thread-score-function-divisor)))
    (+ (float article-score) (/ 1.0 my-gnus-thread-score-function-divisor))))
(setq gnus-thread-score-function 'my-gnus-thread-score-function)


I tested a bit, and it seems to give the expected value.

What do you think ?


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

* Re: better gnus-thread-score-function
       [not found]   ` <85adhdgwlc.fsf.Hubert.Canon@free.fr>
@ 2003-02-07 11:59     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-02-07 11:59 UTC (permalink / raw)


Hubert Canon <hcanon@free.fr> writes:

>> It sounds like a good idea, but do we really need the divisor?  Could
>> you get rid of that variable and submit a patch?
>
> I don't quite exactly understand what you propose : that I get rid of
> that variable and that I put it inside the function ?

You can compute the maximum number of articles in the threads and use
that, perhaps.  But if it doesn't make any difference what the number
is, just hard-code it in the function.

> As a matter of fact, I am not so easy with the internals of gnus yet ;
> I need time to look into before I change anything. In order to debug
> more efficiently, I would like to know what is exactly a "thread" for
> gnus-thread-total-score : I would like to display the total score of a
> (sub-)thread in the summary buffer.

It's basically a tree on the form

([header] subthread subtread ...)

where each subthread has the same structure.

This is somewhat complicated by the presence of gathered threads,
which look like

("subject" subthread subtread ...)

That should be it, unless I've forgotten some complexities of the
structure. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


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

end of thread, other threads:[~2003-02-07 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-30 15:24 better gnus-thread-score-function Hubert Canon
     [not found] ` <m3k7gkc7ln.fsf@quimbies.gnus.org>
     [not found]   ` <85adhdgwlc.fsf.Hubert.Canon@free.fr>
2003-02-07 11:59     ` Lars Magne Ingebrigtsen

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