A chat bot utilizing Markov chains. It speaks Russian and English.
Basic usage:
require 'markov_chain_chat_bot'
bot = MarkovChainChatBot.from(Hash.new)
bot.learn("one two three two one")
bot.answer("count up and down please")
#=> "one two three two three two one two one two three two one two one"
bot.learn("three four six")
bot.answer("count from three please")
#=> "three two one two one two three four six"
One may save the bot's knowledge into key-value storage:
require 'markov_chain_chat_bot'
require 'auto_marshalling_map'
require 'gdbm'
# 1.
kvs = GDBM.open("chat_bot.dat")
bot = MarkovChainChatBot.from(AutoMarshallingMap.new(kvs))
bot.learn("one two three two one")
kvs.close()
# 2.
kvs = GDBM.open("chat_bot.dat")
bot = MarkovChainChatBot.from(AutoMarshallingMap.new(kvs))
bot.answer("count up and down please")
#=> "one two three two three two three two one two one"
- Gem name: markov_chain_chat_bot
- Version: 0.1.7
- License: Public Domain
- Authors: Lavir the Whiolet
- E-mail: [email protected]
- Homepage: https://github.com/LavirtheWhiolet/markov-chain-bot-module