Next Previous Contents

4. Scoring

4.1 What is scoring?

Scoring is a method to give articles a score based on user defined rules. The idea behind this is to give articles with a high score a higher priority while articles with a low score (less than zero) are marked as read.

When entering a group, all articles are given a score of ``0''. Then the list of scoring rules, the ``score file'', is applied to each article. The score file might give articles from ``John Doe'' a higher score, while articles with the word ``Gnus'' in their subjects get a negative score.

In the end, threads with high-score articles appear at the top of your screen and can be read before other, possibly less interesting, articles.

4.2 How can I killfile with Slrn?

Slrn has no killfile. The same effect can be achieved with its score file, however. Assigning a particularly low score will do the trick:

[news.software.readers]
        Score: =-9999   % I'm not interested in articles on gnus
        Subject: gnus

In this example, all postings in news.software.readers that have the substring ``gnus'' in their subjects are assigned a negative score. The equal sign before the score value tells slrn to assign the score -9999 and to skip all other tests for the affected article; otherwise, the score would be added to the score value of all previous matching rules and subsequent rules could increase the score again.

If the score of an article is equal to or less than kill_score (which happens to be -9999 if you didn't change it), the article does not even get displayed, so the above scoring rule effectively killfiles all articles that have ``gnus'' in their subject line.

4.3 How do I set up slrn to read a score file?

In order for slrn to read a score file, it must know the name of the score file. This is specified by putting the appropriate line in your slrnrc file. For example, if the name of the score file is ``Score'' and it is located in the News subdirectory, then add the line:

set scorefile "News/Score"
to your slrnrc file.

4.4 What is the format of an slrn score file?

The format of slrn's score files is described in the file score.txt which is part of the documentation that comes with the source package. That file also contains some examples.

4.5 Where can I get a full description of slrn's regular expressions?

slrn makes use of the regexp engine built into the slang programmer's library. Thus, a full description of the regexp syntax that can be used in slrn's scorefiles can be found in the documentation of slang. In version 1.4.4, this is chapter 18 of the file slang.txt (also available online). Please note that in slrn, the default is \C (case insensitive), not \c.

4.6 How can I test whether my regular expressions do what I expect them to do?

The grep-like utility rgrep that comes with the editor jed uses the same regexp engine as slrn, so you can use it. Alternatively, Matthias Friedrich wrote a small program that can be used to make such tests. He posted the source to de.comm.software.newsreader (Message-ID is <slrn9u07di.93n.matt@endeavour.mafr.de>); you can get the article from google groups.

4.7 Is there an easy way to watch or kill threads / authors?

Editing the scorefile and adding entries manually can become quite time consuming if you want to score on threads or authors regularly. The interactive command create_score (default binding is 'K' in article mode) makes it easy to create a new scorefile entry based on the currently selected article.

If you want to watch or kill subthreads via a single keystroke, you may like the ``one-key scoring macro'' that's available from the macro section of slrn's homepage.

4.8 Do I need to remove expired entries from my score file manually?

Using the Expires: keyword, you can specify that a certain scoring rule should only be valid until a given date. After that, slrn ignores it and will warn you on startup, but does not remove the entry from the score file. If you often use this keyword, expired entries will clutter up your scorefile and make it difficult to read.

Fortunately, Felix Schueller wrote a perl script called cleanscore that can remove expired entries from your score file automatically for you. On Unix-like systems, it can even be called as a cron job, so you don't need to worry about expired entries at all. cleanscore is included in the contrib directory of slrn's source distribution and has its own web page.

4.9 How do I score on a specific subject, e.g., ``test'' messages?

The most simple version is

Score: -9999
Subject: test

This matches all subjects which contain the substring ``test'' case insensitively. The above matches ``test'', ``TEST'', ``teSt'',``Kerneltest'', ``protesting'', etc.

In order to limit this to all subjects containing the word ``test'' rather than the substring use this:

Score: -9999
Subject: \<test\>

The following will score postings which subject is exactly ``test'':

Score: -9999
Subject: ^test$

Finally, a score entry that filters all test-postings to non-test groups:

[~*.test]
        Score: -9999
        Subject: ^test$

4.10 How do I score postings from a specific person?

The following rule

Score: -9999
From: name@who\.knows\.where

assigns a score of -9999 to the person with the mail address ``name@who.knows.where''.

4.11 How do I score articles from a specific site?

Score: -9999
From: @who\.knows\.where

will give a score of -9999 to a From line that contains ``@who.knows.where''. An alternative would be to score on the Message-ID header field.

4.12 How do I score followups?

We're assuming that a followup contains a subject starting with ``Re:'' and/or has a references header. To assign a score of -9999 to such an article use:

Score:: -9999
Subject: ^Re:
References: .

Note the use of the double colon following the score keyword. This indicates that the score is an OR type expression. This means that the above score will pick out articles with subjects that begin with `Re:' OR have a references line (OR both).

To score articles that have both a subject starting with ``Re:'' and a ``References'' header, use the single colon form:

Score: -9999
Subject: ^Re:
References: .

Single colon forms are AND expressions.

4.13 Is it possible to score followups to my own postings?

Scoring followups to your own postings is quite easy if slrn generates the Message-IDs of your articles (see the question on generating Message-IDs for details). In this case, all you have to do is looking for username@your.hosts.fqdn in the `References:' header line. Of course, you need to replace username and your.hosts.fqdn with the strings that are correct for your setup - if in doubt, look at the Message-ID of one of your own articles to find out.

Score: 1000
References: username@your\.hosts\.fqdn>

Note that this will catch articles that reference one of your articles directly or indirectly (e.g. a followup to a followup to your posting). If you only want to score direct followups, make sure to check the last ID in the `References:' header only (note the trailing dollar sign):

Score: 1000
References: username@your\.hosts\.fqdn>$

4.14 How do I kill cross posts from a specific group?

You have two choices: either use the ``Xref'' header or the ``Newsgroups'' header. If possible, you should avoid the ``Newsgroups'' header in your score files, as it is usually not included in the NOV (news overview) data, so retrieving it requires extra server communication that may slow down scoring (and thus entering groups) significantly. So if your server provides ``Xref'' headers, use them.

Assume that you want to score any article that was cross-posted to an ``astrology'' newsgroup. Then use one of the following forms:

Score: -9999
Xref: astrology

Score: -9999
Newsgroups: astrology

To say it again, the latter version is usually much slower.

4.15 How do I score all cross-posts?

Like the previous answer you have two choices: to use the ``Xref'' header (preferred) or the ``Newsgroups'' header. The first choice uses the fact that a cross-posted article will have two colons in the ``Xref'' header field. So, use a score of the form:

Score: -9999
Xref: :.*:

If you do not have the option of using the ``Xref'' header, use:

Score: -9999
Newsgroups: ,

However, you may want to tolerate cross-posts if a Followup-To header is set. The following rule scores articles that are cross-posted into many groups (e.g. more than 2) and have no Followup-To header (note that this rule is ``expensive'', as usually neither Newsgroups nor Followup-To are included in the NOV data).

Score: -9999
        Newsgroups: ,.*,
        ~Followup-To: .

4.16 How do I make it so I read only posts from a specific person?

The answer is simple: kill posts by everyone else. Assume that you want to read only posts by someone whose From line contains: ``someone@i.like''. Then use a score of the form:

Score: -9999
~From: someone@i\.like

Note the use of the NOT indicator (~).

4.17 How do I score articles that have no ``References'' line but whose ``Subject'' line starts with ``Re:''?

Define a score based on the ``References'' header and the ``Subject'' headers, e.g.,

Score: -9999
~References: .
Subject: ^Re: 

Here the ``References'' line simply says that the article must not have a ``References'' header. The subject header uses a regular expression that says ``Re:'' must occur at the beginning of the subject. This will match the strings "Re:", "re:", "rE:", and "RE:". To match only "Re:", use the regular expression

Subject: ^\cRe:

Here, ``\c'' turns on case-sensitivity. To turn it off (which is the default), use ``\C''.

4.18 How do I score subjects that contain only uppercase characters?

Use something like:

Score: -9999
~Subject: \c[a-z]

This will assign a score of -9999 to any article whose subject header does not contain a lowercase character. If you also want to kill followups to such articles use:

Score: -9999
Subject: ^Re: \c[^a-z]*$
~Subject: ^Re: *

The last one says that the article will be killed if the subject satisfies the two conditions:

  1. It begins with "Re: " and the rest of the line does not contain a lowercase character.
  2. It does not begin with "Re: ", followed by blanks only.

The last constraint is necessary to avoid killing articles that are followups to articles with an empty subject line. Of course, one might want to kill such articles as well.

4.19 How can I filter people without a realname?

Some people dislike posters who don't post under their full real name. Of course, slrn has no way of knowing whether a given name is a real name or not; however, a name that does not contain a space is most probably not a full real name, so a commonly used rule is to check for the 'From:' header to contain at least two spaces (one inside the name and one between the name and the address), separated by non-blank characters:

[*]
Score: -9999
~From: [ ]+[^ ]+[ ]+


Next Previous Contents