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

require 'nlp_ruby'


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}"