diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2012-11-05 15:29:46 +0100 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2012-11-05 15:29:46 +0100 |
commit | 6f29f345dc06c1a1033475eac1d1340781d1d603 (patch) | |
tree | 6fa4cdd7aefd7d54c9585c2c6274db61bb8b159a /python/src/hypergraph.pxd | |
parent | b510da2e562c695c90d565eb295c749569c59be8 (diff) | |
parent | c615c37501fa8576584a510a9d2bfe2fdd5bace7 (diff) |
merge upstream/master
Diffstat (limited to 'python/src/hypergraph.pxd')
-rw-r--r-- | python/src/hypergraph.pxd | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/python/src/hypergraph.pxd b/python/src/hypergraph.pxd index 886660bf..dd3d39cc 100644 --- a/python/src/hypergraph.pxd +++ b/python/src/hypergraph.pxd @@ -31,41 +31,45 @@ cdef extern from "decoder/hg.h": ctypedef HypergraphNode const_HypergraphNode "const Hypergraph::Node" cdef cppclass Hypergraph: - Hypergraph(Hypergraph) + Hypergraph() + Hypergraph(Hypergraph) nogil vector[HypergraphNode] nodes_ vector[HypergraphEdge] edges_ int GoalNode() double NumberOfPaths() - void Reweight(vector[weight_t]& weights) - void Reweight(FastSparseVector& weights) + void Reweight(vector[weight_t]& weights) nogil + void Reweight(FastSparseVector[weight_t]& weights) nogil bint PruneInsideOutside(double beam_alpha, double density, EdgeMask* preserve_mask, bint use_sum_prod_semiring, double scale, - bint safe_inside) + bint safe_inside) nogil cdef extern from "decoder/viterbi.h": - prob_t ViterbiESentence(Hypergraph& hg, vector[WordID]* trans) - string ViterbiETree(Hypergraph& hg) - prob_t ViterbiFSentence(Hypergraph& hg, vector[WordID]* trans) - string ViterbiFTree(Hypergraph& hg) - FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg) + prob_t ViterbiESentence(Hypergraph& hg, vector[WordID]* trans) nogil + string ViterbiETree(Hypergraph& hg) nogil + prob_t ViterbiFSentence(Hypergraph& hg, vector[WordID]* trans) nogil + string ViterbiFTree(Hypergraph& hg) nogil + FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg) nogil FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg, FastSparseVector[weight_t]* weights, - bint fatal_dotprod_disagreement) - string JoshuaVisualizationString(Hypergraph& hg) + bint fatal_dotprod_disagreement) nogil + string JoshuaVisualizationString(Hypergraph& hg) nogil cdef extern from "decoder/hg_io.h" namespace "HypergraphIO": + # Hypergraph JSON I/O bint ReadFromJSON(istream* inp, Hypergraph* out) bint WriteToJSON(Hypergraph& hg, bint remove_rules, ostream* out) - void ReadFromPLF(string& inp, Hypergraph* out, int line) + # Hypergraph PLF I/O + void ReadFromPLF(string& inp, Hypergraph* out) string AsPLF(Hypergraph& hg, bint include_global_parentheses) + # Lattice PLF I/O void PLFtoLattice(string& plf, Lattice* pl) string AsPLF(Lattice& lat, bint include_global_parentheses) cdef extern from "decoder/hg_intersect.h" namespace "HG": - bint Intersect(Lattice& target, Hypergraph* hg) + bint Intersect(Lattice& target, Hypergraph* hg) nogil cdef extern from "decoder/hg_sampler.h" namespace "HypergraphSampler": cdef cppclass Hypothesis: @@ -75,10 +79,14 @@ cdef extern from "decoder/hg_sampler.h" namespace "HypergraphSampler": void sample_hypotheses(Hypergraph& hg, unsigned n, MT19937* rng, - vector[Hypothesis]* hypos) + vector[Hypothesis]* hypos) nogil + void sample_trees(Hypergraph& hg, + unsigned n, + MT19937* rng, + vector[string]* trees) nogil cdef extern from "decoder/csplit.h" namespace "CompoundSplit": int GetFullWordEdgeIndex(Hypergraph& forest) cdef extern from "decoder/inside_outside.h": - prob_t InsideOutside "InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>" (Hypergraph& hg, FastSparseVector[prob_t]* result) + prob_t InsideOutside "InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>" (Hypergraph& hg, FastSparseVector[prob_t]* result) nogil |