Article View: news.software.readers
Article #27756SLRN/SLANG
From: cbbr... Christopher B. Browne
Date: Fri, 15 Nov 1996 00:00
Date: Fri, 15 Nov 1996 00:00
105 lines
4065 bytes
4065 bytes
I'm trying to build some SLANG code to (what else) do "more sophisticated"
article scoring. In particular, I'm wanting to tag a bunch of articles and
score them identically. (e.g. - "I really hated these 15 articles. Score
'em nasty.")
The code below does successfully open the score file (hardcoded for now;
I'll see about making it portable later) and writes out the info on the
newsgroup that it ought to submit scores for. Unfortunately, it does not
successfully get article header information so as to write out the scores
for the individual articles.
Nothing happens in the "while" loop, unfortunately. And I'm speculating
that the argument for extract_article_header ought to look like:
sheader = extract_article_header("Subject: ");
and would give something equivalent to:
sheader = "Subject: SLRN/SLANG";
Any suggestions?
define mass_score ()
{
variable ng = current_newsgroup ();
variable mh_saver;%%
variable count = 0;
variable stype, score, sheader, sgrp, ngrp;
variable sfile, sfilename, err;
variable output;
variable sgrp2;
sfilename = "/home/cbbrowne/News/Scores"; % Make this better
% later...
stype = get_select_box_response ("Apply score to:", "Subject", "From", "Ref", "Cancel", 4);
stype = stype + 1;
if (stype == 4) {
return; % abort if selected "cancel"
}
% Get value (default: -5)
score = read_mini ("Score to apply:", "-5");
% Which group? (T/A/C)
% sgrp2 = get_response ("TtaAcC", "This newsgroup/All newsgroups/Cancel");
sgrp = get_select_box_response ("Apply score to:", "This newsgroup", "All newsgroups", "Cancel", 3);
sgrp = stype + 1;
if (sgrp == 3) {
return;
}
% Open score file
sfile = fopen( sfilename, "a" ); % Open in append mode
if (sfile == -1) {
message(Sprintf("Could not open score file %d", sfilename));
return;
}
% print to score file either
% [*] or [newsgroup]
if (sgrp == 2) {
ngrp = strcat("[", current_newsgroup());
} else {
ngrp = "[*";
}
ngrp = strcat(ngrp, "]\n");
% output = Sprintf("\n%%Mass scores created %s\n%s\n", "[Insert Date]", ngrp);
() = fputs(ngrp, sfile);
% Works up to here...
call ("art_header_bob");
while ( next_tagged_header () ) {
count = count + 1;
% print to score file "Score: value\n"
% if "S/1," get subject, write "Subject: [subjectline]"
% if "F/2," get sender, write "From: [sender]"
% if "R/3," get reference line, write "References: [references]"
if (stype == 1) {
sheader = extract_article_header("Subject: ");
}
if (stype == 2) {
sheader = extract_article_header("From: ");
}
if (stype == 3) {
sheader = extract_article_header("References: ");
}
%message (Sprintf("Apply to: %s", sheader));
() = fputs (Sprintf("Score: %s\n%s\n", score, sheader), sfile);
message("Record!");
}
% message (Sprintf("Scored %d articles", count));
() = fclose(sfile);
}
definekey ("mass_score", "\ek", "article");
--
Christopher B. Browne, cbbr...@unicomp.net, chris_...@sdt.com
"When you say 'I wrote a program that crashed Windows', people just stare at
you blankly and say 'Hey, I got those with the system, *for free*"
- Linus Torvalds
Technical Details
Message-ID:
<ifsh65.0an.ln@localhost>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <ifsh65.0an.ln@localhost> Subject: SLRN/SLANG Date: Fri, 15 Nov 1996 00:00:00 +0000 From: cbbr...@wolfe.brownes.org (Christopher B. Browne) 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: 196664524 Followup-to: alt.lang.s-lang Organization: Unicomp Technologies International Corporation Keywords: slang, slrn, scoring Reply-to: cbbr...@unicomp.net Newsgroups: news.software.readers,alt.lang.s-lang