我的代码仅仅是这样,它只会识别特定的问题...否则会要求答案...但是我希望它能够学习并尝试自我解答我的新问题。
示例:
input("hello")
output("Hi,how are you?")
我不希望AI聊天机器人知道如何响应“ hi”,我希望它也能够响应
赞:
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),")
else:
print(out)
else:
print("Error in input")