-
July 13th, 2012, 04:01 PM
#1
Finding keywords in Cin and Cout
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?
-
July 13th, 2012, 04:17 PM
#2
Re: Finding keywords in Cin and Cout
If you plan to allow the input to something complicated consider using something like flex http://flex.sourceforge.net/ for the parsing.
-
July 13th, 2012, 05:34 PM
#3
Re: Finding keywords in Cin and Cout
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.
-
July 13th, 2012, 07:29 PM
#4
Re: Finding keywords in Cin and Cout
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.
-
July 14th, 2012, 08:05 AM
#5
Re: Finding keywords in Cin and Cout
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.
-
July 15th, 2012, 07:13 PM
#6
Re: Finding keywords in Cin and Cout
With all do respect, but if you don't know how to manipulate a string, then don't try to make something hard. Instead, start learning how to code.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|