2016-04-14 65 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

相關問題