Gnus development mailing list
 help / color / mirror / Atom feed
From: labrown@dg-rtp.dg.com ("Lance A. Brown")
Subject: Grouplens addition
Date: Thu, 15 Feb 1996 14:58:56 -0500	[thread overview]
Message-ID: <27154.824414336@dg-rtp.dg.com> (raw)
In-Reply-To: Your message of "Thu, 15 Feb 1996 10:31:26 EST." <21393.824398286@dg-rtp.dg.com>

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

Here is a patch to gnus-gl.el that adds another user-format function
that doesn't rely on having the Grouplens info plugged into the Gnus
scoring mechanism.  This allows both "normal" SCORE/ADAPT scoring and
Grouplens predictions to be displayed in the summary line.  No changes
to existing code were needed.

I am also including the relevant section of my Gnus rc file so you can
see how I set up to use this function.  Groups that are handled by the
BBB have the prediction shown.  Groups that aren't show my "normal"
summary line.

--[Lance]

[-- Attachment #2: Patch for gnus-gl.el --]
[-- Type: text/plain, Size: 2641 bytes --]

*** /tmp/T0a006YJ	Thu Feb 15 14:49:43 1996
--- gnus-gl.el	Thu Feb 15 14:38:50 1996
***************
*** 493,498 ****
--- 493,566 ----
        (aset rate-string 5 ?N) (aset rate-string 6 ?A))
      rate-string))
  
+ ;;
+ ;; Gnus user format function that doesn't depend on
+ ;; bbb-build-mid-scores-alist being used as the score function, but is
+ ;; instead called from gnus-select-group-hook. -- LAB
+ (defun gnus-user-format-function-L (header)
+   (if (not (member grouplens-current-group grouplens-newsgroups))
+       ;; Return an empty string
+       ""
+     (let* ((rate-string (make-string 12 ? ))
+            (mid
+             (aref header
+                   (nth 1 (assoc "message-id" gnus-header-index))))
+            (hashent (gethash mid grouplens-current-hashtable))
+            (pred (nth 0 hashent))
+            (low (nth 1 hashent))
+            (high (nth 2 hashent)))
+ 
+       ;; Init rate-string
+       (aset rate-string 0 ?|) 
+       (aset rate-string 11 ?|)
+       
+       ;; If no entry in BBB hash mark rate string as NA and return
+       (if (null hashent)
+           (progn
+             (aset rate-string 5 ?N) 
+             (aset rate-string 6 ?A)
+             rate-string)
+         ;; Otherwise
+         (cond 
+          ;; prediction-spot
+          ((equal grouplens-prediction-display 'prediction-spot)
+           (fmt-prediction-spot rate-string pred))
+ 
+          ;; confidence-interval
+          ((equal grouplens-prediction-display 'confidence-interval)
+           (fmt-confidence-interval pred low high))
+ 
+          ;; prediction-bar
+          ((equal grouplens-prediction-display 'prediction-bar)
+           (fmt-prediction-bar rate-string pred))
+ 
+          ;; confidence-bar
+          ((equal grouplens-prediction-display 'confidence-bar)
+           (format "|   %4.2f   |" pred))
+ 
+          ;; confidence-spot
+          ((equal grouplens-prediction-display 'confidence-spot)
+           (format "|   %4.2f   |" pred))
+ 
+          ;; prediction-num
+          ((equal grouplens-prediction-display 'prediction-num)
+           (fmt-prediction-num pred))
+ 
+          ;; confidence-plus-minus
+          ((equal grouplens-prediction-display 'confidence-plus-minus)
+           (fmt-confidence-plus-minus pred low high))
+ 
+          (t 
+           (gnus-message 3 "Invalid prediction display type")
+           (aset rate-string 0 ?|) 
+           (aset rate-string 11 ?|)
+           rate-string)
+          )
+         )
+       )
+     )
+   )
+ 
  (defun grouplens-valid-score (score)
    (if (equal grouplens-prediction-display 'prediction-num)
        t

[-- Attachment #3: Lance Brown Grouplens Gnus rc code --]
[-- Type: text/plain, Size: 2321 bytes --]

;;;
;;; Grouplens Stuff
;;;
(require 'gnus-gl)

;;;; In addition, there are a few gnus-*-hooks that need to be set:

(add-hook 'gnus-startup-hook 'bbb-login)
(add-hook 'gnus-exit-gnus-hook 'bbb-logout)

;;; The above format also assumes that you are using gnus-bbdb  You can
;;; just as easily ad %uG to whatever format string you use.  Or add
;;; a %i to just see a simple numeric version of the predictions that
;;; uses less space on the summary line.  If you use %uG you have several
;;; choices for how things look.  See the doc string for the
;;; grouplens-prediction-display variable.

(setq grouplens-prediction-display 'confidence-bar)


;;; If you use %uI on your group-line-format you will get (GroupLens
;;; Enhanced) after the names of newsgroups supported by GroupLens.

(setq gnus-group-line-format "%M%S%p%5y: %(%g%) %uI\n")

;;; Summary Mode Line Format
(setq gnus-summary-line-format "%U%R%4,4i%uL%I%(%[%4L:%-19,19n%]%) %s\n")

(define-key gnus-summary-goto-map "n" 'grouplens-next-unread-article)
(define-key gnus-summary-mode-map "n" 'grouplens-next-unread-article)
(define-key gnus-summary-score-map "r" 'bbb-summary-rate-article)
(define-key gnus-summary-mode-map "," 'grouplens-best-unread-article)

(add-hook 'gnus-exit-group-hook 'bbb-put-ratings)

;;; In addition there are some GroupLens user variables to set

(setq grouplens-pseudonym "Ghost")

;;; If you are using a bbb other than twain.cs.umn.edu you will need to
;; set the grouplens-bbb-host variable, and possibly the
;; grouplens-bbb-port variable. 

(setq grouplens-newsgroups 
      '("comp.lang.c++"
        "rec.humor" 
        "rec.food.recipes"
        "comp.os.linux.announce"
        "comp.os.linux.answers"
        "comp.os.linux.development"
        "comp.os.linux.development.apps"
        "comp.os.linux.development.system"
        "comp.os.linux.hardware"
        "comp.os.linux.misc"
        "comp.os.linux.networking"
        "comp.os.linux.setup"
        "comp.groupware"
        "mn.general"p
        "rec.arts.movies"
        "rec.arts.movies.current-films")
      )
;; This sets up the groups for which you will get predictions and ratings.

;; Hook BBB into group select hook
(defun lab-bbb-select-hook ()
  (bbb-build-mid-scores-alist gnus-newsgroup-name))

(add-hook 'gnus-select-group-hook 'lab-bbb-select-hook)

  reply	other threads:[~1996-02-15 19:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ravx4ge5@totally-fudged-out-message-id>
1996-02-15  3:53 ` GroupLens: gnus-gl.el Brad Miller
1996-02-15 15:31   ` Lance A. Brown
1996-02-15 19:58     ` "Lance A. Brown" [this message]
1996-02-15 21:31       ` Grouplens addition Brad Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27154.824414336@dg-rtp.dg.com \
    --to=labrown@dg-rtp.dg.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).