Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends,i am very new to programming and just got started from vb,this far i was able to get answers to all my questions from googling but right now i am stuck in a (i guess it's very simple but i just cant find the solution) situation.Anyways,let me get to the point;

i am trying to make a simple cleverbot and eliza like chatbot application(ofc it wont be as good as them) the point i am stuck at the moment is; how can i get the console to pick random responses in case of spesific inputs(i googled all the way but i couldn't find the answer in VB,although i tried code converting sites and softwares but that didn't really worked either)

waiting for your responses and i'll be very glad for them =)
Posted

1 solution

We can't really give you a simple "do this" answer - there is far, far too much other stuff involved that we don't know about. For example, are your responses fixed? Do you have the capability to vary them according to the user input? For example if the user says "the ball is green", can you pick out the "ball" and "green" as significant, and slot them into a random stock phrase:
"Can you see the {1} {0}?"
"The {0} looks {1} to me as well!"
If you can, then you need to look at this one way, if not, than you need to look at it another.

Random phrases are easy: just have an array of phrases and pick one at random:
VB
Private rand As New Random()
Private responses As String() = New String() {"..", "..", ...}
...
   Dim response As String = responses(rand.[Next](responses.Length))

You might find this useful: How to Build Eliza Chatterbot - A Program that can Chat with Humans[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900