Method: BLEU.bleu

Defined in:
lib/zipf/bleu.rb

.bleu(hyp_file, ref_file, n, debug = false) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/zipf/bleu.rb', line 115

def BLEU::bleu hyp_file, ref_file, n, debug=false
  hypotheses = ReadFile.readlines_strip(hyp_file)
  references = ReadFile.readlines_strip(ref_file).map { |l|
    splitpipe(l,3)
  }
  counts = []
  hypotheses.each_with_index { |h,i|
    counts << BLEU::get_counts(h, references[i], 4)
  }
  bleu_ counts, n, debug
end