Test complete_prev method
[rbot-mark] / test.rb
1 #! /usr/bin/ruby -w
2 # vim: set sw=2 et:
3 # Author: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
4 # New markov chain plugin tester
5
6 require 'mark2'
7
8 mkv = MarkovChainer.new
9
10 text = "This is a test, a nice little test indeed."
11
12 mkv.learn(text)
13
14 words = text.scan(MarkovChainer::WNW)
15
16 100.times do
17   pick = words.pick_some(MarkovChainer::MAX_ORDER).join
18
19   puts "Pick: #{pick.inspect}"
20   puts "Full Prev: #{mkv.complete_prev(pick).inspect}"
21
22 end
23