diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2012-07-08 14:26:51 +0200 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2012-07-08 14:26:51 +0200 |
commit | e816274e337a066df1b1e86ef00136a021a17caf (patch) | |
tree | 6abc906f4675a0ef0b3799395fd96095e4cee2b3 /python/test.py | |
parent | 0fdb260d38c32e0d4d5403b9bcf1d1a4e60be4c4 (diff) | |
parent | ed50f2b747f21f1613243eee75d812d2596f02d0 (diff) |
Merge branch 'master' of github.com:pks/cdec-dtrain
Diffstat (limited to 'python/test.py')
-rw-r--r-- | python/test.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/python/test.py b/python/test.py index 92403298..8069aa0a 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): @@ -58,3 +60,6 @@ print forest.viterbi_source_tree() # Compare 1best and reference feature vectors fref = forest.viterbi_features() print dict(fsrc - fref) + +# Prune hypergraph +forest.prune(density=100) |