diff options
author | Chris Dyer <cdyer@allegro.clab.cs.cmu.edu> | 2012-11-18 17:41:27 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@allegro.clab.cs.cmu.edu> | 2012-11-18 17:41:27 -0500 |
commit | c3a0f085f678b0186b977c8e97dbc9175676f9bd (patch) | |
tree | 70f3f644229dfdab4aada8fe0b31eb7abf5f3455 /python/src/hypergraph.pxi | |
parent | c634ab440869d77769ce6d5e0f7da7bc8c36650e (diff) |
add another interface
Diffstat (limited to 'python/src/hypergraph.pxi')
-rw-r--r-- | python/src/hypergraph.pxi | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/python/src/hypergraph.pxi b/python/src/hypergraph.pxi index 5b675531..4a709d32 100644 --- a/python/src/hypergraph.pxi +++ b/python/src/hypergraph.pxi @@ -37,6 +37,11 @@ cdef class Hypergraph: fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) return fmap + def viterbi_forest(self): + cdef Hypergraph hg = Hypergraph() + hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) + return hg + def viterbi_joshua(self): """hg.viterbi_joshua() -> Joshua representation of the best derivation.""" return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') @@ -217,6 +222,10 @@ cdef class HypergraphEdge: def __get__(self): return (self.edge.i_, self.edge.j_) + property src_span: + def __get__(self): + return (self.edge.prev_i_, self.edge.prev_j_) + property feature_values: def __get__(self): cdef SparseVector vector = SparseVector.__new__(SparseVector) |