Article View: news.software.readers
Article #42784Re: Scoring with S-Lang function (Was: Re: Why reinvent slrn? (was: Re: [slrn] Preventing an S-Lang macro from aborting.))
From: Lloyd Zusman
Date: Tue, 18 Aug 1998 00:00
Date: Tue, 18 Aug 1998 00:00
117 lines
6634 bytes
6634 bytes
Speaking of scoring with an S-Lang function, here's the thing I wrote
last year to aid in converting a standard slrn score file to some
S-Lang code which does the same thing. Once you run your score file
through this Perl script, you can dispense with the score file
altogether and use the resulting S-Lang code, instead. The full
complement of S-Lang features will then be available to you for doing
any kind of scoring you like.
This post contains the README file, and the other post in this series
contains the Perl script itself, called "scoregen". Please read the
README file completely before attempting to make use of "scoregen".
All feedback is welcome.
Lloyd Zusman
l...@asfast.com
----------------------------- README file -----------------------------
scoregen -- Generate S-Lang scoring routines from an Slrn score file
--------------------------------------------------------------------
Version 0.04
Lloyd Zusman <l...@asfast.com>
1998/08/12
IMPORTANT NOTE: PLEASE READ ALL OF THIS BEFORE USING THIS SOFTWARE
BACKGROUND
----------
This is scoregen, a Perl script that reads an Slrn score file as input
and uses it to produce a group of S-Lang routines which perform the
same scoring functions.
The idea for scoregen came to me in the fall of 1997 during a
discussion in news.software.readers among some of us Slrn aficionados.
One of us, J.B. Nicholson-Owens <j...@pop-a-wheelie.midwest.net>, was
suggesting that Slrn's score-file processing be enhanced with variable
expansion and perhaps some simple functional processing.
During the ensuing debate, it occurred to some of us that this
functionality and a lot more could be had simply by doing the scoring
directly from within S-Lang instead of via the standard score file.
Some objections to this idea were raised, and most of them had to do
with the idea that it would be complicated and time-consuming to
manually construct the appropriate S-Lang code based upon an
arbitrary, existing score file, especially one which is large. It was
at this point that I conceived of the current form of scoregen.
Scoregen answers these objections because it automatically generates
the appropriate S-Lang code by reading a standard score file as input.
Once this code is generated, it is expected to be invoked within
Slrn's article_mode_hook(), at which time it will perform the
requested scoring.
The following point is important, and so I'm putting it in caps:
SCOREGEN IS ONLY INTENDED TO BE USED ONCE PER SCORE FILE
In other words, the recommended use of scoregen is for you to feed
your score file through it once and only once, to start using the
resulting S-Lang code for scoring, and to then stop using your score
file (and scoregen!) altogether. From then on, you should use the
resulting S-Lang routines to do your article scoring, and you should
modify the S-Lang code directly if you want to make any changes to
your scoring rules.
The main advantage in using the resulting S-Lang-based routines is so
that you can easily make use of the added flexibility that you can get
via programatic scoring. Given that the resulting S-Lang-based
scoring routines will run somewhat slower that the optimized, compiled
C routines that currently do scoring in Slrn, you should probably just
stick to using a standard score file if you don't want this added
programatic flexibility.
Of course, if S-Lang-based scoring catches on, it can be speeded up
quite a bit if some new S-lang or Slrn intrinsics would be defined.
Scoregen generates the following S-lang routines:
score_article() This routine scores each article. It's
what gets generated from your score file,
and its structure is pretty much parallel
to that of your score file.
do_scoring() This routine loops through all the articles
in a newsgroup, calling score_article()
on each one. It's designed to be invoked
from within article_mode_hook. Alternatively,
the name of this routine can be changed to
"article_mode_hook", and it'll work just
fine in this manner.
convenience routines The above two routines make use of a few
convenience routines that I wrote to
simplify the S-Lang-based scoring
procedure. These convenience routines are
also generated by scoregen.
Some of the convenience routines I wrote are nearly direct recodings
of C routines that exist in the S-Lang and Slrn source code. These
routines are good candidates to be turned into S-lang or Slrn
intrinsics. The rest of the convenience functions can also be made
into intrinsics if this is deemed useful.
Note that another major purpose of scoregen is to stimulate discussion
and debate about S-Lang-based scoring. Although I spent some time
trying to optimize scoregen and make it useful, I don't necessarily
consider it to be the last word in Slrn scoring. I'm hoping that
through our discussions, we Slrn lovers can come up with the best and
most useful approaches to scoring, whether or not S-lang-based scoring
is ever used.
Technical Details
Message-ID:
<lt1zqd96gs.fsf@asfast.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mailReferences:
<lt7m09d7sr.fsf@asfast.com> <slrn6tcib1.gg3.bluemoon@ux6.cso.uiuc.edu> <slrn6tcjq7.ke5.ljz@sunspot.tiac.net> <slrn6td1jb.c8k.bluemoon@ux6.cso.uiuc.edu> <ltlnopatls.fsf@asfast.com> <slrn6teh0j.bl.bluemoon@ux6.cso.uiuc.edu> <lt3eawbhq2.fsf@asfast.com> <Aug-17-03.42.27-1998.obs@burnout.demon.co.uk> <slrn6tgukj.n8d.bluemoon@ux6.cso.uiuc.edu> <Aug-18-01.07.07-1998.obs@burnout.demon.co.uk> <slrn6ti0da.m7a.lahvak@math.mps.ohio-state.edu>Show Full Headers
Complete Article Headers
Message-ID: <lt1zqd96gs.fsf@asfast.com> Subject: Re: Scoring with S-Lang function (Was: Re: Why reinvent slrn? (was: Re: [slrn] Preventing an S-Lang macro from aborting.)) Date: Tue, 18 Aug 1998 00:00:00 +0000 From: Lloyd Zusman <l...@asfast.com> References: <lt7m09d7sr.fsf@asfast.com> <slrn6tcib1.gg3.bluemoon@ux6.cso.uiuc.edu> <slrn6tcjq7.ke5.ljz@sunspot.tiac.net> <slrn6td1jb.c8k.bluemoon@ux6.cso.uiuc.edu> <ltlnopatls.fsf@asfast.com> <slrn6teh0j.bl.bluemoon@ux6.cso.uiuc.edu> <lt3eawbhq2.fsf@asfast.com> <Aug-17-03.42.27-1998.obs@burnout.demon.co.uk> <slrn6tgukj.n8d.bluemoon@ux6.cso.uiuc.edu> <Aug-18-01.07.07-1998.obs@burnout.demon.co.uk> <slrn6ti0da.m7a.lahvak@math.mps.ohio-state.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail X-Deja-AN: 382462335 X-Complaints-To: news...@supernews.com X-Trace: 903485620 NHG18.M.GE264CCFD usenet40.supernews.com Organization: http://www.supernews.com, The World's Usenet: Discussions Start Here Newsgroups: alt.lang.s-lang,news.software.readers