diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-07-28 12:11:44 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-07-28 12:11:44 -0400 |
commit | 306e0ba4754c6c4f460536cfe8c3f118dc1cc175 (patch) | |
tree | ad5ea3b0a5370ac613d1bad715fe0f5ab8c91c11 /python/src/hypergraph.pxd | |
parent | 934e55dc12c3f374684bc6a0797e6f85c7abb85a (diff) | |
parent | ee5e376e263d9aeabdeee6968b4457f53d3fc772 (diff) |
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'python/src/hypergraph.pxd')
-rw-r--r-- | python/src/hypergraph.pxd | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/python/src/hypergraph.pxd b/python/src/hypergraph.pxd index e51ccf5c..886660bf 100644 --- a/python/src/hypergraph.pxd +++ b/python/src/hypergraph.pxd @@ -9,23 +9,27 @@ cdef extern from "decoder/hg.h": EdgeMask(int size) bint& operator[](int) - cdef cppclass HypergraphEdge "const Hypergraph::Edge": + cdef cppclass HypergraphEdge "Hypergraph::Edge": int id_ int head_node_ # position in hg.nodes_ SmallVector[unsigned] tail_nodes_ # positions in hg.nodes_ shared_ptr[TRule] rule_ FastSparseVector[weight_t] feature_values_ - LogVal[double] edge_prob_ # weights.dot(feature_values_) + prob_t edge_prob_ # weights.dot(feature_values_) # typically source span: short int i_ short int j_ - cdef cppclass HypergraphNode "const Hypergraph::Node": + ctypedef HypergraphEdge const_HypergraphEdge "const Hypergraph::Edge" + + cdef cppclass HypergraphNode "Hypergraph::Node": int id_ WordID cat_ # non-terminal category if <0, 0 if not set vector[int] in_edges_ # positions in hg.edge_prob_ vector[int] out_edges_ # positions in hg.edge_prob_ + ctypedef HypergraphNode const_HypergraphNode "const Hypergraph::Node" + cdef cppclass Hypergraph: Hypergraph(Hypergraph) vector[HypergraphNode] nodes_ @@ -42,9 +46,9 @@ cdef extern from "decoder/hg.h": bint safe_inside) cdef extern from "decoder/viterbi.h": - LogVal[double] ViterbiESentence(Hypergraph& hg, vector[WordID]* trans) + prob_t ViterbiESentence(Hypergraph& hg, vector[WordID]* trans) string ViterbiETree(Hypergraph& hg) - LogVal[double] ViterbiFSentence(Hypergraph& hg, vector[WordID]* trans) + prob_t ViterbiFSentence(Hypergraph& hg, vector[WordID]* trans) string ViterbiFTree(Hypergraph& hg) FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg) FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg, @@ -67,7 +71,7 @@ cdef extern from "decoder/hg_sampler.h" namespace "HypergraphSampler": cdef cppclass Hypothesis: vector[WordID] words FastSparseVector[weight_t] fmap - LogVal[double] model_score + prob_t model_score void sample_hypotheses(Hypergraph& hg, unsigned n, MT19937* rng, @@ -77,4 +81,4 @@ cdef extern from "decoder/csplit.h" namespace "CompoundSplit": int GetFullWordEdgeIndex(Hypergraph& forest) cdef extern from "decoder/inside_outside.h": - LogVal[double] InsideOutside "InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>" (Hypergraph& hg, FastSparseVector[LogVal[double]]* result) + prob_t InsideOutside "InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>" (Hypergraph& hg, FastSparseVector[prob_t]* result) |