🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #189693

Re: dumb question...

#189693
From: sittingduck
Date: Tue, 22 Aug 2006 17:00
244 lines
8723 bytes
Brian wrote:

> So, I have to "train" a score file, kinda' like a junk mail filter?

Yep.

Intro to Xnews' score file.

Xnews happily steals the scoring system concept from slrn.  Basically, each 
article is assigned a score from -9999 to 9999.  By default, an article has 
score 0 (no score, or neutral).  Articles with score of -9999 or less are 
killed (you'll never see them, unless you turn off hard kill, in which case 
they show up with a red X icon).  Articles with score of 9999 or more are 
considered "important" and flagged with a yellow ! icon.  

Xnews scores articles using rules you specify in the score file score.ini.  
This file is a plain text file which you can edit with any text editor 
(Notepad will do). Spaces, tabs, and blank lines are ignored except in 
keywords and regular expressions.  The score file consists of sections (like 
ini files).  Each section begins with a section header

	[group-regular-expression]

that is, a regular expression surrounded by [ ]  The header indicates which 
groups this section applies to.  For example,

	[.]

indicates this section applies to all groups.

	[^alt\.binaries]

indicates this section applies to all groups starting with 'alt.binaries'

	[babylon|trek]

indicates this section applies to all groups containing the word 'babylon' or 
'trek'.

If group-regular-expression is preceded with a tilde (~), then the meaning is 
inverted.  For example, [~babylon|trek] applies to all groups that do NOT 
contain either 'babylon' or 'trek'

Within each group, you have one or more scoring rules.  Each rule begins like 
so:

	Score: number

that is, the keyword 'Score', followed by ':', followed by one or more 
spaces, then an integer from -9999 to 9999.

You define each rule by specifying one or more of these headers.and the 
expression to match, like so

	keyword: expression-to-match

where keyword is one of: 

	Message-ID, Subject, From, Xref, Lines, References

Here's an example:


[.]
	Score: -9999
	Subject: \$\$\$+

	Score: 9999
	From: luu.*tran

The two rules above apply to all groups.  The first assigns a score of -9999 
(i.e., kills) any article which has three or more consecutive $ in the 
subject.  The second marks as important any article whose author is yours 
truly (ah, ego runs amok!).

If you precede keyword with a ~, then the meaning is inverted.  so

	Score: -1000
	~Subject: mulder|sculley

subtract 1000 from the score any article that does NOT mention mulder or 
sculley in the subject.

When the keyword is Lines, then the expression-to-match is an integer 
specifying the minimum number of lines.  For example,

	[~binaries]
		Score: -9999
		Lines: 1000
		~Subject: faq|rfd|rfc

kills any article appearing outside a binaries group with more than 1000 
lines AND is not a FAQ, RFC, or RFD.

	On the other hand

	[binaries]
		Score: -9999
		~Lines: 50

kills any article in a binaries group with 50 or fewer lines.

By the way, I'm only indenting these lines to make it more readable; it makes 
no difference otherwise.  The only important thing is each of the lines above 
must appear on a single line by itself.  Also, you can add comments by 
putting a  percent sign (%) at the beginning of the line.

By default, each individual test must pass in order for the scoring rule to 
apply, i.e., boolean AND is the default.  If you want to use boolean OR 
instead, add an extra : after the Score keyword.  For example,

	[^comp\.]
		Score:: -9999
		Lines: 1000
		Xref: advocacy
		From: beavis
		From: butthead
		

kills any article posted in a comp group which has more than 1000 lines, or 
is crospposted to advocacy, or is from beavis or butthead.

Note that all keywords are case insensitive.  So too are all regular 
expressions, so you don't need to write [Ff][Oo][Oo], just foo will do. If 
you want the  expression-to-match to be case sensitive, then put an equal 
sign instead of of a : after the keyword, e.g.


	[.]
		Score: -9999
		~Subject= .*[a-z]

kills anything that does not contain at least one lower case letter in the 
subject.

Sections and rules within each session are applied in the order that they 
aappear in the score file.  Each article starts out with a score of zero, 
then for each rule that it passes, its score is incremented or decremented by 
the rule's score value except when the rule's score value is -9999 or 9999, 
in which case the program assigns that score and stops any further testing.  
If you want to assign a single score other than 9999 or -9999, then put an 
equal sign in front of the score value.  For example

	Score: =500
	From: joey

means "if an article was posted by joey, then assign it a score of 500 and 
don't bother looking at any other rule."

