summaryrefslogtreecommitdiff
path: root/python/src/hypergraph.pxi
diff options
context:
space:
mode:
authorMichael Denkowski <michael.j.denkowski@gmail.com>2012-12-22 16:01:23 -0500
committerMichael Denkowski <michael.j.denkowski@gmail.com>2012-12-22 16:01:23 -0500
commit597d89c11db53e91bc011eab70fd613bbe6453e8 (patch)
tree83c87c07d1ff6d3ee4e3b1626f7eddd49c61095b /python/src/hypergraph.pxi
parent65e958ff2678a41c22be7171456a63f002ef370b (diff)
parent201af2acd394415a05072fbd53d42584875aa4b4 (diff)
Merge branch 'master' of git://github.com/redpony/cdec
Diffstat (limited to 'python/src/hypergraph.pxi')
-rw-r--r--python/src/hypergraph.pxi9
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)