【发布时间】:2020-09-27 17:45:00
【问题描述】:
我的代码仅此而已,它只能识别特定问题...否则它会要求答案...但我希望它能够学习并尝试自我回答我的新问题。
示例:
input("hello")
output("Hi, how are you?")
在不教人工智能聊天机器人如何回应“嗨”的情况下,我希望它也能够回应
喜欢:
input("Hi")
output("Hello, how are you?")
这对我来说非常困难,这就是为什么我要求回答它
我当前的代码:
said = []
output = []
text = ""
global n
while True:
text = input("Say something: ")
if not(text == ""):
if not(text == "print(input, output)"):
input_contain = text.lower() in said
if input_contain:
n = 0
found = False
while not found:
if said[n] == str(text.lower()):
print(output[n])
found = True
else:
n = n + 1
else:
output_add = input("What should I respond to that? ")
if not output_add == "":
said.append(text.lower())
output.append(output_add)
else:
print("Error in output")
else:
for qn in said:
if not qn == int(len(said)) - 1:
print(str(qn), end=", ")
else:
print(qn)
for out in output:
if not out == int(len(output)) - 1:
print(str(out), end=", ")
else:
print(out)
else:
print("Error in input")
【问题讨论】: