* Grouplens addition
1996-02-15 15:31 ` Lance A. Brown
@ 1996-02-15 19:58 ` "Lance A. Brown"
1996-02-15 21:31 ` Brad Miller
0 siblings, 1 reply; 4+ messages in thread
From: "Lance A. Brown" @ 1996-02-15 19:58 UTC (permalink / raw)
[-- 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)
^ permalink raw reply [flat|nested] 4+ messages in thread