From c3a0f085f678b0186b977c8e97dbc9175676f9bd Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 18 Nov 2012 17:41:27 -0500 Subject: add another interface --- python/src/hypergraph.pxi | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'python/src/hypergraph.pxi') 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) -- cgit v1.2.3