Article View: news.software.readers
Article #42782Scoring with S-Lang function (Was: Re: Why reinvent slrn? (was: Re: [slrn] Preventing an S-Lang macro from aborting.))
From: lah... Jan Hlavacek
Date: Tue, 18 Aug 1998 00:00
Date: Tue, 18 Aug 1998 00:00
66 lines
3269 bytes
3269 bytes
On Tue, 18 Aug 1998 01:29:23 GMT, obscurity <obsc...@obscure.org>
wrote:
> There are also other things I'd like to be able to do that slrn
> doesn't let me (like do article scoring by passing the article to a
> slang function that returns the score, thus giving maximum
> flexibility)
Actually, you can do this in slrn. Try something like this:
define score_article_with_function (f)
{
set_header_score (@f(get_header_score (), article_as_string ()));
}
define identity (score, article)
{
return (score);
}
variable Scoring_Function = &identity;
define article_mode_hook ()
{
call ("header_bob");
do
{
if (is_thread_collapsed ())
{
uncollapse_thread ();
loop (thread_size () - 1)
{
score_article_with_function (Scoring_Function);
header_down (1);
}
score_article_with_function (Scoring_Function);
collapse_thread ();
}
else score_article_with_function (Scoring_Function);
header_down (1);
}
call ("header_bob");
}
You can then write your own scoring function which takes current score
and the article as a string as arguments and returns new score, and
assign it to the Scoring_Function. I didn't test it, it may need some
changes, like maybe few ERRORBLOCKs and so on. You can also make it
even more flexible, like make the Scoring_Function not take any
arguments at all, and get them all using the low level slrn functions
(so you don't need to download the bodies of articles which you know you
don't want to score and so on).
> I realise that at least some of this could be 'solved' by using
> multiple windows in a gui environment, but I *hate* gui's and am
> strictly (or as strictly as my OS allows) a full-screen, text-mode
> only person.
Did you try "screen"?
--
Jan Hlav\'{a}\v{c}ek <lah...@math.mps.ohio-state.edu> (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/
Technical Details
Message-ID:
<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-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>Show Full Headers
Complete Article Headers
Message-ID: <slrn6ti0da.m7a.lahvak@math.mps.ohio-state.edu> Subject: 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: lah...@math.mps.ohio-state.edu (Jan Hlavacek) 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> 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: 382174921 Organization: Department of Mathematics, The Ohio State University Reply-To: lah...@math.mps.ohio-state.edu Newsgroups: alt.lang.s-lang,news.software.readers