Thread View: news.software.readers
1 messages
1 total messages
Started by cbbr... Christopher B. Browne
Fri, 15 Nov 1996 00:00
SLRN/SLANG
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads