summaryrefslogtreecommitdiff
path: root/scripts/free917/eval.rb
blob: ccd8003e1e7177cf97cd99ea55140fe1092adfba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env ruby

require 'zipf'


gold = ReadFile.readlines_strip ARGV[0]
i = j = correct = 0
while line = STDIN.gets
  line.strip!
  correct += 1 if line==gold[i]
  i += 1
  j += 1 if line=='' # no parse
end
acc = correct.to_f/i
prec = correct.to_f/(i-j)
puts "acc=#{(100*acc).round 2} prec=#{(100*prec).round 2} (#{i}/#{j}) abs=#{correct} f1=#{(100*(2*acc*prec)/(acc+prec)).round 2}"