🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #32717

Re: slrn: scoring on body text?

#32717
From: John E. Davis
Date: Fri, 11 Apr 1997 00:00
134 lines
4299 bytes
On 4 Apr 1997 08:48:43 GMT, J.H.M. Dassen <jdassen@wi.LeidenUniv.nl>
wrote:
>Is it possible in slrn to score on words in the body of messages? If so,
>is there an example file available?

   No, I did not add scoring on the body of the message.  It is
extremely unlikely that I would ever do so; however, you should be
able to write a macro to do body searches (see what I use below).

>Also, is slrn's scoring regexp based? If so, what's the precise syntax?

There is no official documentation for the syntax.  Here is what rgrep
produces (rgrep is a recursive grep program distributed with jed and
uses slang regular expressions):

Supported Regular Expressions:
   .                  match any character except newline
   \d                 match any digit
   \e                 match ESC char
   *                  matches zero or more occurences of previous RE
   +                  matches one or more occurences of previous RE
   ?                  matches zero or one occurence of previous RE
   ^                  matches beginning of line
   $                  matches end of line
   [ ... ]            matches any single character between brackets.
                      For example, [-02468] matches `-' or any even digit.
		      and [-0-9a-z] matches `-' and any digit between 0 and 9
		      as well as letters a through z.
   \<                 Match the beginning of a word.
   \>                 Match the end of a word.
   \{ ... \}
   \( ... \)
   \1, \2, ..., \9    matches text specified by nth \( ... \) expression.
                      For example, '\([ \t][a-zA-Z]+\)\1[ \t]' matches any
		      word repeated consecutively.

Here is the body searching macro.  See slrn/doc/README.macros for more
information. (There are actually two searches: one that searches
articles on the server and the other uses www.altavista.com)  

Note: you may need slrn/macros/util.sl loaded.


!if (is_defined ("Search_Altavista_Browser"))
{
   variable Search_Altavista_Browser = "lynx";
}

variable Search_Last_Art_Search_Str = "";
define search_newsgroup ()
{
   variable str;
   variable flags;
   
   str = read_mini ("Search for regexp", Search_Last_Art_Search_Str, "");
   !if (strlen (str))
     return;

   Search_Last_Art_Search_Str = str;
   
   uncollapse_threads ();
   
   do
     {
	flags = get_header_flags ();
	
	if (re_search_article (str))
	  {
	     pop ();
	     return;
	  }
	
	set_header_flags (flags);
	
	call ("hide_article");
     }
   while (header_down (1));
   
   error ("Not found.");
}

define search_using_altavista ()
{
   variable url = "http://www.altavista.digital.com/";
   variable cgi = "cgi-bin/query?pg=q&what=news&fmt=.&q=";
   variable str, new_str, len, ch, chlo, i;
   variable cmd;
   
   str = strcat ("+newsgroups:", current_newsgroup ());
   str = strcat (str, " +");
   
   str = read_mini ("AltaVista Search", "", str);
   
   len = strlen (str);
   !if (len) return;
   
   new_str = "";
   for (i = 0; i < len; i++)
     {
	ch = str [i];
	chlo = ch | 0x20;
	if ((chlo > 'z') or (chlo < 'a'))
	  ch = Sprintf ("%%%02X", ch, 1);
	else 
	  ch = char (ch);
	
	new_str = strcat (new_str, ch);
     }
   
   cmd = Sprintf ("%s '%s%s%s'", Search_Altavista_Browser, 
		  url, cgi, new_str, 4);
   () = system (cmd);
}

define search_easy_search ()
{
   variable rsp;
   rsp = get_select_box_response ("NewsGroup Searches",   %  title
				  "AltaVista (WWW)",
				  "search articles",
				  2);

   switch (rsp)
     { case 0: search_using_altavista (); }
     { case 1: search_newsgroup (); }
}


definekey ("search_easy_search", "$", "article");



Technical Details
Message-ID: <slrn5kqacp.kvn.davis@mygir.davis.net>
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
References: <5i2f9b$c9p@nic.wi.leidenuniv.nl>

Show Full Headers
Complete Article Headers
Message-ID: <slrn5kqacp.kvn.davis@mygir.davis.net>
Subject: Re: slrn: scoring on body text?
Date: Fri, 11 Apr 1997 00:00:00 +0000
From: davis@space.mit.edu (John E. Davis)
References: <5i2f9b$c9p@nic.wi.leidenuniv.nl>
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: 232267118
Organization: Center for Space Research
Newsgroups: news.software.readers