Hello, I am writing an AI program similar to a chatterbot. I want it to be able to detect user inputted words. The user will input messages through 'cin' statements where they will then be interpreted. For example, if I inputted the message "I like waffles", I would want the program to search and detect the strings "like" and "waffles" and make a meaningful response. I originally intended to use the find() function to detect strings inside user inputted statements but I am not sure how to do this. Can anyone help me with this?
I don't need something that complicated at the moment although it will be useful in the future. What I want right now is for the computer to search for strings found within user inputted cin statements.
Or, if you want a more hands-on or classical/vintage approach as a starting point, you may want to have a look at ELIZA.
However, I remember claimed quotes from Weizenbaum that, while most people perceived ELIZA as a startling example of AI, he actually wrote it to disprove the possibility of AI. There's no reference to that in the Wikipedia article, though, but there may be one behind the citation links (didn't check them). ... or it's just one more of these funny urban legends...
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
You can use strtok to break a NULL terminated string into individual words, but then what? Have you thought your approach out yet? Getting individual words in strings is the easiest part of the problem.