Friday, October 25, 2013

One Bit Works, Now the Rest


I have a small (very, very, very small) working Ruby script that starts off with a small dictionary of know phrases and then learns and parrots back new phrases that the user types, as such:

Hello there, I'm Bob.
>> Hi, Bob. Are you a computer?
Who you callin' 'Computer', chump? This isn't the Enterprise.
>> Oh, I didn't mean to offend you.
Oh, 'oh i didnt mean to offend you' you say?
>> Yes.
Oh, 'yes' you say?
>>That's what I said.
oh i didnt mean to offend you
>> I'm a little confused.
oh, 'im a little confused' you say?

I'm still working out how to keep phrases and such separate (currently the computer will learn a phrase with each word in that phrase as a key - use one of those words again and it will parrot back the phrase in which it originally learned that word.) I'm also working on a way to make the file persist between sessions. I (kind of) know how to open and write to files in Ruby. I think I need to play around with that first. But maybe work on the phrasing first....

Oh, well, back in the fray! :D

No comments:

Post a Comment

Comments? Questions? Complaints? Coladas?