diff options
author | Nathan Lasseter <nathan@4574.co.uk> | 2014-01-30 20:10:56 +0000 |
---|---|---|
committer | Nathan Lasseter <nathan@4574.co.uk> | 2014-01-30 20:10:56 +0000 |
commit | 69ee9398256a7e15e64aa73428e7291f6f50a11c (patch) | |
tree | e0f6d35a62c2d1abf2589815a3e7b09d47b32841 /markov-repl.rb | |
parent | 46804facd4b74e6c5796b3427ccbb1a273528395 (diff) |
Diffstat (limited to 'markov-repl.rb')
-rwxr-xr-x | markov-repl.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/markov-repl.rb b/markov-repl.rb index 624539f..0d0ae63 100755 --- a/markov-repl.rb +++ b/markov-repl.rb @@ -12,12 +12,16 @@ def handle_input(inputs) when 'load' case input[1] when 'corpus' - $replstate[:analyser] = Markov::Analyser.new(input[2], input[3].to_i) - when 'serial' - $replstate[:generator] = Markov::Generator.new(input[2]) + $replstate[:analyser] = Markov::Analyser.new(input[2]) + when 'stats' + unless input[2].nil? then + $replstate[:generator] = Markov::Generator.new(input[2], :file) + else + $replstate[:generator] = Markov::Generator.new($replstate[:analyser].stats) + end end when 'analyse' - $replstate[:analyser].analyse + $replstate[:analyser].analyse(input[1].to_i) when 'save' $replstate[:analyser].save(input[1]) when 'generate' @@ -25,6 +29,8 @@ def handle_input(inputs) when 'quit' puts exit + else + puts "Error" end end |