I've got a problem, help me please!!!

2,026 views
Skip to first unread message

Лєрочка Єгорова

unread,
Oct 18, 2011, 11:20:59 AM10/18/11
to CLIPSESG
I am a student of Ukrainian Lviv Politech University, and I've a task
to write an exprt system. But I have some mistakes and I don't know
how to fix them. this is what CLIPS рrints when I load the program:

CLIPS> (load "C:/Program Files/CLIPS/Bin/1.clp")
Defining deffunction: ask-question
Defining deffunction: Yes-No
Defining defrule: Y4en
[EXPRNPSR3] Missing function declaration for defrule.

ERROR:
(defrule MAIN::Y4en ""
(not (student ?))
(not (act ?))
=>
(if (Yes-No "Does the student have problems with eyes(yes/no)?")
then
(assert (student hardly see))
else
(if (Yes-No "Does the student have problems with hearing (Yes/
No)?")
then
(assert (student hardly hear))
else
(if (Yes-No "Does the student have problems with moving (Yes/
No)?")
then
(assert (act "make a lift"))
else
(if (Yes-No "Does the student have any other problems(Yes/
No)?")
then
(assert (student has unknown problems))
else
(assert (student has no problems))))))
(defrule
Defining defrule: vision
[EXPRNPSR3] Missing function declaration for act.

ERROR:
(defrule MAIN::vision ""
(student hardly see)
(not (act ?))
=>
(if (Yes-No "Can the student see a litle (Yes/No)?")
then
assert
(act
Defining defrule: hearing
[EXPRNPSR3] Missing function declaration for act.

ERROR:
(defrule MAIN::hearing ""
(student hardly hear)
(not (act ?))
=>
(if (Yes-No "Can the student hear a litle (Yes/No)?")
then
assert
(act
Defining defrule: nezdorovuj
[PRNTUTIL2] Syntax Error: Check appropriate syntax for defrule.

ERROR:
(defrule MAIN::nezdorovuj ""
declare
Defining defrule: conc
[SCANNER1] Encountered End-Of-File while scanning a string

[EXPRNPSR2] Expected a constant, variable, or expression.

ERROR:
(defrule MAIN::conc ""
(declare (salience 10))
(act ?item)
=>
(printout t crlf crlf)
(printout t "Suggested acts:")
(printout t crlf crlf)
(format t %S%N " ?item)
)
;==================================================="
FALSE
CLIPS>

Help me please!!It is really important task for me!

Vladimir Cvjetkovic

unread,
Oct 18, 2011, 2:23:22 PM10/18/11
to clip...@googlegroups.com
You could send me the whole listing, and I'll try to correct it and send it back. 

2011/10/18 Лєрочка Єгорова <chang...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
To post to this group, send email to CLIP...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en

--> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Click on "Edit my membership" link.
Select the "No Email" radio button.
Click the "Save these settings" button.

--> IF YOU WANT TO UNSUBSCRIBE <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Sign in
Click on "Edit my membership" link.
Click the "Unsubscribe" button.
Note: This appears to be the most reliable way to unsubscribe

Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.



--
Vladimir Cvjetković
Assistant professor
University of Kragujevac
Faculty of Science
Department of physics
Data processing laboratory
Radoja Domanovića 12
34000 Kragujevac
Serbia

https://sites.google.com/site/vladimircvjetkovicproject/

Лєрочка Єгорова

unread,
Oct 18, 2011, 2:33:41 PM10/18/11
to clip...@googlegroups.com
2011/10/18 Vladimir Cvjetkovic <vcvj...@gmail.com>

You could send me the whole listing, and I'll try to correct it and send it back. 


Oh, it would be great!!!!!!!

here it is:

;====================================================
; Ekspertna sustema "Student"
;====================================================
;----------------------------------------------------
;====================================================
; Funktsiji
;====================================================
;===========Funktsija zaputannja=====================
;tsja funktsija zadaje zaputannja korustyva4y
(deffunction ask-question(?question $?allowed-values)
(printout t ?question)
(bind ?answer (read))
(if (lexemep ?answer)
then
(bind ?answer (lowcase ?answer)))
(while (not (member ?answer ?allowed-values)) do
(printout t ?question)
(bind ?answer(read))
(if (lexemep ?answer)
then
(bind ?answer(lowcase ?answer))))
?answer
)
;===================================================
;===========Funktsija tak-ni========================
;tsja funktsija zadaje putannja i otrumyje vidpovid
(deffunction Yes-No (?question)
(bind ?response (ask-question ?question yes no y n))
(if (or (eq ?response yes) (eq ?response y))
then
True
else
False)
)
;===================================================
;---------------------------------------------------
;===================================================
; Diagnostu4ni pravula
;===================================================
;==========Pravulo student==========================
;oprudiljaje do jakogo tupy vidnosutsja stydent
(defrule Y4en ""

(not (student ?))
(not (act ?))
=>
(if (Yes-No "Does the student have problems with eyes(yes/no)?")
then
(assert (student hardly see))
else
(if (Yes-No "Does the student have problems with hearing (Yes/No)?")

then
(assert (student hardly hear))
else
(if (Yes-No "Does the student have problems with moving (Yes/No)?")

then
(assert (act "make a lift"))
else
(if (Yes-No "Does the student have any other problems(Yes/No)?")

then
(assert (student has unknown problems))
else
(assert (student has no problems))
)
)
)
)
;===================================================
;==========Pravulo zdorovuj=========================
;oprudiljaje rishennja dlja stydenta bez problem
(defrule Zdorovuj ""
declare (salience 10))
(student has no problems)
(not (act ?))
=>
(assert (act "no changes")
)
;===================================================
;==========Pravulo zir =============================
;oprudiljaje rishennja dlja stydenta z poganum zorom
(defrule vision ""

(student hardly see)
(not (act ?))
=>
(if (Yes-No "Can the student see a litle (Yes/No)?")
then
assert (act "instal the MAGNIFYING GLASS on the computer")
else
assert (act "buy books for blind")
)
)
;===================================================
;==========Pravulo slyh=============================
;oprudiljaje rishennja dlja stydenta z poganum slyhom
(defrule hearing ""

(student hardly hear)
(not (act ?))
=>
(if (Yes-No "Can the student hear a litle (Yes/No)?")
then
assert (act "equip the class with microphone")
else
assert (act "print oll the lections")
)
)
;===================================================
;==========Pravulo ne zdorovuj=========================
;oprudiljaje rishennja dlja stydenta bez problem
(defrule nezdorovuj ""
declare (salience -1))
(student has unknown problems)
(not (act ?))
=>
(assert (act "ask for the advice, the program can't advice you")
)
;===================================================
;==========Pravulo zakin4ennja======================
;vuvodut resultat na ekran
(defrule conc ""

Vladimir Cvjetkovic

unread,
Oct 18, 2011, 2:57:40 PM10/18/11
to clip...@googlegroups.com
You had unpaired brackets on many places, and also some quotes. 

Use ctrl-b to check brackets pairing

I corrected just the syntax errors. 

You should take care of semantics. 

CLIPS> (clear)
CLIPS> Loading Selection...

Defining deffunction: ask-question
Defining deffunction: Yes-No
Defining defrule: Y4en +j+j+j
Defining defrule: Zdorovuj +j+j+j
Defining defrule: vision +j+j+j
Defining defrule: hearing +j+j+j
Defining defrule: nezdorovuj +j+j+j
Defining defrule: conc +j+j

Corrected listing, es.clp is in the attachment. 

2011/10/18 Лєрочка Єгорова <chang...@gmail.com>
es.clp

Лєрочка Єгорова

unread,
Oct 18, 2011, 4:20:13 PM10/18/11
to clip...@googlegroups.com

l would be really thankful if you could send me the text of the program with all corrections you have done,please!

18 Жов. 2011 21:57, "Vladimir Cvjetkovic" <vcvj...@gmail.com> напис.

Vladimir Cvjetkovic

unread,
Oct 18, 2011, 4:29:31 PM10/18/11
to clip...@googlegroups.com
You can compare yourself your original CLIPS listing with listing that I sent to you. 

It will be a good exercise for you, good to improve your CLIPS, listing is not very long, you can do it for sure.   

2011/10/18 Лєрочка Єгорова <chang...@gmail.com>

Лєрочка Єгорова

unread,
Oct 18, 2011, 5:27:41 PM10/18/11
to clip...@googlegroups.com

Thenk you very much! You saved my life!)

18 Жов. 2011 23:29, "Vladimir Cvjetkovic" <vcvj...@gmail.com> напис.

Vladimir Cvjetkovic

unread,
Oct 19, 2011, 5:43:05 AM10/19/11
to clip...@googlegroups.com
You are welcome. I am happy I could help. 

Vladimir

2011/10/18 Лєрочка Єгорова <chang...@gmail.com>
Reply all
Reply to author
Forward
0 new messages