diff options
author | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-01 00:38:30 -0400 |
---|---|---|
committer | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-01 00:38:30 -0400 |
commit | dc9e428224d95adf63da6460a2031348de295ca1 (patch) | |
tree | 5f7b9022f75d67d8cc8b069b6e8164978b93ff93 /python/test.py | |
parent | 3044d6d1c6d428e8d06c255e3a2d739bcd187679 (diff) |
[python] MT evaluation
Diffstat (limited to 'python/test.py')
-rw-r--r-- | python/test.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/python/test.py b/python/test.py index 92403298..b3900eef 100644 --- a/python/test.py +++ b/python/test.py @@ -31,9 +31,11 @@ print ' FTree[0]:', forest.viterbi_source_tree().encode('utf8') print 'LgProb[0]:', forest.viterbi_features().dot(decoder.weights) # Get k-best translations -for i, (sentence, tree) in enumerate(zip(forest.kbest(5), forest.kbest_tree(5)), 1): +kbest = zip(forest.kbest(5), forest.kbest_tree(5), forest.kbest_features(5)) +for i, (sentence, tree, features) in enumerate(kbest, 1): print 'Output[%d]:' % i, sentence.encode('utf8') print ' Tree[%d]:' % i, tree.encode('utf8') + print ' FVect[%d]:' % i, dict(features) # Sample translations from the forest for sentence in forest.sample(5): |