Eliza Lite?

I'm trying to make a version of Eliza in C++, where you type in a keyword and you get said response. I'm hoping to make this work and then move towards full sentences. Any help will be grand.

char *who_reply[]={ // needs more people who she knows
"no","No, to what?"
"yes","Yes, to what?"
"fuck","Don't swear around me please."
"i'm","What are you trying to say?"
"nothing","Okay."
"stop","If you say so."
"friend","Why thank you. Though, you are human and I'm a program."
"hello","Hello, how are you?"
"okay","Okay."
"o.k.","O.K."
"sorry","Don't be."
"anyways","Yes."
"anyway","Yeah."
"bye","Powering down."
"when","Some time."
"why","I don't know why."
"how","I really don't know how."
"ha ha","Laughter, I have yet to laugh."
"who","I don't know who."
"what","What are you trying to ask?"
"jesse","That is what my name is."
"david","David, is the one that gave me this existence."
"shit","Why must you use such language?"
"because","Oh is that why..."
"where","Right here."
"ouch","Are you in pain?"
"stupid","You or myself?"
"idiot","Now you're just testing words."
"no.","To what?"
"yes i'm stupid","Don't be so hard on yourself."
"yes","Okay."
"food","I don't need food to survive."
"computer","I'm not a computer, just a program."
"hungry","I don't get hungry."
"uh","What?"
"ontario","A province in Canada."
"alberta","A province in Canada."
"yukon","A territory in Canada."
"canada","A country in North America."
"america","A continent on the planet Earth."
"earth","The third planet in the solar system."
"oxygen","What all living land based mammals need to survive."
"robot","The future rulers of the world."
"ai","Artifical Intelligence."
"prison","Life."
"war","The great erasier of civilisation."
"health","What we wish to have a lot of."
"death","What we all must face."
"liar","I can't lie."
"invasion","When a force from the outside breaks in."
"food","What is consumed to create energy for survival."
"farewell","Wish, to see you again soon."
"toilet","Where one releaves themselves."
"library","A building, with a vast collection of knowledge."
closed account (E0p9LyTq)
Someone already did it for C++, though I can't guarantee how well it works.

From 2006:
https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=10353&lngWId=3

If you are going to create a C++ Eliza I'd recommend using an array/vector of std::string elements. Using a C array of C strings is really not using what C++ has to offer to make an updated program.
Another option would be to use a map to map keywords to phrases.
Topic archived. No new replies allowed.