-;;; $Id: sql-classes.lisp,v 1.2 2002/10/09 00:34:47 kevin Exp $
-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*-
+;;;; *************************************************************************
+;;;; FILE IDENTIFICATION
+;;;;
+;;;; Name: sql-classes.lisp
+;;;; Purpose: Routines for reading UMLS objects from SQL database
+;;;; Programmer: Kevin M. Rosenberg
+;;;; Date Started: Apr 2000
+;;;;
+;;;; $Id: sql-classes.lisp,v 1.3 2002/10/09 23:03:41 kevin Exp $
+;;;;
+;;;; This file, part of UMLisp, is
+;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
+;;;;
+;;;; UMLisp users are granted the rights to distribute and use this software
+;;;; as governed by the terms of the GNU General Public License.
+;;;; *************************************************************************
+
(in-package :umlisp)
+(declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3)))
-(declaim (optimize (speed 3) (safety 1)))
(defvar *current-srl* nil)
(defun current-srl ()
(setq ucons (append ucons (find-ucon-word word :srl srl))))
(sort-score-ucon-str str (delete-duplicates ucons :test #'eql :key #'cui))))
-(defun find-ucon-normalized-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 '())
- (nwords '()))
- (dolist (word words)
- (let ((nws (lvg:process-terms word)))
- (dolist (nword nws)
- (push nword nwords))))
- (dolist (word nwords)
- (setq ucons (append ucons (find-ucon-word word :srl srl))))
- (sort-score-ucon-str str (delete-duplicates ucons :test #'eql :key #'cui))))
-
(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))
(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))))
-
-(defun find-ustr-normalized-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 '())
- (nwords '()))
- (dolist (word words)
- (let ((nws (lvg:process-terms word)))
- (dolist (nword nws)
- (push nword nwords))))
- (dolist (word nwords)
- (setq ustrs (append ustrs (find-ustr-word word :srl srl))))
- (sort-score-ustr-str str (delete-duplicates ustrs :test #'eql :key #'ustr-cui))))
-
-(defun a (str)
- (find-normalized-matches-for-str str #'find-ustr-normalized-word #'ustr-sui))
-
-(defun find-normalized-matches-for-str (str lookup-func key-func)
- "Return list of objects that normalize match for words in string,
-eliminate duplicates."
- (let ((objs '())
- (nwords '()))
- (dolist (word (delimited-string-to-list str #\space))
- (dolist (nword (lvg:process-terms word))
- (unless (member nword nwords :test #'string-equal)
- (push nword nwords))))
- (dolist (nw nwords)
- (setq objs (append objs (funcall lookup-func nw))))
- (delete-duplicates objs :key key-func :test #'eql)))
(defun sort-score-ucon-str (str ucons)
"Return list of sorted and scored ucons. Score by match of str to ucon-pfstr"