Article View: news.software.readers
Article #23543slrn score-file fiddling
From: Christopher B. Browne
Date: Sat, 29 Jun 1996 00:00
Date: Sat, 29 Jun 1996 00:00
106 lines
3820 bytes
3820 bytes
I posted some comments about slrn and scoring, and I think it behooves
me to do more than just talk about things I'd like to see in slrn.
I was looking for two things:
a) A utility to clean up slrn score files
This would do things like:
- re-arranging rules into some sort of coherent order
- Deleting comment lines (not universally a good thing, but I'm
happy enough doing it...)
- Folding duplicated scores together.
The following Perl script does this sort of thing. Change the filename
that it reads score info from; you'll need to have a temporary file to
sent output to. (Redirecting output to the score file that you started
with will result in an *empty* score file.)
It may not handle expiry dates very well; I don't use expiry much, so
I didn't much care. It should be a simple extension...
#!/usr/bin/perl
# $Id$
# Reformat score file
open(SCORES, "</home/cbbrowne/News/scores/Scores");
while (<SCORES>) {
if (/^%/) {
# Skip comment line
} else {
if (/\s*Score:(.*)\s*/) {
$score = $1;
}
if ((/^\s*\[/) || (/^\s*Score:/ )) {
# New entry
# Process last entry
# Clear from/to/sub/score/xref/newsgroup
$key = "$group:$exp:$from:$ref:$sub:$xref:$grp";
$RULE{$key} += $score;
($exp, $from, $sub, $xref, $grp) = ();
}
if (/\s*\[(.*)\]\s*$/) {
$group = $1;
} elsif (/\s*Expires:(.*)\s*/) {
$exp = $1;
} elsif (/\s*Subject:(.*)\s*/) {
$sub = $1;
} elsif (/\s*Newsgroup:(.*)\s*/) {
$grp = $1;
} elsif (/\s*References:(.*)\s*/) {
$ref = $1;
} elsif (/\s*From:(.*)\s*$/) {
$from = $1;
} elsif (/\s*Xref:(.*)\s*$/) {
$xref = $1;
}
}
}
foreach $i (sort keys %RULE) {
$score = $RULE{$i};
if ($score < -9999) {
$score = -9999;
}
# print $i, $score, "\n";
($group, $exp,$from,$ref,$sub,$xref,$grp) = split(/:/, $i);
if ($group eq $lastgroup) {
# Skip group - hasn't changed
} else {
$lastgroup = $group;
print "\[$group\]\n";
}
print "Score: $score\n";
print "\tExpires: $exp\n" unless $exp eq "";
print "\tSubject: $sub\n" unless $sub eq "";
print "\tNewsgroup: $grp\n" unless $grp eq "";
print "\tReferences: $ref\n" unless $ref eq "";
print "\tFrom: $from\n" unless $from eq "";
print "\tXref: $xref\n" unless $xref eq "";
print "\n";
}
# End of Perl script
b) Different thresholds to kill/delete/favor articles.
I've made patches on the latest version (0.8.8.3) that provides new
variables, allowing one to have articles killed at other than a score
of -9999, deletion at other than <0, "favored" for selection at other
than >0.
*Very* simple changes; I'm still figuring out how to build the patch
file.
c) Automatic scoring based on slrn variables.
This looks more "entertaining;" more than a morning's worth of work.
I'm thinking of an approach; not certain yet of how best to link the
functionality in.
--
Christopher B. Browne, cbbrowne@conline.com, chris_browne@sdt.com
Web: http://www.conline.com/~cbbrowne SAP Basis Consultant, UNIX Guy,
Linux Guy. "Windows? Ah... The Athena Project from MIT..."
Technical Details
Message-ID:
<slrn4tal8o.7v4.cbbrowne@dantzig.nodomain.nowhere>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <slrn4tal8o.7v4.cbbrowne@dantzig.nodomain.nowhere> Subject: slrn score-file fiddling Date: Sat, 29 Jun 1996 00:00:00 +0000 From: cbbrowne@dantzig.nodomain.nowhere (Christopher B. Browne) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 162795935 Organization: UniComp Technologies International Corp -- Internet Service Reply-to: cbbrowne@conline.com Newsgroups: news.software.readers