How to Make an AI – Part 5 - Remembering Context.

by Rexx23 in Circuits > Computers

30 Views, 2 Favorites, 0 Comments

How to Make an AI – Part 5 - Remembering Context.

Part 5 Title img.PNG

Right now, my A.I. and many other chat bots remember only the last entry, and possibly one previous entry. But this can present problems.

Supplies

Please read parts 1-4 first. This is part 5.

1. Trying to Solve a Logic Problem.

White House 1.PNG
Blue House.PNG

I was trying to give my A.I. a logic problem to solve, where I would tell it some factual statements, and see if it could derive the correct answer.

So, I said, “There are two houses on my street. One house is blue, and the other house is white. Bill lives in the blue house, and Wilma lives in the other house.”

Processing a Question

Computer Thinking.PNG

Each sentence is processed as a single input, but I had the program set to save every one of my entries into the database table that holds random sayings. This is one of the tables used to store potential replies. (See parts 1-4 of my instructable for how my DB is set up.)

Then I asked, “Who lives in the white house?”

Oops...

White House 2.PNG

I got this response:

Donald Trump lives in the white house

Oops…

Old Data.

Old Data.PNG

My algorithm searched for all combinations of the words in my input, and the query containing “lives in the white house” returned “Donald Trump lives in the white house”. Any potential reply from the database is “scored” , and this reply scored the most points because it matched 5 words, (“lives in the white house”) and it matched the 5 words in order.

The algorithm needs to store all of my inputs, and they need to be “Time Stamped”, that is, it needs to know exactly when the statement was stored.

When potential replies are being scored, extra points can be awarded for replies that use the most current data.

If you want your system to have intelligent conversations, You will need to implement the "context remembering" code as well.