Artificial Intelligence is not the result of a sophisticated computer algorithm, but it is produced by human to machine interaction. An easy to implement example is a chatbot which is demonstrated for the domain of a kitchen robot. The software was written in 35 lines of code in python and consists of a mini database plus a parser. A command send to the chatbot is searched in the database and found matches are shown on the screen.
From a technical perspective, the chatbot is trivial. It doesn't contain of complex routines and even beginner in the Python language will understand how the program works. The more advanced subject is to explain why such a program is required for a robot control system. The idea is that the AI is stored in the database which is a vocabulary list. For each word e,g. the noun "apple" additional information are provided. In the chatbot the words are linked to a simple definition, but the database can be enhanced with a longer description and even a filename to a picture which shows a photograph of the noun. Such kind of database allows a computer to understand the meaning of a sentence. A sentence like "eat apple" is converted by the parser into a full blown description of the workflow. The software knows that the sentence is referencing to an action word and an object and it knows that it has to with eating food.
-----
user: open door
parsing ...
open action open something
door noun entrance to room
user: eat apple
parsing ...
eat action eat food
apple noun food
-----
"""
chatbot kitchen robot
a wordlist is stored as python dictionary, user enters command which is searched in the wordlist
"""
class Chatbot:
def __init__(self):
self.data={
# verb
"open": "action open something",
"grasp": "action take an object",
"ungrasp": "action place object from hand to world",
"eat": "action eat food",
"walkto": "action move towards location",
# noun
"apple": "noun food",
"banana": "noun food",
"table": "noun place for storing objects",
"plate": "noun food is served there",
"door": "noun entrance to room",
}
self.parser()
def parser(self):
line=input("user: ") # manuel input
line=line.split()
print("parsing ...")
for i in line:
if i in self.data:
print(i,self.data[i])
else:
print(i,"not found")
if __name__ == '__main__':
c=Chatbot()