我是 prolog 的新手,我尝试编写答录机。起初,我想弄清楚问了什么,并检查正确的语法。
question(P) --> [where],[is], article(G,K,N), location(P,G,K,N).
location(P,G,K,N) --> [P], {member(P, [bakery, mcdonalds, kfc, embassy]),noun(G,K,N)}.
article(m, akk, sg) --> [a].
article(f, akk, sg) --> [an].
noun(m, akk, sg) --> [bakery]|[mcdonalds]|[kfc].
noun(f, akk, sg) --> [embassy].
但我收到了这个错误:
question(What, [where,is,a,bakery],[]).
ERROR: location/6: Undefined procedure: noun/3
ERROR: However, there are definitions for:
ERROR: noun/5
但是,我发现 dcg 变量的最后两个参数是某种列表,但我真的没有找到关于该主题的任何内容......你有什么提示或解决方案给我吗?PS:我试图从德语语法中翻译示例,所以不要混淆;)