我使最简单的聊天机器人成为可能。它会根据您之前希望它回答同一问题的内容来回答您的问题。代码有点像这样:
question = []
answer = []
qcount = 0
stop = 0
b = 0
while stop == 0:
b = 0
q = input("Ask me anything: ")
if q == "stop":
exit()
for i in range(qcount):
if q == question[i]:
b = 1
print(answer[i])
if b == 0:
question.append(q)
qcount = qcount + 1
a = input("How should i answer that? ")
answer.append(a)
有没有办法转
if q == question[i]
到
if q is similar to question[i]
?
慕码人2483693
慕标琳琳
相关分类