diff options
author | Patrick Simianer <p@simianer.de> | 2015-01-25 13:28:05 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2015-01-25 13:28:05 +0100 |
commit | 4c08c31d6759bfc1cd9d31a051fe182827345e17 (patch) | |
tree | 6b11555daf845b2fdcf6e252e96be99bee2af229 /test | |
parent | 51e19d21496ec977843f1c10c229c5370cd381b4 (diff) |
BLEU: support for multiple references, unit test
Diffstat (limited to 'test')
-rw-r--r-- | test/bleu/h | 2 | ||||
-rw-r--r-- | test/bleu/r | 2 | ||||
-rwxr-xr-x | test/test_bleu.rb | 30 |
3 files changed, 34 insertions, 0 deletions
diff --git a/test/bleu/h b/test/bleu/h new file mode 100644 index 0000000..e9901ad --- /dev/null +++ b/test/bleu/h @@ -0,0 +1,2 @@ +a s d f x +a s f d diff --git a/test/bleu/r b/test/bleu/r new file mode 100644 index 0000000..6b5f216 --- /dev/null +++ b/test/bleu/r @@ -0,0 +1,2 @@ +a s d f ||| a s d f a ||| a s d f x +a s d f ||| a s d f a ||| a s d f x diff --git a/test/test_bleu.rb b/test/test_bleu.rb new file mode 100755 index 0000000..4b9addc --- /dev/null +++ b/test/test_bleu.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby + +require_relative '../lib/zipf/bleu' +require_relative '../lib/zipf/stringutil' +require_relative '../lib/zipf/fileutil' +require_relative '../lib/zipf/misc' +require 'test/unit' + +class TestBLEU < Test::Unit::TestCase + + def test_raw + h = ["a s d f x", "a s f d"] + r = [["a s d f", "a s d f a", "a s d f x"], ["a s d f", "a s d f a", "a s d f x"]] + counts = [] + h.each_with_index { |h,i| + counts << BLEU::get_counts(h, r[i], 4) + } + BLEU::bleu_ counts, 4, true + end + + def test + BLEU::bleu 'test/bleu/h', 'test/bleu/r', 4, true + end +end + + + + + + |