Chatbot created in Ruby using markov chains.
git clone https://github.com/Akrivus/Peri.git
gem build peri.gemspec
gem install peri
- You can now reference Peri.
Basic example of how Peri works below:
require 'peri' peri = Peri.new() corpora = peri.load_corpora('path/to/corpora.txt') # Creates an array of lines. chain = peri.load_chain(corpora) # Creates a markov chain from the loaded corpora. weights = peri.load_weights(chain) # Generates a set of weights from the markov chain. # The corpora allows the chain to parse data easier. # The chain allows data to be rendered through a semi-predictable (stochstic) sequence. # The weights make these semi-predictable (stochastic) sequences predictable. # Now for the fun part. response = peri.respond(chain, weights, "Hello!") #=> "Hello!"
Corpora supports ERB and some basic keyword captures, which can be seen by looking through the "data" folder on this repository.
Pull requests are welcomed!