diff options
author | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-21 01:22:53 -0400 |
---|---|---|
committer | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-21 01:22:53 -0400 |
commit | 06f90d83a1feafad301d365a4a437e44f68be45b (patch) | |
tree | 24128de1cb5a4767151f9380c46104a26121535d /python/test.py | |
parent | c4c9c2febd5af552ecddc215758e32b88013fbc7 (diff) |
[python] Support for grammars
- Translation rules can now be create programatically
- Grammars = list of translation rules can be used for translation
- Feature expectations on the hypergraph (inside_outside)
Diffstat (limited to 'python/test.py')
-rw-r--r-- | python/test.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/python/test.py b/python/test.py index 54859e81..eb9e6a95 100644 --- a/python/test.py +++ b/python/test.py @@ -45,6 +45,9 @@ for sentence in forest.sample(5): # Get feature vector for 1best fsrc = forest.viterbi_features() +# Feature expectations +print 'Feature expectations:', dict(forest.inside_outside()) + # Reference lattice lattice = ((('australia',0,1),),(('is',0,1),),(('one',0,1),),(('of',0,1),),(('the',0,4),('a',0,4),('a',0,1),('the',0,1),),(('small',0,1),('tiny',0,1),('miniscule',0,1),('handful',0,2),),(('number',0,1),('group',0,1),),(('of',0,2),),(('few',0,1),),(('countries',0,1),),(('that',0,1),),(('has',0,1),('have',0,1),),(('diplomatic',0,1),),(('relations',0,1),),(('with',0,1),),(('north',0,1),),(('korea',0,1),),(('.',0,1),),) |