预计构造错误的开始

时间:2015-06-15 19:24:59

标签: clips expert-system

当我运行系统时,它显示错误"期望构造的开始" ..我怎么能纠正这个错误

我的规则看起来像这样

(defrule UFP
 (not (repair ?))
   ?f <- (rule1)

   =>
(retract ?f)
(printout t "Finish UFP (y/n)
yes> go to rule 10 - Advise : Select your major
No> go to rule 2 - Advise : please finish all the levels of UFP to enter your major
q>Exit system" crlf)

(bind ?response (check-YNoptions-input))
(if (eq ?response y)
then
(assert (rule10))
)
(if (or(eq ?response q) (eq ?response Q))
    then 
    (output-exitmessage)
)
(if (eq ?response n)
    then



            (assert (rule2))
        )
)
)



; --------------------------------------------------
; Define coleege-system rule2
; --------------------------------------------------
(defrule rule2
?f <- (rule2)
   =>
   (retract ?f)

(bind ?response (ask-question "which level from OET result: (A0 or A1 =level1 ,A2= level2, B1=level3)
 (level1/level2/level3)
level1 > go to rule 3
level2 > go to rule 5
level3 > go to rule 7"


                   level1 level2 level3))
   (if (eq ?response level1)
       then 
      (assert (rule3))
       else (if (eq ?response level2)
                then (assert (rule5))

     else  (assert (rule7))
     )))

第二期:

想按&#34; q&#34;退出系统密钥,每条规则,每条规则都有y和n个密钥.....什么是正确的结合...

1 个答案:

答案 0 :(得分:1)

如果您观看编辑,则可以看到发生错误的位置:

bigrams = LOAD 'input/bigram/zv.gz' AS (bigram:chararray, year:int, count:float, books:float);
group_bigrams = GROUP bigrams BY bigram;
average_bigrams = FOREACH group_bigrams GENERATE group, SUM(bigrams.count) / SUM(bigrams.books) AS average;
sorted_bigrams = ORDER average_bigrams BY average;

问题发生在UFP规则之后。规则后有一个额外的右括号。编辑CLIPS规则时,使用具有某种类型的括号平衡的编辑器会很有帮助。它可以更容易地找到这些类型的错误。

如果要在不退出CLIPS的情况下暂停CLIPS执行,请使用(halt)命令。如果要退出CLIPS,请使用(exit)命令。