-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlung.pl
102 lines (85 loc) · 3.46 KB
/
lung.pl
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
notice:-
write('This is an Example of a Disease Diagnosis Artificial intelligence System for Diagnosing some Diseases'),nl,
write('This system has been designed by Hassan_Wari'),nl,
nl,
write('To use it, just answer the simple questions the AI system asks you.'),nl.
disease(Patient,tuberculosis,isoniazid,4*3):-
symptom(Patient, persistent_cough),
symptom(Patient, constant_fatigue),
symptom(Patient, weight_loss),
symptom(Patient, lack_of_appetite),
symptom(Patient, fever),
symptom(Patient, coughing_blood),
symptom(Patient, night_sweats).
disease(Patient,amoeba,abz,3*3):-
symptom(Patient, diaorhea),
symptom(Patient, fever),
symptom(Patient, body_weakness),
symptom(Patient, lack_of_appetite),
symptom(Patient, abdominal_pains).
disease(Patient,malaria,ketakonazol,3*3):-
symptom(Patient, fever),
symptom(Patient, lack_of_appetite),
symptom(Patient, body_weakness),
symptom(Patient, shaking_chills),
symptom(Patient, headache).
disease(Patient,typhoid,rifampin,2*3):-
symptom(Patient, diaorhea),
symptom(Patient, fever),
symptom(Patient, abdominal_pains),
symptom(Patient, body_weakness),
symptom(Patient, mild_fever).
disease(Patient,ulcers,udihep_forte,3*3):-
symptom(Patient, headache),
symptom(Patient, abdominal_pains),
symptom(Patient, lack_of_appetite),
symptom(Patient, rumbling_stomach),
symptom(Patient, body_weakness),
symptom(Patient, night_sweats),
symptom(Patient, fever).
disease(Patient,liver_cirrhosis,cachcet,3*3):-
symptom(Patient, body_weakness),
symptom(Patient, fartigue),
symptom(Patient, shaking_chills),
symptom(Patient, lack_of_appetite).
disease(Patient,skin_cancaer,enterogermina,3*3):-
symptom(Patient, blue_skin),
symptom(Patient, itchy_skin),
symptom(Patient, skin_rushes),
symptom(Patient, pale_skin).
disease(Patient,breast_cancaer,cacetrizine,4*3):-
symptom(Patient, harden_breast),
symptom(Patient, pain_in_the_breast),
symptom(Patient, lack_of_appetite),
symptom(Patient, headache),
symptom(Patient, body_weakness).
disease(Patient,common_cold,himachal,1*3):-
symptom(Patient, headache),
symptom(Patient, fever),
symptom(Patient, shaking_chills),
symptom(Patient, nasal_congestion),
symptom(Patient, runny_nose),
symptom(Patient, sore_throat).
disease(Patient,lung_cancer,streptomycin,4*3):-
symptom(Patient, cough),
symptom(Patient, fever),
symptom(Patient, hoarseness),
symptom(Patient, chest_pain),
symptom(Patient, wheezing),
symptom(Patient, weight_loss),
symptom(Patient, lack_of_appetite),
symptom(Patient, coughing_blood),
symptom(Patient, headache),
symptom(Patient, shortness_of_breath).
/*Ask rules*/
symptom(P, Val):-ask('Does the Patient have ',Val).
ask(Obj, Val):-nl,write(Obj),
write( Val) , write('?(y/n)'), read(Ans), !,
((Ans=y, assert(known(Obj, Val, true)));(assert(known(Obj, Val, false)),fail)).
diagnose:-nl,write('Diagnosing disease..........'),nl,disease(Symptom,Disease,Drug,Pres) ,!,nl,
write('What is the name of the patient?'),nl,
read(X),
write('That disease could be '), write(Disease),nl,write('And the system highly recommends that '),write(X), write(' should use this drug '), write(Drug), write(' with the following prescription '), write(Pres).
diagnose:- nl, write('Sorry,we may not be able to diagnose the desease!!').
start:-notice,repeat, abolish(known/3),dynamic(known/3), retractall(known/3), diagnose,nl,nl, write('Try again ? (y/n)'),read(Resp),\+ Resp=y,
nl,write('GoodBye ! Thank you for using this system and we hope to see you soon @Hassan_Wari 2018'),abolish(known,3) .