There are a number of chatbots in Ruby out there but after I looked at
them I ended up creating my own.
You program it like this
miho.learn “whats|what_is the time?”, “what time is it?”, “time” do
Where say_time() returns a string which is displayed to the user
[AIML]$ rvm 1.8.7
[Miho] Hello, how are you?
[You] what is the time
[Miho] It is nineteen fourteen
[You] what day is it
[Miho] Today is Sunday
[You] whats your ip address
[Miho] Sorry I didn’t understand ‘whats your ip address’
[You] what is your address
[Miho] My ip address is 192.168.1.2
[Miho] Bye. Come again
It’s pure ruby. I was in the process of converting the AIML ruleset
over but I was less than impressed with the rulesets (they didn’t
really have much of interest in them) so I gave up on that. Presently
I have become sidetracked trying to integrate speech input and output
so the full Ruby shell has ground to a halt. I do however have mruby
embeded in a C based program that allows mruby to use espeak to to
speek the results.
I am in the process of getting Pocket Sphinx STT (speech to text) to
integrate with the C shell so that the input no longer comes from the
keyboard. Finally a computer that I can talk to that is fully
programable in Ruby
Then to port it to the Raspberry PI and away we go, it presently just
runs on Ubuntu with much cajoling.
If you want the Ruby only version I can zip it up for you, though you
will probably look at it and go “Is that all?” but it might be a
useful starting point.