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 ``scorefile'', is applied to each article. The scorefile might give articles from ``John Doe'' a higher score, while articles with the word ``Gnus'' in their subjects get a negative score. More than one rule may apply cumulatively to the same article.

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, but the same effect can be achieved with its scorefile. 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 articles in news.software.readers that have the substring ``gnus'' in their Subject lines are assigned a negative score. The equals 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 scorefile?

In order for slrn to read a scorefile, it must know the name of the scorefile. This is specified by putting the appropriate line in your slrnrc file. For example, if the name of the scorefile 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 scorefile?

The format of slrn's scorefiles 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 S-Lang 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 S-Lang. In version 2.1, this is chapter 22 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 is available from the macro section of the slrn website: <http://slrn.sourceforge.net/macros.html>.

4.8 Do I need to remove expired entries from my scorefile 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 scorefile. 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 scorefile 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 can also be downloaded from the slrn website: <http://slrn.sourceforge.net/downloads/>.

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

The most simple version is

        Score: -9999
          Subject: test
This matches all ``Subject'' lines which contain the substring ``test'' case insensitively. The above matches ``test'', ``TEST'', ``teSt'',``Kerneltest'', ``protesting'', etc.

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

        Score: -9999
          Subject: \<test\>
The following will score articles whose ``Subject'' line 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 articles from a specific person?

The following rule

        Score: -9999
          From: name@who\.knows\.where
assigns a score of -9999 to the person with the email 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:
        Score: -9999
          Message-Id: @who\.knows\.where>

4.12 How do I score followups?

We're assuming that a followup contains a ``Subject'' line starting with ``Re:'' and/or has a ``References'' header line. 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'' line starting with ``Re:'' and a ``References'' header line, 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 to look 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 article). If you only want to score direct followups, make sure to check the last ID in the ``References'' header line 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 line or the ``Newsgroups'' header line. If possible, you should avoid the ``Newsgroups'' line in your scorefiles, 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'' header lines, 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, and should be avoided whenever the necessary pattern is available from ``Xref''.

4.15 How do I score all cross-posts?

Like the previous answer you have two choices: to use the ``Xref'' line (preferred) or the ``Newsgroups'' line. 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'' line, use:
        Score: -9999
          Newsgroups: ,
However, you may want to tolerate cross-posts if a ``Followup-To'' header line is set. The following rule scores articles that are cross-posted into many groups (e.g. more than 2) and have no ``Followup-To'' line (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 articles from a specific person?

The answer is simple: kill articles by everyone else. Assume that you want to read only articles 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'' line and the ``Subject'' line, e.g.,

        Score: -9999
          ~References: .
          Subject: ^Re: 
Here the ``References'' pattern simply says that the article must not have a ``References'' line. The ``Subject'' pattern 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'', e.g.:
        Subject: ^\cRe:.*\Ctest

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 line 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 real name?

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