形容詞と前置詞、前置名、前置語を含むフレーズの新定義を含む(2)のアプローチを見ていきましょう。この新しい文法をgenerate関数を変更せずに適用してみます。
(defparamter *bigger-grammar*
'((sentence -> (noun-phrase verb-phrase))
(noun-phrase -> (Article Adj* Noun PP*) (Name) (Pronoun))
(verb-phrase -> (Verb noun-phrase PP*))
(PP* -> () (PP PP*))
(Adj* -> () (Adj Adj*))
(PP -> (Prep noun-phrase))
(Prep -> to in by with on)
(Adj -> big little blue green adiabatic)
(Article -> the a)
(Name -> Pat Kim Lee Terry Robin)
(Noun -> man ball woman table)
(Verb -> hit took saw liked)
(Pronoun -> he she it these those that)))
(setf *grammar* *bigger-grammar*)
(generate 'sentence) => ...
"with him"でなくてはならないところが"with he"になったりする問題はあります。愚かな入力を区別できないということがあきらかになったわけです。
最終更新:2008年01月08日 16:59