2016-04-14 66 views

回答

1

这里是一个开始:

CLIPS> 
(deftemplate sentence 
    (multislot text) 
    (slot deleted_count (default 0))) 
CLIPS> 
(defrule delete 
    ?f <- (sentence (text $?b ?word&:(< (str-length ?word) 4) $?e) 
        (deleted_count ?count)) 
    => 
    (modify ?f (text ?b ?e) (deleted_count (+ 1 ?count)))) 
CLIPS> (assert (sentence (text the quick brown fox jumped over the lazy dogs))) 
<Fact-1> 
CLIPS> (run) 
CLIPS> (facts) 
f-0  (initial-fact) 
f-4  (sentence (text quick brown jumped over lazy dogs) (deleted_count 3)) 
For a total of 2 facts. 
CLIPS> 

当问堆栈溢出问题,你应该在至少一个令牌的努力证明您已经阅读现有的文件和作出努力解决问题。

+0

thx!我试图让这样的事情'(defmethod阿一 \t() \t(绑定?输入(爆炸$ “铁锤DRIL看到螺丝”)) \t(绑定?结果 “”) \t(环换算(?I 1 4)做 \t \t(绑定?字(第n个$?我?输入)) \t \t(如果(<(长度$?字)4)然后 \t \t \t(STR-猫?word?result) \t \t) \t \t \t (打印输出吨?字CRLF) \t) \t?导致 )' – IchigoWalker

相关问题