Class: Andrey::Command::Analyze

Inherits:
Object
  • Object
show all
Defined in:
lib/andrey/command.rb

Instance Method Summary collapse

Instance Method Details

#run(*args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/andrey/command.rb', line 33

def run(*args)
  symbols, probability_map = Andrey::Analyzer.analyze_file(args.first)
  puts "[#{ symbols.map{|s| "'#{ s }'" }.join(',') }]"

  puts "["
  probability_map.each_with_index do |row, index|
    print "[#{ row.map { |v| sprintf('%.04f',v) }.join(',') }]"
    print "," if index < 25
    puts
  end
  puts "]"
end