forked from norvig/paip-lisp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mycin-r.lisp
82 lines (69 loc) · 2.3 KB
/
mycin-r.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;;;; -*- Mode: Lisp; Syntax: Common-Lisp -*-
;;;; Code from Paradigms of AI Programming
;;;; Copyright (c) 1991 Peter Norvig
;;;; File mycin-r.lisp: Sample parameter list and rulebase for mycin.
(requires "mycin")
;;; Parameters for patient:
(defparm name patient t "Patient's name: " t read-line)
(defparm sex patient (member male female) "Sex:" t)
(defparm age patient number "Age:" t)
(defparm burn patient (member no mild serious)
"Is ~a a burn patient? If so, mild or serious?" t)
(defparm compromised-host patient yes/no
"Is ~a a compromised host?")
;;; Parameters for culture:
(defparm site culture (member blood)
"From what site was the specimen for ~a taken?" t)
(defparm days-old culture number
"How many days ago was this culture (~a) obtained?" t)
;;; Parameters for organism:
(defparm identity organism
(member pseudomonas klebsiella enterobacteriaceae
staphylococcus bacteroides streptococcus)
"Enter the identity (genus) of ~a:" t)
(defparm gram organism (member acid-fast pos neg)
"The gram stain of ~a:" t)
(defparm morphology organism (member rod coccus)
"Is ~a a rod or coccus (etc.):")
(defparm aerobicity organism (member aerobic anaerobic))
(defparm growth-conformation organism
(member chains pairs clumps))
(clear-rules)
(defrule 52
if (site culture is blood)
(gram organism is neg)
(morphology organism is rod)
(burn patient is serious)
then .4
(identity organism is pseudomonas))
(defrule 71
if (gram organism is pos)
(morphology organism is coccus)
(growth-conformation organism is clumps)
then .7
(identity organism is staphylococcus))
(defrule 73
if (site culture is blood)
(gram organism is neg)
(morphology organism is rod)
(aerobicity organism is anaerobic)
then .9
(identity organism is bacteroides))
(defrule 75
if (gram organism is neg)
(morphology organism is rod)
(compromised-host patient is yes)
then .6
(identity organism is pseudomonas))
(defrule 107
if (gram organism is neg)
(morphology organism is rod)
(aerobicity organism is aerobic)
then .8
(identity organism is enterobacteriaceae))
(defrule 165
if (gram organism is pos)
(morphology organism is coccus)
(growth-conformation organism is chains)
then .7
(identity organism is streptococcus))