diff options
author | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-21 01:22:53 -0400 |
---|---|---|
committer | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-21 01:22:53 -0400 |
commit | 06f90d83a1feafad301d365a4a437e44f68be45b (patch) | |
tree | 24128de1cb5a4767151f9380c46104a26121535d /python/src/hypergraph.pxd | |
parent | c4c9c2febd5af552ecddc215758e32b88013fbc7 (diff) |
[python] Support for grammars
- Translation rules can now be create programatically
- Grammars = list of translation rules can be used for translation
- Feature expectations on the hypergraph (inside_outside)
Diffstat (limited to 'python/src/hypergraph.pxd')
-rw-r--r-- | python/src/hypergraph.pxd | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/python/src/hypergraph.pxd b/python/src/hypergraph.pxd index 14c60dd0..e51ccf5c 100644 --- a/python/src/hypergraph.pxd +++ b/python/src/hypergraph.pxd @@ -1,18 +1,9 @@ from libcpp.string cimport string from libcpp.vector cimport vector from utils cimport * +from grammar cimport TRule from lattice cimport Lattice -cdef extern from "decoder/trule.h": - cdef cppclass TRule: - vector[WordID] f_ - vector[WordID] e_ - FastSparseVector[weight_t] scores_ - WordID lhs_ - int arity_ - bint IsUnary() - bint IsGoal() - cdef extern from "decoder/hg.h": cdef cppclass EdgeMask "std::vector<bool>": EdgeMask(int size) @@ -40,6 +31,7 @@ cdef extern from "decoder/hg.h": vector[HypergraphNode] nodes_ vector[HypergraphEdge] edges_ int GoalNode() + double NumberOfPaths() void Reweight(vector[weight_t]& weights) void Reweight(FastSparseVector& weights) bint PruneInsideOutside(double beam_alpha, @@ -83,3 +75,6 @@ cdef extern from "decoder/hg_sampler.h" namespace "HypergraphSampler": 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) |