You can add an expiration date to each rule, after which time the rule will 
no longer fires.  The format is

	Expires: date

The line, if present, must appear immediately after a Score: line.  For 
example

	% this rule expires at the end of the millenium
	% (okay, the year 1999 anyway :)

	Score: 2000
	Expires: 12/31/1999
	....

The date format is locale-dependent.  It's mm/dd/yyyy for those in the US and 
dd/mm/yyyy for those in the UK and elsewhere.

If you have an empty section, then scoring for groups matching that section 
will halt at that point.  For example, if you want to apply some scores to 
binaries group, but not discussion binaries group, you can do this

[binaries.*\.d$]
% this section is left intentionally empty.  It prevents the scores below 
from 
% being applied to binaries groups ending in .d

[binaries]
	Score: 2000
	......

Xnews' score file format is very similar to slrn's, with (at least) these 
differences: 1) regular expressions are case insensitive in Xnews; 2) slrn 
treats section headers as wildcard expressions while xnews treats them as 
full regular expressions; 3) Xnews does NOT allow scoring on any header other 
than those mentioned, namely, Message-ID, From, Subject, XRef, Lines, and 
References;  and 4) as far as I know, slrn doesn't use the empty section as a 
mean to stop evaluation.

You can read an intro to slrn score file at

	http://kwaziwai.cc.columbia.edu/acis/tutor/slrnscore-txt.html

There's also a slrn score file FAQ at

	http://kwaziwai.cc.columbia.edu/acis/tutor/slrnscorefile-faq.html

You can incorporate ideas in the FAQ to make your own score file, taking into 
account the differences stated above.


Luu Tran
Feb 23, 1999



% sample score file
% rename it as score.ini to use it
% modify to suit your needs
% read scoring.txt for instructions

% in all groups
[.]
	% kill money spam and sex spam
	Score:: -9999
	Subject: \$\$\$+
	Subject: [fs]uck|sex|xxx+|naked|nude


	% kill if subject doesn't contain at least 1 lower case letter
	% i.e., kill all caps subject
	Score:: -9999
	~Subject= [a-z]

	% kill followup to all caps subject while we're at it.
	Score: -9999
	Subject= ^[Rr][Ee]: [^a-z]*$
	Subject= ^[Rr][Ee]: .*[A-Z]

% unless in alt or binaries group
[~alt|binaries]
	% kill stuff crossposted to binaries 
	Score:: -9999
	XRef: binaries

% in midi groups
[midi]
	% kill anything with less than 80 lines
	Score: -9999
	~Lines: 80

% investment tracking
[invest]
	Score: 9999
	Subject: dell|compaq|cpq|intel|intc
Technical Details
Message-ID: <Xns9827659EA1B4duckrulestheuniverse@news.easynews.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!4.24.21.153!newsfeed3.dallas1.level3.net!news.level3.com!newsfeed1.easynews.com!easynews.com!easynews!easynews-local!fe09.news.easynews.com.POSTED!not-for-mail
References: <12em6rer6qv64cd@corp.supernews.com> <Xns98277B4313F4Bmbeausympaticoca@130.133.1.4> <12emdm4s0vou1f@corp.supernews.com>

Show Full Headers
Complete Article Headers
Message-ID: <Xns9827659EA1B4duckrulestheuniverse@news.easynews.com>
Subject: Re: dumb question...
Date: Tue, 22 Aug 2006 17:00:49 GMT
From: sittingduck <you.love.sitting-duck@spamgourmet.com>
References: <12em6rer6qv64cd@corp.supernews.com> <Xns98277B4313F4Bmbeausympaticoca@130.133.1.4> <12emdm4s0vou1f@corp.supernews.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!4.24.21.153!newsfeed3.dallas1.level3.net!news.level3.com!newsfeed1.easynews.com!easynews.com!easynews!easynews-local!fe09.news.easynews.com.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: CHAOS
User-Agent: Xnews/2006.08.21
X-No-Archive: yes
X-Complain-To: your momma, sissy-boy
X-Face: )C/Z<"U&_0<o$r5Z!)H%2/|Y0dbZYY,y)+v0Gm,BT8P=3M"gPbH(/caPEc3jOM{N=yxrm5L
 ]Fdph&; /@R\]#MGl'A+hgU|*,u
Lines: 244
X-Complaints-To: abuse@easynews.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise
 we will be unable to process your complaint properly.