|
ru.linux- RU.LINUX --------------------------------------------------------------------- From : Kirill Frolov 2:5030/827.2 16 Jan 2005 02:25:13 To : Valery Shishkov Subject : Re: скоринг -------------------------------------------------------------------------------- On Fri, 14 Jan 05 23:33:26 +0300, Valery Shishkov wrote: VS> Это так, довольно общая и грубая схема. Гораздо более интересен так VS> называемый "адаптивный скоринг", когда читалка сама формирует правила VS> скоринга на основании того, что ты читаешь, а что -- нет. Гораздо интересней три больших кнопки: затвитовать нафиг конкретного человека, всю нить сообщений или целиком сабж. (для slrn) variable expire_days = 10; variable score_step = 10; define score_by_name (score) { variable msgid = extract_article_header("Message-Id"); variable name = str_quote_string ( extract_article_header("From"), "\\^$[].*+?", '\\' ); call("header_bob"); do { variable s=extract_article_header("From"); if (string_match (s, name, 1)) { set_header_score (get_header_score() + score); } } while (header_down(1)); ()=locate_header_by_msgid (msgid, 0); return strcat ("From: ", name); } define score_by_ref (score) { variable msgid = extract_article_header("Message-Id"); set_header_score (get_header_score() + score); call("header_bob"); do { if (is_substr( extract_article_header("References"), msgid) ) { set_header_score (get_header_score() + score); } } while (header_down(1)); ()=locate_header_by_msgid (msgid, 0); msgid = str_quote_string (msgid, "\\^$[].*+?", '\\'); return strcat ("Message-ID: ", strcat (msgid, strcat ("\nReferences: ", msgid))); } define score_by_subj (score) { variable msgid = extract_article_header("Message-Id"); variable subj = str_quote_string ( extract_article_header("Subject"), "\\^$[].*+?", '\\' ); variable subjpat = strcat ("[A-Za-z0-9^]:[ ]", subj); call("header_bob"); do { variable s=extract_article_header("Subject"); if (string_match (s, subj, 1) or string_match (s, subjpat, 1) ) { set_header_score (get_header_score() + score); } } while (header_down(1)); ()=locate_header_by_msgid (msgid, 0); return strcat ("Subject: ", subj); } define score_add (score, by_rule) { variable file, time, arg; arg = get_prefix_arg(); if (arg != -1) { if (score >= 0) score = arg; else score = -arg; } variable scorefile = strcat (getenv("HOME"), "/News/Score"); file = fopen(scorefile, "a+"); if (file==NULL) { error( sprintf( "Can't open score file for writing (%s)", scorefile )); return; } time = localtime(_time() + expire_days*86400); fprintf (file, "\n%%BOS\n[%s]\nScore:: %d\nExpires: %d/%d/%d\n%s\n%%EOS\n\n", current_newsgroup(), score, time.tm_mon+1, time.tm_mday, 1900+time.tm_year, @by_rule(score) ); fclose(file); reload_scorefile(0); % not apply now } define score_ref_plus() {score_add(score_step, &score_by_ref);} definekey("score_ref_plus", "+", "article"); define score_ref_minus() {score_add(-score_step, &score_by_ref);} definekey("score_ref_minus", "-", "article"); define score_subj_plus() {score_add(score_step, &score_by_subj);} definekey("score_subj_plus", "\e+", "article"); define score_subj_minus() {score_add(-score_step, &score_by_subj);} definekey("score_subj_minus", "\e-", "article"); define score_name_plus() {score_add(score_step, &score_by_name);} definekey("score_name_plus", ")", "article"); define score_name_minus() {score_add(-score_step, &score_by_name);} definekey("score_name_plus", "(", "article"); --- [ZX] * Origin: [ лучше пингвин в руках, чем журавль в облаках ] (2:5030/827.2) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.linux/59620827521f.html, оценка из 5, голосов 10
|