diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-02-12 17:44:06 +0100 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2014-02-12 17:44:06 +0100 |
commit | 27bc315543a4e3002e5d4ec0e37be3dcc2e3114e (patch) | |
tree | 8887ee8b5ce2bf6f6fc2c885aafef7340a265226 /lib/nlp_ruby/ttable.rb | |
parent | f69ba1155e5f51dce0669bcf3e79a4c230e120d2 (diff) |
per sentence bleu, spawn with timeout
Diffstat (limited to 'lib/nlp_ruby/ttable.rb')
-rw-r--r-- | lib/nlp_ruby/ttable.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/nlp_ruby/ttable.rb b/lib/nlp_ruby/ttable.rb index 598e318..14d6c5d 100644 --- a/lib/nlp_ruby/ttable.rb +++ b/lib/nlp_ruby/ttable.rb @@ -15,18 +15,21 @@ def read_phrase_table fn return table end +# FIXME class Translation - attr_accessor :id, :s, :raw, :f, :score + attr_accessor :id, :s, :raw, :f, :score, :rank, :other_score - def initialize id=nil, raw=nil, s=nil, f=nil, score=nil + def initialize id=nil, raw=nil, s=nil, f=nil, score=nil, rank=nil, other_score=nil @id = id @raw = raw @s = s @f = f @score = score + @rank = rank + @other_score = other_score end - def from_s t, strip_alignment=true + def from_s t, strip_alignment=true, rank=nil id, raw, features, score = splitpipe(t, 3) raw.strip! @raw = raw @@ -39,10 +42,16 @@ class Translation @id = id.to_i @f = read_feature_string features @score = score.to_f + @rank = rank + @other_score = nil end def to_s - [id, s, f.to_kv, score].join ' ||| ' + [@id, @s, @f.to_kv, @score].join ' ||| ' + end + + def to_s2 + [@rank, @s, @f.to_kv, @score, @other_score].join ' ||| ' end end |