我一直在尝试用Prolog创建一个聊天机器人(作为一个任务),到目前为止,我已经在一个.pl文件中建立了一个数据库,并列出了许多可能的对话。
我知道Prolog的工作方式就像这样,例如如果我们有
Chatbot(good)
我们输入
?-Chatbot(good).
它会响应
yes or ture.
现在我不知道如何使用我的数据库,使程序可以像聊天机器人一样工作,例如不需要编写适当的语法。
Hello (typed by the user)
Hi there, (typed by the program automatically)
我的数据库是这样的:
answer( question, [
[Yes, I am here]]).
question ([are you there?])