[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.15 Advanced Scoring

Scoring on Subjects and From headers is nice enough, but what if you’re really interested in what a person has to say only when she’s talking about a particular subject? Or what if you really don’t want to read what person A has to say when she’s following up to person B, but want to read what she says when she’s following up to person C?

By using advanced scoring rules you may create arbitrarily complex scoring patterns.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.15.1 Advanced Scoring Syntax

Ordinary scoring rules have a string as the first element in the rule. Advanced scoring rules have a list as the first element. The second element is the score to be applied if the first element evaluated to a non-nil value.

These lists may consist of three logical operators, one redirection operator, and various match operators.

Logical operators:

&
and

This logical operator will evaluate each of its arguments until it finds one that evaluates to false, and then it’ll stop. If all arguments evaluate to true values, then this operator will return true.

|
or

This logical operator will evaluate each of its arguments until it finds one that evaluates to true. If no arguments are true, then this operator will return false.

!
not
¬

This logical operator only takes a single argument. It returns the logical negation of the value of its argument.

There is an indirection operator that will make its arguments apply to the ancestors of the current article being scored. For instance, 1- will make score rules apply to the parent of the current article. 2- will make score rules apply to the grandparent of the current article. Alternatively, you can write ^^, where the number of ^s (carets) says how far back into the ancestry you want to go.

Finally, we have the match operators. These are the ones that do the real work. Match operators are header name strings followed by a match and a match type. A typical match operator looks like ‘("from" "Lars Ingebrigtsen" s)’. The header names are the same as when using simple scoring, and the match types are also the same.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.15.2 Advanced Scoring Examples

Please note that the following examples are score file rules. To make a complete score file from them, surround them with another pair of parentheses.

Let’s say you want to increase the score of articles written by Lars when he’s talking about Gnus:

 
((&
  ("from" "Lars Ingebrigtsen")
  ("subject" "Gnus"))
 1000)

Quite simple, huh?

When he writes long articles, he sometimes has something nice to say:

 
((&
  ("from" "Lars Ingebrigtsen")
  (|
   ("subject" "Gnus")
   ("lines" 100 >)))
 1000)

However, when he responds to things written by Reig Eigil Logge, you really don’t want to read what he’s written:

 
((&
  ("from" "Lars Ingebrigtsen")
  (1- ("from" "Reig Eigil Logge")))
 -100000)

Everybody that follows up Redmondo when he writes about disappearing socks should have their scores raised, but only when they talk about white socks. However, when Lars talks about socks, it’s usually not very interesting:

 
((&
  (1-
   (&
    ("from" "redmondo@.*no" r)
    ("body" "disappearing.*socks" t)))
  (! ("from" "Lars Ingebrigtsen"))
  ("body" "white.*socks"))
 1000)

Suppose you’re reading a high volume group and you’re only interested in replies. The plan is to score down all articles that don’t have subject that begin with "Re:", "Fw:" or "Fwd:" and then score up all parents of articles that have subjects that begin with reply marks.

 
((! ("subject" "re:\\|fwd?:" r))
  -200)
((1- ("subject" "re:\\|fwd?:" r))
  200)

The possibilities are endless.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.15.3 Advanced Scoring Tips

The & and | logical operators do short-circuit logic. That is, they stop processing their arguments when it’s clear what the result of the operation will be. For instance, if one of the arguments of an & evaluates to false, there’s no point in evaluating the rest of the arguments. This means that you should put slow matches (‘body’, ‘header’) last and quick matches (‘from’, ‘subject’) first.

The indirection arguments (1- and so on) will make their arguments work on previous generations of the thread. If you say something like:

 
...
(1-
 (1-
  ("from" "lars")))
...

Then that means “score on the from header of the grandparent of the current article”. An indirection is quite fast, but it’s better to say:

 
(1-
 (&
  ("from" "Lars")
  ("subject" "Gnus")))

than it is to say:

 
(&
 (1- ("from" "Lars"))
 (1- ("subject" "Gnus")))

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated on January 25, 2015 using texi2html 1.82.