summaryrefslogtreecommitdiff
path: root/python/src/_cdec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'python/src/_cdec.cpp')
-rw-r--r--python/src/_cdec.cpp3142
1 files changed, 1747 insertions, 1395 deletions
diff --git a/python/src/_cdec.cpp b/python/src/_cdec.cpp
index dd812b52..1bd600f0 100644
--- a/python/src/_cdec.cpp
+++ b/python/src/_cdec.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17.beta1 on Sat Aug 11 23:26:15 2012 */
+/* Generated by Cython 0.17.beta1 on Tue Aug 14 22:47:23 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -303,6 +303,7 @@
#include "decoder/ff_register.h"
#include "decoder/decoder.h"
#include "observer.h"
+#include "stdio.h"
#include "decoder/kbest.h"
#include "mteval/ns.h"
#include "py_scorer.h"
@@ -403,8 +404,10 @@ static const char *__pyx_f[] = {
};
/*--- Type declarations ---*/
-struct __pyx_obj_5_cdec_Scorer;
+struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector;
struct __pyx_obj_5_cdec_NTRef;
+struct __pyx_obj_5_cdec_Scorer;
+struct __pyx_obj_4cdec_2sa_3_sa_IntList;
struct __pyx_obj_4cdec_2sa_3_sa_Phrase;
struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__;
struct __pyx_obj_5_cdec_Grammar;
@@ -423,6 +426,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot;
struct __pyx_obj_5_cdec_Candidate;
struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr;
struct __pyx_obj_5_cdec_NT;
+struct __pyx_obj_4cdec_2sa_3_sa_FloatList;
struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__;
struct __pyx_obj_5_cdec_HypergraphEdge;
struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__;
@@ -464,6 +468,33 @@ struct __pyx_opt_args_5_cdec_as_str {
char *error_msg;
};
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":25
+ * cdef void read_handle(self, FILE* f)
+ *
+ * cdef class FeatureVector: # <<<<<<<<<<<<<<
+ * cdef IntList names
+ * cdef FloatList values
+ */
+struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector {
+ PyObject_HEAD
+ struct __pyx_obj_4cdec_2sa_3_sa_IntList *names;
+ struct __pyx_obj_4cdec_2sa_3_sa_FloatList *values;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":20
+ * return '[%s]' % self.cat
+ *
+ * cdef class NTRef: # <<<<<<<<<<<<<<
+ * cdef public unsigned ref
+ * def __init__(self, unsigned ref):
+ */
+struct __pyx_obj_5_cdec_NTRef {
+ PyObject_HEAD
+ unsigned int ref;
+};
+
+
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":117
* return CandidateSet(self)
*
@@ -478,20 +509,26 @@ struct __pyx_obj_5_cdec_Scorer {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":20
- * return '[%s]' % self.cat
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":12
+ * cdef void read_handle(self, FILE* f)
*
- * cdef class NTRef: # <<<<<<<<<<<<<<
- * cdef public unsigned ref
- * def __init__(self, unsigned ref):
+ * cdef class IntList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
*/
-struct __pyx_obj_5_cdec_NTRef {
+struct __pyx_obj_4cdec_2sa_3_sa_IntList {
PyObject_HEAD
- unsigned int ref;
+ struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtab;
+ int size;
+ int increment;
+ int len;
+ int *arr;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":1
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":29
+ * cdef FloatList values
+ *
* cdef class Phrase: # <<<<<<<<<<<<<<
* cdef int *syms
* cdef int n, *varpos, n_vars
@@ -522,7 +559,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":181
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":178
* super(MRule, self).__init__(lhs, rhs, e, scores, a)
*
* cdef class Grammar: # <<<<<<<<<<<<<<
@@ -535,7 +572,7 @@ struct __pyx_obj_5_cdec_Grammar {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
@@ -576,7 +613,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":126
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":136
*
* property edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -620,7 +657,7 @@ struct __pyx_obj_5_cdec_CandidateSet {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":132
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":142
*
* property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -636,7 +673,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":50
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":47
* return TRule(lhs, f, e, scores, a)
*
* cdef class TRule: # <<<<<<<<<<<<<<
@@ -649,11 +686,11 @@ struct __pyx_obj_5_cdec_TRule {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":7
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":35
* cdef public int chunklen(self, int k)
*
* cdef class Rule: # <<<<<<<<<<<<<<
- * cdef public int lhs
+ * cdef int lhs
* cdef readonly Phrase f, e
*/
struct __pyx_obj_4cdec_2sa_3_sa_Rule {
@@ -661,13 +698,13 @@ struct __pyx_obj_4cdec_2sa_3_sa_Rule {
int lhs;
struct __pyx_obj_4cdec_2sa_3_sa_Phrase *f;
struct __pyx_obj_4cdec_2sa_3_sa_Phrase *e;
- float *cscores;
+ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *scores;
int n_scores;
PyObject *word_alignments;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":169
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":166
* _phrase(self.f), _phrase(self.e), scores)
*
* cdef class MRule(TRule): # <<<<<<<<<<<<<<
@@ -709,6 +746,14 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr {
PyObject *(*__pyx_t_2)(PyObject *);
};
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":62
+ * yield self[i]
+ *
+ * def todot(self): # <<<<<<<<<<<<<<
+ * def lines():
+ * yield 'digraph lattice {'
+ */
struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot {
PyObject_HEAD
struct __pyx_obj_5_cdec_Lattice *__pyx_v_self;
@@ -729,7 +774,7 @@ struct __pyx_obj_5_cdec_Candidate {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":162
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -760,6 +805,23 @@ struct __pyx_obj_5_cdec_NT {
};
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":3
+ * from libc.stdio cimport FILE
+ *
+ * cdef class FloatList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
+ */
+struct __pyx_obj_4cdec_2sa_3_sa_FloatList {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtab;
+ int size;
+ int increment;
+ int len;
+ float *arr;
+};
+
+
/* "_cdec.pyx":46
* cdef DenseVector weights
*
@@ -773,7 +835,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":170
* return vector
*
* cdef class HypergraphEdge: # <<<<<<<<<<<<<<
@@ -806,7 +868,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":226
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -822,7 +884,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":121
*
* property a:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -839,8 +901,8 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
- * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":57
+ * return unicode(str(self), 'utf8')
*
* def __iter__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
@@ -869,7 +931,7 @@ struct __pyx_obj_5_cdec_Decoder {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
* raise NotImplemented('comparison not implemented for HypergraphEdge')
*
* cdef class HypergraphNode: # <<<<<<<<<<<<<<
@@ -897,7 +959,7 @@ struct __pyx_obj_5_cdec_SparseVector {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":232
*
* property out_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -960,7 +1022,7 @@ struct __pyx_obj_5_cdec_DenseVector {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":187
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":184
* del self.grammar
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -1045,7 +1107,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":190
*
* property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -1061,7 +1123,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":161
* self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -1183,7 +1245,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":204
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":201
* self.grammar.get().SetGrammarName(string(<char *>name))
*
* cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<<
@@ -1210,7 +1272,59 @@ struct __pyx_vtabstruct_5_cdec_Hypergraph {
static struct __pyx_vtabstruct_5_cdec_Hypergraph *__pyx_vtabptr_5_cdec_Hypergraph;
-/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":1
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":170
+ * return vector
+ *
+ * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
+ */
+
+struct __pyx_vtabstruct_5_cdec_HypergraphEdge {
+ PyObject *(*init)(struct __pyx_obj_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int);
+};
+static struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtabptr_5_cdec_HypergraphEdge;
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":12
+ * cdef void read_handle(self, FILE* f)
+ *
+ * cdef class IntList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
+ */
+
+struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList {
+ void (*set)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int, int);
+ void (*_append)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int);
+ void (*_extend)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *);
+ void (*_extend_arr)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int *, int);
+ void (*_clear)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *);
+ void (*write_handle)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, FILE *);
+ void (*read_handle)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, FILE *);
+};
+static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtabptr_4cdec_2sa_3_sa_IntList;
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":3
+ * from libc.stdio cimport FILE
+ *
+ * cdef class FloatList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
+ */
+
+struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList {
+ void (*set)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, int, float);
+ void (*write_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
+ void (*read_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
+};
+static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtabptr_4cdec_2sa_3_sa_FloatList;
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":29
+ * cdef FloatList values
+ *
* cdef class Phrase: # <<<<<<<<<<<<<<
* cdef int *syms
* cdef int n, *varpos, n_vars
@@ -1223,7 +1337,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtabptr_4cdec_2sa_3_sa_Phrase;
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
* raise NotImplemented('comparison not implemented for HypergraphEdge')
*
* cdef class HypergraphNode: # <<<<<<<<<<<<<<
@@ -1235,20 +1349,6 @@ struct __pyx_vtabstruct_5_cdec_HypergraphNode {
PyObject *(*init)(struct __pyx_obj_5_cdec_HypergraphNode *, Hypergraph *, unsigned int);
};
static struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtabptr_5_cdec_HypergraphNode;
-
-
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
- * return vector
- *
- * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphEdge* edge
- */
-
-struct __pyx_vtabstruct_5_cdec_HypergraphEdge {
- PyObject *(*init)(struct __pyx_obj_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int);
-};
-static struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtabptr_5_cdec_HypergraphEdge;
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
@@ -1333,22 +1433,6 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
- PyListObject* L = (PyListObject*) list;
- Py_ssize_t len = Py_SIZE(list);
- if (likely(L->allocated > len)) {
- Py_INCREF(x);
- PyList_SET_ITEM(list, len, x);
- Py_SIZE(list) = len+1;
- return 0;
- }
- return PyList_Append(list, x);
-}
-#else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
-#endif
-
static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
if (likely(PyList_CheckExact(L))) {
if (unlikely(PyList_Append(L, x) < 0)) return NULL;
@@ -1713,7 +1797,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from 'decoder' */
+/* Module declarations from 'libc.stdio' */
+
/* Module declarations from 'cdec.sa._sa' */
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_FloatList = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_IntList = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_FeatureVector = 0;
static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Phrase = 0;
static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Rule = 0;
static char *(*__pyx_f_4cdec_2sa_3_sa_sym_tostring)(int); /*proto*/
@@ -1787,6 +1876,7 @@ static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_ValueError;
+static PyObject *__pyx_builtin_basestring;
static PyObject *__pyx_builtin_eval;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_IndexError;
@@ -1866,15 +1956,16 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_trees(struct __pyx_obj_5_c
static PyObject *__pyx_pf_5_cdec_10Hypergraph_16kbest_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_19sample(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_22sample_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_25intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, struct __pyx_obj_5_cdec_Lattice *__pyx_v_lat); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_25intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_31plf(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_33reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_35inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
@@ -1890,15 +1981,18 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __py
static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_x, struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_y, int __pyx_v_op); /* proto */
-static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
-static void __pyx_pf_5_cdec_7Lattice_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index); /* proto */
-static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs); /* proto */
-static Py_ssize_t __pyx_pf_5_cdec_7Lattice_8__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_7Lattice_10__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_7Lattice_12__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
+static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
+static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
+static void __pyx_pf_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index); /* proto */
+static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs); /* proto */
+static Py_ssize_t __pyx_pf_5_cdec_7Lattice_10__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_7Lattice_16__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_9Candidate_5score___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self); /* proto */
@@ -1948,34 +2042,35 @@ static char __pyx_k_10[] = "[%d]";
static char __pyx_k_11[] = "%s=%s";
static char __pyx_k_12[] = "%s ||| %s ||| %s ||| %s";
static char __pyx_k_13[] = "the grammar should contain TRule objects";
-static char __pyx_k_15[] = "csplit_preserve_full_word";
-static char __pyx_k_16[] = "cannot reweight hypergraph with %s";
-static char __pyx_k_17[] = "comparison not implemented for HypergraphEdge";
-static char __pyx_k_19[] = "comparison not implemented for HypergraphNode";
-static char __pyx_k_22[] = "Cannot create lattice from %s";
-static char __pyx_k_23[] = "lattice index out of range";
-static char __pyx_k_27[] = "digraph lattice {";
- static char __pyx_k_28[] = "rankdir = LR;";
- static char __pyx_k_29[] = "node [shape=circle];";
- static char __pyx_k_30[] = "%d -> %d [label=\"%s\"];";
- static char __pyx_k_31[] = "\"";
- static char __pyx_k_32[] = "\\\"";
- static char __pyx_k_34[] = "%d [shape=doublecircle]";
-static char __pyx_k_35[] = "}";
-static char __pyx_k_38[] = "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi";
-static char __pyx_k_39[] = "\n";
-static char __pyx_k_41[] = "sufficient stats vector index out of range";
-static char __pyx_k_43[] = "candidate set index out of range";
-static char __pyx_k_45[] = "%s %s";
-static char __pyx_k_46[] = "%s = %s";
-static char __pyx_k_48[] = "formalism \"%s\" unknown";
-static char __pyx_k_49[] = "cannot initialize weights with %s";
-static char __pyx_k_50[] = "#";
-static char __pyx_k_53[] = "Cannot translate input type %s";
-static char __pyx_k_54[] = "cdec.sa._sa";
-static char __pyx_k_55[] = "*";
-static char __pyx_k_58[] = "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi";
-static char __pyx_k_64[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx";
+static char __pyx_k_15[] = "cannot intersect hypergraph with %s";
+static char __pyx_k_16[] = "csplit_preserve_full_word";
+static char __pyx_k_17[] = "cannot reweight hypergraph with %s";
+static char __pyx_k_18[] = "comparison not implemented for HypergraphEdge";
+static char __pyx_k_20[] = "comparison not implemented for HypergraphNode";
+static char __pyx_k_23[] = "cannot create lattice from %s";
+static char __pyx_k_24[] = "lattice index out of range";
+static char __pyx_k_28[] = "digraph lattice {";
+ static char __pyx_k_29[] = "rankdir = LR;";
+ static char __pyx_k_30[] = "node [shape=circle];";
+ static char __pyx_k_31[] = "%d -> %d [label=\"%s\"];";
+ static char __pyx_k_32[] = "\"";
+ static char __pyx_k_33[] = "\\\"";
+ static char __pyx_k_35[] = "%d [shape=doublecircle]";
+static char __pyx_k_36[] = "}";
+static char __pyx_k_39[] = "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi";
+static char __pyx_k_40[] = "\n";
+static char __pyx_k_42[] = "sufficient stats vector index out of range";
+static char __pyx_k_44[] = "candidate set index out of range";
+static char __pyx_k_46[] = "%s %s";
+static char __pyx_k_47[] = "%s = %s";
+static char __pyx_k_49[] = "formalism \"%s\" unknown";
+static char __pyx_k_50[] = "cannot initialize weights with %s";
+static char __pyx_k_51[] = "#";
+static char __pyx_k_54[] = "Cannot translate input type %s";
+static char __pyx_k_55[] = "cdec.sa._sa";
+static char __pyx_k_56[] = "*";
+static char __pyx_k_59[] = "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi";
+static char __pyx_k_65[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx";
static char __pyx_k__a[] = "a";
static char __pyx_k__e[] = "e";
static char __pyx_k__f[] = "f";
@@ -2055,13 +2150,14 @@ static char __pyx_k__evaluator[] = "evaluator";
static char __pyx_k__formalism[] = "formalism";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k__alignments[] = "alignments";
+static char __pyx_k__basestring[] = "basestring";
static char __pyx_k__beam_alpha[] = "beam_alpha";
static char __pyx_k__config_str[] = "config_str";
static char __pyx_k__hypergraph[] = "hypergraph";
static char __pyx_k__set_silent[] = "set_silent";
static char __pyx_k__startswith[] = "startswith";
static char __pyx_k__ParseFailed[] = "ParseFailed";
-static char __pyx_k__PhraseModel_[] = "PhraseModel_";
static char __pyx_k___make_config[] = "_make_config";
static char __pyx_k__InvalidConfig[] = "InvalidConfig";
static char __pyx_k__NotImplemented[] = "NotImplemented";
@@ -2069,36 +2165,37 @@ static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_n_s_15;
-static PyObject *__pyx_kp_s_16;
+static PyObject *__pyx_kp_s_15;
+static PyObject *__pyx_n_s_16;
static PyObject *__pyx_kp_s_17;
-static PyObject *__pyx_kp_s_19;
-static PyObject *__pyx_kp_s_22;
+static PyObject *__pyx_kp_s_18;
+static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_23;
-static PyObject *__pyx_kp_s_27;
+static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_kp_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_32;
-static PyObject *__pyx_kp_s_34;
+static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_35;
-static PyObject *__pyx_kp_s_38;
+static PyObject *__pyx_kp_s_36;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_kp_s_4;
-static PyObject *__pyx_kp_s_41;
-static PyObject *__pyx_kp_s_43;
-static PyObject *__pyx_kp_s_45;
+static PyObject *__pyx_kp_s_40;
+static PyObject *__pyx_kp_s_42;
+static PyObject *__pyx_kp_s_44;
static PyObject *__pyx_kp_s_46;
-static PyObject *__pyx_kp_s_48;
+static PyObject *__pyx_kp_s_47;
static PyObject *__pyx_kp_s_49;
static PyObject *__pyx_kp_s_50;
-static PyObject *__pyx_kp_s_53;
-static PyObject *__pyx_n_s_54;
+static PyObject *__pyx_kp_s_51;
+static PyObject *__pyx_kp_s_54;
static PyObject *__pyx_n_s_55;
-static PyObject *__pyx_kp_s_58;
-static PyObject *__pyx_kp_s_64;
+static PyObject *__pyx_n_s_56;
+static PyObject *__pyx_kp_s_59;
+static PyObject *__pyx_kp_s_65;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_9;
@@ -2111,7 +2208,6 @@ static PyObject *__pyx_n_s__InvalidConfig;
static PyObject *__pyx_n_s__KeyError;
static PyObject *__pyx_n_s__NotImplemented;
static PyObject *__pyx_n_s__ParseFailed;
-static PyObject *__pyx_n_s__PhraseModel_;
static PyObject *__pyx_n_s__TER;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
@@ -2127,6 +2223,8 @@ static PyObject *__pyx_n_s___make_config;
static PyObject *__pyx_n_s___phrase;
static PyObject *__pyx_n_s___sa;
static PyObject *__pyx_n_s__a;
+static PyObject *__pyx_n_s__alignments;
+static PyObject *__pyx_n_s__basestring;
static PyObject *__pyx_n_s__beam_alpha;
static PyObject *__pyx_n_s__cat;
static PyObject *__pyx_n_s__config;
@@ -2193,35 +2291,34 @@ static PyObject *__pyx_n_s__weight;
static PyObject *__pyx_n_s__yn;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
-static PyObject *__pyx_int_65536;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_14;
-static PyObject *__pyx_k_tuple_18;
-static PyObject *__pyx_k_tuple_20;
+static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_21;
-static PyObject *__pyx_k_tuple_24;
+static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_25;
static PyObject *__pyx_k_tuple_26;
-static PyObject *__pyx_k_tuple_33;
-static PyObject *__pyx_k_tuple_36;
-static PyObject *__pyx_k_tuple_40;
-static PyObject *__pyx_k_tuple_42;
-static PyObject *__pyx_k_tuple_44;
-static PyObject *__pyx_k_tuple_47;
-static PyObject *__pyx_k_tuple_51;
+static PyObject *__pyx_k_tuple_27;
+static PyObject *__pyx_k_tuple_34;
+static PyObject *__pyx_k_tuple_37;
+static PyObject *__pyx_k_tuple_41;
+static PyObject *__pyx_k_tuple_43;
+static PyObject *__pyx_k_tuple_45;
+static PyObject *__pyx_k_tuple_48;
static PyObject *__pyx_k_tuple_52;
-static PyObject *__pyx_k_tuple_56;
-static PyObject *__pyx_k_tuple_59;
+static PyObject *__pyx_k_tuple_53;
+static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_60;
static PyObject *__pyx_k_tuple_61;
static PyObject *__pyx_k_tuple_62;
-static PyObject *__pyx_k_tuple_65;
-static PyObject *__pyx_k_codeobj_37;
-static PyObject *__pyx_k_codeobj_57;
-static PyObject *__pyx_k_codeobj_63;
-static PyObject *__pyx_k_codeobj_66;
+static PyObject *__pyx_k_tuple_63;
+static PyObject *__pyx_k_tuple_66;
+static PyObject *__pyx_k_codeobj_38;
+static PyObject *__pyx_k_codeobj_58;
+static PyObject *__pyx_k_codeobj_64;
+static PyObject *__pyx_k_codeobj_67;
/* "_cdec.pyx":6
* cimport decoder
@@ -5492,118 +5589,77 @@ static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *_
* return '[%d]' % self.ref
*
* cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * cdef lhs = _sa.sym_tocat(rule.lhs)
+ * lhs = _sa.sym_tocat(rule.lhs)
+ * scores = dict(rule.scores)
*/
static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_rule) {
- unsigned int __pyx_v_i;
- PyObject *__pyx_v_lhs = 0;
- PyObject *__pyx_v_scores = 0;
+ char *__pyx_v_lhs;
+ PyObject *__pyx_v_scores = NULL;
PyObject *__pyx_v_f = NULL;
PyObject *__pyx_v_e = NULL;
int *__pyx_v_fsyms;
+ int __pyx_v_i;
int *__pyx_v_esyms;
- PyObject *__pyx_v_a = 0;
- PyObject *__pyx_v_point = NULL;
+ PyObject *__pyx_v_a = NULL;
struct __pyx_obj_5_cdec_TRule *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
- int __pyx_t_2;
- unsigned int __pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ int __pyx_t_5;
int __pyx_t_6;
- int __pyx_t_7;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
- PyObject *__pyx_t_11 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_rule", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":30
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":29
+ *
* cdef TRule convert_rule(_sa.Rule rule):
- * cdef unsigned i
- * cdef lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<<
- * cdef scores = {}
- * for i in range(rule.n_scores):
- */
- __pyx_t_1 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tocat(__pyx_v_rule->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_v_lhs = ((PyObject *)__pyx_t_1);
- __pyx_t_1 = 0;
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":31
- * cdef unsigned i
- * cdef lhs = _sa.sym_tocat(rule.lhs)
- * cdef scores = {} # <<<<<<<<<<<<<<
- * for i in range(rule.n_scores):
- * scores['PhraseModel_'+str(i)] = rule.cscores[i]
- */
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_v_scores = ((PyObject *)__pyx_t_1);
- __pyx_t_1 = 0;
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":32
- * cdef lhs = _sa.sym_tocat(rule.lhs)
- * cdef scores = {}
- * for i in range(rule.n_scores): # <<<<<<<<<<<<<<
- * scores['PhraseModel_'+str(i)] = rule.cscores[i]
+ * lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<<
+ * scores = dict(rule.scores)
* f, e = [], []
*/
- __pyx_t_2 = __pyx_v_rule->n_scores;
- for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
- __pyx_v_i = __pyx_t_3;
+ __pyx_v_lhs = __pyx_f_4cdec_2sa_3_sa_sym_tocat(__pyx_v_rule->lhs);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":33
- * cdef scores = {}
- * for i in range(rule.n_scores):
- * scores['PhraseModel_'+str(i)] = rule.cscores[i] # <<<<<<<<<<<<<<
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":30
+ * cdef TRule convert_rule(_sa.Rule rule):
+ * lhs = _sa.sym_tocat(rule.lhs)
+ * scores = dict(rule.scores) # <<<<<<<<<<<<<<
* f, e = [], []
* cdef int* fsyms = rule.f.syms
*/
- __pyx_t_1 = PyFloat_FromDouble((__pyx_v_rule->cscores[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_n_s__PhraseModel_), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (PyObject_SetItem(__pyx_v_scores, __pyx_t_5, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- }
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)__pyx_v_rule->scores));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_rule->scores));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_rule->scores));
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_v_scores = ((PyObject*)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":34
- * for i in range(rule.n_scores):
- * scores['PhraseModel_'+str(i)] = rule.cscores[i]
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":31
+ * lhs = _sa.sym_tocat(rule.lhs)
+ * scores = dict(rule.scores)
* f, e = [], [] # <<<<<<<<<<<<<<
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n):
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_v_f = __pyx_t_1;
+ __pyx_v_f = __pyx_t_2;
+ __pyx_t_2 = 0;
+ __pyx_v_e = __pyx_t_1;
__pyx_t_1 = 0;
- __pyx_v_e = __pyx_t_5;
- __pyx_t_5 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":35
- * scores['PhraseModel_'+str(i)] = rule.cscores[i]
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":32
+ * scores = dict(rule.scores)
* f, e = [], []
* cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<<
* for i in range(rule.f.n):
@@ -5611,66 +5667,66 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
*/
__pyx_v_fsyms = __pyx_v_rule->f->syms;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":36
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":33
* f, e = [], []
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n): # <<<<<<<<<<<<<<
* if _sa.sym_isvar(fsyms[i]):
* f.append(NT(_sa.sym_tocat(fsyms[i])))
*/
- __pyx_t_2 = __pyx_v_rule->f->n;
- for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
- __pyx_v_i = __pyx_t_3;
+ __pyx_t_3 = __pyx_v_rule->f->n;
+ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+ __pyx_v_i = __pyx_t_4;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":34
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]): # <<<<<<<<<<<<<<
* f.append(NT(_sa.sym_tocat(fsyms[i])))
* else:
*/
- __pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i]));
- if (__pyx_t_6) {
+ __pyx_t_5 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i]));
+ if (__pyx_t_5) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":38
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":35
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]):
* f.append(NT(_sa.sym_tocat(fsyms[i]))) # <<<<<<<<<<<<<<
* else:
* f.append(_sa.sym_tostring(fsyms[i]))
*/
- __pyx_t_5 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tocat((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tocat((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_7 = PyList_Append(__pyx_v_f, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- goto __pyx_L7;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_6 = PyList_Append(__pyx_v_f, __pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L5;
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":40
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":37
* f.append(NT(_sa.sym_tocat(fsyms[i])))
* else:
* f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<<
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n):
*/
- __pyx_t_5 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_7 = PyList_Append(__pyx_v_f, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_6 = PyList_Append(__pyx_v_f, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
}
- __pyx_L7:;
+ __pyx_L5:;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":38
* else:
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms # <<<<<<<<<<<<<<
@@ -5679,180 +5735,134 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
*/
__pyx_v_esyms = __pyx_v_rule->e->syms;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":39
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n): # <<<<<<<<<<<<<<
* if _sa.sym_isvar(esyms[i]):
* e.append(NTRef(_sa.sym_getindex(esyms[i])))
*/
- __pyx_t_2 = __pyx_v_rule->e->n;
- for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
- __pyx_v_i = __pyx_t_3;
+ __pyx_t_3 = __pyx_v_rule->e->n;
+ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+ __pyx_v_i = __pyx_t_4;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":40
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]): # <<<<<<<<<<<<<<
* e.append(NTRef(_sa.sym_getindex(esyms[i])))
* else:
*/
- __pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i]));
- if (__pyx_t_6) {
+ __pyx_t_5 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i]));
+ if (__pyx_t_5) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":44
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":41
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]):
* e.append(NTRef(_sa.sym_getindex(esyms[i]))) # <<<<<<<<<<<<<<
* else:
* e.append(_sa.sym_tostring(esyms[i]))
*/
- __pyx_t_5 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- goto __pyx_L10;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_6 = PyList_Append(__pyx_v_e, __pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L8;
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":46
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":43
* e.append(NTRef(_sa.sym_getindex(esyms[i])))
* else:
* e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<<
- * cdef a = [(point/65536, point%65536) for point in rule.word_alignments]
+ * a = list(rule.alignments())
* return TRule(lhs, f, e, scores, a)
*/
- __pyx_t_5 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_7 = PyList_Append(__pyx_v_e, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_6 = PyList_Append(__pyx_v_e, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
}
- __pyx_L10:;
+ __pyx_L8:;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":47
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":44
* else:
* e.append(_sa.sym_tostring(esyms[i]))
- * cdef a = [(point/65536, point%65536) for point in rule.word_alignments] # <<<<<<<<<<<<<<
+ * a = list(rule.alignments()) # <<<<<<<<<<<<<<
* return TRule(lhs, f, e, scores, a)
*
*/
- __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- if (PyList_CheckExact(__pyx_v_rule->word_alignments) || PyTuple_CheckExact(__pyx_v_rule->word_alignments)) {
- __pyx_t_1 = __pyx_v_rule->word_alignments; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
- } else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rule->word_alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
- }
- for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- #endif
- } else {
- __pyx_t_4 = __pyx_t_9(__pyx_t_1);
- if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_4);
- }
- __Pyx_XDECREF(__pyx_v_point);
- __pyx_v_point = __pyx_t_4;
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_point, __pyx_int_65536); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_10 = PyNumber_Remainder(__pyx_v_point, __pyx_int_65536); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_4 = 0;
- __pyx_t_10 = 0;
- if (unlikely(__Pyx_PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_11))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
- }
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_rule), __pyx_n_s__alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_INCREF(((PyObject *)__pyx_t_5));
- __pyx_v_a = ((PyObject *)__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_v_a = ((PyObject*)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":48
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":45
* e.append(_sa.sym_tostring(esyms[i]))
- * cdef a = [(point/65536, point%65536) for point in rule.word_alignments]
+ * a = list(rule.alignments())
* return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<<
*
* cdef class TRule:
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
- __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(__pyx_v_lhs);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_lhs);
- __Pyx_GIVEREF(__pyx_v_lhs);
+ __pyx_t_2 = PyBytes_FromString(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(((PyObject *)__pyx_v_f));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_f));
+ PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_f));
__Pyx_GIVEREF(((PyObject *)__pyx_v_f));
__Pyx_INCREF(((PyObject *)__pyx_v_e));
- PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_e));
+ PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_e));
__Pyx_GIVEREF(((PyObject *)__pyx_v_e));
- __Pyx_INCREF(__pyx_v_scores);
- PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_scores);
- __Pyx_GIVEREF(__pyx_v_scores);
- __Pyx_INCREF(__pyx_v_a);
- PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_a);
- __Pyx_GIVEREF(__pyx_v_a);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_r = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_INCREF(((PyObject *)__pyx_v_scores));
+ PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_scores));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_scores));
+ __Pyx_INCREF(((PyObject *)__pyx_v_a));
+ PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_a));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_a));
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_r = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_2);
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = ((struct __pyx_obj_5_cdec_TRule *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_10);
- __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("_cdec.convert_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
- __Pyx_XDECREF(__pyx_v_lhs);
__Pyx_XDECREF(__pyx_v_scores);
__Pyx_XDECREF(__pyx_v_f);
__Pyx_XDECREF(__pyx_v_e);
__Pyx_XDECREF(__pyx_v_a);
- __Pyx_XDECREF(__pyx_v_point);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -5873,7 +5883,7 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,0};
PyObject* values[5] = {0,0,0,0,0};
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":53
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":50
* cdef shared_ptr[grammar.TRule]* rule
*
* def __init__(self, lhs, f, e, scores, a=None): # <<<<<<<<<<<<<<
@@ -5901,17 +5911,17 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (kw_args > 0) {
@@ -5920,7 +5930,7 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -5941,7 +5951,7 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.TRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -5962,75 +5972,75 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":51
*
* def __init__(self, lhs, f, e, scores, a=None):
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) # <<<<<<<<<<<<<<
* self.lhs = lhs
* self.e = e
*/
- try {__pyx_t_1 = new TRule();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+ try {__pyx_t_1 = new TRule();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
__pyx_v_self->rule = new boost::shared_ptr<TRule>(__pyx_t_1);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":52
* def __init__(self, lhs, f, e, scores, a=None):
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* self.lhs = lhs # <<<<<<<<<<<<<<
* self.e = e
* self.f = f
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":56
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":53
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* self.lhs = lhs
* self.e = e # <<<<<<<<<<<<<<
* self.f = f
* self.scores = scores
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":57
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":54
* self.lhs = lhs
* self.e = e
* self.f = f # <<<<<<<<<<<<<<
* self.scores = scores
* if a:
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":55
* self.e = e
* self.f = f
* self.scores = scores # <<<<<<<<<<<<<<
* if a:
* self.a = a
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":56
* self.f = f
* self.scores = scores
* if a: # <<<<<<<<<<<<<<
* self.a = a
* self.rule.get().ComputeArity()
*/
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":57
* self.scores = scores
* if a:
* self.a = a # <<<<<<<<<<<<<<
* self.rule.get().ComputeArity()
*
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":58
* if a:
* self.a = a
* self.rule.get().ComputeArity() # <<<<<<<<<<<<<<
@@ -6058,7 +6068,7 @@ static void __pyx_pw_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":63
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":60
* self.rule.get().ComputeArity()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -6070,7 +6080,7 @@ static void __pyx_pf_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":61
*
* def __dealloc__(self):
* del self.rule # <<<<<<<<<<<<<<
@@ -6093,7 +6103,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":67
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":64
*
* property arity:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6110,7 +6120,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_T
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":65
* property arity:
* def __get__(self):
* return self.rule.get().arity_ # <<<<<<<<<<<<<<
@@ -6118,7 +6128,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_T
* property f:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->rule->get()->arity_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong(__pyx_v_self->rule->get()->arity_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -6147,7 +6157,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":71
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":68
*
* property f:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6174,7 +6184,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":69
* property f:
* def __get__(self):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6183,19 +6193,19 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":74
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":71
* cdef vector[WordID]* f_ = &self.rule.get().f_
* cdef WordID w
* cdef f = [] # <<<<<<<<<<<<<<
* cdef unsigned i
* cdef int idx = 0
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_f = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":73
* cdef f = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6204,7 +6214,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":74
* cdef unsigned i
* cdef int idx = 0
* for i in range(f_.size()): # <<<<<<<<<<<<<<
@@ -6215,7 +6225,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":78
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":75
* cdef int idx = 0
* for i in range(f_.size()):
* w = f_[0][i] # <<<<<<<<<<<<<<
@@ -6224,7 +6234,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_w = ((__pyx_v_f_[0])[__pyx_v_i]);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":79
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":76
* for i in range(f_.size()):
* w = f_[0][i]
* if w < 0: # <<<<<<<<<<<<<<
@@ -6234,7 +6244,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
__pyx_t_4 = (__pyx_v_w < 0);
if (__pyx_t_4) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":80
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":77
* w = f_[0][i]
* if w < 0:
* idx += 1 # <<<<<<<<<<<<<<
@@ -6243,18 +6253,18 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":81
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":78
* if w < 0:
* idx += 1
* f.append(NT(TDConvert(-w).c_str(), idx)) # <<<<<<<<<<<<<<
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
*/
- __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_w)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_w)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
@@ -6262,10 +6272,10 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_1 = 0;
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
@@ -6273,28 +6283,28 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":83
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":80
* f.append(NT(TDConvert(-w).c_str(), idx))
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<<
* return f
*
*/
- __pyx_t_6 = PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
__Pyx_GIVEREF(((PyObject *)__pyx_t_6));
__pyx_t_6 = 0;
- __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
- if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
@@ -6302,7 +6312,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
__pyx_L5:;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":81
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
* return f # <<<<<<<<<<<<<<
@@ -6340,7 +6350,7 @@ static int __pyx_pw_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":86
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":83
* return f
*
* def __set__(self, f): # <<<<<<<<<<<<<<
@@ -6365,7 +6375,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":87
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":84
*
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6374,17 +6384,17 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":85
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_
* f_.resize(len(f)) # <<<<<<<<<<<<<<
* cdef unsigned i
* cdef int idx = 0
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f_->resize(__pyx_t_1);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":90
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":87
* f_.resize(len(f))
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6393,25 +6403,25 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_idx = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":91
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":88
* cdef unsigned i
* cdef int idx = 0
* for i in range(len(f)): # <<<<<<<<<<<<<<
* if isinstance(f[i], NT):
* f_[0][i] = -TDConvert(<char *>f[i].cat)
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":89
* cdef int idx = 0
* for i in range(len(f)):
* if isinstance(f[i], NT): # <<<<<<<<<<<<<<
* f_[0][i] = -TDConvert(<char *>f[i].cat)
* else:
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT));
__Pyx_INCREF(__pyx_t_4);
@@ -6420,35 +6430,35 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":90
* for i in range(len(f)):
* if isinstance(f[i], NT):
* f_[0][i] = -TDConvert(<char *>f[i].cat) # <<<<<<<<<<<<<<
* else:
- * f_[0][i] = TDConvert(<char *>as_str(f[i]))
+ * f_[0][i] = TDConvert(as_str(f[i]))
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__cat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__cat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
((__pyx_v_f_[0])[__pyx_v_i]) = (-TD::Convert(((char *)__pyx_t_6)));
goto __pyx_L5;
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":92
* f_[0][i] = -TDConvert(<char *>f[i].cat)
* else:
- * f_[0][i] = TDConvert(<char *>as_str(f[i])) # <<<<<<<<<<<<<<
+ * f_[0][i] = TDConvert(as_str(f[i])) # <<<<<<<<<<<<<<
*
* property e:
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- ((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(((char *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)));
+ ((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(__pyx_f_5_cdec_as_str(__pyx_t_3, NULL));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_L5:;
@@ -6477,7 +6487,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":98
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":95
*
* property e:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6504,7 +6514,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":99
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":96
* property e:
* def __get__(self):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -6513,19 +6523,19 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":101
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":98
* cdef vector[WordID]* e_ = &self.rule.get().e_
* cdef WordID w
* cdef e = [] # <<<<<<<<<<<<<<
* cdef unsigned i
* cdef int idx = 0
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_e = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":103
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":100
* cdef e = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6534,7 +6544,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":104
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":101
* cdef unsigned i
* cdef int idx = 0
* for i in range(e_.size()): # <<<<<<<<<<<<<<
@@ -6545,7 +6555,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":102
* cdef int idx = 0
* for i in range(e_.size()):
* w = e_[0][i] # <<<<<<<<<<<<<<
@@ -6554,7 +6564,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_w = ((__pyx_v_e_[0])[__pyx_v_i]);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":106
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":103
* for i in range(e_.size()):
* w = e_[0][i]
* if w < 1: # <<<<<<<<<<<<<<
@@ -6564,7 +6574,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
__pyx_t_4 = (__pyx_v_w < 1);
if (__pyx_t_4) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":107
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":104
* w = e_[0][i]
* if w < 1:
* idx += 1 # <<<<<<<<<<<<<<
@@ -6573,24 +6583,24 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":108
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":105
* if w < 1:
* idx += 1
* e.append(NTRef(1-w)) # <<<<<<<<<<<<<<
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
*/
- __pyx_t_1 = PyInt_FromLong((1 - __pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong((1 - __pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -6598,28 +6608,28 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":107
* e.append(NTRef(1-w))
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<<
* return e
*
*/
- __pyx_t_5 = PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__pyx_t_5 = 0;
- __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
- if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -6627,7 +6637,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
__pyx_L5:;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":108
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
* return e # <<<<<<<<<<<<<<
@@ -6665,7 +6675,7 @@ static int __pyx_pw_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":113
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":110
* return e
*
* def __set__(self, e): # <<<<<<<<<<<<<<
@@ -6689,7 +6699,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":111
*
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -6698,35 +6708,35 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":112
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_
* e_.resize(len(e)) # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(len(e)):
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_e_->resize(__pyx_t_1);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":117
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":114
* e_.resize(len(e))
* cdef unsigned i
* for i in range(len(e)): # <<<<<<<<<<<<<<
* if isinstance(e[i], NTRef):
* e_[0][i] = 1-e[i].ref
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":118
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":115
* cdef unsigned i
* for i in range(len(e)):
* if isinstance(e[i], NTRef): # <<<<<<<<<<<<<<
* e_[0][i] = 1-e[i].ref
* else:
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef));
__Pyx_INCREF(__pyx_t_4);
@@ -6735,38 +6745,38 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":119
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":116
* for i in range(len(e)):
* if isinstance(e[i], NTRef):
* e_[0][i] = 1-e[i].ref # <<<<<<<<<<<<<<
* else:
- * e_[0][i] = TDConvert(<char *>as_str(e[i]))
+ * e_[0][i] = TDConvert(as_str(e[i]))
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Subtract(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Subtract(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyInt_from_py_WordID(__pyx_t_4); if (unlikely((__pyx_t_6 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyInt_from_py_WordID(__pyx_t_4); if (unlikely((__pyx_t_6 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
((__pyx_v_e_[0])[__pyx_v_i]) = __pyx_t_6;
goto __pyx_L5;
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":121
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":118
* e_[0][i] = 1-e[i].ref
* else:
- * e_[0][i] = TDConvert(<char *>as_str(e[i])) # <<<<<<<<<<<<<<
+ * e_[0][i] = TDConvert(as_str(e[i])) # <<<<<<<<<<<<<<
*
* property a:
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- ((__pyx_v_e_[0])[__pyx_v_i]) = TD::Convert(((char *)__pyx_f_5_cdec_as_str(__pyx_t_4, NULL)));
+ ((__pyx_v_e_[0])[__pyx_v_i]) = TD::Convert(__pyx_f_5_cdec_as_str(__pyx_t_4, NULL));
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_L5:;
@@ -6796,7 +6806,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":121
*
* property a:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6822,7 +6832,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1a___get__(struct __pyx_obj_5_cdec_TRule
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_5TRule_1a_2generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_5TRule_1a_2generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -6859,9 +6869,9 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":126
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":123
* def __get__(self):
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -6870,7 +6880,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
*/
__pyx_cur_scope->__pyx_v_a = (&__pyx_cur_scope->__pyx_v_self->rule->get()->a_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()): # <<<<<<<<<<<<<<
@@ -6881,18 +6891,18 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":128
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":125
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()):
* yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<<
*
* def __set__(self, a):
*/
- __pyx_t_3 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).s_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).s_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).t_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).t_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
@@ -6912,7 +6922,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -6940,7 +6950,7 @@ static int __pyx_pw_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":130
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":127
* yield (a[0][i].s_, a[0][i].t_)
*
* def __set__(self, a): # <<<<<<<<<<<<<<
@@ -6969,7 +6979,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":128
*
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -6978,35 +6988,35 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_a_ = (&__pyx_v_self->rule->get()->a_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":132
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":129
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
* a_.resize(len(a)) # <<<<<<<<<<<<<<
* cdef unsigned i
* cdef int s, t
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_a_->resize(__pyx_t_1);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":132
* cdef unsigned i
* cdef int s, t
* for i in range(len(a)): # <<<<<<<<<<<<<<
* s, t = a[i]
* a_[0][i] = grammar.AlignmentPoint(s, t)
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":136
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":133
* cdef int s, t
* for i in range(len(a)):
* s, t = a[i] # <<<<<<<<<<<<<<
* a_[0][i] = grammar.AlignmentPoint(s, t)
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
@@ -7018,7 +7028,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -7031,14 +7041,14 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
#else
- __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
@@ -7046,7 +7056,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
__Pyx_GOTREF(__pyx_t_4);
index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_7 = NULL;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_unpacking_done;
@@ -7054,17 +7064,17 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
- __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_s = __pyx_t_8;
__pyx_v_t = __pyx_t_9;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":137
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":134
* for i in range(len(a)):
* s, t = a[i]
* a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<<
@@ -7099,7 +7109,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":140
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":137
*
* property scores:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -7117,20 +7127,20 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":141
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":138
* property scores:
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* scores.vector = new FastSparseVector[double](self.rule.get().scores_)
* return scores
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_scores = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":139
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<<
@@ -7139,7 +7149,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_
*/
__pyx_v_scores->vector = new FastSparseVector<double>(__pyx_v_self->rule->get()->scores_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":143
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":140
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_)
* return scores # <<<<<<<<<<<<<<
@@ -7175,7 +7185,7 @@ static int __pyx_pw_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":145
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":142
* return scores
*
* def __set__(self, scores): # <<<<<<<<<<<<<<
@@ -7205,7 +7215,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":146
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":143
*
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<<
@@ -7214,7 +7224,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_scores_ = (&__pyx_v_self->rule->get()->scores_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":147
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":144
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
* scores_.clear() # <<<<<<<<<<<<<<
@@ -7223,23 +7233,23 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_scores_->clear();
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":150
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":147
* cdef int fid
* cdef float fval
* for fname, fval in scores.items(): # <<<<<<<<<<<<<<
- * fid = FDConvert(<char *>as_str(fname))
+ * fid = FDConvert(as_str(fname))
* if fid < 0: raise KeyError(fname)
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_scores, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_scores, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
__pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -7250,21 +7260,21 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else {
__pyx_t_2 = __pyx_t_4(__pyx_t_1);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -7280,7 +7290,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -7293,14 +7303,14 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
@@ -7308,7 +7318,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
__Pyx_GOTREF(__pyx_t_5);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L6_unpacking_done;
@@ -7316,51 +7326,51 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
- __pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_v_fname);
__pyx_v_fname = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_v_fval = __pyx_t_9;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":151
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":148
* cdef float fval
* for fname, fval in scores.items():
- * fid = FDConvert(<char *>as_str(fname)) # <<<<<<<<<<<<<<
+ * fid = FDConvert(as_str(fname)) # <<<<<<<<<<<<<<
* if fid < 0: raise KeyError(fname)
* scores_.set_value(fid, fval)
*/
- __pyx_v_fid = FD::Convert(((char *)__pyx_f_5_cdec_as_str(__pyx_v_fname, NULL)));
+ __pyx_v_fid = FD::Convert(__pyx_f_5_cdec_as_str(__pyx_v_fname, NULL));
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":152
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":149
* for fname, fval in scores.items():
- * fid = FDConvert(<char *>as_str(fname))
+ * fid = FDConvert(as_str(fname))
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
* scores_.set_value(fid, fval)
*
*/
__pyx_t_10 = (__pyx_v_fid < 0);
if (__pyx_t_10) {
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_fname);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fname);
__Pyx_GIVEREF(__pyx_v_fname);
- __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":153
- * fid = FDConvert(<char *>as_str(fname))
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":150
+ * fid = FDConvert(as_str(fname))
* if fid < 0: raise KeyError(fname)
* scores_.set_value(fid, fval) # <<<<<<<<<<<<<<
*
@@ -7397,7 +7407,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":156
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":153
*
* property lhs:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -7415,7 +7425,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":157
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":154
* property lhs:
* def __get__(self):
* return NT(TDConvert(-self.rule.get().lhs_).c_str()) # <<<<<<<<<<<<<<
@@ -7423,14 +7433,14 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu
* def __set__(self, lhs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->rule->get()->lhs_)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->rule->get()->lhs_)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -7461,7 +7471,7 @@ static int __pyx_pw_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":159
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":156
* return NT(TDConvert(-self.rule.get().lhs_).c_str())
*
* def __set__(self, lhs): # <<<<<<<<<<<<<<
@@ -7483,7 +7493,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_lhs);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":160
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":157
*
* def __set__(self, lhs):
* if not isinstance(lhs, NT): # <<<<<<<<<<<<<<
@@ -7497,19 +7507,19 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
__pyx_t_3 = (!__pyx_t_2);
if (__pyx_t_3) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":161
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":158
* def __set__(self, lhs):
* if not isinstance(lhs, NT):
* lhs = NT(lhs) # <<<<<<<<<<<<<<
* self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat)
*
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_lhs);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_lhs);
__Pyx_GIVEREF(__pyx_v_lhs);
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_lhs);
@@ -7519,16 +7529,16 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":162
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":159
* if not isinstance(lhs, NT):
* lhs = NT(lhs)
* self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat) # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
- __pyx_t_4 = PyObject_GetAttr(__pyx_v_lhs, __pyx_n_s__cat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_v_lhs, __pyx_n_s__cat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_self->rule->get()->lhs_ = (-TD::Convert(((char *)__pyx_t_5)));
@@ -7557,7 +7567,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) {
}
static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":162
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -7583,7 +7593,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) {
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_5TRule_7__str___2generator19, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_5TRule_7__str___2generator19, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -7619,15 +7629,15 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
@@ -7638,21 +7648,21 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -7663,7 +7673,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
__Pyx_GIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_v_feat = __pyx_t_1;
__pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
@@ -7682,7 +7692,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
__Pyx_XGOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
__pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
PyErr_SetNone(PyExc_StopIteration);
@@ -7699,7 +7709,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
return NULL;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":161
* self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -7731,30 +7741,30 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":162
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
* return '%s ||| %s ||| %s ||| %s' % (self.lhs,
* _phrase(self.f), _phrase(self.e), scores)
*/
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_pf_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_pf_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_scores = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":166
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":163
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<<
@@ -7762,43 +7772,43 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":167
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs,
* _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<<
*
* cdef class MRule(TRule):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
@@ -7812,7 +7822,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
__pyx_t_2 = 0;
__pyx_t_1 = 0;
__pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_r = ((PyObject *)__pyx_t_3);
@@ -7851,7 +7861,7 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__scores,&__pyx_n_s__a,0};
PyObject* values[4] = {0,0,0,0};
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":170
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":167
*
* cdef class MRule(TRule):
* def __init__(self, lhs, rhs, scores, a=None): # <<<<<<<<<<<<<<
@@ -7878,12 +7888,12 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (kw_args > 0) {
@@ -7892,7 +7902,7 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -7911,7 +7921,7 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.MRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -7940,7 +7950,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":171
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":168
* cdef class MRule(TRule):
* def __init__(self, lhs, rhs, scores, a=None):
* cdef unsigned i = 1 # <<<<<<<<<<<<<<
@@ -7949,19 +7959,19 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
*/
__pyx_v_i = 1;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":169
* def __init__(self, lhs, rhs, scores, a=None):
* cdef unsigned i = 1
* e = [] # <<<<<<<<<<<<<<
* for s in rhs:
* if isinstance(s, NT):
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_e = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":170
* cdef unsigned i = 1
* e = []
* for s in rhs: # <<<<<<<<<<<<<<
@@ -7972,7 +7982,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__pyx_t_1 = __pyx_v_rhs; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -7982,21 +7992,21 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -8006,7 +8016,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__pyx_v_s = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":174
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":171
* e = []
* for s in rhs:
* if isinstance(s, NT): # <<<<<<<<<<<<<<
@@ -8019,27 +8029,27 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172
* for s in rhs:
* if isinstance(s, NT):
* e.append(NTRef(i)) # <<<<<<<<<<<<<<
* i += 1
* else:
*/
- __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":176
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173
* if isinstance(s, NT):
* e.append(NTRef(i))
* i += 1 # <<<<<<<<<<<<<<
@@ -8051,27 +8061,27 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":178
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175
* i += 1
* else:
* e.append(s) # <<<<<<<<<<<<<<
* super(MRule, self).__init__(lhs, rhs, e, scores, a)
*
*/
- __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_v_s); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_v_s); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L5:;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":179
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":176
* else:
* e.append(s)
* super(MRule, self).__init__(lhs, rhs, e, scores, a) # <<<<<<<<<<<<<<
*
* cdef class Grammar:
*/
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_MRule)));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_MRule)));
@@ -8079,13 +8089,13 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_lhs);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lhs);
@@ -8102,7 +8112,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__Pyx_INCREF(__pyx_v_a);
PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_a);
__Pyx_GIVEREF(__pyx_v_a);
- __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
@@ -8132,7 +8142,7 @@ static void __pyx_pw_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":184
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":181
* cdef shared_ptr[grammar.Grammar]* grammar
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -8144,7 +8154,7 @@ static void __pyx_pf_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":185
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":182
*
* def __dealloc__(self):
* del self.grammar # <<<<<<<<<<<<<<
@@ -8168,7 +8178,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":187
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":184
* del self.grammar
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -8194,7 +8204,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_2__iter__(struct __pyx_obj_5_cdec_Gram
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Grammar_4generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Grammar_4generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -8229,9 +8239,9 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":188
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":185
*
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<<
@@ -8240,7 +8250,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_root = __pyx_cur_scope->__pyx_v_self->grammar->get()->GetRoot();
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":189
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":186
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
* cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<<
@@ -8249,7 +8259,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_rbin = __pyx_cur_scope->__pyx_v_root->GetRules();
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":192
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":189
* cdef TRule trule
* cdef unsigned i
* for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<<
@@ -8260,23 +8270,23 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":193
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":190
* cdef unsigned i
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule) # <<<<<<<<<<<<<<
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i))
* yield trule
*/
- __pyx_t_3 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_trule));
__Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_trule));
__Pyx_GIVEREF(__pyx_t_3);
__pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":194
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":191
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<<
@@ -8285,7 +8295,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_trule->rule = new boost::shared_ptr<TRule>(__pyx_cur_scope->__pyx_v_rbin->GetIthRule(__pyx_cur_scope->__pyx_v_i));
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":195
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":192
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i))
* yield trule # <<<<<<<<<<<<<<
@@ -8304,7 +8314,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -8330,7 +8340,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":198
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":195
*
* property name:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -8348,21 +8358,21 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":199
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":196
* property name:
* def __get__(self):
* str(self.grammar.get().GetGrammarName().c_str()) # <<<<<<<<<<<<<<
*
* def __set__(self, name):
*/
- __pyx_t_1 = PyBytes_FromString(__pyx_v_self->grammar->get()->GetGrammarName().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(__pyx_v_self->grammar->get()->GetGrammarName().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -8391,7 +8401,7 @@ static int __pyx_pw_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":201
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":198
* str(self.grammar.get().GetGrammarName().c_str())
*
* def __set__(self, name): # <<<<<<<<<<<<<<
@@ -8408,14 +8418,14 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":202
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":199
*
* def __set__(self, name):
* self.grammar.get().SetGrammarName(string(<char *>name)) # <<<<<<<<<<<<<<
*
* cdef class TextGrammar(Grammar):
*/
- __pyx_t_1 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->grammar->get()->SetGrammarName(std::string(((char *)__pyx_t_1)));
__pyx_r = 0;
@@ -8453,7 +8463,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyOb
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -8464,7 +8474,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyOb
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.TextGrammar.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -8475,7 +8485,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyOb
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":205
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":202
*
* cdef class TextGrammar(Grammar):
* def __cinit__(self, rules): # <<<<<<<<<<<<<<
@@ -8500,7 +8510,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":206
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":203
* cdef class TextGrammar(Grammar):
* def __cinit__(self, rules):
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) # <<<<<<<<<<<<<<
@@ -8509,7 +8519,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
*/
__pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar>(new TextGrammar());
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":207
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":204
* def __cinit__(self, rules):
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() # <<<<<<<<<<<<<<
@@ -8518,7 +8528,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
*/
__pyx_v__g = ((TextGrammar *)__pyx_v_self->__pyx_base.grammar->get());
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":208
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":205
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules: # <<<<<<<<<<<<<<
@@ -8529,7 +8539,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
__pyx_t_1 = __pyx_v_rules; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -8539,21 +8549,21 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -8563,7 +8573,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
__pyx_v_trule = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":209
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":206
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules:
* if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<<
@@ -8576,17 +8586,17 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":210
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":207
* for trule in rules:
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule) # <<<<<<<<<<<<<<
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects')
*/
- if (!(likely(((__pyx_v_trule) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_trule, __pyx_ptype_4cdec_2sa_3_sa_Rule))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(((__pyx_v_trule) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_trule, __pyx_ptype_4cdec_2sa_3_sa_Rule))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = __pyx_v_trule;
__Pyx_INCREF(__pyx_t_4);
- __pyx_t_6 = ((PyObject *)__pyx_f_5_cdec_convert_rule(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_t_4))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = ((PyObject *)__pyx_f_5_cdec_convert_rule(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_t_4))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_trule);
@@ -8595,7 +8605,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
goto __pyx_L5;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":211
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":208
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule): # <<<<<<<<<<<<<<
@@ -8609,22 +8619,22 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
__pyx_t_7 = (!__pyx_t_5);
if (__pyx_t_7) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":212
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":209
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
* _g.AddRule((<TRule> trule).rule[0])
*/
- __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":213
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":210
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects')
* _g.AddRule((<TRule> trule).rule[0]) # <<<<<<<<<<<<<<
@@ -10217,7 +10227,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_24generator8(__pyx_GeneratorObject
* finally:
* del trees # <<<<<<<<<<<<<<
*
- * def intersect(self, Lattice lat):
+ * def intersect(self, inp):
*/
/*finally:*/ {
int __pyx_why;
@@ -10261,17 +10271,12 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_24generator8(__pyx_GeneratorObject
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_lat); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_lat) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("intersect (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5_cdec_Lattice, 1, "lat", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_25intersect(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_lat));
- goto __pyx_L0;
- __pyx_L1_error:;
- __pyx_r = NULL;
- __pyx_L0:;
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_25intersect(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_inp));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -10279,41 +10284,128 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":101
* del trees
*
- * def intersect(self, Lattice lat): # <<<<<<<<<<<<<<
- * return hypergraph.Intersect(lat.lattice[0], self.hg)
- *
+ * def intersect(self, inp): # <<<<<<<<<<<<<<
+ * cdef Lattice lat
+ * if isinstance(inp, Lattice):
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_25intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, struct __pyx_obj_5_cdec_Lattice *__pyx_v_lat) {
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_25intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp) {
+ struct __pyx_obj_5_cdec_Lattice *__pyx_v_lat = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("intersect", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":102
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":103
+ * def intersect(self, inp):
+ * cdef Lattice lat
+ * if isinstance(inp, Lattice): # <<<<<<<<<<<<<<
+ * lat = <Lattice> inp
+ * elif isinstance(inp, basestring):
+ */
+ __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice));
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_inp, __pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":104
+ * cdef Lattice lat
+ * if isinstance(inp, Lattice):
+ * lat = <Lattice> inp # <<<<<<<<<<<<<<
+ * elif isinstance(inp, basestring):
+ * lat = Lattice(inp)
+ */
+ __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_inp)));
+ __pyx_v_lat = ((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_inp);
+ goto __pyx_L3;
+ }
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":105
+ * if isinstance(inp, Lattice):
+ * lat = <Lattice> inp
+ * elif isinstance(inp, basestring): # <<<<<<<<<<<<<<
+ * lat = Lattice(inp)
+ * else:
+ */
+ __pyx_t_1 = __pyx_builtin_basestring;
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_inp, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":106
+ * lat = <Lattice> inp
+ * elif isinstance(inp, basestring):
+ * lat = Lattice(inp) # <<<<<<<<<<<<<<
+ * else:
+ * raise TypeError('cannot intersect hypergraph with %s' % type(inp))
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_inp);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_inp);
+ __Pyx_GIVEREF(__pyx_v_inp);
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_v_lat = ((struct __pyx_obj_5_cdec_Lattice *)__pyx_t_3);
+ __pyx_t_3 = 0;
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108
+ * lat = Lattice(inp)
+ * else:
+ * raise TypeError('cannot intersect hypergraph with %s' % type(inp)) # <<<<<<<<<<<<<<
+ * return hypergraph.Intersect(lat.lattice[0], self.hg)
*
- * def intersect(self, Lattice lat):
+ */
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_L3:;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":109
+ * else:
+ * raise TypeError('cannot intersect hypergraph with %s' % type(inp))
* return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<<
*
* def prune(self, beam_alpha=0, density=0, **kwargs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong(HG::Intersect((__pyx_v_lat->lattice[0]), __pyx_v_self->hg)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_r = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_PyBool_FromLong(HG::Intersect((__pyx_v_lat->lattice[0]), __pyx_v_self->hg)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("_cdec.Hypergraph.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_lat);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -10358,7 +10450,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, Py
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "prune") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "prune") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -10373,7 +10465,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
__Pyx_AddTraceback("_cdec.Hypergraph.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -10386,7 +10478,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":104
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":111
* return hypergraph.Intersect(lat.lattice[0], self.hg)
*
* def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
@@ -10406,7 +10498,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("prune", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":112
*
* def prune(self, beam_alpha=0, density=0, **kwargs):
* cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<<
@@ -10415,17 +10507,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_preserve_mask = NULL;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":106
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113
* def prune(self, beam_alpha=0, density=0, **kwargs):
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs: # <<<<<<<<<<<<<<
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
*/
- __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s_15)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s_16)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":107
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":114
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<<
@@ -10434,7 +10526,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_preserve_mask = new std::vector<bool>(__pyx_v_self->hg->edges_.size());
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":115
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True # <<<<<<<<<<<<<<
@@ -10446,18 +10538,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":109
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":116
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) # <<<<<<<<<<<<<<
* if preserve_mask:
* del preserve_mask
*/
- __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_beam_alpha); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_density); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_beam_alpha); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_density); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->hg->PruneInsideOutside(__pyx_t_2, __pyx_t_3, __pyx_v_preserve_mask, 0, 1.0, 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":117
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask: # <<<<<<<<<<<<<<
@@ -10467,7 +10559,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
__pyx_t_1 = (__pyx_v_preserve_mask != 0);
if (__pyx_t_1) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":118
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask:
* del preserve_mask # <<<<<<<<<<<<<<
@@ -10501,7 +10593,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_30lattice(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":120
* del preserve_mask
*
* def lattice(self): # TODO direct hg -> lattice conversion in cdec # <<<<<<<<<<<<<<
@@ -10521,37 +10613,37 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lattice", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":121
*
* def lattice(self): # TODO direct hg -> lattice conversion in cdec
* cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() # <<<<<<<<<<<<<<
* return Lattice(eval(plf))
*
*/
- __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_v_plf = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":122
* def lattice(self): # TODO direct hg -> lattice conversion in cdec
* cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str()
* return Lattice(eval(plf)) # <<<<<<<<<<<<<<
*
- * def reweight(self, weights):
+ * def plf(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
if (((PyObject *)__pyx_v_plf)) {
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__plf), ((PyObject *)__pyx_v_plf)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__plf), ((PyObject *)__pyx_v_plf)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
if (((PyObject *)__pyx_v_self)) {
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_v_plf));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_plf));
@@ -10562,15 +10654,15 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_eval, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_eval, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -10593,25 +10685,89 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_32reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_32reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_32plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_32plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("reweight (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_31reweight(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+ __Pyx_RefNannySetupContext("plf (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_31plf(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":117
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":124
* return Lattice(eval(plf))
*
+ * def plf(self): # <<<<<<<<<<<<<<
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_31plf(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("plf", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":125
+ *
+ * def plf(self):
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) # <<<<<<<<<<<<<<
+ *
+ * def reweight(self, weights):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_cdec.Hypergraph.plf", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_34reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_34reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("reweight (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_33reweight(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":127
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ *
* def reweight(self, weights): # <<<<<<<<<<<<<<
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0])
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) {
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_33reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -10622,7 +10778,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("reweight", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":118
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":128
*
* def reweight(self, weights):
* if isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -10635,7 +10791,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":119
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":129
* def reweight(self, weights):
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -10646,7 +10802,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
goto __pyx_L3;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":120
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":130
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
@@ -10659,7 +10815,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":121
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":131
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector):
* self.hg.Reweight((<DenseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -10671,26 +10827,26 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":123
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":133
* self.hg.Reweight((<DenseVector> weights).vector[0])
* else:
* raise TypeError('cannot reweight hypergraph with %s' % type(weights)) # <<<<<<<<<<<<<<
*
* property edges:
*/
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -10719,7 +10875,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":126
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":136
*
* property edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10745,7 +10901,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5edges_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5edges_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -10781,9 +10937,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":128
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<<
@@ -10794,16 +10950,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":129
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":139
* cdef unsigned i
* for i in range(self.hg.edges_.size()):
* yield HypergraphEdge().init(self.hg, i) # <<<<<<<<<<<<<<
*
* property nodes:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -10818,7 +10974,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -10846,7 +11002,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":132
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":142
*
* property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10872,7 +11028,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -10908,9 +11064,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":134
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":144
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<<
@@ -10921,16 +11077,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":145
* cdef unsigned i
* for i in range(self.hg.nodes_.size()):
* yield HypergraphNode().init(self.hg, i) # <<<<<<<<<<<<<<
*
* property goal:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -10945,7 +11101,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -10972,7 +11128,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":148
*
* property goal:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10990,7 +11146,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":139
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":149
* property goal:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<<
@@ -10998,9 +11154,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c
* property npaths:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->hg->GoalNode()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->hg->GoalNode()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
@@ -11031,7 +11187,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":142
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":152
*
* property npaths:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11048,7 +11204,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":143
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":153
* property npaths:
* def __get__(self):
* return self.hg.NumberOfPaths() # <<<<<<<<<<<<<<
@@ -11056,7 +11212,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5
* def inside_outside(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->hg->NumberOfPaths()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->hg->NumberOfPaths()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -11075,17 +11231,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_34inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_34inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_36inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_36inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inside_outside (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_33inside_outside(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_35inside_outside(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":145
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":155
* return self.hg.NumberOfPaths()
*
* def inside_outside(self): # <<<<<<<<<<<<<<
@@ -11093,7 +11249,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_34inside_outside(PyObject *__pyx_v
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_35inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
FastSparseVector<prob_t> *__pyx_v_result;
prob_t __pyx_v_z;
struct __pyx_obj_5_cdec_SparseVector *__pyx_v_vector = 0;
@@ -11109,7 +11265,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("inside_outside", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":146
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":156
*
* def inside_outside(self):
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() # <<<<<<<<<<<<<<
@@ -11118,7 +11274,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_result = new FastSparseVector<prob_t>();
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":147
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":157
* def inside_outside(self):
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) # <<<<<<<<<<<<<<
@@ -11127,7 +11283,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":148
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":158
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z # <<<<<<<<<<<<<<
@@ -11136,20 +11292,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
(__pyx_v_result[0]) /= __pyx_v_z;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":149
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":159
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* vector.vector = new FastSparseVector[double]()
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False)
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":150
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<<
@@ -11158,7 +11314,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_vector->vector = new FastSparseVector<double>();
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":151
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":161
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double]()
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) # <<<<<<<<<<<<<<
@@ -11167,7 +11323,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":153
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":163
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False)
* cdef unsigned i
* for i in range(result.size()): # <<<<<<<<<<<<<<
@@ -11178,7 +11334,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":154
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":164
* cdef unsigned i
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) # <<<<<<<<<<<<<<
@@ -11187,7 +11343,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":155
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":165
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it # <<<<<<<<<<<<<<
@@ -11197,7 +11353,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
(++(__pyx_v_it[0]));
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":156
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":166
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it
* del it # <<<<<<<<<<<<<<
@@ -11206,7 +11362,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
delete __pyx_v_it;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":157
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167
* pinc(it[0]) # ++it
* del it
* del result # <<<<<<<<<<<<<<
@@ -11215,7 +11371,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
delete __pyx_v_result;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":158
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":168
* del it
* del result
* return vector # <<<<<<<<<<<<<<
@@ -11240,7 +11396,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":165
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":175
* cdef public TRule trule
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -11257,7 +11413,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("init", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":166
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":176
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -11266,7 +11422,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":177
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.edge = &hg.edges_[i] # <<<<<<<<<<<<<<
@@ -11275,23 +11431,23 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":168
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":178
* self.hg = hg
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule) # <<<<<<<<<<<<<<
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->trule);
__Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
__pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":169
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":179
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<<
@@ -11300,7 +11456,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->trule->rule = new boost::shared_ptr<TRule>(__pyx_v_self->edge->rule_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":170
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self # <<<<<<<<<<<<<<
@@ -11335,7 +11491,7 @@ static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":172
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":182
* return self
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -11348,7 +11504,7 @@ static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":173
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":183
*
* def __len__(self):
* return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<<
@@ -11375,7 +11531,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":176
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":186
*
* property head_node:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11393,7 +11549,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":177
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":187
* property head_node:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<<
@@ -11401,9 +11557,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py
* property tail_nodes:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->edge->head_node_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->edge->head_node_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
@@ -11435,7 +11591,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":190
*
* property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11461,7 +11617,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -11497,9 +11653,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":182
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":192
* def __get__(self):
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<<
@@ -11510,16 +11666,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":183
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":193
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()):
* yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i]) # <<<<<<<<<<<<<<
*
* property span:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->edge->tail_nodes_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->edge->tail_nodes_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -11534,7 +11690,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -11561,7 +11717,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":186
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":196
*
* property span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11580,7 +11736,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":187
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":197
* property span:
* def __get__(self):
* return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<<
@@ -11588,11 +11744,11 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj
* property feature_values:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->edge->i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong(__pyx_v_self->edge->i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_self->edge->j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromLong(__pyx_v_self->edge->j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -11629,7 +11785,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyOb
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":190
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":200
*
* property feature_values:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11647,20 +11803,20 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":191
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":201
* property feature_values:
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":192
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<<
@@ -11669,7 +11825,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc
*/
__pyx_v_vector->vector = new FastSparseVector<double>(__pyx_v_self->edge->feature_values_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":193
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":203
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector # <<<<<<<<<<<<<<
@@ -11705,7 +11861,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":196
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
*
* property prob:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11722,7 +11878,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":197
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":207
* property prob:
* def __get__(self):
* return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<<
@@ -11730,7 +11886,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->edge->edge_prob_.as_float()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->edge->edge_prob_.as_float()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -11754,8 +11910,8 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphEdge, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphEdge, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_x), ((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_y), ((int)__pyx_v_op));
goto __pyx_L0;
__pyx_L1_error:;
@@ -11765,7 +11921,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":199
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":209
* return self.edge.edge_prob_.as_float()
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
@@ -11783,7 +11939,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":212
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -11792,7 +11948,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
switch (__pyx_v_op) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":200
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":210
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -11801,7 +11957,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
case 2:
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":201
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":211
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # ==
* return x.edge == y.edge # <<<<<<<<<<<<<<
@@ -11809,14 +11965,14 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
* return not (x == y)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->edge == __pyx_v_y->edge)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->edge == __pyx_v_y->edge)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
break;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":212
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -11825,7 +11981,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
case 3:
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":203
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":213
* return x.edge == y.edge
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -11833,11 +11989,11 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -11845,18 +12001,18 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
break;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":204
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":214
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
*
* cdef class HypergraphNode:
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
@@ -11881,7 +12037,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__py
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":163
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":173
* cdef hypergraph.Hypergraph* hg
* cdef hypergraph.HypergraphEdge* edge
* cdef public TRule trule # <<<<<<<<<<<<<<
@@ -11923,7 +12079,7 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_5_c
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__Pyx_GOTREF(__pyx_v_self->trule);
@@ -11966,7 +12122,7 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_c
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":210
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":220
* cdef hypergraph.HypergraphNode* node
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -11979,7 +12135,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("init", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":211
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":221
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -11988,7 +12144,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":212
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.node = &hg.nodes_[i] # <<<<<<<<<<<<<<
@@ -11997,7 +12153,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->node = (&(__pyx_v_hg->nodes_[__pyx_v_i]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":213
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":223
* self.hg = hg
* self.node = &hg.nodes_[i]
* return self # <<<<<<<<<<<<<<
@@ -12028,7 +12184,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":226
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12054,7 +12210,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -12090,9 +12246,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":218
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":228
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<<
@@ -12103,16 +12259,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":219
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":229
* cdef unsigned i
* for i in range(self.node.in_edges_.size()):
* yield HypergraphEdge().init(self.hg, self.node.in_edges_[i]) # <<<<<<<<<<<<<<
*
* property out_edges:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -12127,7 +12283,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -12155,7 +12311,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":232
*
* property out_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12181,7 +12337,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __py
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -12217,9 +12373,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":224
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":234
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<<
@@ -12230,16 +12386,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":225
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":235
* cdef unsigned i
* for i in range(self.node.out_edges_.size()):
* yield HypergraphEdge().init(self.hg, self.node.out_edges_[i]) # <<<<<<<<<<<<<<
*
* property span:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -12254,7 +12410,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -12281,7 +12437,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":228
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":238
*
* property span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12299,7 +12455,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":229
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239
* property span:
* def __get__(self):
* return next(self.in_edges).span # <<<<<<<<<<<<<<
@@ -12307,12 +12463,12 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj
* property cat:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__in_edges); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__in_edges); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__span); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__span); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -12343,7 +12499,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":232
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":242
*
* property cat:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12361,7 +12517,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":233
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":243
* property cat:
* def __get__(self):
* if self.node.cat_: # <<<<<<<<<<<<<<
@@ -12370,7 +12526,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
*/
if (__pyx_v_self->node->cat_) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":234
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":244
* def __get__(self):
* if self.node.cat_:
* return str(TDConvert(-self.node.cat_).c_str()) # <<<<<<<<<<<<<<
@@ -12378,14 +12534,14 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->node->cat_)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->node->cat_)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -12414,8 +12570,8 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_14HypergraphNode___richcmp__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_x), ((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_y), ((int)__pyx_v_op));
goto __pyx_L0;
__pyx_L1_error:;
@@ -12425,7 +12581,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":236
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":246
* return str(TDConvert(-self.node.cat_).c_str())
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
@@ -12443,7 +12599,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":249
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12452,7 +12608,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
switch (__pyx_v_op) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":237
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":247
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -12461,7 +12617,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
case 2:
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":238
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":248
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # ==
* return x.node == y.node # <<<<<<<<<<<<<<
@@ -12469,14 +12625,14 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
* return not (x == y)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->node == __pyx_v_y->node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->node == __pyx_v_y->node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
break;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":249
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12485,18 +12641,18 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
case 3:
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":240
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":250
* return x.node == y.node
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
* raise NotImplemented('comparison not implemented for HypergraphNode')
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -12504,16 +12660,16 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
break;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":241
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":251
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
@@ -12530,10 +12686,51 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
/* Python wrapper */
static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_inp = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+ if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
+ __pyx_r = __pyx_pf_5_cdec_7Lattice___cinit__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":6
+ * cdef lattice.Lattice* lattice
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.lattice = new lattice.Lattice()
+ *
+ */
+
+static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":7
+ *
+ * def __cinit__(self):
+ * self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<<
+ *
+ * def __init__(self, inp):
+ */
+ __pyx_v_self->lattice = new Lattice();
+
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_inp = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__inp,0};
PyObject* values[1] = {0};
@@ -12552,7 +12749,7 @@ static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -12563,26 +12760,26 @@ static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
- __Pyx_AddTraceback("_cdec.Lattice.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_cdec.Lattice.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_5_cdec_7Lattice___cinit__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), __pyx_v_inp);
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_2__init__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), __pyx_v_inp);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":6
- * cdef lattice.Lattice* lattice
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":9
+ * self.lattice = new lattice.Lattice()
*
- * def __cinit__(self, inp): # <<<<<<<<<<<<<<
+ * def __init__(self, inp): # <<<<<<<<<<<<<<
* if isinstance(inp, tuple):
- * self.lattice = new lattice.Lattice(len(inp))
+ * self.lattice.resize(len(inp))
*/
-static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp) {
+static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp) {
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_arcs = NULL;
int __pyx_r;
@@ -12598,14 +12795,14 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("__cinit__", 0);
+ __Pyx_RefNannySetupContext("__init__", 0);
__Pyx_INCREF(__pyx_v_inp);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":7
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":10
*
- * def __cinit__(self, inp):
+ * def __init__(self, inp):
* if isinstance(inp, tuple): # <<<<<<<<<<<<<<
- * self.lattice = new lattice.Lattice(len(inp))
+ * self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp):
*/
__pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
@@ -12614,19 +12811,19 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":8
- * def __cinit__(self, inp):
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":11
+ * def __init__(self, inp):
* if isinstance(inp, tuple):
- * self.lattice = new lattice.Lattice(len(inp)) # <<<<<<<<<<<<<<
+ * self.lattice.resize(len(inp)) # <<<<<<<<<<<<<<
* for i, arcs in enumerate(inp):
* self[i] = arcs
*/
- __pyx_t_3 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_self->lattice = new Lattice(__pyx_t_3);
+ __pyx_t_3 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->lattice->resize(__pyx_t_3);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":9
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":12
* if isinstance(inp, tuple):
- * self.lattice = new lattice.Lattice(len(inp))
+ * self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp): # <<<<<<<<<<<<<<
* self[i] = arcs
* else:
@@ -12637,7 +12834,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__pyx_t_4 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
@@ -12647,21 +12844,21 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_4)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else {
__pyx_t_6 = __pyx_t_5(__pyx_t_4);
if (unlikely(!__pyx_t_6)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -12673,20 +12870,20 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__Pyx_INCREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_1;
- __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_6;
__pyx_t_6 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":10
- * self.lattice = new lattice.Lattice(len(inp))
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":13
+ * self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp):
* self[i] = arcs # <<<<<<<<<<<<<<
* else:
* if isinstance(inp, unicode):
*/
- if (PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_i, __pyx_v_arcs) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_i, __pyx_v_arcs) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -12694,7 +12891,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":12
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":15
* self[i] = arcs
* else:
* if isinstance(inp, unicode): # <<<<<<<<<<<<<<
@@ -12707,16 +12904,16 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":16
* else:
* if isinstance(inp, unicode):
* inp = inp.encode('utf8') # <<<<<<<<<<<<<<
* if not isinstance(inp, str):
- * raise TypeError('Cannot create lattice from %s' % type(inp))
+ * raise TypeError('cannot create lattice from %s' % type(inp))
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_inp, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_inp, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_inp);
@@ -12726,12 +12923,12 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
}
__pyx_L6:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":14
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":17
* if isinstance(inp, unicode):
* inp = inp.encode('utf8')
* if not isinstance(inp, str): # <<<<<<<<<<<<<<
- * raise TypeError('Cannot create lattice from %s' % type(inp))
- * self.lattice = new lattice.Lattice()
+ * raise TypeError('cannot create lattice from %s' % type(inp))
+ * lattice.ConvertTextOrPLF(string(<char *>inp), self.lattice)
*/
__pyx_t_4 = ((PyObject *)((PyObject*)(&PyString_Type)));
__Pyx_INCREF(__pyx_t_4);
@@ -12740,48 +12937,39 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__pyx_t_7 = (!__pyx_t_2);
if (__pyx_t_7) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":15
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":18
* inp = inp.encode('utf8')
* if not isinstance(inp, str):
- * raise TypeError('Cannot create lattice from %s' % type(inp)) # <<<<<<<<<<<<<<
- * self.lattice = new lattice.Lattice()
- * lattice.ConvertTextToLattice(string(<char *>inp), self.lattice)
+ * raise TypeError('cannot create lattice from %s' % type(inp)) # <<<<<<<<<<<<<<
+ * lattice.ConvertTextOrPLF(string(<char *>inp), self.lattice)
+ *
*/
- __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":16
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":19
* if not isinstance(inp, str):
- * raise TypeError('Cannot create lattice from %s' % type(inp))
- * self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<<
- * lattice.ConvertTextToLattice(string(<char *>inp), self.lattice)
- *
- */
- __pyx_v_self->lattice = new Lattice();
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":17
- * raise TypeError('Cannot create lattice from %s' % type(inp))
- * self.lattice = new lattice.Lattice()
- * lattice.ConvertTextToLattice(string(<char *>inp), self.lattice) # <<<<<<<<<<<<<<
+ * raise TypeError('cannot create lattice from %s' % type(inp))
+ * lattice.ConvertTextOrPLF(string(<char *>inp), self.lattice) # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __pyx_t_8 = PyBytes_AsString(__pyx_v_inp); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- LatticeTools::ConvertTextToLattice(std::string(((char *)__pyx_t_8)), __pyx_v_self->lattice);
+ __pyx_t_8 = PyBytes_AsString(__pyx_v_inp); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ LatticeTools::ConvertTextOrPLF(std::string(((char *)__pyx_t_8)), __pyx_v_self->lattice);
}
__pyx_L3:;
@@ -12791,7 +12979,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_AddTraceback("_cdec.Lattice.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_cdec.Lattice.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_i);
@@ -12802,27 +12990,27 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
}
/* Python wrapper */
-static void __pyx_pw_5_cdec_7Lattice_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5_cdec_7Lattice_3__dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pw_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
- __pyx_pf_5_cdec_7Lattice_2__dealloc__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
+ __pyx_pf_5_cdec_7Lattice_4__dealloc__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":19
- * lattice.ConvertTextToLattice(string(<char *>inp), self.lattice)
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":21
+ * lattice.ConvertTextOrPLF(string(<char *>inp), self.lattice)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* del self.lattice
*
*/
-static void __pyx_pf_5_cdec_7Lattice_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
+static void __pyx_pf_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":20
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":22
*
* def __dealloc__(self):
* del self.lattice # <<<<<<<<<<<<<<
@@ -12835,14 +13023,14 @@ static void __pyx_pf_5_cdec_7Lattice_2__dealloc__(CYTHON_UNUSED struct __pyx_obj
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_7Lattice_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
-static PyObject *__pyx_pw_5_cdec_7Lattice_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
+static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
+static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
int __pyx_v_index;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -12850,12 +13038,12 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5__getitem__(PyObject *__pyx_v_self, P
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_5_cdec_7Lattice_4__getitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index));
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_6__getitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":22
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24
* del self.lattice
*
* def __getitem__(self, int index): # <<<<<<<<<<<<<<
@@ -12863,7 +13051,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5__getitem__(PyObject *__pyx_v_self, P
* raise IndexError('lattice index out of range')
*/
-static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index) {
+static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index) {
PyObject *__pyx_v_arcs = NULL;
std::vector<LatticeArc> __pyx_v_arc_vector;
LatticeArc *__pyx_v_arc;
@@ -12885,7 +13073,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":23
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":25
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -12894,41 +13082,41 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
*/
__pyx_t_1 = (0 <= __pyx_v_index);
if (__pyx_t_1) {
- __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_v_index < __pyx_t_2);
}
__pyx_t_3 = (!__pyx_t_1);
if (__pyx_t_3) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":25
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":27
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range')
* arcs = [] # <<<<<<<<<<<<<<
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
* cdef lattice.LatticeArc* arc
*/
- __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_arcs = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":28
* raise IndexError('lattice index out of range')
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<<
@@ -12937,7 +13125,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
*/
__pyx_v_arc_vector = ((__pyx_v_self->lattice[0])[__pyx_v_index]);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":29
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":31
* cdef lattice.LatticeArc* arc
* cdef unsigned i
* for i in range(arc_vector.size()): # <<<<<<<<<<<<<<
@@ -12948,7 +13136,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i = __pyx_t_6;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":30
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":32
* cdef unsigned i
* for i in range(arc_vector.size()):
* arc = &arc_vector[i] # <<<<<<<<<<<<<<
@@ -12957,16 +13145,16 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
*/
__pyx_v_arc = (&(__pyx_v_arc_vector[__pyx_v_i]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":31
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33
* for i in range(arc_vector.size()):
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label).c_str(), 'utf8') # <<<<<<<<<<<<<<
* arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs)
*/
- __pyx_t_4 = PyBytes_FromString(TD::Convert(__pyx_v_arc->label).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyBytes_FromString(TD::Convert(__pyx_v_arc->label).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
@@ -12974,25 +13162,25 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__Pyx_XDECREF(((PyObject *)__pyx_v_label));
__pyx_v_label = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":32
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":34
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label).c_str(), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<<
* return tuple(arcs)
*
*/
- __pyx_t_4 = PyFloat_FromDouble(__pyx_v_arc->cost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyFloat_FromDouble(__pyx_v_arc->cost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_7 = PyInt_FromLong(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyInt_FromLong(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_INCREF(((PyObject *)__pyx_v_label));
PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_label));
@@ -13003,11 +13191,11 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_4 = 0;
__pyx_t_7 = 0;
- __pyx_t_9 = PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":35
* label = unicode(TDConvert(arc.label).c_str(), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs) # <<<<<<<<<<<<<<
@@ -13015,7 +13203,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
* def __setitem__(self, int index, tuple arcs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_8 = ((PyObject *)PyList_AsTuple(__pyx_v_arcs)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = ((PyObject *)PyList_AsTuple(__pyx_v_arcs)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_8));
__pyx_r = ((PyObject *)__pyx_t_8);
__pyx_t_8 = 0;
@@ -13038,14 +13226,14 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
}
/* Python wrapper */
-static int __pyx_pw_5_cdec_7Lattice_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs); /*proto*/
-static int __pyx_pw_5_cdec_7Lattice_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs) {
+static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs); /*proto*/
+static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs) {
int __pyx_v_index;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -13053,8 +13241,8 @@ static int __pyx_pw_5_cdec_7Lattice_7__setitem__(PyObject *__pyx_v_self, PyObjec
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = __pyx_pf_5_cdec_7Lattice_6__setitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject*)__pyx_v_arcs));
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_8__setitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject*)__pyx_v_arcs));
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -13063,7 +13251,7 @@ static int __pyx_pw_5_cdec_7Lattice_7__setitem__(PyObject *__pyx_v_self, PyObjec
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":35
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37
* return tuple(arcs)
*
* def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
@@ -13071,7 +13259,7 @@ static int __pyx_pw_5_cdec_7Lattice_7__setitem__(PyObject *__pyx_v_self, PyObjec
* raise IndexError('lattice index out of range')
*/
-static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs) {
+static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs) {
LatticeArc *__pyx_v_arc;
PyObject *__pyx_v_label = NULL;
PyObject *__pyx_v_cost = NULL;
@@ -13096,7 +13284,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":36
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":38
*
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -13105,29 +13293,29 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
*/
__pyx_t_1 = (0 <= __pyx_v_index);
if (__pyx_t_1) {
- __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_v_index < __pyx_t_2);
}
__pyx_t_3 = (!__pyx_t_1);
if (__pyx_t_3) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41
* raise IndexError('lattice index out of range')
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<<
@@ -13136,7 +13324,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
*/
if (unlikely(((PyObject *)__pyx_v_arcs) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_4 = ((PyObject *)__pyx_v_arcs); __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
for (;;) {
@@ -13144,7 +13332,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++;
#else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
PyObject* sequence = __pyx_t_5;
@@ -13156,7 +13344,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -13172,15 +13360,15 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(__pyx_t_8);
#else
- __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
@@ -13190,7 +13378,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_GOTREF(__pyx_t_7);
index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_8);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_10 = NULL;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L7_unpacking_done;
@@ -13198,7 +13386,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_10 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_label);
@@ -13211,7 +13399,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__pyx_v_dist2next = __pyx_t_8;
__pyx_t_8 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":40
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":42
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode): # <<<<<<<<<<<<<<
@@ -13224,16 +13412,16 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_3) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode):
* label = label.encode('utf8') # <<<<<<<<<<<<<<
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
*/
- __pyx_t_5 = PyObject_GetAttr(__pyx_v_label, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_v_label, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_v_label);
@@ -13243,19 +13431,19 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
}
__pyx_L8:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":44
* if isinstance(label, unicode):
* label = label.encode('utf8')
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next) # <<<<<<<<<<<<<<
* self.lattice[0][index].push_back(arc[0])
* del arc
*/
- __pyx_t_11 = PyBytes_AsString(__pyx_v_label); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cost); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = PyBytes_AsString(__pyx_v_label); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cost); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_arc = new LatticeArc(TD::Convert(((char *)__pyx_t_11)), __pyx_t_12, __pyx_t_13);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":45
* label = label.encode('utf8')
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0]) # <<<<<<<<<<<<<<
@@ -13264,7 +13452,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
*/
((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":44
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":46
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
* del arc # <<<<<<<<<<<<<<
@@ -13295,17 +13483,17 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
}
/* Python wrapper */
-static Py_ssize_t __pyx_pw_5_cdec_7Lattice_9__len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pw_5_cdec_7Lattice_9__len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_pw_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pw_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_7Lattice_8__len__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_10__len__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":46
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":48
* del arc
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -13313,12 +13501,12 @@ static Py_ssize_t __pyx_pw_5_cdec_7Lattice_9__len__(PyObject *__pyx_v_self) {
*
*/
-static Py_ssize_t __pyx_pf_5_cdec_7Lattice_8__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_5_cdec_7Lattice_10__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":47
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":49
*
* def __len__(self):
* return self.lattice.size() # <<<<<<<<<<<<<<
@@ -13335,17 +13523,17 @@ static Py_ssize_t __pyx_pf_5_cdec_7Lattice_8__len__(struct __pyx_obj_5_cdec_Latt
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_7Lattice_11__str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5_cdec_7Lattice_11__str__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_7Lattice_10__str__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_12__str__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":49
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":51
* return self.lattice.size()
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -13353,7 +13541,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_11__str__(PyObject *__pyx_v_self) {
*
*/
-static PyObject *__pyx_pf_5_cdec_7Lattice_10__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
+static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -13363,22 +13551,22 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_10__str__(struct __pyx_obj_5_cdec_Latt
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":50
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
*
* def __str__(self):
* return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) # <<<<<<<<<<<<<<
*
- * def __iter__(self):
+ * def __unicode__(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -13397,28 +13585,101 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_10__str__(struct __pyx_obj_5_cdec_Latt
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_7Lattice_13__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5_cdec_7Lattice_13__iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_7Lattice_12__iter__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
+ __Pyx_RefNannySetupContext("__unicode__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_14__unicode__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":54
* return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
*
+ * def __unicode__(self): # <<<<<<<<<<<<<<
+ * return unicode(str(self), 'utf8')
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__unicode__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":55
+ *
+ * def __unicode__(self):
+ * return unicode(str(self), 'utf8') # <<<<<<<<<<<<<<
+ *
+ * def __iter__(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__utf8));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_cdec.Lattice.__unicode__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_16__iter__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":57
+ * return unicode(str(self), 'utf8')
+ *
* def __iter__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(len(self)):
*/
-static PyObject *__pyx_pf_5_cdec_7Lattice_12__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
+static PyObject *__pyx_pf_5_cdec_7Lattice_16__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13436,7 +13697,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__iter__(struct __pyx_obj_5_cdec_Lat
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_14generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_18generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -13454,7 +13715,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__iter__(struct __pyx_obj_5_cdec_Lat
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -13471,27 +13732,27 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *_
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
* yield self[i]
*
*/
- __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":60
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def todot(self):
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -13505,7 +13766,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *_
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -13521,12 +13782,12 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *_
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_7Lattice_16todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_5_cdec_7Lattice_16todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("todot (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_7Lattice_15todot(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_19todot(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -13544,7 +13805,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CY
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
@@ -13570,7 +13831,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) {
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_5todot_2generator20, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_5todot_2generator20, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -13619,86 +13880,86 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
* def todot(self):
* def lines():
* yield 'digraph lattice {' # <<<<<<<<<<<<<<
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
- __pyx_r = ((PyObject *)__pyx_kp_s_27);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
+ __pyx_r = ((PyObject *)__pyx_kp_s_28);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
__pyx_L4_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":65
* def lines():
* yield 'digraph lattice {'
* yield 'rankdir = LR;' # <<<<<<<<<<<<<<
* yield 'node [shape=circle];'
* for i in range(len(self)):
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
- __pyx_r = ((PyObject *)__pyx_kp_s_28);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
+ __pyx_r = ((PyObject *)__pyx_kp_s_29);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 2;
return __pyx_r;
__pyx_L5_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":66
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
* yield 'node [shape=circle];' # <<<<<<<<<<<<<<
* for i in range(len(self)):
* for label, weight, delta in self[i]:
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
- __pyx_r = ((PyObject *)__pyx_kp_s_29);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
+ __pyx_r = ((PyObject *)__pyx_kp_s_30);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 3;
return __pyx_r;
__pyx_L6_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":62
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
* for i in range(len(self)): # <<<<<<<<<<<<<<
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
*/
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
__pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self);
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -13709,21 +13970,21 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_3);
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -13735,20 +13996,20 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_cur_scope->__pyx_v_i = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":68
* yield 'node [shape=circle];'
* for i in range(len(self)):
* for label, weight, delta in self[i]: # <<<<<<<<<<<<<<
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
*/
- __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
- __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
}
@@ -13759,21 +14020,21 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else {
__pyx_t_1 = __pyx_t_7(__pyx_t_5);
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -13789,7 +14050,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -13805,15 +14066,15 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_10);
#else
- __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
@@ -13823,7 +14084,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__Pyx_GOTREF(__pyx_t_9);
index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L12_unpacking_done;
@@ -13831,7 +14092,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L12_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_label);
@@ -13850,21 +14111,21 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_cur_scope->__pyx_v_delta = __pyx_t_10;
__pyx_t_10 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":69
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
*/
- __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_i, __pyx_cur_scope->__pyx_v_delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_i, __pyx_cur_scope->__pyx_v_delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_label, __pyx_n_s__replace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_label, __pyx_n_s__replace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_i);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_cur_scope->__pyx_v_i);
@@ -13875,7 +14136,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_1 = 0;
__pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_9));
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__pyx_r = ((PyObject *)__pyx_t_9);
@@ -13904,13 +14165,13 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__Pyx_XGOTREF(__pyx_t_5);
__pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
__pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":70
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self) # <<<<<<<<<<<<<<
@@ -13919,11 +14180,11 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
*/
__pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self);
__Pyx_INCREF(__pyx_t_3);
- __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = ((PyObject *)__pyx_t_5);
@@ -13934,23 +14195,24 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_generator->resume_label = 5;
return __pyx_r;
__pyx_L14_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":71
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
* yield '}' # <<<<<<<<<<<<<<
* return '\n'.join(lines()).encode('utf8')
+ *
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
- __pyx_r = ((PyObject *)__pyx_kp_s_35);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_36));
+ __pyx_r = ((PyObject *)__pyx_kp_s_36);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 6;
return __pyx_r;
__pyx_L15_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -13970,7 +14232,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
return NULL;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":57
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":62
* yield self[i]
*
* def todot(self): # <<<<<<<<<<<<<<
@@ -13978,7 +14240,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
* yield 'digraph lattice {'
*/
-static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
+static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *__pyx_cur_scope;
PyObject *__pyx_v_lines = 0;
PyObject *__pyx_r = NULL;
@@ -14000,41 +14262,43 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattic
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5_cdec_7Lattice_5todot_1lines, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s___cdec, ((PyObject *)__pyx_k_codeobj_37)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5_cdec_7Lattice_5todot_1lines, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s___cdec, ((PyObject *)__pyx_k_codeobj_38)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_lines = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":72
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
+ *
+ * def as_hypergraph(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_40), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_v_lines, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_v_lines, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -14057,6 +14321,113 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattic
return __pyx_r;
}
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("as_hypergraph (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_7Lattice_21as_hypergraph(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":74
+ * return '\n'.join(lines()).encode('utf8')
+ *
+ * def as_hypergraph(self): # <<<<<<<<<<<<<<
+ * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
+ * result.hg = new hypergraph.Hypergraph()
+ */
+
+static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
+ struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_result = 0;
+ PyObject *__pyx_v_plf = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ char *__pyx_t_3;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("as_hypergraph", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":75
+ *
+ * def as_hypergraph(self):
+ * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) # <<<<<<<<<<<<<<
+ * result.hg = new hypergraph.Hypergraph()
+ * cdef bytes plf = str(self)
+ */
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_Hypergraph)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_Hypergraph)))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_result = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":76
+ * def as_hypergraph(self):
+ * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
+ * result.hg = new hypergraph.Hypergraph() # <<<<<<<<<<<<<<
+ * cdef bytes plf = str(self)
+ * hypergraph.ReadFromPLF(string(plf), result.hg)
+ */
+ __pyx_v_result->hg = new Hypergraph();
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":77
+ * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
+ * result.hg = new hypergraph.Hypergraph()
+ * cdef bytes plf = str(self) # <<<<<<<<<<<<<<
+ * hypergraph.ReadFromPLF(string(plf), result.hg)
+ * return result
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_plf = ((PyObject*)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":78
+ * result.hg = new hypergraph.Hypergraph()
+ * cdef bytes plf = str(self)
+ * hypergraph.ReadFromPLF(string(plf), result.hg) # <<<<<<<<<<<<<<
+ * return result
+ */
+ __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_plf)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ HypergraphIO::ReadFromPLF(std::string(__pyx_t_3), __pyx_v_result->hg);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":79
+ * cdef bytes plf = str(self)
+ * hypergraph.ReadFromPLF(string(plf), result.hg)
+ * return result # <<<<<<<<<<<<<<
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_result));
+ __pyx_r = ((PyObject *)__pyx_v_result);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_cdec.Lattice.as_hypergraph", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_result);
+ __Pyx_XDECREF(__pyx_v_plf);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":3
* cimport mteval
*
@@ -14842,7 +15213,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj
* return self.stats[0][index]
*
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -15287,7 +15658,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
*/
- __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -15969,7 +16340,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj
* del self.name
*
* def __call__(self, refs): # <<<<<<<<<<<<<<
- * if isinstance(refs, unicode) or isinstance(refs, str):
+ * if isinstance(refs, basestring):
* refs = [refs]
*/
@@ -15982,12 +16353,10 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
- int __pyx_t_3;
- int __pyx_t_4;
- Py_ssize_t __pyx_t_5;
- PyObject *(*__pyx_t_6)(PyObject *);
- PyObject *__pyx_t_7 = NULL;
- PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_3;
+ PyObject *(*__pyx_t_4)(PyObject *);
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -15997,28 +16366,19 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":130
*
* def __call__(self, refs):
- * if isinstance(refs, unicode) or isinstance(refs, str): # <<<<<<<<<<<<<<
+ * if isinstance(refs, basestring): # <<<<<<<<<<<<<<
* refs = [refs]
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
*/
- __pyx_t_1 = ((PyObject *)((PyObject*)(&PyUnicode_Type)));
+ __pyx_t_1 = __pyx_builtin_basestring;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_refs, __pyx_t_1);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_refs, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (!__pyx_t_2) {
- __pyx_t_1 = ((PyObject *)((PyObject*)(&PyString_Type)));
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_refs, __pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = __pyx_t_3;
- } else {
- __pyx_t_4 = __pyx_t_2;
- }
- if (__pyx_t_4) {
+ if (__pyx_t_2) {
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":131
* def __call__(self, refs):
- * if isinstance(refs, unicode) or isinstance(refs, str):
+ * if isinstance(refs, basestring):
* refs = [refs] # <<<<<<<<<<<<<<
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
* cdef vector[WordID]* refv
@@ -16036,7 +16396,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__pyx_L3:;
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":132
- * if isinstance(refs, unicode) or isinstance(refs, str):
+ * if isinstance(refs, basestring):
* refs = [refs]
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<<
* cdef vector[WordID]* refv
@@ -16052,42 +16412,42 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
* ConvertSentence(string(as_str(ref.strip())), refv)
*/
if (PyList_CheckExact(__pyx_v_refs) || PyTuple_CheckExact(__pyx_v_refs)) {
- __pyx_t_1 = __pyx_v_refs; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
- __pyx_t_6 = NULL;
+ __pyx_t_1 = __pyx_v_refs; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
+ __pyx_t_4 = NULL;
} else {
- __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
for (;;) {
- if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
+ __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
- } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#endif
} else {
- __pyx_t_7 = __pyx_t_6(__pyx_t_1);
- if (unlikely(!__pyx_t_7)) {
+ __pyx_t_5 = __pyx_t_4(__pyx_t_1);
+ if (unlikely(!__pyx_t_5)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_5);
}
__Pyx_XDECREF(__pyx_v_ref);
- __pyx_v_ref = __pyx_t_7;
- __pyx_t_7 = 0;
+ __pyx_v_ref = __pyx_t_5;
+ __pyx_t_5 = 0;
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":135
* cdef vector[WordID]* refv
@@ -16105,13 +16465,13 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
* refsv.push_back(refv[0])
* del refv
*/
- __pyx_t_7 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- TD::ConvertSentence(std::string(__pyx_f_5_cdec_as_str(__pyx_t_8, NULL)), __pyx_v_refv);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_5 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__strip); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ TD::ConvertSentence(std::string(__pyx_f_5_cdec_as_str(__pyx_t_6, NULL)), __pyx_v_refv);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":137
* refv = new vector[WordID]()
@@ -16188,8 +16548,8 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_7);
- __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("_cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -17253,7 +17613,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_info);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_info);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_info);
- __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_7));
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -17649,7 +18009,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_Generato
__Pyx_GIVEREF(__pyx_t_3);
__pyx_cur_scope->__pyx_v_kv = __pyx_t_3;
__pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_r = ((PyObject *)__pyx_t_3);
__pyx_t_3 = 0;
@@ -17741,7 +18101,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
*/
__pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_formalism = __pyx_t_3;
@@ -17806,7 +18166,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
*/
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__InvalidConfig); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), __pyx_v_formalism); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), __pyx_v_formalism); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
@@ -17831,7 +18191,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
* cdef istringstream* config_stream = new istringstream(config_str)
* self.dec = new decoder.Decoder(config_stream)
*/
- __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_40), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = __pyx_pf_5_cdec_7Decoder_9__cinit___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
@@ -18246,7 +18606,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
*
* property formalism:
*/
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -18495,7 +18855,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
@@ -18671,7 +19031,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
}
/*finally:*/ {
if (__pyx_t_3) {
- __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_52, NULL);
+ __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_53, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
@@ -18724,7 +19084,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
*
* def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
* cdef bytes input_str
- * if isinstance(sentence, unicode) or isinstance(sentence, str):
+ * if isinstance(sentence, basestring):
*/
values[1] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
@@ -18782,10 +19142,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
- int __pyx_t_3;
- int __pyx_t_4;
- PyObject *__pyx_t_5 = NULL;
- char *__pyx_t_6;
+ PyObject *__pyx_t_3 = NULL;
+ char *__pyx_t_4;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -18794,47 +19152,38 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
/* "_cdec.pyx":99
* def translate(self, sentence, grammar=None):
* cdef bytes input_str
- * if isinstance(sentence, unicode) or isinstance(sentence, str): # <<<<<<<<<<<<<<
+ * if isinstance(sentence, basestring): # <<<<<<<<<<<<<<
* input_str = as_str(sentence.strip())
* elif isinstance(sentence, Lattice):
*/
- __pyx_t_1 = ((PyObject *)((PyObject*)(&PyUnicode_Type)));
+ __pyx_t_1 = __pyx_builtin_basestring;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, __pyx_t_1);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_sentence, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (!__pyx_t_2) {
- __pyx_t_1 = ((PyObject *)((PyObject*)(&PyString_Type)));
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_sentence, __pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = __pyx_t_3;
- } else {
- __pyx_t_4 = __pyx_t_2;
- }
- if (__pyx_t_4) {
+ if (__pyx_t_2) {
/* "_cdec.pyx":100
* cdef bytes input_str
- * if isinstance(sentence, unicode) or isinstance(sentence, str):
+ * if isinstance(sentence, basestring):
* input_str = as_str(sentence.strip()) # <<<<<<<<<<<<<<
* elif isinstance(sentence, Lattice):
* input_str = str(sentence) # PLF format
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyBytes_FromString(__pyx_f_5_cdec_as_str(__pyx_t_5, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_input_str = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L3;
}
/* "_cdec.pyx":101
- * if isinstance(sentence, unicode) or isinstance(sentence, str):
+ * if isinstance(sentence, basestring):
* input_str = as_str(sentence.strip())
* elif isinstance(sentence, Lattice): # <<<<<<<<<<<<<<
* input_str = str(sentence) # PLF format
@@ -18842,9 +19191,9 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
*/
__pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice));
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_sentence, __pyx_t_1);
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_4) {
+ if (__pyx_t_2) {
/* "_cdec.pyx":102
* input_str = as_str(sentence.strip())
@@ -18858,12 +19207,12 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
__Pyx_INCREF(__pyx_v_sentence);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sentence);
__Pyx_GIVEREF(__pyx_v_sentence);
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_input_str = ((PyObject*)__pyx_t_5);
- __pyx_t_5 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_input_str = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
goto __pyx_L3;
}
/*else*/ {
@@ -18873,20 +19222,20 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence)) # <<<<<<<<<<<<<<
* if grammar:
- * if isinstance(grammar, str) or isinstance(grammar, unicode):
+ * if isinstance(grammar, basestring):
*/
- __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -18895,37 +19244,28 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar: # <<<<<<<<<<<<<<
- * if isinstance(grammar, str) or isinstance(grammar, unicode):
+ * if isinstance(grammar, basestring):
* self.dec.AddSupplementalGrammarFromString(string(as_str(grammar)))
*/
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_4) {
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_2) {
/* "_cdec.pyx":106
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar:
- * if isinstance(grammar, str) or isinstance(grammar, unicode): # <<<<<<<<<<<<<<
+ * if isinstance(grammar, basestring): # <<<<<<<<<<<<<<
* self.dec.AddSupplementalGrammarFromString(string(as_str(grammar)))
* else:
*/
- __pyx_t_5 = ((PyObject *)((PyObject*)(&PyString_Type)));
- __Pyx_INCREF(__pyx_t_5);
- __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_grammar, __pyx_t_5);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (!__pyx_t_4) {
- __pyx_t_5 = ((PyObject *)((PyObject*)(&PyUnicode_Type)));
- __Pyx_INCREF(__pyx_t_5);
- __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_grammar, __pyx_t_5);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_3 = __pyx_t_2;
- } else {
- __pyx_t_3 = __pyx_t_4;
- }
- if (__pyx_t_3) {
+ __pyx_t_3 = __pyx_builtin_basestring;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_grammar, __pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_2) {
/* "_cdec.pyx":107
* if grammar:
- * if isinstance(grammar, str) or isinstance(grammar, unicode):
+ * if isinstance(grammar, basestring):
* self.dec.AddSupplementalGrammarFromString(string(as_str(grammar))) # <<<<<<<<<<<<<<
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
@@ -18942,14 +19282,14 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(string(input_str), &observer)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_grammar);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_grammar);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_grammar);
__Pyx_GIVEREF(__pyx_v_grammar);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_5_cdec_TextGrammar *)__pyx_t_1)->__pyx_base.grammar[0]));
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
@@ -18974,8 +19314,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
* if observer.hypergraph == NULL:
* raise ParseFailed()
*/
- __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_input_str)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_self->dec->Decode(std::string(__pyx_t_6), (&__pyx_v_observer));
+ __pyx_t_4 = PyBytes_AsString(((PyObject *)__pyx_v_input_str)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->dec->Decode(std::string(__pyx_t_4), (&__pyx_v_observer));
/* "_cdec.pyx":112
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
@@ -18984,8 +19324,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph()
*/
- __pyx_t_3 = (__pyx_v_observer.hypergraph == NULL);
- if (__pyx_t_3) {
+ __pyx_t_2 = (__pyx_v_observer.hypergraph == NULL);
+ if (__pyx_t_2) {
/* "_cdec.pyx":113
* self.dec.Decode(string(input_str), &observer)
@@ -18996,11 +19336,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
@@ -19013,10 +19353,10 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg
*/
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_5);
- __pyx_t_5 = 0;
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_3);
+ __pyx_t_3 = 0;
/* "_cdec.pyx":115
* raise ParseFailed()
@@ -19040,7 +19380,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -20704,8 +21044,9 @@ static PyMethodDef __pyx_methods_5_cdec_Hypergraph[] = {
{__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_26intersect, METH_O, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_28prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_30lattice, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_32reweight, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_34inside_outside, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("plf"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_32plf, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_34reweight, METH_O, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_36inside_outside, METH_NOARGS, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
@@ -21303,10 +21644,10 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphNode = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Lattice(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_Lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
- if (__pyx_pw_5_cdec_7Lattice_1__cinit__(o, a, k) < 0) {
+ if (__pyx_pw_5_cdec_7Lattice_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) {
Py_DECREF(o); o = 0;
}
return o;
@@ -21317,7 +21658,7 @@ static void __pyx_tp_dealloc_5_cdec_Lattice(PyObject *o) {
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_5_cdec_7Lattice_3__dealloc__(o);
+ __pyx_pw_5_cdec_7Lattice_5__dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
@@ -21334,7 +21675,7 @@ static PyObject *__pyx_sq_item_5_cdec_Lattice(PyObject *o, Py_ssize_t i) {
static int __pyx_mp_ass_subscript_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) {
if (v) {
- return __pyx_pw_5_cdec_7Lattice_7__setitem__(o, i, v);
+ return __pyx_pw_5_cdec_7Lattice_9__setitem__(o, i, v);
}
else {
PyErr_Format(PyExc_NotImplementedError,
@@ -21344,7 +21685,9 @@ static int __pyx_mp_ass_subscript_5_cdec_Lattice(PyObject *o, PyObject *i, PyObj
}
static PyMethodDef __pyx_methods_5_cdec_Lattice[] = {
- {__Pyx_NAMESTR("todot"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_16todot, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_15__unicode__, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("todot"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_20todot, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("as_hypergraph"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_22as_hypergraph, METH_NOARGS, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
@@ -21407,7 +21750,7 @@ static PyNumberMethods __pyx_tp_as_number_Lattice = {
};
static PySequenceMethods __pyx_tp_as_sequence_Lattice = {
- __pyx_pw_5_cdec_7Lattice_9__len__, /*sq_length*/
+ __pyx_pw_5_cdec_7Lattice_11__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
__pyx_sq_item_5_cdec_Lattice, /*sq_item*/
@@ -21420,8 +21763,8 @@ static PySequenceMethods __pyx_tp_as_sequence_Lattice = {
};
static PyMappingMethods __pyx_tp_as_mapping_Lattice = {
- __pyx_pw_5_cdec_7Lattice_9__len__, /*mp_length*/
- __pyx_pw_5_cdec_7Lattice_5__getitem__, /*mp_subscript*/
+ __pyx_pw_5_cdec_7Lattice_11__len__, /*mp_length*/
+ __pyx_pw_5_cdec_7Lattice_7__getitem__, /*mp_subscript*/
__pyx_mp_ass_subscript_5_cdec_Lattice, /*mp_ass_subscript*/
};
@@ -21466,7 +21809,7 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = {
&__pyx_tp_as_mapping_Lattice, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_5_cdec_7Lattice_11__str__, /*tp_str*/
+ __pyx_pw_5_cdec_7Lattice_13__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_Lattice, /*tp_as_buffer*/
@@ -21476,7 +21819,7 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = {
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_5_cdec_7Lattice_13__iter__, /*tp_iter*/
+ __pyx_pw_5_cdec_7Lattice_17__iter__, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_5_cdec_Lattice, /*tp_methods*/
0, /*tp_members*/
@@ -21486,7 +21829,7 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_5_cdec_7Lattice_3__init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_5_cdec_Lattice, /*tp_new*/
0, /*tp_free*/
@@ -28074,36 +28417,37 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
{&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
{&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
- {&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1},
- {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
+ {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
+ {&__pyx_n_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 1},
{&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
- {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
- {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
+ {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
+ {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
{&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
- {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
+ {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
{&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
{&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
{&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
{&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
{&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
{&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
- {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
+ {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
{&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
- {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
+ {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
{&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
{&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
- {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
- {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
- {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
+ {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
+ {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
+ {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
{&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
- {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
+ {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
{&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
{&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
- {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
- {&__pyx_n_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 1},
+ {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
+ {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
{&__pyx_n_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 1},
- {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
- {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0},
+ {&__pyx_n_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 1},
+ {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
+ {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
{&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
{&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
{&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
@@ -28116,7 +28460,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
{&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1},
{&__pyx_n_s__ParseFailed, __pyx_k__ParseFailed, sizeof(__pyx_k__ParseFailed), 0, 0, 1, 1},
- {&__pyx_n_s__PhraseModel_, __pyx_k__PhraseModel_, sizeof(__pyx_k__PhraseModel_), 0, 0, 1, 1},
{&__pyx_n_s__TER, __pyx_k__TER, sizeof(__pyx_k__TER), 0, 0, 1, 1},
{&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
@@ -28132,6 +28475,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s___phrase, __pyx_k___phrase, sizeof(__pyx_k___phrase), 0, 0, 1, 1},
{&__pyx_n_s___sa, __pyx_k___sa, sizeof(__pyx_k___sa), 0, 0, 1, 1},
{&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
+ {&__pyx_n_s__alignments, __pyx_k__alignments, sizeof(__pyx_k__alignments), 0, 0, 1, 1},
+ {&__pyx_n_s__basestring, __pyx_k__basestring, sizeof(__pyx_k__basestring), 0, 0, 1, 1},
{&__pyx_n_s__beam_alpha, __pyx_k__beam_alpha, sizeof(__pyx_k__beam_alpha), 0, 0, 1, 1},
{&__pyx_n_s__cat, __pyx_k__cat, sizeof(__pyx_k__cat), 0, 0, 1, 1},
{&__pyx_n_s__config, __pyx_k__config, sizeof(__pyx_k__config), 0, 0, 1, 1},
@@ -28204,11 +28549,12 @@ static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_NotImplemented = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_super = __Pyx_GetName(__pyx_b, __pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_eval = __Pyx_GetName(__pyx_b, __pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_super = __Pyx_GetName(__pyx_b, __pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_basestring = __Pyx_GetName(__pyx_b, __pyx_n_s__basestring); if (!__pyx_builtin_basestring) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_eval = __Pyx_GetName(__pyx_b, __pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
@@ -28261,153 +28607,155 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
- /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":212
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":209
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
* _g.AddRule((<TRule> trule).rule[0])
*/
- __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_14);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":204
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":214
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
*
* cdef class HypergraphNode:
*/
- __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_18);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
- PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_17));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
+ __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_19);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
+ PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":241
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":251
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_20);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
- PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
+ __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_21);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
+ PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":16
* else:
* if isinstance(inp, unicode):
* inp = inp.encode('utf8') # <<<<<<<<<<<<<<
* if not isinstance(inp, str):
- * raise TypeError('Cannot create lattice from %s' % type(inp))
+ * raise TypeError('cannot create lattice from %s' % type(inp))
*/
- __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_21);
+ __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_22);
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
*/
- __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_24);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
- PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
+ __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_25);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
+ PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_24));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
*/
- __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_25);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
- PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_23));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
+ __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_26);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
+ PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_24));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode):
* label = label.encode('utf8') # <<<<<<<<<<<<<<
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
*/
- __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_26);
+ __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_27);
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":69
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
*/
- __pyx_k_tuple_33 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_33);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
- PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_31));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
+ __pyx_k_tuple_34 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_34);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
- PyTuple_SET_ITEM(__pyx_k_tuple_33, 1, ((PyObject *)__pyx_kp_s_32));
+ PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_kp_s_32));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
+ PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, ((PyObject *)__pyx_kp_s_33));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_33));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
- __pyx_k_tuple_36 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_36);
+ __pyx_k_tuple_37 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_37);
__Pyx_INCREF(((PyObject *)__pyx_n_s__i));
- PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_n_s__i));
+ PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_n_s__i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__label));
- PyTuple_SET_ITEM(__pyx_k_tuple_36, 1, ((PyObject *)__pyx_n_s__label));
+ PyTuple_SET_ITEM(__pyx_k_tuple_37, 1, ((PyObject *)__pyx_n_s__label));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__label));
__Pyx_INCREF(((PyObject *)__pyx_n_s__weight));
- PyTuple_SET_ITEM(__pyx_k_tuple_36, 2, ((PyObject *)__pyx_n_s__weight));
+ PyTuple_SET_ITEM(__pyx_k_tuple_37, 2, ((PyObject *)__pyx_n_s__weight));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__weight));
__Pyx_INCREF(((PyObject *)__pyx_n_s__delta));
- PyTuple_SET_ITEM(__pyx_k_tuple_36, 3, ((PyObject *)__pyx_n_s__delta));
+ PyTuple_SET_ITEM(__pyx_k_tuple_37, 3, ((PyObject *)__pyx_n_s__delta));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
- __pyx_k_codeobj_37 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_38, __pyx_n_s__lines, 58, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_37)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
+ __pyx_k_codeobj_38 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_39, __pyx_n_s__lines, 63, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_38)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":72
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
+ *
+ * def as_hypergraph(self):
*/
- __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_40);
+ __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_41);
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":50
* def __getitem__(self, int index):
@@ -28416,12 +28764,12 @@ static int __Pyx_InitCachedConstants(void) {
* return self.stats[0][index]
*
*/
- __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_42);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
- PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_41));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
+ __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_43);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
+ PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_s_42));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":84
* def __getitem__(self,int k):
@@ -28430,12 +28778,12 @@ static int __Pyx_InitCachedConstants(void) {
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
*/
- __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_44);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
- PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_43));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
+ __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_45);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_44));
+ PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_s_44));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_44));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
/* "_cdec.pyx":53
* """
@@ -28444,15 +28792,15 @@ static int __Pyx_InitCachedConstants(void) {
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
* 'csplit', 'tagger', 'lexalign'):
*/
- __pyx_k_tuple_47 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_47);
+ __pyx_k_tuple_48 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_48);
__Pyx_INCREF(((PyObject *)__pyx_n_s__formalism));
- PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__formalism));
+ PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, ((PyObject *)__pyx_n_s__formalism));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__formalism));
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_k_tuple_47, 1, Py_None);
+ PyTuple_SET_ITEM(__pyx_k_tuple_48, 1, Py_None);
__Pyx_GIVEREF(Py_None);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));
/* "_cdec.pyx":93
* with open(weights) as fp:
@@ -28461,12 +28809,12 @@ static int __Pyx_InitCachedConstants(void) {
* fname, value = line.split()
* self.weights[fname.strip()] = float(value)
*/
- __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_51);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
- PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_50));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
+ __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_52);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
+ PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_51));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
/* "_cdec.pyx":91
*
@@ -28475,18 +28823,18 @@ static int __Pyx_InitCachedConstants(void) {
* for line in fp:
* if line.strip().startswith('#'): continue
*/
- __pyx_k_tuple_52 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_52);
+ __pyx_k_tuple_53 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_53);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, Py_None);
+ PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_k_tuple_52, 1, Py_None);
+ PyTuple_SET_ITEM(__pyx_k_tuple_53, 1, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_k_tuple_52, 2, Py_None);
+ PyTuple_SET_ITEM(__pyx_k_tuple_53, 2, Py_None);
__Pyx_GIVEREF(Py_None);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
@@ -28495,19 +28843,19 @@ static int __Pyx_InitCachedConstants(void) {
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
*/
- __pyx_k_tuple_56 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_56);
+ __pyx_k_tuple_57 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_57);
__Pyx_INCREF(((PyObject *)__pyx_n_s__phrase));
- PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_n_s__phrase));
+ PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_n_s__phrase));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__phrase));
__Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr));
- PyTuple_SET_ITEM(__pyx_k_tuple_56, 1, ((PyObject *)__pyx_n_s__genexpr));
+ PyTuple_SET_ITEM(__pyx_k_tuple_57, 1, ((PyObject *)__pyx_n_s__genexpr));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr));
__Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr));
- PyTuple_SET_ITEM(__pyx_k_tuple_56, 2, ((PyObject *)__pyx_n_s__genexpr));
+ PyTuple_SET_ITEM(__pyx_k_tuple_57, 2, ((PyObject *)__pyx_n_s__genexpr));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
- __pyx_k_codeobj_57 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_58, __pyx_n_s___phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
+ __pyx_k_codeobj_58 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_59, __pyx_n_s___phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":189
* return []
@@ -28516,12 +28864,12 @@ static int __Pyx_InitCachedConstants(void) {
* TER = Scorer('TER')
* CER = Scorer('CER')
*/
- __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_59);
+ __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_60);
__Pyx_INCREF(((PyObject *)__pyx_n_s__IBM_BLEU));
- PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_n_s__IBM_BLEU));
+ PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__IBM_BLEU));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__IBM_BLEU));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":190
*
@@ -28529,24 +28877,24 @@ static int __Pyx_InitCachedConstants(void) {
* TER = Scorer('TER') # <<<<<<<<<<<<<<
* CER = Scorer('CER')
*/
- __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_60);
+ __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_61);
__Pyx_INCREF(((PyObject *)__pyx_n_s__TER));
- PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__TER));
+ PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_n_s__TER));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__TER));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":191
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_61);
+ __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_62);
__Pyx_INCREF(((PyObject *)__pyx_n_s__CER));
- PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_n_s__CER));
+ PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_n_s__CER));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__CER));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
/* "_cdec.pyx":28
* class ParseFailed(Exception): pass
@@ -28555,13 +28903,13 @@ static int __Pyx_InitCachedConstants(void) {
* SetSilent(yn)
*
*/
- __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_62);
+ __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_63);
__Pyx_INCREF(((PyObject *)__pyx_n_s__yn));
- PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_n_s__yn));
+ PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_n_s__yn));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__yn));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
- __pyx_k_codeobj_63 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_64, __pyx_n_s__set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
+ __pyx_k_codeobj_64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "_cdec.pyx":31
* SetSilent(yn)
@@ -28570,25 +28918,25 @@ static int __Pyx_InitCachedConstants(void) {
* for key, value in config.items():
* if isinstance(value, dict):
*/
- __pyx_k_tuple_65 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_65);
+ __pyx_k_tuple_66 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_66);
__Pyx_INCREF(((PyObject *)__pyx_n_s__config));
- PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_n_s__config));
+ PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_n_s__config));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__config));
__Pyx_INCREF(((PyObject *)__pyx_n_s__key));
- PyTuple_SET_ITEM(__pyx_k_tuple_65, 1, ((PyObject *)__pyx_n_s__key));
+ PyTuple_SET_ITEM(__pyx_k_tuple_66, 1, ((PyObject *)__pyx_n_s__key));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
__Pyx_INCREF(((PyObject *)__pyx_n_s__value));
- PyTuple_SET_ITEM(__pyx_k_tuple_65, 2, ((PyObject *)__pyx_n_s__value));
+ PyTuple_SET_ITEM(__pyx_k_tuple_66, 2, ((PyObject *)__pyx_n_s__value));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
__Pyx_INCREF(((PyObject *)__pyx_n_s__name));
- PyTuple_SET_ITEM(__pyx_k_tuple_65, 3, ((PyObject *)__pyx_n_s__name));
+ PyTuple_SET_ITEM(__pyx_k_tuple_66, 3, ((PyObject *)__pyx_n_s__name));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__name));
__Pyx_INCREF(((PyObject *)__pyx_n_s__info));
- PyTuple_SET_ITEM(__pyx_k_tuple_65, 4, ((PyObject *)__pyx_n_s__info));
+ PyTuple_SET_ITEM(__pyx_k_tuple_66, 4, ((PyObject *)__pyx_n_s__info));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__info));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
- __pyx_k_codeobj_66 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_64, __pyx_n_s___make_config, 31, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
+ __pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s___make_config, 31, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -28600,7 +28948,6 @@ static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __pyx_int_65536 = PyInt_FromLong(65536); if (unlikely(!__pyx_int_65536)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
return -1;
@@ -28689,19 +29036,19 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyType_Ready(&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "NTRef", (PyObject *)&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_NTRef = &__pyx_type_5_cdec_NTRef;
- if (PyType_Ready(&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_TRule = &__pyx_type_5_cdec_TRule;
__pyx_type_5_cdec_MRule.tp_base = __pyx_ptype_5_cdec_TRule;
- if (PyType_Ready(&__pyx_type_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_MRule = &__pyx_type_5_cdec_MRule;
- if (PyType_Ready(&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_Grammar = &__pyx_type_5_cdec_Grammar;
__pyx_type_5_cdec_TextGrammar.tp_base = __pyx_ptype_5_cdec_Grammar;
- if (PyType_Ready(&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_TextGrammar = &__pyx_type_5_cdec_TextGrammar;
__pyx_vtabptr_5_cdec_Hypergraph = &__pyx_vtable_5_cdec_Hypergraph;
__pyx_vtable_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_5_cdec_Hypergraph *))__pyx_f_5_cdec_10Hypergraph__rng;
@@ -28711,15 +29058,15 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_ptype_5_cdec_Hypergraph = &__pyx_type_5_cdec_Hypergraph;
__pyx_vtabptr_5_cdec_HypergraphEdge = &__pyx_vtable_5_cdec_HypergraphEdge;
__pyx_vtable_5_cdec_HypergraphEdge.init = (PyObject *(*)(struct __pyx_obj_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int))__pyx_f_5_cdec_14HypergraphEdge_init;
- if (PyType_Ready(&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_HypergraphEdge = &__pyx_type_5_cdec_HypergraphEdge;
__pyx_vtabptr_5_cdec_HypergraphNode = &__pyx_vtable_5_cdec_HypergraphNode;
__pyx_vtable_5_cdec_HypergraphNode.init = (PyObject *(*)(struct __pyx_obj_5_cdec_HypergraphNode *, Hypergraph *, unsigned int))__pyx_f_5_cdec_14HypergraphNode_init;
- if (PyType_Ready(&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_HypergraphNode = &__pyx_type_5_cdec_HypergraphNode;
if (PyType_Ready(&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28753,13 +29100,13 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_ptype_5_cdec___pyx_scope_struct_2__phrase = &__pyx_type_5_cdec___pyx_scope_struct_2__phrase;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_3_genexpr;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_4___get__ = &__pyx_type_5_cdec___pyx_scope_struct_4___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_5___str__ = &__pyx_type_5_cdec___pyx_scope_struct_5___str__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_6_genexpr;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_7___iter__;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_5_cdec___pyx_scope_struct_8_kbest;
@@ -28771,21 +29118,21 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_ptype_5_cdec___pyx_scope_struct_11_sample = &__pyx_type_5_cdec___pyx_scope_struct_11_sample;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = &__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = &__pyx_type_5_cdec___pyx_scope_struct_13___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_14___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_14___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = &__pyx_type_5_cdec___pyx_scope_struct_14___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_15___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_15___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_15___get__ = &__pyx_type_5_cdec___pyx_scope_struct_15___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_5_cdec___pyx_scope_struct_16___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_5_cdec___pyx_scope_struct_17___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_18___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_19_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_19_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_19_todot = &__pyx_type_5_cdec___pyx_scope_struct_19_todot;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_20_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_20_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_20_lines = &__pyx_type_5_cdec___pyx_scope_struct_20_lines;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_21___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_21___iter__;
@@ -28798,9 +29145,14 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_25_genexpr;
/*--- Type import code ---*/
- __pyx_ptype_4cdec_2sa_3_sa_Phrase = __Pyx_ImportType("cdec.sa._sa", "Phrase", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_FloatList = __Pyx_ImportType("cdec.sa._sa", "FloatList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FloatList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_FloatList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_FloatList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_IntList = __Pyx_ImportType("cdec.sa._sa", "IntList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_IntList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_IntList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_IntList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_FeatureVector = __Pyx_ImportType("cdec.sa._sa", "FeatureVector", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FeatureVector)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_Phrase = __Pyx_ImportType("cdec.sa._sa", "Phrase", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Variable import code ---*/
/*--- Function import code ---*/
__pyx_t_1 = __Pyx_ImportModule("cdec.sa._sa"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28820,10 +29172,10 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_n_s_55));
- PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_55));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s_55));
- __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_54), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)__pyx_n_s_56));
+ PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_56));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s_56));
+ __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_55), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n_s___sa, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28848,7 +29200,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
* TER = Scorer('TER')
* CER = Scorer('CER')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLEU, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -28859,7 +29211,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
* TER = Scorer('TER') # <<<<<<<<<<<<<<
* CER = Scorer('CER')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -28869,7 +29221,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;