summaryrefslogtreecommitdiff
path: root/python/src/grammar.pxd
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-08-01 17:32:37 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-08-01 17:32:37 +0200
commit3f8e33cfe481a09c121a410e66a6074b5d05683e (patch)
treea41ecaf0bbb69fa91a581623abe89d41219c04f8 /python/src/grammar.pxd
parentc139ce495861bb341e1b86a85ad4559f9ad53c14 (diff)
parent9fe0219562e5db25171cce8776381600ff9a5649 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'python/src/grammar.pxd')
-rw-r--r--python/src/grammar.pxd45
1 files changed, 45 insertions, 0 deletions
diff --git a/python/src/grammar.pxd b/python/src/grammar.pxd
new file mode 100644
index 00000000..833de2e3
--- /dev/null
+++ b/python/src/grammar.pxd
@@ -0,0 +1,45 @@
+from libcpp.vector cimport vector
+from libcpp.string cimport string
+from utils cimport *
+
+cdef extern from "decoder/trule.h":
+ cdef cppclass AlignmentPoint:
+ AlignmentPoint(int s, int t)
+ AlignmentPoint Inverted()
+ short s_
+ short t_
+
+ cdef cppclass TRule:
+ vector[WordID] f_
+ vector[WordID] e_
+ vector[AlignmentPoint] a_
+ FastSparseVector[weight_t] scores_
+ WordID lhs_
+ int arity_
+ bint IsUnary()
+ bint IsGoal()
+ void ComputeArity()
+
+cdef extern from "decoder/grammar.h":
+ cdef cppclass RuleBin:
+ int GetNumRules()
+ shared_ptr[TRule] GetIthRule(int i)
+ int Arity()
+
+ ctypedef RuleBin const_RuleBin "const RuleBin"
+
+ cdef cppclass GrammarIter:
+ const_RuleBin* GetRules()
+
+ ctypedef GrammarIter const_GrammarIter "const GrammarIter"
+
+ cdef cppclass Grammar:
+ const_GrammarIter* GetRoot()
+ bint HasRuleForSpan(int i, int j, int distance)
+ unsigned GetCTFLevels()
+ string GetGrammarName()
+ void SetGrammarName(string)
+
+ cdef cppclass TextGrammar(Grammar):
+ TextGrammar()
+ void AddRule(shared_ptr[TRule]& rule)