From 476aba64a717f135e7b27cfc8d4a94cbfc3171b1 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Tue, 24 Jun 2003 08:49:52 +0000 Subject: [PATCH] r5185: *** empty log message *** --- class-support.lisp | 6 +++--- package.lisp | 3 ++- sql-classes.lisp | 41 ++++++++++++++++++++--------------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/class-support.lisp b/class-support.lisp index 7614a15..85b49a6 100644 --- a/class-support.lisp +++ b/class-support.lisp @@ -7,7 +7,7 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: class-support.lisp,v 1.14 2003/06/17 04:56:02 kevin Exp $ +;;;; $Id: class-support.lisp,v 1.15 2003/06/24 08:49:09 kevin Exp $ ;;;; ;;;; This file, part of UMLisp, is ;;;; Copyright (c) 2000-2003 by Kevin M. Rosenberg, M.D. @@ -154,11 +154,11 @@ "Return the string for a ulo object" (find-string-sui (sui lo))) -(defun uterm-pfstr (uterm) +(defmethod pfstr ((uterm uterm)) "Return the preferred string for a uterm" (dolist (ustr (s#str uterm)) (when (string= "PF" (stt ustr)) - (return-from uterm-pfstr (str ustr))))) + (return-from pfstr (str ustr))))) (defun remove-non-english-terms (uterms) (remove-if-not #'english-term-p uterms)) diff --git a/package.lisp b/package.lisp index 7981c32..9e0972f 100644 --- a/package.lisp +++ b/package.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: package.lisp,v 1.23 2003/06/24 00:27:59 kevin Exp $ +;;;; $Id: package.lisp,v 1.24 2003/06/24 08:49:09 kevin Exp $ ;;;; ;;;; This file, part of UMLisp, is ;;;; Copyright (c) 2000-2003 by Kevin M. Rosenberg, M.D. @@ -122,6 +122,7 @@ #:find-ucon-normalized-word #:find-ustr-word #:find-ustr-normalized-word + #:find-uterm-multiword #:find-uterm-word #:find-uterm-normalized-word #:find-ucon-multiword diff --git a/sql-classes.lisp b/sql-classes.lisp index 904e77d..bdaa025 100644 --- a/sql-classes.lisp +++ b/sql-classes.lisp @@ -7,7 +7,7 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: sql-classes.lisp,v 1.86 2003/06/24 00:27:59 kevin Exp $ +;;;; $Id: sql-classes.lisp,v 1.87 2003/06/24 08:49:09 kevin Exp $ ;;;; ;;;; This file, part of UMLisp, is ;;;; Copyright (c) 2000-2003 by Kevin M. Rosenberg, M.D. @@ -565,15 +565,15 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" (defun find-uterm-word (word &key (srl *current-srl*)) "Return list of uterms that match word" - (collect-umlisp-query (mrxw_eng (cui sui) srl wd word :lrl klrl - :order (cui asc sui asc)) - (find-uterm-cuisui (ensure-integer cui) (ensure-integer sui) :srl srl))) + (collect-umlisp-query (mrxw_eng (cui lui) srl wd word :lrl klrl + :order (cui asc lui asc)) + (find-uterm-cuilui (ensure-integer cui) (ensure-integer lui) :srl srl))) (defun find-uterm-normalized-word (word &key (srl *current-srl*)) "Return list of uterms that match word" - (collect-umlisp-query (mrxnw_eng (cui sui) srl nwd word :lrl klrl - :order (cui asc sui asc)) - (find-uterm-cuisui (ensure-integer cui) (ensure-integer sui) :srl srl))) + (collect-umlisp-query (mrxnw_eng (cui lui) srl nwd word :lrl klrl + :order (cui asc lui asc)) + (find-uterm-cuilui (ensure-integer cui) (ensure-integer lui) :srl srl))) (defun find-ucon-noneng-word (word &key (srl *current-srl*) (like nil)) "Return list of ucons that match non-english word" @@ -595,25 +595,24 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS" ;;; Multiword lookup and score functions +(defun find-uobj-multiword (str obj-lookup-fun sort-fun key srl) + (let ((uobjs '())) + (dolist (word (delimited-string-to-list str #\space)) + (setq uobjs (append uobjs (funcall obj-lookup-fun word :srl srl)))) + (funcall sort-fun str (delete-duplicates uobjs :test #'= :key key)))) + (defun find-ucon-multiword (str &key (srl *current-srl*)) - "Return sorted list of ucon's that match a multiword string" - (let* ((words (delimited-string-to-list str #\space)) - (ucons '())) - (dolist (word words) - (setq ucons (append ucons (find-ucon-word word :srl srl)))) - (sort-score-ucon-str str (delete-duplicates ucons :test #'eql :key #'cui)))) + (find-uobj-multiword str #'find-ucon-word #'sort-score-pfstr-str #'cui srl)) + +(defun find-uterm-multiword (str &key (srl *current-srl*)) + (find-uobj-multiword str #'find-uterm-word #'sort-score-pfstr-str #'lui srl)) (defun find-ustr-multiword (str &key (srl *current-srl*)) - "Return sorted list of ustr's that match a multiword string" - (let* ((words (delimited-string-to-list str #\space)) - (ustrs '())) - (dolist (word words) - (setq ustrs (append ustrs (find-ustr-word word :srl srl)))) - (sort-score-ustr-str str (delete-duplicates ustrs :test #'eql :key #'cui)))) + (find-uobj-multiword str #'find-ustr-word #'sort-score-ustr-str #'sui srl)) -(defun sort-score-ucon-str (str ucons) +(defun sort-score-pfstr-str (str uobjs) "Return list of sorted and scored ucons. Score by match of str to ucon-pfstr" - (sort-score-umlsclass-str ucons str #'pfstr)) + (sort-score-umlsclass-str uobjs str #'pfstr)) (defun sort-score-ustr-str (str ustrs) "Return list of sorted and scored ucons. Score by match of str to ucon-pfstr" -- 2.34.1