diff options
author | Paul Baltescu <pauldb89@gmail.com> | 2013-04-24 17:18:10 +0100 |
---|---|---|
committer | Paul Baltescu <pauldb89@gmail.com> | 2013-04-24 17:18:10 +0100 |
commit | ba206aaac1d95e76126443c9e7ccc5941e879849 (patch) | |
tree | 13a918da3f3983fd8e4cb74e7cdc3f5e1fc01cd1 /python/src/_cdec.cpp | |
parent | c2aede0f19b7a5e43581768b8c4fbfae8b92c68c (diff) | |
parent | db960a8bba81df3217660ec5a96d73e0d6baa01b (diff) |
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'python/src/_cdec.cpp')
-rw-r--r-- | python/src/_cdec.cpp | 3015 |
1 files changed, 1545 insertions, 1470 deletions
diff --git a/python/src/_cdec.cpp b/python/src/_cdec.cpp index 38cf04a9..4b950f01 100644 --- a/python/src/_cdec.cpp +++ b/python/src/_cdec.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.1 on Tue Feb 19 16:54:40 2013 */ +/* Generated by Cython 0.18 on Tue Apr 23 18:41:37 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -53,12 +53,15 @@ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) @@ -295,8 +298,6 @@ #define CYTHON_WITHOUT_ASSERTIONS #endif - -/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ @@ -308,8 +309,6 @@ #define CYTHON_INLINE #endif #endif - -/* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -323,24 +322,17 @@ # define CYTHON_UNUSED # endif #endif - typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - -/* Type Conversion Predeclarations */ - #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) - #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); - #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -348,6 +340,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) + #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) @@ -448,7 +441,7 @@ struct __pyx_opt_args_5_cdec_as_str { char *error_msg; }; -/* "/home/pauldb/workspace/cdec/python/src/cdec.sa._sa.pxd":25 +/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":25 * cdef void read_handle(self, FILE* f) * * cdef class FeatureVector: # <<<<<<<<<<<<<< @@ -475,7 +468,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":21 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":21 * return '[%s]' % self.cat * * cdef class NTRef: # <<<<<<<<<<<<<< @@ -488,7 +481,7 @@ struct __pyx_obj_5_cdec_NTRef { }; -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":121 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":121 * return CandidateSet(self) * * cdef class Scorer: # <<<<<<<<<<<<<< @@ -502,7 +495,7 @@ struct __pyx_obj_5_cdec_Scorer { }; -/* "/home/pauldb/workspace/cdec/python/src/cdec.sa._sa.pxd":12 +/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":12 * cdef void read_handle(self, FILE* f) * * cdef class IntList: # <<<<<<<<<<<<<< @@ -519,7 +512,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_IntList { }; -/* "/home/pauldb/workspace/cdec/python/src/cdec.sa._sa.pxd":29 +/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":29 * cdef FloatList values * * cdef class Phrase: # <<<<<<<<<<<<<< @@ -536,7 +529,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Phrase { }; -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":90 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":90 * return candidate * * def __iter__(self): # <<<<<<<<<<<<<< @@ -552,7 +545,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":193 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":193 * super(MRule, self).__init__(lhs, rhs, e, scores, None) * * cdef class Grammar: # <<<<<<<<<<<<<< @@ -565,7 +558,7 @@ struct __pyx_obj_5_cdec_Grammar { }; -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":63 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< @@ -588,7 +581,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":108 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":108 * del hypos * * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<< @@ -606,7 +599,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":161 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":161 * * property edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -622,7 +615,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":5 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< @@ -635,7 +628,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase { }; -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":65 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":65 * return result * * cdef class CandidateSet: # <<<<<<<<<<<<<< @@ -650,7 +643,7 @@ struct __pyx_obj_5_cdec_CandidateSet { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":167 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":167 * * property nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -666,7 +659,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":49 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":49 * return TRule(lhs, f, e, scores, a) * * cdef class TRule: # <<<<<<<<<<<<<< @@ -679,7 +672,7 @@ struct __pyx_obj_5_cdec_TRule { }; -/* "/home/pauldb/workspace/cdec/python/src/cdec.sa._sa.pxd":35 +/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":35 * cdef public int chunklen(self, int k) * * cdef class Rule: # <<<<<<<<<<<<<< @@ -697,7 +690,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Rule { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":177 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":177 * _phrase(self.f), _phrase(self.e), scores) * * cdef class MRule(TRule): # <<<<<<<<<<<<<< @@ -709,7 +702,7 @@ struct __pyx_obj_5_cdec_MRule { }; -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":100 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":100 * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) * * cdef class SegmentEvaluator: # <<<<<<<<<<<<<< @@ -740,7 +733,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr { }; -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":61 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":61 * yield self[i] * * def todot(self): # <<<<<<<<<<<<<< @@ -753,7 +746,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot { }; -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":12 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":12 * return stats * * cdef class Candidate: # <<<<<<<<<<<<<< @@ -767,7 +760,7 @@ struct __pyx_obj_5_cdec_Candidate { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":173 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":173 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -784,7 +777,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":8 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":8 * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) * * cdef class NT: # <<<<<<<<<<<<<< @@ -798,7 +791,7 @@ struct __pyx_obj_5_cdec_NT { }; -/* "/home/pauldb/workspace/cdec/python/src/cdec.sa._sa.pxd":3 +/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":3 * from libc.stdio cimport FILE * * cdef class FloatList: # <<<<<<<<<<<<<< @@ -815,7 +808,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_FloatList { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":196 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":196 * return vector * * cdef class HypergraphEdge: # <<<<<<<<<<<<<< @@ -831,7 +824,7 @@ struct __pyx_obj_5_cdec_HypergraphEdge { }; -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":72 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":72 * self.vector.set_value(fid, value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -848,7 +841,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":256 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":256 * * property in_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -864,7 +857,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":131 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":131 * * property a: * def __get__(self): # <<<<<<<<<<<<<< @@ -881,7 +874,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ { }; -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":56 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":56 * return unicode(str(self), 'utf8') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -911,7 +904,7 @@ struct __pyx_obj_5_cdec_Decoder { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":246 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":246 * raise NotImplemented('comparison not implemented for HypergraphEdge') * * cdef class HypergraphNode: # <<<<<<<<<<<<<< @@ -926,7 +919,7 @@ struct __pyx_obj_5_cdec_HypergraphNode { }; -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":48 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":48 * return sparse * * cdef class SparseVector: # <<<<<<<<<<<<<< @@ -939,7 +932,7 @@ struct __pyx_obj_5_cdec_SparseVector { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":262 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":262 * * property out_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -955,7 +948,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ { }; -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":32 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":32 * self.vector[0][fid] = value * * def __iter__(self): # <<<<<<<<<<<<<< @@ -971,7 +964,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ { }; -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":44 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":44 * return self.stats.size() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -988,7 +981,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ { }; -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":3 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":3 * from cython.operator cimport preincrement as pinc * * cdef class DenseVector: # <<<<<<<<<<<<<< @@ -1002,7 +995,7 @@ struct __pyx_obj_5_cdec_DenseVector { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":199 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":199 * del self.grammar * * def __iter__(self): # <<<<<<<<<<<<<< @@ -1021,7 +1014,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ { }; -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":176 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":176 * out.fields[i] = ss[i] * * cdef class Metric: # <<<<<<<<<<<<<< @@ -1034,7 +1027,7 @@ struct __pyx_obj_5_cdec_Metric { }; -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":26 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":26 * return fmap * * cdef class SufficientStats: # <<<<<<<<<<<<<< @@ -1048,7 +1041,7 @@ struct __pyx_obj_5_cdec_SufficientStats { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":49 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":49 * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') * * def kbest(self, size): # <<<<<<<<<<<<<< @@ -1067,7 +1060,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":81 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":81 * del e_derivations * * def kbest_features(self, size): # <<<<<<<<<<<<<< @@ -1087,7 +1080,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":216 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":216 * * property tail_nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -1103,7 +1096,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":172 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":172 * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) * * def __str__(self): # <<<<<<<<<<<<<< @@ -1116,7 +1109,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":6 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":6 * * def _phrase(phrase): * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< @@ -1133,7 +1126,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":62 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":62 * del derivations * * def kbest_trees(self, size): # <<<<<<<<<<<<<< @@ -1156,7 +1149,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":4 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":4 * cimport kbest * * cdef class Hypergraph: # <<<<<<<<<<<<<< @@ -1171,7 +1164,7 @@ struct __pyx_obj_5_cdec_Hypergraph { }; -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":3 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":3 * cimport lattice * * cdef class Lattice: # <<<<<<<<<<<<<< @@ -1184,7 +1177,7 @@ struct __pyx_obj_5_cdec_Lattice { }; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":97 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":97 * del derivations * * def sample(self, unsigned n): # <<<<<<<<<<<<<< @@ -1225,7 +1218,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config { }; -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":217 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":217 * self.grammar.get().SetGrammarName(name) * * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<< @@ -1238,7 +1231,7 @@ struct __pyx_obj_5_cdec_TextGrammar { -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":4 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":4 * cimport kbest * * cdef class Hypergraph: # <<<<<<<<<<<<<< @@ -1252,7 +1245,7 @@ struct __pyx_vtabstruct_5_cdec_Hypergraph { static struct __pyx_vtabstruct_5_cdec_Hypergraph *__pyx_vtabptr_5_cdec_Hypergraph; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":196 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":196 * return vector * * cdef class HypergraphEdge: # <<<<<<<<<<<<<< @@ -1266,7 +1259,7 @@ struct __pyx_vtabstruct_5_cdec_HypergraphEdge { static struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtabptr_5_cdec_HypergraphEdge; -/* "/home/pauldb/workspace/cdec/python/src/cdec.sa._sa.pxd":12 +/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":12 * cdef void read_handle(self, FILE* f) * * cdef class IntList: # <<<<<<<<<<<<<< @@ -1286,7 +1279,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList { static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtabptr_4cdec_2sa_3_sa_IntList; -/* "/home/pauldb/workspace/cdec/python/src/cdec.sa._sa.pxd":3 +/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":3 * from libc.stdio cimport FILE * * cdef class FloatList: # <<<<<<<<<<<<<< @@ -1302,7 +1295,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList { static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtabptr_4cdec_2sa_3_sa_FloatList; -/* "/home/pauldb/workspace/cdec/python/src/cdec.sa._sa.pxd":29 +/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":29 * cdef FloatList values * * cdef class Phrase: # <<<<<<<<<<<<<< @@ -1317,7 +1310,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; -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":246 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":246 * raise NotImplemented('comparison not implemented for HypergraphEdge') * * cdef class HypergraphNode: # <<<<<<<<<<<<<< @@ -1530,6 +1523,35 @@ static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, i #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*proto*/ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if PY_MAJOR_VERSION >= 3 + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); +#else + if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } else { + PyObject *m; + m = __Pyx_GetAttrString(d, "get"); + if (!m) return NULL; + value = PyObject_CallFunctionObjArgs(m, key, + (default_value == Py_None) ? NULL : default_value, NULL); + Py_DECREF(m); + } +#endif + return value; +} + static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_AsDouble(obj) \ @@ -1547,12 +1569,12 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, - PyObject *modname); /*proto*/ + PyObject *qualname, PyObject *modname); /*proto*/ #ifndef __Pyx_CppExn2PyErr #include <new> @@ -1616,6 +1638,7 @@ typedef struct { PyObject *func_dict; PyObject *func_weakreflist; PyObject *func_name; + PyObject *func_qualname; PyObject *func_doc; PyObject *func_code; PyObject *func_closure; @@ -1626,10 +1649,10 @@ typedef struct { PyObject *(*defaults_getter)(PyObject *); } __pyx_CyFunctionObject; static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \ - __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, - PyMethodDef *ml, int flags, +#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \ + __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, + int flags, PyObject* qualname, PyObject *self, PyObject *module, PyObject* code); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, @@ -2026,20 +2049,21 @@ static char __pyx_k_26[] = "digraph lattice {"; static char __pyx_k_31[] = "\\\""; static char __pyx_k_33[] = "%d [shape=doublecircle]"; static char __pyx_k_34[] = "}"; -static char __pyx_k_37[] = "/home/pauldb/workspace/cdec/python/src/lattice.pxi"; -static char __pyx_k_38[] = "\n"; -static char __pyx_k_40[] = "sufficient stats vector index out of range"; -static char __pyx_k_42[] = "candidate set index out of range"; -static char __pyx_k_44[] = "%s %s"; -static char __pyx_k_45[] = "%s = %s"; +static char __pyx_k_37[] = "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi"; +static char __pyx_k_38[] = "Lattice.todot.<locals>.lines"; +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_47[] = "formalism \"%s\" unknown"; static char __pyx_k_48[] = "cannot initialize weights with %s"; static char __pyx_k_49[] = "#"; static char __pyx_k_52[] = "Cannot translate input type %s"; static char __pyx_k_53[] = "cdec.sa._sa"; static char __pyx_k_54[] = "*"; -static char __pyx_k_57[] = "/home/pauldb/workspace/cdec/python/src/grammar.pxi"; -static char __pyx_k_63[] = "/home/pauldb/workspace/cdec/python/src/_cdec.pyx"; +static char __pyx_k_57[] = "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi"; +static char __pyx_k_65[] = "/usr0/home/cdyer/cdec-merge/python/src/_cdec.pyx"; static char __pyx_k__a[] = "a"; static char __pyx_k__e[] = "e"; static char __pyx_k__f[] = "f"; @@ -2048,12 +2072,12 @@ static char __pyx_k__k[] = "k"; static char __pyx_k__pb[] = "pb"; static char __pyx_k__yn[] = "yn"; static char __pyx_k__CER[] = "CER"; +static char __pyx_k__SSK[] = "SSK"; static char __pyx_k__TER[] = "TER"; static char __pyx_k___sa[] = "_sa"; static char __pyx_k__cat[] = "cat"; static char __pyx_k__dot[] = "dot"; static char __pyx_k__fst[] = "fst"; -static char __pyx_k__get[] = "get"; static char __pyx_k__hyp[] = "hyp"; static char __pyx_k__inp[] = "inp"; static char __pyx_k__key[] = "key"; @@ -2062,6 +2086,7 @@ static char __pyx_k__plf[] = "plf"; static char __pyx_k__ref[] = "ref"; static char __pyx_k__rhs[] = "rhs"; static char __pyx_k__BLEU[] = "BLEU"; +static char __pyx_k__QCRI[] = "QCRI"; static char __pyx_k__eval[] = "eval"; static char __pyx_k__info[] = "info"; static char __pyx_k__join[] = "join"; @@ -2111,6 +2136,7 @@ static char __pyx_k__lexalign[] = "lexalign"; static char __pyx_k__lextrans[] = "lextrans"; static char __pyx_k__sentence[] = "sentence"; static char __pyx_k__Exception[] = "Exception"; +static char __pyx_k__QCRI_BLEU[] = "QCRI_BLEU"; static char __pyx_k__TypeError[] = "TypeError"; static char __pyx_k____class__[] = "__class__"; static char __pyx_k____enter__[] = "__enter__"; @@ -2151,12 +2177,13 @@ static PyObject *__pyx_kp_s_31; static PyObject *__pyx_kp_s_33; static PyObject *__pyx_kp_s_34; static PyObject *__pyx_kp_s_37; -static PyObject *__pyx_kp_s_38; +static PyObject *__pyx_n_s_38; +static PyObject *__pyx_kp_s_39; static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_kp_s_40; -static PyObject *__pyx_kp_s_42; -static PyObject *__pyx_kp_s_44; +static PyObject *__pyx_kp_s_41; +static PyObject *__pyx_kp_s_43; static PyObject *__pyx_kp_s_45; +static PyObject *__pyx_kp_s_46; static PyObject *__pyx_kp_s_47; static PyObject *__pyx_kp_s_48; static PyObject *__pyx_kp_s_49; @@ -2164,7 +2191,7 @@ static PyObject *__pyx_kp_s_52; static PyObject *__pyx_n_s_53; static PyObject *__pyx_n_s_54; static PyObject *__pyx_kp_s_57; -static PyObject *__pyx_kp_s_63; +static PyObject *__pyx_kp_s_65; static PyObject *__pyx_kp_s_7; static PyObject *__pyx_kp_s_8; static PyObject *__pyx_kp_s_9; @@ -2177,6 +2204,9 @@ 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__QCRI; +static PyObject *__pyx_n_s__QCRI_BLEU; +static PyObject *__pyx_n_s__SSK; static PyObject *__pyx_n_s__TER; static PyObject *__pyx_n_s__TypeError; static PyObject *__pyx_n_s__ValueError; @@ -2214,7 +2244,6 @@ static PyObject *__pyx_n_s__formalism; static PyObject *__pyx_n_s__format; static PyObject *__pyx_n_s__fst; static PyObject *__pyx_n_s__genexpr; -static PyObject *__pyx_n_s__get; static PyObject *__pyx_n_s__grammar; static PyObject *__pyx_n_s__hyp; static PyObject *__pyx_n_s__hypergraph; @@ -2270,10 +2299,9 @@ static PyObject *__pyx_k_tuple_24; static PyObject *__pyx_k_tuple_25; static PyObject *__pyx_k_tuple_32; static PyObject *__pyx_k_tuple_35; -static PyObject *__pyx_k_tuple_39; -static PyObject *__pyx_k_tuple_41; -static PyObject *__pyx_k_tuple_43; -static PyObject *__pyx_k_tuple_46; +static PyObject *__pyx_k_tuple_40; +static PyObject *__pyx_k_tuple_42; +static PyObject *__pyx_k_tuple_44; static PyObject *__pyx_k_tuple_50; static PyObject *__pyx_k_tuple_51; static PyObject *__pyx_k_tuple_55; @@ -2281,11 +2309,13 @@ static PyObject *__pyx_k_tuple_58; static PyObject *__pyx_k_tuple_59; static PyObject *__pyx_k_tuple_60; static PyObject *__pyx_k_tuple_61; -static PyObject *__pyx_k_tuple_64; +static PyObject *__pyx_k_tuple_62; +static PyObject *__pyx_k_tuple_63; +static PyObject *__pyx_k_tuple_66; static PyObject *__pyx_k_codeobj_36; static PyObject *__pyx_k_codeobj_56; -static PyObject *__pyx_k_codeobj_62; -static PyObject *__pyx_k_codeobj_65; +static PyObject *__pyx_k_codeobj_64; +static PyObject *__pyx_k_codeobj_67; /* "_cdec.pyx":6 * cimport decoder @@ -2300,8 +2330,8 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ PyObject *__pyx_v_ret = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; @@ -2321,11 +2351,8 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ * ret = data.encode('utf8') * elif isinstance(data, str): */ - __pyx_t_1 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_data, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyUnicode_Check(__pyx_v_data); + if (__pyx_t_1) { /* "_cdec.pyx":9 * cdef bytes ret @@ -2334,11 +2361,11 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ * elif isinstance(data, str): * ret = data */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_ret = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; @@ -2352,11 +2379,8 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ * ret = data * else: */ - __pyx_t_3 = ((PyObject *)((PyObject*)(&PyString_Type))); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_data, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyString_Check(__pyx_v_data); + if (__pyx_t_1) { /* "_cdec.pyx":11 * ret = data.encode('utf8') @@ -2381,17 +2405,17 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ */ __pyx_t_3 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data))); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(__pyx_v_data))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data))); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __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[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -2422,7 +2446,7 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("_cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -2452,7 +2476,7 @@ static int __pyx_pw_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":7 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":7 * cdef bint owned # if True, do not manage memory * * def __init__(self): # <<<<<<<<<<<<<< @@ -2469,17 +2493,22 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":9 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":9 * def __init__(self): * """DenseVector() -> Dense weight/feature vector.""" * self.vector = new vector[weight_t]() # <<<<<<<<<<<<<< * self.owned = False * */ - try {__pyx_t_1 = new std::vector<weight_t>();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_1 = new std::vector<weight_t>(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_self->vector = __pyx_t_1; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":10 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":10 * """DenseVector() -> Dense weight/feature vector.""" * self.vector = new vector[weight_t]() * self.owned = False # <<<<<<<<<<<<<< @@ -2507,7 +2536,7 @@ static void __pyx_pw_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":12 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":12 * self.owned = False * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2520,7 +2549,7 @@ static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_D int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":13 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":13 * * def __dealloc__(self): * if not self.owned: # <<<<<<<<<<<<<< @@ -2530,7 +2559,7 @@ static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_D __pyx_t_1 = (!__pyx_v_self->owned); if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":14 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":14 * def __dealloc__(self): * if not self.owned: * del self.vector # <<<<<<<<<<<<<< @@ -2556,7 +2585,7 @@ static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":16 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":16 * del self.vector * * def __len__(self): # <<<<<<<<<<<<<< @@ -2569,7 +2598,7 @@ static Py_ssize_t __pyx_pf_5_cdec_11DenseVector_4__len__(struct __pyx_obj_5_cdec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":17 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":17 * * def __len__(self): * return self.vector.size() # <<<<<<<<<<<<<< @@ -2606,7 +2635,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":19 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":19 * return self.vector.size() * * def __getitem__(self, char* fname): # <<<<<<<<<<<<<< @@ -2626,7 +2655,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":20 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":20 * * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -2635,7 +2664,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":21 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":21 * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) * if 0 <= fid < self.vector.size(): # <<<<<<<<<<<<<< @@ -2648,7 +2677,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c } if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":22 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":22 * cdef int fid = FDConvert(fname) * if 0 <= fid < self.vector.size(): * return self.vector[0][fid] # <<<<<<<<<<<<<< @@ -2665,7 +2694,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":23 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":23 * if 0 <= fid < self.vector.size(): * return self.vector[0][fid] * raise KeyError(fname) # <<<<<<<<<<<<<< @@ -2724,7 +2753,7 @@ static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":25 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":25 * raise KeyError(fname) * * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<< @@ -2744,7 +2773,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":26 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":26 * * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -2753,7 +2782,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":27 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":27 * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -2779,7 +2808,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":28 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":28 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * if self.vector.size() <= fid: # <<<<<<<<<<<<<< @@ -2789,7 +2818,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De __pyx_t_1 = (__pyx_v_self->vector->size() <= __pyx_v_fid); if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":29 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":29 * if fid < 0: raise KeyError(fname) * if self.vector.size() <= fid: * self.vector.resize(fid + 1) # <<<<<<<<<<<<<< @@ -2801,7 +2830,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De } __pyx_L4:; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":30 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":30 * if self.vector.size() <= fid: * self.vector.resize(fid + 1) * self.vector[0][fid] = value # <<<<<<<<<<<<<< @@ -2834,7 +2863,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":32 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":32 * self.vector[0][fid] = value * * def __iter__(self): # <<<<<<<<<<<<<< @@ -2899,7 +2928,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":34 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":34 * def __iter__(self): * cdef unsigned fid * for fid in range(1, self.vector.size()): # <<<<<<<<<<<<<< @@ -2910,7 +2939,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_fid = __pyx_t_2; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":35 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":35 * cdef unsigned fid * for fid in range(1, self.vector.size()): * yield str(FDConvert(fid).c_str()), self.vector[0][fid] # <<<<<<<<<<<<<< @@ -2983,7 +3012,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":37 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":37 * yield str(FDConvert(fid).c_str()), self.vector[0][fid] * * def dot(self, SparseVector other): # <<<<<<<<<<<<<< @@ -3002,7 +3031,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_Den int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dot", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":39 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":39 * def dot(self, SparseVector other): * """vector.dot(SparseVector other) -> Dot product of the two vectors.""" * return other.dot(self) # <<<<<<<<<<<<<< @@ -3051,7 +3080,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":41 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":41 * return other.dot(self) * * def tosparse(self): # <<<<<<<<<<<<<< @@ -3069,7 +3098,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tosparse", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":43 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":43 * def tosparse(self): * """vector.tosparse() -> Equivalent SparseVector.""" * cdef SparseVector sparse = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -3082,7 +3111,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde __pyx_v_sparse = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":44 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":44 * """vector.tosparse() -> Equivalent SparseVector.""" * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<< @@ -3091,7 +3120,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde */ __pyx_v_sparse->vector = new FastSparseVector<weight_t>(); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":45 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":45 * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) # <<<<<<<<<<<<<< @@ -3100,7 +3129,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde */ Weights::InitSparseVector((__pyx_v_self->vector[0]), __pyx_v_sparse->vector); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":46 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":46 * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) * return sparse # <<<<<<<<<<<<<< @@ -3143,7 +3172,7 @@ static int __pyx_pw_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":51 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":51 * cdef FastSparseVector[weight_t]* vector * * def __init__(self): # <<<<<<<<<<<<<< @@ -3156,7 +3185,7 @@ static int __pyx_pf_5_cdec_12SparseVector___init__(struct __pyx_obj_5_cdec_Spars __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":53 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":53 * def __init__(self): * """SparseVector() -> Sparse feature/weight vector.""" * self.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<< @@ -3179,7 +3208,7 @@ static void __pyx_pw_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self) __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":55 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":55 * self.vector = new FastSparseVector[weight_t]() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3191,7 +3220,7 @@ static void __pyx_pf_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":56 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":56 * * def __dealloc__(self): * del self.vector # <<<<<<<<<<<<<< @@ -3215,7 +3244,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CY return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":58 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":58 * del self.vector * * def copy(self): # <<<<<<<<<<<<<< @@ -3232,7 +3261,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_Sp int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":60 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":60 * def copy(self): * """vector.copy() -> SparseVector copy.""" * return self * 1 # <<<<<<<<<<<<<< @@ -3279,7 +3308,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":62 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":62 * return self * 1 * * def __getitem__(self, char* fname): # <<<<<<<<<<<<<< @@ -3299,7 +3328,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":63 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":63 * * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -3308,7 +3337,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_ */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":64 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":64 * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -3334,7 +3363,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_ } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":65 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":65 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * return self.vector.value(fid) # <<<<<<<<<<<<<< @@ -3386,7 +3415,7 @@ static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, P return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":67 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":67 * return self.vector.value(fid) * * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<< @@ -3406,7 +3435,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":68 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":68 * * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -3415,7 +3444,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":69 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":69 * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -3441,7 +3470,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":70 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":70 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * self.vector.set_value(fid, value) # <<<<<<<<<<<<<< @@ -3474,7 +3503,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":72 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":72 * self.vector.set_value(fid, value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -3539,7 +3568,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":73 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":73 * * def __iter__(self): * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) # <<<<<<<<<<<<<< @@ -3548,7 +3577,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje */ __pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t>::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":75 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":75 * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) * cdef unsigned i * try: # <<<<<<<<<<<<<< @@ -3557,7 +3586,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje */ /*try:*/ { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":76 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":76 * cdef unsigned i * try: * for i in range(self.vector.size()): # <<<<<<<<<<<<<< @@ -3568,7 +3597,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":77 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":77 * try: * for i in range(self.vector.size()): * yield (str(FDConvert(it[0].ptr().first).c_str()), it[0].ptr().second) # <<<<<<<<<<<<<< @@ -3609,7 +3638,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;} - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":78 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":78 * for i in range(self.vector.size()): * yield (str(FDConvert(it[0].ptr().first).c_str()), it[0].ptr().second) * pinc(it[0]) # ++it # <<<<<<<<<<<<<< @@ -3620,7 +3649,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje } } - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":80 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":80 * pinc(it[0]) # ++it * finally: * del it # <<<<<<<<<<<<<< @@ -3682,7 +3711,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":82 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":82 * del it * * def dot(self, other): # <<<<<<<<<<<<<< @@ -3693,28 +3722,25 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, Py static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dot", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":84 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":84 * def dot(self, other): * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors.""" * if isinstance(other, DenseVector): # <<<<<<<<<<<<<< * return self.vector.dot((<DenseVector> other).vector[0]) * elif isinstance(other, SparseVector): */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_DenseVector)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_5_cdec_DenseVector)); + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":85 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":85 * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors.""" * if isinstance(other, DenseVector): * return self.vector.dot((<DenseVector> other).vector[0]) # <<<<<<<<<<<<<< @@ -3722,28 +3748,25 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp * return self.vector.dot((<SparseVector> other).vector[0]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L3; } - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":86 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":86 * if isinstance(other, DenseVector): * return self.vector.dot((<DenseVector> other).vector[0]) * elif isinstance(other, SparseVector): # <<<<<<<<<<<<<< * return self.vector.dot((<SparseVector> other).vector[0]) * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":87 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":87 * return self.vector.dot((<DenseVector> other).vector[0]) * elif isinstance(other, SparseVector): * return self.vector.dot((<SparseVector> other).vector[0]) # <<<<<<<<<<<<<< @@ -3751,40 +3774,40 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":88 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":88 * elif isinstance(other, SparseVector): * return self.vector.dot((<SparseVector> other).vector[0]) * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) # <<<<<<<<<<<<<< * * def __richcmp__(SparseVector x, SparseVector y, int op): */ - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __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[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __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_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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_XDECREF(__pyx_t_3); __Pyx_AddTraceback("_cdec.SparseVector.dot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -3811,7 +3834,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":90 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":90 * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) * * def __richcmp__(SparseVector x, SparseVector y, int op): # <<<<<<<<<<<<<< @@ -3829,7 +3852,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":93 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":93 * if op == 2: # == * return x.vector[0] == y.vector[0] * elif op == 3: # != # <<<<<<<<<<<<<< @@ -3838,7 +3861,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 */ switch (__pyx_v_op) { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":91 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":91 * * def __richcmp__(SparseVector x, SparseVector y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -3847,7 +3870,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 */ case 2: - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":92 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":92 * def __richcmp__(SparseVector x, SparseVector y, int op): * if op == 2: # == * return x.vector[0] == y.vector[0] # <<<<<<<<<<<<<< @@ -3862,7 +3885,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 goto __pyx_L0; break; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":93 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":93 * if op == 2: # == * return x.vector[0] == y.vector[0] * elif op == 3: # != # <<<<<<<<<<<<<< @@ -3871,7 +3894,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 */ case 3: - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":94 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":94 * return x.vector[0] == y.vector[0] * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -3890,7 +3913,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 break; } - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":95 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":95 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<< @@ -3926,7 +3949,7 @@ static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":97 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":97 * raise NotImplemented('comparison not implemented for SparseVector') * * def __len__(self): # <<<<<<<<<<<<<< @@ -3939,7 +3962,7 @@ static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_17__len__(struct __pyx_obj_5_cd __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":98 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":98 * * def __len__(self): * return self.vector.size() # <<<<<<<<<<<<<< @@ -3976,7 +3999,7 @@ static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":100 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":100 * return self.vector.size() * * def __contains__(self, char* fname): # <<<<<<<<<<<<<< @@ -3989,7 +4012,7 @@ static int __pyx_pf_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_5_cdec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__contains__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":101 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":101 * * def __contains__(self, char* fname): * return self.vector.nonzero(FDConvert(fname)) # <<<<<<<<<<<<<< @@ -4016,7 +4039,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":103 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":103 * return self.vector.nonzero(FDConvert(fname)) * * def __neg__(self): # <<<<<<<<<<<<<< @@ -4034,7 +4057,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__neg__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":104 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":104 * * def __neg__(self): * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -4047,7 +4070,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":105 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":105 * def __neg__(self): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) # <<<<<<<<<<<<<< @@ -4056,7 +4079,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde */ __pyx_v_result->vector = new FastSparseVector<weight_t>((__pyx_v_self->vector[0])); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":106 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":106 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 # <<<<<<<<<<<<<< @@ -4065,7 +4088,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde */ (__pyx_v_result->vector[0]) *= -1.0; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":107 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":107 * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 * return result # <<<<<<<<<<<<<< @@ -4106,7 +4129,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":109 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":109 * return result * * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<< @@ -4119,7 +4142,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iadd__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":110 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":110 * * def __iadd__(SparseVector self, SparseVector other): * self.vector[0] += other.vector[0] # <<<<<<<<<<<<<< @@ -4128,7 +4151,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) += (__pyx_v_other->vector[0]); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":111 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":111 * def __iadd__(SparseVector self, SparseVector other): * self.vector[0] += other.vector[0] * return self # <<<<<<<<<<<<<< @@ -4163,7 +4186,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":113 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":113 * return self * * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<< @@ -4176,7 +4199,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__isub__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":114 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":114 * * def __isub__(SparseVector self, SparseVector other): * self.vector[0] -= other.vector[0] # <<<<<<<<<<<<<< @@ -4185,7 +4208,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) -= (__pyx_v_other->vector[0]); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":115 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":115 * def __isub__(SparseVector self, SparseVector other): * self.vector[0] -= other.vector[0] * return self # <<<<<<<<<<<<<< @@ -4225,7 +4248,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":117 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":117 * return self * * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<< @@ -4238,7 +4261,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__imul__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":118 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":118 * * def __imul__(SparseVector self, float scalar): * self.vector[0] *= scalar # <<<<<<<<<<<<<< @@ -4247,7 +4270,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) *= __pyx_v_scalar; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":119 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":119 * def __imul__(SparseVector self, float scalar): * self.vector[0] *= scalar * return self # <<<<<<<<<<<<<< @@ -4289,7 +4312,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_sel } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":121 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":121 * return self * * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<< @@ -4303,7 +4326,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__idiv__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":122 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":122 * * def __idiv__(SparseVector self, float scalar): * self.vector[0] /= scalar # <<<<<<<<<<<<<< @@ -4312,7 +4335,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) /= __pyx_v_scalar; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":123 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":123 * def __idiv__(SparseVector self, float scalar): * self.vector[0] /= scalar * return self # <<<<<<<<<<<<<< @@ -4349,7 +4372,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, P return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":125 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":125 * return self * * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<< @@ -4367,7 +4390,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":126 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":126 * * def __add__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -4380,7 +4403,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":127 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":127 * def __add__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) # <<<<<<<<<<<<<< @@ -4389,7 +4412,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0]))); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":128 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":128 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) * return result # <<<<<<<<<<<<<< @@ -4431,7 +4454,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, P return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":130 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":130 * return result * * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<< @@ -4449,7 +4472,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__sub__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":131 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":131 * * def __sub__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -4462,7 +4485,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":132 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":132 * def __sub__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) # <<<<<<<<<<<<<< @@ -4471,7 +4494,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0]))); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":133 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":133 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) * return result # <<<<<<<<<<<<<< @@ -4507,7 +4530,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, P return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":135 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":135 * return result * * def __mul__(x, y): # <<<<<<<<<<<<<< @@ -4521,38 +4544,35 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; float __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__mul__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":138 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":138 * cdef SparseVector vector * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<< * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_x, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + if (__pyx_t_1) { if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_x; - __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_x; + __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2); + __pyx_t_2 = 0; __pyx_v_scalar = __pyx_t_3; goto __pyx_L3; } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":139 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":139 * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x # <<<<<<<<<<<<<< @@ -4560,29 +4580,29 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) */ if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_y; - __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_y; + __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2); + __pyx_t_2 = 0; __pyx_v_scalar = __pyx_t_3; } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":140 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":140 * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) * return result */ - __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __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[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":141 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":141 * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) # <<<<<<<<<<<<<< @@ -4591,7 +4611,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) * __pyx_v_scalar)); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":142 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":142 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) * return result # <<<<<<<<<<<<<< @@ -4606,7 +4626,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P __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.SparseVector.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4630,7 +4650,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, P } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":144 +/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":144 * return result * * def __div__(x, y): # <<<<<<<<<<<<<< @@ -4645,38 +4665,35 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; float __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__div__", 0); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":147 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":147 * cdef SparseVector vector * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<< * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_x, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + if (__pyx_t_1) { if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_x; - __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_x; + __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2); + __pyx_t_2 = 0; __pyx_v_scalar = __pyx_t_3; goto __pyx_L3; } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":148 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":148 * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x # <<<<<<<<<<<<<< @@ -4684,29 +4701,29 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) */ if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_y; - __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_y; + __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2); + __pyx_t_2 = 0; __pyx_v_scalar = __pyx_t_3; } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":149 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":149 * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) * return result */ - __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __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[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":150 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":150 * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) # <<<<<<<<<<<<<< @@ -4714,7 +4731,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) / __pyx_v_scalar)); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":151 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":151 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) * return result # <<<<<<<<<<<<<< @@ -4727,7 +4744,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P __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.SparseVector.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4752,7 +4769,7 @@ static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_ } static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":6 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":6 * * def _phrase(phrase): * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< @@ -4804,8 +4821,8 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__ Py_ssize_t __pyx_t_2; PyObject *(*__pyx_t_3)(PyObject *); PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); @@ -4858,16 +4875,13 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__ __Pyx_GIVEREF(__pyx_t_4); __pyx_cur_scope->__pyx_v_w = __pyx_t_4; __pyx_t_4 = 0; - __pyx_t_5 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_w, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - __pyx_t_5 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyUnicode_Check(__pyx_cur_scope->__pyx_v_w); + if (__pyx_t_5) { + __pyx_t_6 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s__encode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_4 = __pyx_t_7; __pyx_t_7 = 0; } else { @@ -4876,11 +4890,11 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_w); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_cur_scope->__pyx_v_w); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_w); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_4 = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_4 = __pyx_t_6; + __pyx_t_6 = 0; } __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -4907,7 +4921,7 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; @@ -4918,7 +4932,7 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__ return NULL; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":5 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< @@ -4947,7 +4961,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":6 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":6 * * def _phrase(phrase): * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< @@ -5058,7 +5072,7 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":11 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":11 * cdef public bytes cat * cdef public unsigned ref * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<< @@ -5071,7 +5085,7 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":13 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":13 * def __init__(self, bytes cat, unsigned ref=0): * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.""" * self.cat = cat # <<<<<<<<<<<<<< @@ -5084,7 +5098,7 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self __Pyx_DECREF(((PyObject *)__pyx_v_self->cat)); __pyx_v_self->cat = __pyx_v_cat; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":14 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":14 * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.""" * self.cat = cat * self.ref = ref # <<<<<<<<<<<<<< @@ -5109,7 +5123,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":16 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":16 * self.ref = ref * * def __str__(self): # <<<<<<<<<<<<<< @@ -5128,7 +5142,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":17 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":17 * * def __str__(self): * if self.ref > 0: # <<<<<<<<<<<<<< @@ -5138,7 +5152,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ __pyx_t_1 = (__pyx_v_self->ref > 0); if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":18 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":18 * def __str__(self): * if self.ref > 0: * return '[%s,%d]' % (self.cat, self.ref) # <<<<<<<<<<<<<< @@ -5166,7 +5180,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":19 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":19 * if self.ref > 0: * return '[%s,%d]' % (self.cat, self.ref) * return '[%s]' % self.cat # <<<<<<<<<<<<<< @@ -5204,7 +5218,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":9 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":9 * * cdef class NT: * cdef public bytes cat # <<<<<<<<<<<<<< @@ -5300,7 +5314,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":10 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":10 * cdef class NT: * cdef public bytes cat * cdef public unsigned ref # <<<<<<<<<<<<<< @@ -5418,7 +5432,7 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":23 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":23 * cdef class NTRef: * cdef public unsigned ref * def __init__(self, unsigned ref): # <<<<<<<<<<<<<< @@ -5431,7 +5445,7 @@ static int __pyx_pf_5_cdec_5NTRef___init__(struct __pyx_obj_5_cdec_NTRef *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":25 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":25 * def __init__(self, unsigned ref): * """NTRef(int ref) -> Non-terminal reference.""" * self.ref = ref # <<<<<<<<<<<<<< @@ -5456,7 +5470,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":27 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":27 * self.ref = ref * * def __str__(self): # <<<<<<<<<<<<<< @@ -5474,7 +5488,7 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_2__str__(struct __pyx_obj_5_cdec_NTRef * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":28 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":28 * * def __str__(self): * return '[%d]' % self.ref # <<<<<<<<<<<<<< @@ -5515,7 +5529,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":22 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":22 * * cdef class NTRef: * cdef public unsigned ref # <<<<<<<<<<<<<< @@ -5582,7 +5596,7 @@ static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":30 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":30 * return '[%d]' % self.ref * * cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<< @@ -5603,16 +5617,17 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; + int *__pyx_t_3; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_rule", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":31 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":31 * * cdef TRule convert_rule(_sa.Rule rule): * lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<< @@ -5621,7 +5636,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o */ __pyx_v_lhs = __pyx_f_4cdec_2sa_3_sa_sym_tocat(__pyx_v_rule->lhs); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":32 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":32 * cdef TRule convert_rule(_sa.Rule rule): * lhs = _sa.sym_tocat(rule.lhs) * scores = dict(rule.scores) # <<<<<<<<<<<<<< @@ -5639,7 +5654,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_v_scores = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":33 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":33 * lhs = _sa.sym_tocat(rule.lhs) * scores = dict(rule.scores) * f, e = [], [] # <<<<<<<<<<<<<< @@ -5650,42 +5665,43 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyList_New(0); 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_v_f = __pyx_t_2; + __pyx_v_f = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_e = __pyx_t_1; + __pyx_v_e = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":34 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":34 * scores = dict(rule.scores) * f, e = [], [] * cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<< * for i in range(rule.f.n): * if _sa.sym_isvar(fsyms[i]): */ - __pyx_v_fsyms = __pyx_v_rule->f->syms; + __pyx_t_3 = __pyx_v_rule->f->syms; + __pyx_v_fsyms = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":35 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":35 * 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_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; + __pyx_t_4 = __pyx_v_rule->f->n; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":36 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":36 * 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_5 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i])); - if (__pyx_t_5) { + __pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i])); + if (__pyx_t_6) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":37 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":37 * for i in range(rule.f.n): * if _sa.sym_isvar(fsyms[i]): * f.append(NT(_sa.sym_tocat(fsyms[i]))) # <<<<<<<<<<<<<< @@ -5702,13 +5718,13 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __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 = 37; __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_f, __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_t_7 = PyList_Append(__pyx_v_f, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L5; } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":39 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":39 * f.append(NT(_sa.sym_tocat(fsyms[i]))) * else: * f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<< @@ -5717,43 +5733,44 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o */ __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 = 39; __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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_Append(__pyx_v_f, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } __pyx_L5:; } - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":40 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":40 * else: * 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]): */ - __pyx_v_esyms = __pyx_v_rule->e->syms; + __pyx_t_3 = __pyx_v_rule->e->syms; + __pyx_v_esyms = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":41 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":41 * 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_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; + __pyx_t_4 = __pyx_v_rule->e->n; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":42 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":42 * 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_5 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i])); - if (__pyx_t_5) { + __pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i])); + if (__pyx_t_6) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":43 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":43 * for i in range(rule.e.n): * if _sa.sym_isvar(esyms[i]): * e.append(NTRef(_sa.sym_getindex(esyms[i]))) # <<<<<<<<<<<<<< @@ -5770,13 +5787,13 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __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 = 43; __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 = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L8; } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":45 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":45 * e.append(NTRef(_sa.sym_getindex(esyms[i]))) * else: * e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<< @@ -5785,13 +5802,13 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o */ __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 = 45; __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_Append(__pyx_v_e, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } __pyx_L8:; } - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":46 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":46 * else: * e.append(_sa.sym_tostring(esyms[i])) * a = list(rule.alignments()) # <<<<<<<<<<<<<< @@ -5814,7 +5831,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_v_a = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":47 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":47 * e.append(_sa.sym_tostring(esyms[i])) * a = list(rule.alignments()) * return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<< @@ -5884,7 +5901,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}; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":52 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":52 * cdef shared_ptr[grammar.TRule]* rule * * def __init__(self, lhs, f, e, scores, a=None): # <<<<<<<<<<<<<< @@ -5973,17 +5990,22 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":59 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":59 * scores: dictionary of feature scores * a: optional list of alignment points""" * 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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_1 = new TRule(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_self->rule = new boost::shared_ptr<TRule>(__pyx_t_1); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":60 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":60 * a: optional list of alignment points""" * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) * self.lhs = lhs # <<<<<<<<<<<<<< @@ -5992,7 +6014,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ */ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":61 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":61 * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) * self.lhs = lhs * self.e = e # <<<<<<<<<<<<<< @@ -6001,7 +6023,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ */ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":62 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":62 * self.lhs = lhs * self.e = e * self.f = f # <<<<<<<<<<<<<< @@ -6010,7 +6032,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ */ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":63 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":63 * self.e = e * self.f = f * self.scores = scores # <<<<<<<<<<<<<< @@ -6019,7 +6041,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ */ if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":64 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":64 * self.f = f * self.scores = scores * if a: # <<<<<<<<<<<<<< @@ -6029,7 +6051,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":65 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":65 * self.scores = scores * if a: * self.a = a # <<<<<<<<<<<<<< @@ -6041,7 +6063,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":66 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":66 * if a: * self.a = a * self.rule.get().ComputeArity() # <<<<<<<<<<<<<< @@ -6069,7 +6091,7 @@ static void __pyx_pw_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":68 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":68 * self.rule.get().ComputeArity() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -6081,7 +6103,7 @@ static void __pyx_pf_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5 __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":69 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":69 * * def __dealloc__(self): * del self.rule # <<<<<<<<<<<<<< @@ -6104,7 +6126,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":72 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":72 * * property arity: * def __get__(self): # <<<<<<<<<<<<<< @@ -6121,7 +6143,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_T int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":73 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":73 * property arity: * def __get__(self): * return self.rule.get().arity_ # <<<<<<<<<<<<<< @@ -6158,7 +6180,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":76 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":76 * * property f: * def __get__(self): # <<<<<<<<<<<<<< @@ -6185,7 +6207,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":77 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":77 * property f: * def __get__(self): * cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<< @@ -6194,7 +6216,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_f_ = (&__pyx_v_self->rule->get()->f_); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":79 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":79 * cdef vector[WordID]* f_ = &self.rule.get().f_ * cdef WordID w * cdef f = [] # <<<<<<<<<<<<<< @@ -6206,7 +6228,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule __pyx_v_f = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":81 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":81 * cdef f = [] * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6215,7 +6237,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_idx = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":82 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":82 * cdef unsigned i * cdef int idx = 0 * for i in range(f_.size()): # <<<<<<<<<<<<<< @@ -6226,7 +6248,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; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":83 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":83 * cdef int idx = 0 * for i in range(f_.size()): * w = f_[0][i] # <<<<<<<<<<<<<< @@ -6235,7 +6257,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]); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":84 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":84 * for i in range(f_.size()): * w = f_[0][i] * if w < 0: # <<<<<<<<<<<<<< @@ -6245,7 +6267,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) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":85 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":85 * w = f_[0][i] * if w < 0: * idx += 1 # <<<<<<<<<<<<<< @@ -6254,7 +6276,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":86 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":86 * if w < 0: * idx += 1 * f.append(NT(TDConvert(-w).c_str(), idx)) # <<<<<<<<<<<<<< @@ -6284,7 +6306,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":88 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":88 * f.append(NT(TDConvert(-w).c_str(), idx)) * else: * f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<< @@ -6313,7 +6335,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule __pyx_L5:; } - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":89 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":89 * else: * f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) * return f # <<<<<<<<<<<<<< @@ -6351,7 +6373,7 @@ static int __pyx_pw_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":91 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":91 * return f * * def __set__(self, f): # <<<<<<<<<<<<<< @@ -6369,15 +6391,15 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p Py_ssize_t __pyx_t_1; unsigned int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - char *__pyx_t_6; + int __pyx_t_4; + char *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":92 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":92 * * def __set__(self, f): * cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<< @@ -6386,7 +6408,7 @@ 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_); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":93 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":93 * def __set__(self, f): * cdef vector[WordID]* f_ = &self.rule.get().f_ * f_.resize(len(f)) # <<<<<<<<<<<<<< @@ -6396,7 +6418,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f_->resize(__pyx_t_1); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":95 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":95 * f_.resize(len(f)) * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6405,7 +6427,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __pyx_v_idx = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":96 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":96 * cdef unsigned i * cdef int idx = 0 * for i in range(len(f)): # <<<<<<<<<<<<<< @@ -6416,7 +6438,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":97 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":97 * cdef int idx = 0 * for i in range(len(f)): * if isinstance(f[i], NT): # <<<<<<<<<<<<<< @@ -6425,54 +6447,51 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __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 = 97; __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); - __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_3, __pyx_t_4); + __pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_5_cdec_NT)); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { + if (__pyx_t_4) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":98 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":98 * for i in range(len(f)): * if isinstance(f[i], NT): * f_[0][i] = -TDConvert((<NT> f[i]).cat) # <<<<<<<<<<<<<< * else: * fi = 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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyBytes_AsString(((PyObject *)((struct __pyx_obj_5_cdec_NT *)__pyx_t_4)->cat)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - ((__pyx_v_f_[0])[__pyx_v_i]) = (-TD::Convert(__pyx_t_6)); + __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyBytes_AsString(((PyObject *)((struct __pyx_obj_5_cdec_NT *)__pyx_t_3)->cat)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __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(__pyx_t_5)); goto __pyx_L5; } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":100 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":100 * f_[0][i] = -TDConvert((<NT> f[i]).cat) * else: * fi = as_str(f[i]) # <<<<<<<<<<<<<< * f_[0][i] = TDConvert(fi) * */ - __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_fi)); - __pyx_v_fi = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_fi = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":101 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":101 * else: * fi = as_str(f[i]) * f_[0][i] = TDConvert(fi) # <<<<<<<<<<<<<< * * property e: */ - __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_fi)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_6); + __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_fi)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_5); } __pyx_L5:; } @@ -6481,7 +6500,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("_cdec.TRule.f.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -6501,7 +6520,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":104 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":104 * * property e: * def __get__(self): # <<<<<<<<<<<<<< @@ -6528,7 +6547,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":105 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":105 * property e: * def __get__(self): * cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<< @@ -6537,7 +6556,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_e_ = (&__pyx_v_self->rule->get()->e_); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":107 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":107 * cdef vector[WordID]* e_ = &self.rule.get().e_ * cdef WordID w * cdef e = [] # <<<<<<<<<<<<<< @@ -6549,7 +6568,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule __pyx_v_e = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":109 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":109 * cdef e = [] * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6558,7 +6577,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_idx = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":110 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":110 * cdef unsigned i * cdef int idx = 0 * for i in range(e_.size()): # <<<<<<<<<<<<<< @@ -6569,7 +6588,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; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":111 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":111 * cdef int idx = 0 * for i in range(e_.size()): * w = e_[0][i] # <<<<<<<<<<<<<< @@ -6578,7 +6597,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]); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":112 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":112 * for i in range(e_.size()): * w = e_[0][i] * if w < 1: # <<<<<<<<<<<<<< @@ -6588,7 +6607,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) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":113 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":113 * w = e_[0][i] * if w < 1: * idx += 1 # <<<<<<<<<<<<<< @@ -6597,7 +6616,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":114 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":114 * if w < 1: * idx += 1 * e.append(NTRef(1-w)) # <<<<<<<<<<<<<< @@ -6622,7 +6641,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":116 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":116 * e.append(NTRef(1-w)) * else: * e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<< @@ -6651,7 +6670,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule __pyx_L5:; } - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":117 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":117 * else: * e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) * return e # <<<<<<<<<<<<<< @@ -6689,7 +6708,7 @@ static int __pyx_pw_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":119 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":119 * return e * * def __set__(self, e): # <<<<<<<<<<<<<< @@ -6706,8 +6725,8 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p Py_ssize_t __pyx_t_1; unsigned int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; WordID __pyx_t_6; char *__pyx_t_7; int __pyx_lineno = 0; @@ -6715,7 +6734,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); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":120 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":120 * * def __set__(self, e): * cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<< @@ -6724,7 +6743,7 @@ 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_); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":121 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":121 * def __set__(self, e): * cdef vector[WordID]* e_ = &self.rule.get().e_ * e_.resize(len(e)) # <<<<<<<<<<<<<< @@ -6734,7 +6753,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_e_->resize(__pyx_t_1); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":123 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":123 * e_.resize(len(e)) * cdef unsigned i * for i in range(len(e)): # <<<<<<<<<<<<<< @@ -6745,7 +6764,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":124 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":124 * cdef unsigned i * for i in range(len(e)): * if isinstance(e[i], NTRef): # <<<<<<<<<<<<<< @@ -6754,52 +6773,49 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __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 = 124; __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); - __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_3, __pyx_t_4); + __pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_5_cdec_NTRef)); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { + if (__pyx_t_4) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":125 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":125 * for i in range(len(e)): * if isinstance(e[i], NTRef): * e_[0][i] = 1-e[i].ref # <<<<<<<<<<<<<< * else: * ei = 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 = 125; __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 = 125; __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 = 125; __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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ref); 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); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, __pyx_t_5); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyInt_from_py_WordID(__pyx_t_3); if (unlikely((__pyx_t_6 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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 = 125; __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*/ { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":127 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":127 * e_[0][i] = 1-e[i].ref * else: * ei = as_str(e[i]) # <<<<<<<<<<<<<< * e_[0][i] = TDConvert(ei) * */ - __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_ei)); - __pyx_v_ei = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_ei = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":128 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":128 * else: * ei = as_str(e[i]) * e_[0][i] = TDConvert(ei) # <<<<<<<<<<<<<< @@ -6816,7 +6832,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("_cdec.TRule.e.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -6837,7 +6853,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":131 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":131 * * property a: * def __get__(self): # <<<<<<<<<<<<<< @@ -6902,7 +6918,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__ __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":133 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":133 * def __get__(self): * cdef unsigned i * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<< @@ -6911,7 +6927,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_); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":134 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":134 * cdef unsigned i * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ * for i in range(a.size()): # <<<<<<<<<<<<<< @@ -6922,7 +6938,7 @@ 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; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":135 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":135 * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ * for i in range(a.size()): * yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<< @@ -6981,7 +6997,7 @@ static int __pyx_pw_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":137 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":137 * yield (a[0][i].s_, a[0][i].t_) * * def __set__(self, a): # <<<<<<<<<<<<<< @@ -7010,7 +7026,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); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":138 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":138 * * def __set__(self, a): * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<< @@ -7019,7 +7035,7 @@ 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_); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":139 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":139 * def __set__(self, a): * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ * a_.resize(len(a)) # <<<<<<<<<<<<<< @@ -7029,7 +7045,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_a_->resize(__pyx_t_1); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":142 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":142 * cdef unsigned i * cdef int s, t * for i in range(len(a)): # <<<<<<<<<<<<<< @@ -7040,7 +7056,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":143 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":143 * cdef int s, t * for i in range(len(a)): * s, t = a[i] # <<<<<<<<<<<<<< @@ -7073,7 +7089,9 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p __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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else @@ -7105,7 +7123,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_v_s = __pyx_t_8; __pyx_v_t = __pyx_t_9; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":144 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":144 * for i in range(len(a)): * s, t = a[i] * a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<< @@ -7140,7 +7158,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":147 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":147 * * property scores: * def __get__(self): # <<<<<<<<<<<<<< @@ -7158,7 +7176,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":148 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":148 * property scores: * def __get__(self): * cdef SparseVector scores = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -7171,7 +7189,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_ __pyx_v_scores = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":149 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":149 * def __get__(self): * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<< @@ -7180,7 +7198,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_); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":150 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":150 * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) * return scores # <<<<<<<<<<<<<< @@ -7216,7 +7234,7 @@ static int __pyx_pw_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":152 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":152 * return scores * * def __set__(self, scores): # <<<<<<<<<<<<<< @@ -7248,7 +7266,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); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":153 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":153 * * def __set__(self, scores): * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<< @@ -7257,7 +7275,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_); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":154 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":154 * def __set__(self, scores): * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ * scores_.clear() # <<<<<<<<<<<<<< @@ -7266,7 +7284,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_scores_->clear(); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":157 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":157 * cdef int fid * cdef float fval * for fname, fval in scores.items(): # <<<<<<<<<<<<<< @@ -7337,7 +7355,9 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule __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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else @@ -7369,7 +7389,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule __pyx_t_5 = 0; __pyx_v_fval = __pyx_t_9; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":158 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":158 * cdef float fval * for fname, fval in scores.items(): * fn = as_str(fname) # <<<<<<<<<<<<<< @@ -7382,7 +7402,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule __pyx_v_fn = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":159 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":159 * for fname, fval in scores.items(): * fn = as_str(fname) * fid = FDConvert(fn) # <<<<<<<<<<<<<< @@ -7392,7 +7412,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule __pyx_t_10 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_fid = FD::Convert(__pyx_t_10); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":160 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":160 * fn = as_str(fname) * fid = FDConvert(fn) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -7416,7 +7436,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule } __pyx_L7:; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":161 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":161 * fid = FDConvert(fn) * if fid < 0: raise KeyError(fname) * scores_.set_value(fid, fval) # <<<<<<<<<<<<<< @@ -7455,7 +7475,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":164 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":164 * * property lhs: * def __get__(self): # <<<<<<<<<<<<<< @@ -7473,7 +7493,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":165 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":165 * property lhs: * def __get__(self): * return NT(TDConvert(-self.rule.get().lhs_).c_str()) # <<<<<<<<<<<<<< @@ -7519,7 +7539,7 @@ static int __pyx_pw_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":167 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":167 * return NT(TDConvert(-self.rule.get().lhs_).c_str()) * * def __set__(self, lhs): # <<<<<<<<<<<<<< @@ -7530,9 +7550,9 @@ static int __pyx_pw_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs) { int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; char *__pyx_t_5; int __pyx_lineno = 0; @@ -7541,35 +7561,32 @@ 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); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":168 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":168 * * def __set__(self, lhs): * if not isinstance(lhs, NT): # <<<<<<<<<<<<<< * lhs = NT(lhs) * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_lhs, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (!__pyx_t_2); - if (__pyx_t_3) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_lhs, ((PyObject*)__pyx_ptype_5_cdec_NT)); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":169 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":169 * def __set__(self, lhs): * if not isinstance(lhs, NT): * lhs = NT(lhs) # <<<<<<<<<<<<<< * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) * */ - __pyx_t_1 = PyTuple_New(1); 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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_lhs); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_lhs); + PyTuple_SET_ITEM(__pyx_t_3, 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 = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_lhs); __pyx_v_lhs = __pyx_t_4; __pyx_t_4 = 0; @@ -7577,7 +7594,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_ } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":170 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":170 * if not isinstance(lhs, NT): * lhs = NT(lhs) * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) # <<<<<<<<<<<<<< @@ -7590,7 +7607,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("_cdec.TRule.lhs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; @@ -7612,7 +7629,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 */ -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":173 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":173 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -7754,7 +7771,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj return NULL; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":172 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":172 * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) * * def __str__(self): # <<<<<<<<<<<<<< @@ -7786,7 +7803,7 @@ 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); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":173 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":173 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -7809,7 +7826,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * __pyx_v_scores = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":174 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":174 * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) * return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<< @@ -7820,7 +7837,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * __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 = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":175 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":175 * scores = ' '.join('%s=%s' % feat for feat in self.scores) * return '%s ||| %s ||| %s ||| %s' % (self.lhs, * _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<< @@ -7961,7 +7978,7 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":178 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":178 * * cdef class MRule(TRule): * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<< @@ -7987,7 +8004,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":183 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":183 * rhs: right hand side phrase (list of words/NT) * scores: dictionary of feature scores""" * cdef unsigned i = 1 # <<<<<<<<<<<<<< @@ -7996,7 +8013,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ */ __pyx_v_i = 1; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":184 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":184 * scores: dictionary of feature scores""" * cdef unsigned i = 1 * e = [] # <<<<<<<<<<<<<< @@ -8005,10 +8022,10 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_e = __pyx_t_1; + __pyx_v_e = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":185 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":185 * cdef unsigned i = 1 * e = [] * for s in rhs: # <<<<<<<<<<<<<< @@ -8053,20 +8070,17 @@ 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; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":186 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":186 * e = [] * for s in rhs: * if isinstance(s, NT): # <<<<<<<<<<<<<< * e.append(NTRef(i)) * i += 1 */ - __pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_s, __pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_s, ((PyObject*)__pyx_ptype_5_cdec_NT)); if (__pyx_t_5) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":187 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":187 * for s in rhs: * if isinstance(s, NT): * e.append(NTRef(i)) # <<<<<<<<<<<<<< @@ -8086,7 +8100,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":188 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":188 * if isinstance(s, NT): * e.append(NTRef(i)) * i += 1 # <<<<<<<<<<<<<< @@ -8098,7 +8112,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":190 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":190 * i += 1 * else: * e.append(s) # <<<<<<<<<<<<<< @@ -8111,7 +8125,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":191 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":191 * else: * e.append(s) * super(MRule, self).__init__(lhs, rhs, e, scores, None) # <<<<<<<<<<<<<< @@ -8179,7 +8193,7 @@ static void __pyx_pw_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":196 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":196 * cdef shared_ptr[grammar.Grammar]* grammar * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -8191,7 +8205,7 @@ static void __pyx_pf_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":197 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":197 * * def __dealloc__(self): * del self.grammar # <<<<<<<<<<<<<< @@ -8215,7 +8229,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":199 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":199 * del self.grammar * * def __iter__(self): # <<<<<<<<<<<<<< @@ -8278,7 +8292,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":200 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":200 * * def __iter__(self): * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<< @@ -8287,7 +8301,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(); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":201 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":201 * def __iter__(self): * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() * cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<< @@ -8296,7 +8310,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(); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":204 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":204 * cdef TRule trule * cdef unsigned i * for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<< @@ -8307,7 +8321,7 @@ 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; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":205 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":205 * cdef unsigned i * for i in range(rbin.GetNumRules()): * trule = TRule.__new__(TRule) # <<<<<<<<<<<<<< @@ -8323,7 +8337,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p __pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":206 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":206 * for i in range(rbin.GetNumRules()): * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<< @@ -8332,7 +8346,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)); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":207 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":207 * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) * yield trule # <<<<<<<<<<<<<< @@ -8377,7 +8391,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":210 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":210 * * property name: * def __get__(self): # <<<<<<<<<<<<<< @@ -8395,7 +8409,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":211 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":211 * property name: * def __get__(self): * str(self.grammar.get().GetGrammarName().c_str()) # <<<<<<<<<<<<<< @@ -8438,7 +8452,7 @@ static int __pyx_pw_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":213 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":213 * str(self.grammar.get().GetGrammarName().c_str()) * * def __set__(self, name): # <<<<<<<<<<<<<< @@ -8457,7 +8471,7 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_name); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":214 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":214 * * def __set__(self, name): * name = as_str(name) # <<<<<<<<<<<<<< @@ -8470,7 +8484,7 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm __pyx_v_name = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":215 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":215 * def __set__(self, name): * name = as_str(name) * self.grammar.get().SetGrammarName(name) # <<<<<<<<<<<<<< @@ -8543,7 +8557,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":218 +/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":218 * * cdef class TextGrammar(Grammar): * def __init__(self, rules): # <<<<<<<<<<<<<< @@ -8561,14 +8575,13 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr PyObject *(*__pyx_t_3)(PyObject *); PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":220 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":220 * def __init__(self, rules): * """TextGrammar(rules) -> SCFG Grammar containing the rules.""" * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) # <<<<<<<<<<<<<< @@ -8577,7 +8590,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr */ __pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar>(new TextGrammar()); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":221 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":221 * """TextGrammar(rules) -> SCFG Grammar containing the rules.""" * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() # <<<<<<<<<<<<<< @@ -8586,7 +8599,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr */ __pyx_v__g = ((TextGrammar *)__pyx_v_self->__pyx_base.grammar->get()); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":222 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":222 * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() * for trule in rules: # <<<<<<<<<<<<<< @@ -8631,20 +8644,17 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr __pyx_v_trule = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":223 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":223 * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() * for trule in rules: * if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<< * trule = convert_rule(trule) * elif not isinstance(trule, TRule): */ - __pyx_t_4 = ((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_trule, __pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_trule, ((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)); if (__pyx_t_5) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":224 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":224 * for trule in rules: * if isinstance(trule, _sa.Rule): * trule = convert_rule(trule) # <<<<<<<<<<<<<< @@ -8652,47 +8662,41 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr * 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 = 224; __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 = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = ((PyObject *)__pyx_f_5_cdec_convert_rule(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_trule))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_v_trule); - __pyx_v_trule = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_trule = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L5; } - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":225 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":225 * if isinstance(trule, _sa.Rule): * 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 *)((PyObject*)__pyx_ptype_5_cdec_TRule)); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_trule, __pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = (!__pyx_t_5); - if (__pyx_t_7) { + __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_trule, ((PyObject*)__pyx_ptype_5_cdec_TRule)); + __pyx_t_6 = (!__pyx_t_5); + if (__pyx_t_6) { - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":226 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":226 * 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 = 226; __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_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __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[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":227 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":227 * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') * _g.AddRule((<TRule> trule).rule[0]) # <<<<<<<<<<<<<< @@ -8706,7 +8710,6 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("_cdec.TextGrammar.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -8724,7 +8727,7 @@ static void __pyx_pw_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":8 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":8 * cdef MT19937* rng * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -8737,7 +8740,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":9 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":9 * * def __dealloc__(self): * del self.hg # <<<<<<<<<<<<<< @@ -8746,7 +8749,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp */ delete __pyx_v_self->hg; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":10 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":10 * def __dealloc__(self): * del self.hg * if self.rng != NULL: # <<<<<<<<<<<<<< @@ -8756,7 +8759,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp __pyx_t_1 = (__pyx_v_self->rng != NULL); if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":11 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":11 * del self.hg * if self.rng != NULL: * del self.rng # <<<<<<<<<<<<<< @@ -8771,7 +8774,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":13 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":13 * del self.rng * * cdef MT19937* _rng(self): # <<<<<<<<<<<<<< @@ -8789,7 +8792,7 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_rng", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":14 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":14 * * cdef MT19937* _rng(self): * if self.rng == NULL: # <<<<<<<<<<<<<< @@ -8799,20 +8802,25 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr __pyx_t_1 = (__pyx_v_self->rng == NULL); if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":15 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":15 * cdef MT19937* _rng(self): * if self.rng == NULL: * self.rng = new MT19937() # <<<<<<<<<<<<<< * return self.rng * */ - try {__pyx_t_2 = new MT19937();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_2 = new MT19937(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_self->rng = __pyx_t_2; goto __pyx_L3; } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":16 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":16 * if self.rng == NULL: * self.rng = new MT19937() * return self.rng # <<<<<<<<<<<<<< @@ -8844,7 +8852,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, C return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":18 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":18 * return self.rng * * def viterbi(self): # <<<<<<<<<<<<<< @@ -8863,7 +8871,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":21 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":21 * """hg.viterbi() -> String for the best hypothesis in the hypergraph.""" * cdef vector[WordID] trans * hypergraph.ViterbiESentence(self.hg[0], &trans) # <<<<<<<<<<<<<< @@ -8872,7 +8880,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H */ ViterbiESentence((__pyx_v_self->hg[0]), (&__pyx_v_trans)); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":22 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":22 * cdef vector[WordID] trans * hypergraph.ViterbiESentence(self.hg[0], &trans) * return unicode(GetString(trans).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -8922,7 +8930,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":24 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":24 * return unicode(GetString(trans).c_str(), 'utf8') * * def viterbi_trees(self): # <<<<<<<<<<<<<< @@ -8942,7 +8950,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_trees", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":29 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":29 * e_tree: Target tree for the best hypothesis in the hypergraph. * """ * f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -8965,7 +8973,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_ __pyx_v_f_tree = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":30 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":30 * """ * f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') * e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -8988,7 +8996,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_ __pyx_v_e_tree = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":31 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":31 * f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') * e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8') * return (f_tree, e_tree) # <<<<<<<<<<<<<< @@ -9035,7 +9043,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":33 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":33 * return (f_tree, e_tree) * * def viterbi_features(self): # <<<<<<<<<<<<<< @@ -9053,7 +9061,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_features", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":36 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":36 * """hg.viterbi_features() -> SparseVector with the features corresponding * to the best derivation in the hypergraph.""" * cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -9066,7 +9074,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj __pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":37 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":37 * to the best derivation in the hypergraph.""" * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) # <<<<<<<<<<<<<< @@ -9075,7 +9083,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj */ __pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0]))); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":38 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":38 * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) * return fmap # <<<<<<<<<<<<<< @@ -9111,7 +9119,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":40 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":40 * return fmap * * def viterbi_forest(self): # <<<<<<<<<<<<<< @@ -9129,7 +9137,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_forest", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":41 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":41 * * def viterbi_forest(self): * cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<< @@ -9141,7 +9149,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5 __pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":42 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":42 * def viterbi_forest(self): * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) # <<<<<<<<<<<<<< @@ -9150,7 +9158,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5 */ __pyx_v_hg->hg = new Hypergraph(((__pyx_v_self->hg[0]).CreateViterbiHypergraph(NULL).get()[0])); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":43 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":43 * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) * return hg # <<<<<<<<<<<<<< @@ -9187,7 +9195,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *__pyx_v return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":45 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":45 * return hg * * def viterbi_joshua(self): # <<<<<<<<<<<<<< @@ -9205,7 +9213,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_joshua", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":47 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":47 * def viterbi_joshua(self): * """hg.viterbi_joshua() -> Joshua representation of the best derivation.""" * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9256,7 +9264,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":49 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":49 * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') * * def kbest(self, size): # <<<<<<<<<<<<<< @@ -9324,7 +9332,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":51 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":51 * def kbest(self, size): * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph.""" * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9334,7 +9342,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":54 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":54 * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal].Derivation* derivation * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -9343,7 +9351,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject */ /*try:*/ { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":55 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":55 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -9354,7 +9362,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":56 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":56 * try: * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9363,7 +9371,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":57 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":57 * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break # <<<<<<<<<<<<<< @@ -9377,7 +9385,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject } __pyx_L9:; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":58 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":58 * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break * yield unicode(GetString(derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9414,7 +9422,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject __pyx_L8_break:; } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":60 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":60 * yield unicode(GetString(derivation._yield).c_str(), 'utf8') * finally: * del derivations # <<<<<<<<<<<<<< @@ -9475,7 +9483,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_16kbest_trees(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":62 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":62 * del derivations * * def kbest_trees(self, size): # <<<<<<<<<<<<<< @@ -9545,7 +9553,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":64 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":64 * def kbest_trees(self, size): * """hg.kbest_trees(size) -> List of k-best trees in the hypergraph.""" * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9555,7 +9563,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":66 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":66 * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal].Derivation* f_derivation * cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9565,7 +9573,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":69 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":69 * cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal].Derivation* e_derivation * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -9574,7 +9582,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject */ /*try:*/ { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":70 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":70 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -9585,7 +9593,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":71 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":71 * try: * for k in range(size): * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9594,7 +9602,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_f_derivation = __pyx_cur_scope->__pyx_v_f_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":72 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":72 * for k in range(size): * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9603,7 +9611,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_e_derivation = __pyx_cur_scope->__pyx_v_e_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":73 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":73 * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not f_derivation or not e_derivation: break # <<<<<<<<<<<<<< @@ -9623,7 +9631,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject } __pyx_L9:; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":74 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":74 * e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not f_derivation or not e_derivation: break * f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9649,7 +9657,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":75 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":75 * if not f_derivation or not e_derivation: break * f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') * e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9675,7 +9683,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":76 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":76 * f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') * e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8') * yield (f_tree, e_tree) # <<<<<<<<<<<<<< @@ -9707,7 +9715,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_L8_break:; } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":78 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":78 * yield (f_tree, e_tree) * finally: * del f_derivations # <<<<<<<<<<<<<< @@ -9731,7 +9739,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_L6:; delete __pyx_cur_scope->__pyx_v_f_derivations; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":79 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":79 * finally: * del f_derivations * del e_derivations # <<<<<<<<<<<<<< @@ -9777,7 +9785,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_19kbest_features(PyObject *__pyx_v return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":81 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":81 * del e_derivations * * def kbest_features(self, size): # <<<<<<<<<<<<<< @@ -9844,7 +9852,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":83 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":83 * def kbest_features(self, size): * """hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph.""" * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9854,7 +9862,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":87 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":87 * cdef SparseVector fmap * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -9863,7 +9871,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject */ /*try:*/ { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":88 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":88 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -9874,7 +9882,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":89 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":89 * try: * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9883,7 +9891,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":90 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":90 * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break # <<<<<<<<<<<<<< @@ -9897,7 +9905,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject } __pyx_L9:; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":91 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":91 * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break * fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -9913,7 +9921,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":92 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":92 * if not derivation: break * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<< @@ -9922,7 +9930,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":93 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":93 * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) * yield fmap # <<<<<<<<<<<<<< @@ -9946,7 +9954,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject __pyx_L8_break:; } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":95 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":95 * yield fmap * finally: * del derivations # <<<<<<<<<<<<<< @@ -10015,7 +10023,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, P return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":97 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":97 * del derivations * * def sample(self, unsigned n): # <<<<<<<<<<<<<< @@ -10081,17 +10089,22 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":99 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":99 * def sample(self, unsigned n): * """hg.sample(n) -> Sample of n hypotheses from the hypergraph.""" * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<< * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) * cdef unsigned k */ - try {__pyx_t_1 = new std::vector<HypergraphSampler::Hypothesis>();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_1 = new std::vector<HypergraphSampler::Hypothesis>(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_cur_scope->__pyx_v_hypos = __pyx_t_1; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":100 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":100 * """hg.sample(n) -> Sample of n hypotheses from the hypergraph.""" * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) # <<<<<<<<<<<<<< @@ -10100,7 +10113,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject */ HypergraphSampler::sample_hypotheses((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_hypos); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":102 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":102 * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -10109,7 +10122,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject */ /*try:*/ { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":103 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":103 * cdef unsigned k * try: * for k in range(hypos.size()): # <<<<<<<<<<<<<< @@ -10120,7 +10133,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":104 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":104 * try: * for k in range(hypos.size()): * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -10156,7 +10169,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject } } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":106 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":106 * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') * finally: * del hypos # <<<<<<<<<<<<<< @@ -10227,7 +10240,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":108 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":108 * del hypos * * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<< @@ -10293,17 +10306,22 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":110 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":110 * def sample_trees(self, unsigned n): * """hg.sample_trees(n) -> Sample of n trees from the hypergraph.""" * cdef vector[string]* trees = new vector[string]() # <<<<<<<<<<<<<< * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) * cdef unsigned k */ - try {__pyx_t_1 = new std::vector<std::string>();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_1 = new std::vector<std::string>(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_cur_scope->__pyx_v_trees = __pyx_t_1; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":111 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":111 * """hg.sample_trees(n) -> Sample of n trees from the hypergraph.""" * cdef vector[string]* trees = new vector[string]() * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) # <<<<<<<<<<<<<< @@ -10312,7 +10330,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject */ HypergraphSampler::sample_trees((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_trees); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":113 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":113 * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -10321,7 +10339,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject */ /*try:*/ { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":114 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":114 * cdef unsigned k * try: * for k in range(trees.size()): # <<<<<<<<<<<<<< @@ -10332,7 +10350,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":115 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":115 * try: * for k in range(trees.size()): * yield unicode(trees[0][k].c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -10368,7 +10386,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject } } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":117 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":117 * yield unicode(trees[0][k].c_str(), 'utf8') * finally: * del trees # <<<<<<<<<<<<<< @@ -10428,7 +10446,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28intersect(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":119 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":119 * del trees * * def intersect(self, inp): # <<<<<<<<<<<<<< @@ -10440,28 +10458,25 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde 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; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intersect", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":122 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":122 * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference.""" * 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) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_inp, ((PyObject*)__pyx_ptype_5_cdec_Lattice)); + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":123 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":123 * cdef Lattice lat * if isinstance(inp, Lattice): * lat = <Lattice> inp # <<<<<<<<<<<<<< @@ -10473,41 +10488,38 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde goto __pyx_L3; } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":124 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":124 * 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 = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyObject_IsInstance(__pyx_v_inp, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":125 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":125 * 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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__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); __Pyx_INCREF(__pyx_v_inp); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_inp); + PyTuple_SET_ITEM(__pyx_t_2, 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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_lat = ((struct __pyx_obj_5_cdec_Lattice *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L3; } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":127 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":127 * lat = Lattice(inp) * else: * raise TypeError('cannot intersect hypergraph with %s' % type(inp)) # <<<<<<<<<<<<<< @@ -10516,21 +10528,21 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde */ __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 = 127; __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":128 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":128 * else: * raise TypeError('cannot intersect hypergraph with %s' % type(inp)) * return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<< @@ -10547,7 +10559,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde __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_XDECREF(__pyx_t_3); __Pyx_AddTraceback("_cdec.Hypergraph.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -10626,7 +10638,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":130 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":130 * return hypergraph.Intersect(lat.lattice[0], self.hg) * * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<< @@ -10646,7 +10658,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy int __pyx_clineno = 0; __Pyx_RefNannySetupContext("prune", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":134 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":134 * beam_alpha: use beam pruning * density: use density pruning""" * cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<< @@ -10655,7 +10667,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy */ __pyx_v_preserve_mask = NULL; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":135 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":135 * density: use density pruning""" * cdef hypergraph.EdgeMask* preserve_mask = NULL * if 'csplit_preserve_full_word' in kwargs: # <<<<<<<<<<<<<< @@ -10665,7 +10677,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy __pyx_t_1 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s_16), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":136 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":136 * cdef hypergraph.EdgeMask* preserve_mask = NULL * if 'csplit_preserve_full_word' in kwargs: * preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<< @@ -10674,7 +10686,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy */ __pyx_v_preserve_mask = new std::vector<bool>(__pyx_v_self->hg->edges_.size()); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":137 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":137 * 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 # <<<<<<<<<<<<<< @@ -10686,7 +10698,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":138 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":138 * 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) # <<<<<<<<<<<<<< @@ -10697,7 +10709,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy __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 = 138; __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); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":139 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":139 * preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True * self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) * if preserve_mask: # <<<<<<<<<<<<<< @@ -10707,7 +10719,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy __pyx_t_1 = (__pyx_v_preserve_mask != 0); if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":140 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":140 * self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) * if preserve_mask: * del preserve_mask # <<<<<<<<<<<<<< @@ -10742,7 +10754,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_32lattice(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":142 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":142 * del preserve_mask * * def lattice(self): # TODO direct hg -> lattice conversion in cdec # <<<<<<<<<<<<<< @@ -10762,7 +10774,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lattice", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":144 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":144 * def lattice(self): # TODO direct hg -> lattice conversion in cdec * """hg.lattice() -> Lattice corresponding to the hypergraph.""" * cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() # <<<<<<<<<<<<<< @@ -10771,10 +10783,10 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_ */ __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_plf = __pyx_t_1; + __pyx_v_plf = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":145 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":145 * """hg.lattice() -> Lattice corresponding to the hypergraph.""" * cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() * return Lattice(eval(plf)) # <<<<<<<<<<<<<< @@ -10845,7 +10857,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_34plf(PyObject *__pyx_v_self, CYTH return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":147 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":147 * return Lattice(eval(plf)) * * def plf(self): # <<<<<<<<<<<<<< @@ -10863,7 +10875,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33plf(struct __pyx_obj_5_cdec_Hype int __pyx_clineno = 0; __Pyx_RefNannySetupContext("plf", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":149 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":149 * def plf(self): * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph.""" * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) # <<<<<<<<<<<<<< @@ -10910,7 +10922,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":151 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":151 * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) * * def reweight(self, weights): # <<<<<<<<<<<<<< @@ -10921,28 +10933,25 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v_self, static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("reweight", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":153 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":153 * def reweight(self, weights): * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.""" * if isinstance(weights, SparseVector): # <<<<<<<<<<<<<< * self.hg.Reweight((<SparseVector> weights).vector[0]) * elif isinstance(weights, DenseVector): */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":154 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":154 * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.""" * if isinstance(weights, SparseVector): * self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<< @@ -10953,20 +10962,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec goto __pyx_L3; } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":155 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":155 * if isinstance(weights, SparseVector): * self.hg.Reweight((<SparseVector> weights).vector[0]) * elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<< * self.hg.Reweight((<DenseVector> weights).vector[0]) * else: */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_DenseVector)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_DenseVector)); + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":156 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":156 * self.hg.Reweight((<SparseVector> weights).vector[0]) * elif isinstance(weights, DenseVector): * self.hg.Reweight((<DenseVector> weights).vector[0]) # <<<<<<<<<<<<<< @@ -10978,25 +10984,25 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":158 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":158 * 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_17), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __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 = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __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_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -11004,7 +11010,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec __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_XDECREF(__pyx_t_3); __Pyx_AddTraceback("_cdec.Hypergraph.reweight", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -11026,7 +11032,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":161 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":161 * * property edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -11090,7 +11096,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":163 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":163 * def __get__(self): * cdef unsigned i * for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<< @@ -11101,7 +11107,7 @@ 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; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":164 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":164 * cdef unsigned i * for i in range(self.hg.edges_.size()): * yield HypergraphEdge().init(self.hg, i) # <<<<<<<<<<<<<< @@ -11153,7 +11159,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":167 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":167 * * property nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -11217,7 +11223,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":169 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":169 * def __get__(self): * cdef unsigned i * for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<< @@ -11228,7 +11234,7 @@ 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; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":170 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":170 * cdef unsigned i * for i in range(self.hg.nodes_.size()): * yield HypergraphNode().init(self.hg, i) # <<<<<<<<<<<<<< @@ -11279,7 +11285,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":173 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":173 * * property goal: * def __get__(self): # <<<<<<<<<<<<<< @@ -11297,7 +11303,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":174 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":174 * property goal: * def __get__(self): * return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<< @@ -11338,7 +11344,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":177 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":177 * * property npaths: * def __get__(self): # <<<<<<<<<<<<<< @@ -11355,7 +11361,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":178 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":178 * property npaths: * def __get__(self): * return self.hg.NumberOfPaths() # <<<<<<<<<<<<<< @@ -11393,7 +11399,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_38inside_outside(PyObject *__pyx_v return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":180 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":180 * return self.hg.NumberOfPaths() * * def inside_outside(self): # <<<<<<<<<<<<<< @@ -11417,7 +11423,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("inside_outside", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":182 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":182 * def inside_outside(self): * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature.""" * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() # <<<<<<<<<<<<<< @@ -11426,7 +11432,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_result = new FastSparseVector<prob_t>(); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":183 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":183 * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature.""" * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) # <<<<<<<<<<<<<< @@ -11435,7 +11441,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":184 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":184 * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) * result[0] /= z # <<<<<<<<<<<<<< @@ -11444,7 +11450,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ (__pyx_v_result[0]) /= __pyx_v_z; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":185 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":185 * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) * result[0] /= z * cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -11457,7 +11463,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":186 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":186 * result[0] /= z * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<< @@ -11466,7 +11472,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_vector->vector = new FastSparseVector<double>(); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":187 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":187 * 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) # <<<<<<<<<<<<<< @@ -11475,7 +11481,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":189 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":189 * 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()): # <<<<<<<<<<<<<< @@ -11486,7 +11492,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_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; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":190 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":190 * cdef unsigned i * for i in range(result.size()): * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) # <<<<<<<<<<<<<< @@ -11495,7 +11501,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second)); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":191 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":191 * for i in range(result.size()): * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) * pinc(it[0]) # ++it # <<<<<<<<<<<<<< @@ -11505,7 +11511,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ (++(__pyx_v_it[0])); } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":192 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":192 * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) * pinc(it[0]) # ++it * del it # <<<<<<<<<<<<<< @@ -11514,7 +11520,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ delete __pyx_v_it; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":193 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":193 * pinc(it[0]) # ++it * del it * del result # <<<<<<<<<<<<<< @@ -11523,7 +11529,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ delete __pyx_v_result; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":194 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":194 * del it * del result * return vector # <<<<<<<<<<<<<< @@ -11548,7 +11554,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":201 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":201 * cdef public TRule trule * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<< @@ -11565,7 +11571,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy int __pyx_clineno = 0; __Pyx_RefNannySetupContext("init", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":202 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":202 * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg # <<<<<<<<<<<<<< @@ -11574,7 +11580,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy */ __pyx_v_self->hg = __pyx_v_hg; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":203 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":203 * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg * self.edge = &hg.edges_[i] # <<<<<<<<<<<<<< @@ -11583,7 +11589,7 @@ 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])); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":204 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":204 * self.hg = hg * self.edge = &hg.edges_[i] * self.trule = TRule.__new__(TRule) # <<<<<<<<<<<<<< @@ -11599,7 +11605,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":205 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":205 * self.edge = &hg.edges_[i] * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<< @@ -11608,7 +11614,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_); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":206 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":206 * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) * return self # <<<<<<<<<<<<<< @@ -11643,7 +11649,7 @@ static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":208 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":208 * return self * * def __len__(self): # <<<<<<<<<<<<<< @@ -11656,7 +11662,7 @@ static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cd __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":209 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":209 * * def __len__(self): * return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<< @@ -11683,7 +11689,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject * return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":212 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":212 * * property head_node: * def __get__(self): # <<<<<<<<<<<<<< @@ -11701,7 +11707,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":213 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":213 * property head_node: * def __get__(self): * return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<< @@ -11743,7 +11749,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":216 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":216 * * property tail_nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -11807,7 +11813,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":218 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":218 * def __get__(self): * cdef unsigned i * for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<< @@ -11818,7 +11824,7 @@ 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; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":219 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":219 * cdef unsigned i * for i in range(self.edge.tail_nodes_.size()): * yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i]) # <<<<<<<<<<<<<< @@ -11869,7 +11875,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":222 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":222 * * property span: * def __get__(self): # <<<<<<<<<<<<<< @@ -11888,7 +11894,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":223 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":223 * property span: * def __get__(self): * return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<< @@ -11937,7 +11943,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":226 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":226 * * property src_span: * def __get__(self): # <<<<<<<<<<<<<< @@ -11956,7 +11962,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":227 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":227 * property src_span: * def __get__(self): * return (self.edge.prev_i_, self.edge.prev_j_) # <<<<<<<<<<<<<< @@ -12005,7 +12011,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyOb return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":230 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":230 * * property feature_values: * def __get__(self): # <<<<<<<<<<<<<< @@ -12023,7 +12029,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":231 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":231 * property feature_values: * def __get__(self): * cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -12036,7 +12042,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":232 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":232 * def __get__(self): * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<< @@ -12045,7 +12051,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_); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":233 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":233 * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) * return vector # <<<<<<<<<<<<<< @@ -12081,7 +12087,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":236 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":236 * * property prob: * def __get__(self): # <<<<<<<<<<<<<< @@ -12098,7 +12104,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":237 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":237 * property prob: * def __get__(self): * return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<< @@ -12141,7 +12147,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":239 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":239 * return self.edge.edge_prob_.as_float() * * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<< @@ -12159,7 +12165,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":242 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":242 * if op == 2: # == * return x.edge == y.edge * elif op == 3: # != # <<<<<<<<<<<<<< @@ -12168,7 +12174,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ */ switch (__pyx_v_op) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":240 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":240 * * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -12177,7 +12183,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ */ case 2: - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":241 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":241 * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): * if op == 2: # == * return x.edge == y.edge # <<<<<<<<<<<<<< @@ -12192,7 +12198,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ goto __pyx_L0; break; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":242 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":242 * if op == 2: # == * return x.edge == y.edge * elif op == 3: # != # <<<<<<<<<<<<<< @@ -12201,7 +12207,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ */ case 3: - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":243 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":243 * return x.edge == y.edge * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -12220,7 +12226,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ break; } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":244 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":244 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<< @@ -12256,7 +12262,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__py return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":199 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":199 * cdef hypergraph.Hypergraph* hg * cdef hypergraph.HypergraphEdge* edge * cdef public TRule trule # <<<<<<<<<<<<<< @@ -12341,7 +12347,7 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_c return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":250 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":250 * cdef hypergraph.HypergraphNode* node * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<< @@ -12354,7 +12360,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":251 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":251 * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg # <<<<<<<<<<<<<< @@ -12363,7 +12369,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy */ __pyx_v_self->hg = __pyx_v_hg; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":252 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":252 * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg * self.node = &hg.nodes_[i] # <<<<<<<<<<<<<< @@ -12372,7 +12378,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])); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":253 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":253 * self.hg = hg * self.node = &hg.nodes_[i] * return self # <<<<<<<<<<<<<< @@ -12403,7 +12409,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":256 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":256 * * property in_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -12467,7 +12473,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":258 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":258 * def __get__(self): * cdef unsigned i * for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<< @@ -12478,7 +12484,7 @@ 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; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":259 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":259 * cdef unsigned i * for i in range(self.node.in_edges_.size()): * yield HypergraphEdge().init(self.hg, self.node.in_edges_[i]) # <<<<<<<<<<<<<< @@ -12530,7 +12536,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject * return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":262 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":262 * * property out_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -12594,7 +12600,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_ __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":264 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":264 * def __get__(self): * cdef unsigned i * for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<< @@ -12605,7 +12611,7 @@ 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; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":265 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":265 * cdef unsigned i * for i in range(self.node.out_edges_.size()): * yield HypergraphEdge().init(self.hg, self.node.out_edges_[i]) # <<<<<<<<<<<<<< @@ -12656,7 +12662,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":268 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":268 * * property span: * def __get__(self): # <<<<<<<<<<<<<< @@ -12674,7 +12680,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":269 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":269 * property span: * def __get__(self): * return next(self.in_edges).span # <<<<<<<<<<<<<< @@ -12718,7 +12724,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":272 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":272 * * property cat: * def __get__(self): # <<<<<<<<<<<<<< @@ -12736,7 +12742,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":273 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":273 * property cat: * def __get__(self): * if self.node.cat_: # <<<<<<<<<<<<<< @@ -12745,7 +12751,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_ */ if (__pyx_v_self->node->cat_) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":274 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":274 * def __get__(self): * if self.node.cat_: * return str(TDConvert(-self.node.cat_).c_str()) # <<<<<<<<<<<<<< @@ -12800,7 +12806,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":276 +/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":276 * return str(TDConvert(-self.node.cat_).c_str()) * * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<< @@ -12818,7 +12824,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":279 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":279 * if op == 2: # == * return x.node == y.node * elif op == 3: # != # <<<<<<<<<<<<<< @@ -12827,7 +12833,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 */ switch (__pyx_v_op) { - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":277 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":277 * * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -12836,7 +12842,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 */ case 2: - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":278 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":278 * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): * if op == 2: # == * return x.node == y.node # <<<<<<<<<<<<<< @@ -12851,7 +12857,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 goto __pyx_L0; break; - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":279 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":279 * if op == 2: # == * return x.node == y.node * elif op == 3: # != # <<<<<<<<<<<<<< @@ -12860,7 +12866,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 */ case 3: - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":280 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":280 * return x.node == y.node * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -12878,7 +12884,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 break; } - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":281 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":281 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<< @@ -12915,7 +12921,7 @@ static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":6 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":6 * cdef lattice.Lattice* lattice * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -12928,7 +12934,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":7 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":7 * * def __cinit__(self): * self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<< @@ -12993,7 +12999,7 @@ static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":9 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":9 * self.lattice = new lattice.Lattice() * * def __init__(self, inp): # <<<<<<<<<<<<<< @@ -13006,9 +13012,9 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ PyObject *__pyx_v_arcs = NULL; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; @@ -13018,30 +13024,27 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":12 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":12 * """Lattice(tuple) -> Lattice from node list. * Lattice(string) -> Lattice from PLF representation.""" * if isinstance(inp, tuple): # <<<<<<<<<<<<<< * self.lattice.resize(len(inp)) * for i, arcs in enumerate(inp): */ - __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type))); - __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) { + __pyx_t_1 = PyTuple_Check(__pyx_v_inp); + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":13 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":13 * Lattice(string) -> Lattice from PLF representation.""" * if isinstance(inp, tuple): * 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 = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->lattice->resize(__pyx_t_3); + __pyx_t_2 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->lattice->resize(__pyx_t_2); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":14 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":14 * if isinstance(inp, tuple): * self.lattice.resize(len(inp)) * for i, arcs in enumerate(inp): # <<<<<<<<<<<<<< @@ -13049,29 +13052,29 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ * elif isinstance(inp, basestring): */ __Pyx_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; + __pyx_t_3 = __pyx_int_0; if (PyList_CheckExact(__pyx_v_inp) || PyTuple_CheckExact(__pyx_v_inp)) { - __pyx_t_4 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 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 = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_4)) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; #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++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #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 = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __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 (__pyx_t_2 >= 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++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #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 = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_6 = __pyx_t_5(__pyx_t_4); @@ -13087,16 +13090,16 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ __Pyx_XDECREF(__pyx_v_arcs); __pyx_v_arcs = __pyx_t_6; __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); __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 = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_i = __pyx_t_3; + __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_6; + __Pyx_DECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_6; __pyx_t_6 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":15 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":15 * self.lattice.resize(len(inp)) * for i, arcs in enumerate(inp): * self[i] = arcs # <<<<<<<<<<<<<< @@ -13106,58 +13109,55 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ if (PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_i, __pyx_v_arcs) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __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; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L3; } - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":16 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":16 * for i, arcs in enumerate(inp): * self[i] = arcs * elif isinstance(inp, basestring): # <<<<<<<<<<<<<< * lattice.ConvertTextOrPLF(as_str(inp), self.lattice) * 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[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyObject_IsInstance(__pyx_v_inp, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":17 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":17 * self[i] = arcs * elif isinstance(inp, basestring): * lattice.ConvertTextOrPLF(as_str(inp), self.lattice) # <<<<<<<<<<<<<< * else: * raise TypeError('cannot create lattice from %s' % type(inp)) */ - __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_v_inp, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __pyx_convert_string_from_py_(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_v_inp, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __pyx_convert_string_from_py_(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; LatticeTools::ConvertTextOrPLF(__pyx_t_7, __pyx_v_self->lattice); goto __pyx_L3; } /*else*/ { - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":19 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":19 * lattice.ConvertTextOrPLF(as_str(inp), self.lattice) * else: * raise TypeError('cannot create lattice from %s' % type(inp)) # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 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_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 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_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__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[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -13165,7 +13165,7 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("_cdec.Lattice.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -13186,7 +13186,7 @@ static void __pyx_pw_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":21 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":21 * raise TypeError('cannot create lattice from %s' % type(inp)) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -13198,7 +13198,7 @@ static void __pyx_pf_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":22 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":22 * * def __dealloc__(self): * del self.lattice # <<<<<<<<<<<<<< @@ -13231,7 +13231,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, P return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":24 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":24 * del self.lattice * * def __getitem__(self, int index): # <<<<<<<<<<<<<< @@ -13261,7 +13261,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":25 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":25 * * def __getitem__(self, int index): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -13276,7 +13276,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L __pyx_t_3 = (!__pyx_t_1); if (__pyx_t_3) { - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":26 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":26 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -13292,7 +13292,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":27 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":27 * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') * arcs = [] # <<<<<<<<<<<<<< @@ -13301,10 +13301,10 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L */ __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_v_arcs = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":28 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":28 * raise IndexError('lattice index out of range') * arcs = [] * cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<< @@ -13313,7 +13313,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L */ __pyx_v_arc_vector = ((__pyx_v_self->lattice[0])[__pyx_v_index]); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":31 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":31 * cdef lattice.LatticeArc* arc * cdef unsigned i * for i in range(arc_vector.size()): # <<<<<<<<<<<<<< @@ -13324,7 +13324,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__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; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":32 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":32 * cdef unsigned i * for i in range(arc_vector.size()): * arc = &arc_vector[i] # <<<<<<<<<<<<<< @@ -13333,7 +13333,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L */ __pyx_v_arc = (&(__pyx_v_arc_vector[__pyx_v_i])); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":33 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":33 * for i in range(arc_vector.size()): * arc = &arc_vector[i] * label = unicode(TDConvert(arc.label).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -13357,7 +13357,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L __pyx_v_label = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":34 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":34 * arc = &arc_vector[i] * label = unicode(TDConvert(arc.label).c_str(), 'utf8') * arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<< @@ -13383,7 +13383,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; } - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":35 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":35 * label = unicode(TDConvert(arc.label).c_str(), 'utf8') * arcs.append((label, arc.cost, arc.dist2next)) * return tuple(arcs) # <<<<<<<<<<<<<< @@ -13439,7 +13439,7 @@ static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":37 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":37 * return tuple(arcs) * * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<< @@ -13473,7 +13473,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":38 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":38 * * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -13488,7 +13488,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __pyx_t_3 = (!__pyx_t_1); if (__pyx_t_3) { - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":39 + /* "/usr0/home/cdyer/cdec-merge/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') # <<<<<<<<<<<<<< @@ -13504,7 +13504,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":41 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":41 * raise IndexError('lattice index out of range') * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<< @@ -13550,8 +13550,11 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __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 = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __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_GOTREF(__pyx_t_7); __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;} + __Pyx_GOTREF(__pyx_t_8); #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else @@ -13588,7 +13591,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __pyx_v_dist2next = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":42 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":42 * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: * label_str = as_str(label) # <<<<<<<<<<<<<< @@ -13601,7 +13604,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __pyx_v_label_str = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":43 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":43 * for (label, cost, dist2next) in arcs: * label_str = as_str(label) * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) # <<<<<<<<<<<<<< @@ -13613,7 +13616,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __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 = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_arc = new LatticeArc(TD::Convert(__pyx_t_11), __pyx_t_12, __pyx_t_13); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":44 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":44 * label_str = as_str(label) * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) # <<<<<<<<<<<<<< @@ -13622,7 +13625,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice */ ((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0])); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":45 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":45 * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) * del arc # <<<<<<<<<<<<<< @@ -13664,7 +13667,7 @@ static Py_ssize_t __pyx_pw_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":47 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":47 * del arc * * def __len__(self): # <<<<<<<<<<<<<< @@ -13677,7 +13680,7 @@ static Py_ssize_t __pyx_pf_5_cdec_7Lattice_10__len__(struct __pyx_obj_5_cdec_Lat __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":48 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":48 * * def __len__(self): * return self.lattice.size() # <<<<<<<<<<<<<< @@ -13704,7 +13707,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":50 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":50 * return self.lattice.size() * * def __str__(self): # <<<<<<<<<<<<<< @@ -13722,7 +13725,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Latt int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":51 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":51 * * def __str__(self): * return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) # <<<<<<<<<<<<<< @@ -13768,7 +13771,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":53 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":53 * return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) * * def __unicode__(self): # <<<<<<<<<<<<<< @@ -13786,7 +13789,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__unicode__", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":54 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":54 * * def __unicode__(self): * return unicode(str(self), 'utf8') # <<<<<<<<<<<<<< @@ -13842,7 +13845,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":56 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":56 * return unicode(str(self), 'utf8') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -13905,7 +13908,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *_ __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":58 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":58 * def __iter__(self): * cdef unsigned i * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -13916,7 +13919,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__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; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":59 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":59 * cdef unsigned i * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -13977,7 +13980,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CY return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":63 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< @@ -14054,7 +14057,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":64 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":64 * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): * yield 'digraph lattice {' # <<<<<<<<<<<<<< @@ -14071,7 +14074,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L4_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":65 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":65 * def lines(): * yield 'digraph lattice {' * yield 'rankdir = LR;' # <<<<<<<<<<<<<< @@ -14088,7 +14091,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L5_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":66 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":66 * yield 'digraph lattice {' * yield 'rankdir = LR;' * yield 'node [shape=circle];' # <<<<<<<<<<<<<< @@ -14105,7 +14108,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L6_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":67 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":67 * yield 'rankdir = LR;' * yield 'node [shape=circle];' * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -14168,7 +14171,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_cur_scope->__pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":68 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":68 * yield 'node [shape=circle];' * for i in range(len(self)): * for label, weight, delta in self[i]: # <<<<<<<<<<<<<< @@ -14239,8 +14242,11 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __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_GOTREF(__pyx_t_9); __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;} + __Pyx_GOTREF(__pyx_t_10); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else @@ -14283,7 +14289,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_cur_scope->__pyx_v_delta = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":69 + /* "/usr0/home/cdyer/cdec-merge/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('"', '\\"')) # <<<<<<<<<<<<<< @@ -14343,7 +14349,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":70 + /* "/usr0/home/cdyer/cdec-merge/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) # <<<<<<<<<<<<<< @@ -14369,7 +14375,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L14_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":71 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":71 * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) * yield '%d [shape=doublecircle]' % len(self) * yield '}' # <<<<<<<<<<<<<< @@ -14404,7 +14410,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj return NULL; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":61 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":61 * yield self[i] * * def todot(self): # <<<<<<<<<<<<<< @@ -14434,19 +14440,19 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":63 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * 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_36)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5_cdec_7Lattice_5todot_1lines, 0, __pyx_n_s_38, ((PyObject*)__pyx_cur_scope), __pyx_n_s___cdec, ((PyObject *)__pyx_k_codeobj_36)); 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; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":72 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":72 * yield '%d [shape=doublecircle]' % len(self) * yield '}' * return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<< @@ -14454,9 +14460,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic * def as_hypergraph(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_38), __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_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 = 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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_pf_5_cdec_7Lattice_5todot_lines(__pyx_v_lines); 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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -14470,7 +14476,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic __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_39), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 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; @@ -14505,7 +14511,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":74 +/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":74 * return '\n'.join(lines()).encode('utf8') * * def as_hypergraph(self): # <<<<<<<<<<<<<< @@ -14526,7 +14532,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("as_hypergraph", 0); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":76 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":76 * def as_hypergraph(self): * """lattice.as_hypergraph() -> Hypergraph representation of the lattice.""" * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) # <<<<<<<<<<<<<< @@ -14539,7 +14545,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde __pyx_v_result = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":77 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":77 * """lattice.as_hypergraph() -> Hypergraph representation of the lattice.""" * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) * result.hg = new hypergraph.Hypergraph() # <<<<<<<<<<<<<< @@ -14548,7 +14554,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde */ __pyx_v_result->hg = new Hypergraph(); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":78 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":78 * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) * result.hg = new hypergraph.Hypergraph() * cdef bytes plf = str(self) # <<<<<<<<<<<<<< @@ -14567,7 +14573,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde __pyx_v_plf = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":79 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":79 * result.hg = new hypergraph.Hypergraph() * cdef bytes plf = str(self) * hypergraph.ReadFromPLF(plf, result.hg) # <<<<<<<<<<<<<< @@ -14576,7 +14582,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde __pyx_t_3 = __pyx_convert_string_from_py_(((PyObject *)__pyx_v_plf)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} HypergraphIO::ReadFromPLF(__pyx_t_3, __pyx_v_result->hg); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":80 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":80 * cdef bytes plf = str(self) * hypergraph.ReadFromPLF(plf, result.hg) * return result # <<<<<<<<<<<<<< @@ -14601,7 +14607,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":3 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":3 * cimport mteval * * cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<< @@ -14613,29 +14619,27 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_stats = NULL; struct __pyx_obj_5_cdec_SufficientStats *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; + EvaluationMetric *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("as_stats", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":4 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":4 * * cdef SufficientStats as_stats(x, y): * if isinstance(x, SufficientStats): # <<<<<<<<<<<<<< * return x * elif x == 0 and isinstance(y, SufficientStats): */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_x, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SufficientStats)); + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":5 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":5 * cdef SufficientStats as_stats(x, y): * if isinstance(x, SufficientStats): * return x # <<<<<<<<<<<<<< @@ -14650,40 +14654,37 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject goto __pyx_L3; } - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":6 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":6 * if isinstance(x, SufficientStats): * return x * elif x == 0 and isinstance(y, SufficientStats): # <<<<<<<<<<<<<< * stats = SufficientStats() * stats.stats = new mteval.SufficientStats() */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __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[5]; __pyx_lineno = 6; __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*)__pyx_ptype_5_cdec_SufficientStats)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_y, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_5_cdec_SufficientStats)); __pyx_t_4 = __pyx_t_3; } else { - __pyx_t_4 = __pyx_t_2; + __pyx_t_4 = __pyx_t_1; } if (__pyx_t_4) { - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":7 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":7 * return x * elif x == 0 and isinstance(y, SufficientStats): * stats = SufficientStats() # <<<<<<<<<<<<<< * stats.stats = new mteval.SufficientStats() * stats.metric = (<SufficientStats> y).metric */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_stats = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_stats = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":8 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":8 * elif x == 0 and isinstance(y, SufficientStats): * stats = SufficientStats() * stats.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<< @@ -14692,16 +14693,17 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject */ __pyx_v_stats->stats = new SufficientStats(); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":9 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":9 * stats = SufficientStats() * stats.stats = new mteval.SufficientStats() * stats.metric = (<SufficientStats> y).metric # <<<<<<<<<<<<<< * return stats * */ - __pyx_v_stats->metric = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_y)->metric; + __pyx_t_5 = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_y)->metric; + __pyx_v_stats->metric = __pyx_t_5; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":10 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":10 * stats.stats = new mteval.SufficientStats() * stats.metric = (<SufficientStats> y).metric * return stats # <<<<<<<<<<<<<< @@ -14719,7 +14721,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject __pyx_r = ((struct __pyx_obj_5_cdec_SufficientStats *)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.as_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -14740,7 +14742,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":17 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":17 * * property words: * def __get__(self): # <<<<<<<<<<<<<< @@ -14759,7 +14761,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":18 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":18 * property words: * def __get__(self): * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8') # <<<<<<<<<<<<<< @@ -14810,7 +14812,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":21 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":21 * * property fmap: * def __get__(self): # <<<<<<<<<<<<<< @@ -14828,7 +14830,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":22 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":22 * property fmap: * def __get__(self): * cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -14841,7 +14843,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde __pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":23 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":23 * def __get__(self): * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<< @@ -14850,7 +14852,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde */ __pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_v_self->candidate->fmap); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":24 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":24 * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) * return fmap # <<<<<<<<<<<<<< @@ -14886,7 +14888,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":14 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":14 * cdef class Candidate: * cdef mteval.const_Candidate* candidate * cdef public float score # <<<<<<<<<<<<<< @@ -14962,7 +14964,7 @@ static void __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_sel __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":30 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":30 * cdef mteval.EvaluationMetric* metric * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -14974,7 +14976,7 @@ static void __pyx_pf_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct _ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":31 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":31 * * def __dealloc__(self): * del self.stats # <<<<<<<<<<<<<< @@ -14997,7 +14999,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5score_1__get__(PyObject *__p return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":34 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":34 * * property score: * def __get__(self): # <<<<<<<<<<<<<< @@ -15014,7 +15016,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":35 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":35 * property score: * def __get__(self): * return self.metric.ComputeScore(self.stats[0]) # <<<<<<<<<<<<<< @@ -15051,7 +15053,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":38 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":38 * * property detail: * def __get__(self): # <<<<<<<<<<<<<< @@ -15069,7 +15071,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":39 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":39 * property detail: * def __get__(self): * return str(self.metric.DetailedScore(self.stats[0]).c_str()) # <<<<<<<<<<<<<< @@ -15115,7 +15117,7 @@ static Py_ssize_t __pyx_pw_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":41 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":41 * return str(self.metric.DetailedScore(self.stats[0]).c_str()) * * def __len__(self): # <<<<<<<<<<<<<< @@ -15128,7 +15130,7 @@ static Py_ssize_t __pyx_pf_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_5_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":42 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":42 * * def __len__(self): * return self.stats.size() # <<<<<<<<<<<<<< @@ -15156,7 +15158,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":44 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":44 * return self.stats.size() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -15220,7 +15222,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":45 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":45 * * def __iter__(self): * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -15279,7 +15281,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO __pyx_cur_scope->__pyx_v_i = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":46 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":46 * def __iter__(self): * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -15343,7 +15345,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":48 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":48 * yield self[i] * * def __getitem__(self, int index): # <<<<<<<<<<<<<< @@ -15363,7 +15365,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":49 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":49 * * def __getitem__(self, int index): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -15378,14 +15380,14 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj __pyx_t_3 = (!__pyx_t_1); if (__pyx_t_3) { - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":50 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":50 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<< * return self.stats[0][index] * */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_41), 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_42), 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; @@ -15394,7 +15396,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":51 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":51 * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') * return self.stats[0][index] # <<<<<<<<<<<<<< @@ -15436,7 +15438,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":53 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":53 * return self.stats[0][index] * * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<< @@ -15449,7 +15451,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iadd__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":54 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":54 * * def __iadd__(SufficientStats self, SufficientStats other): * self.stats[0] += other.stats[0] # <<<<<<<<<<<<<< @@ -15458,7 +15460,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_ */ (__pyx_v_self->stats[0]) += (__pyx_v_other->stats[0]); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":55 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":55 * def __iadd__(SufficientStats self, SufficientStats other): * self.stats[0] += other.stats[0] * return self # <<<<<<<<<<<<<< @@ -15488,7 +15490,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":57 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":57 * return self * * def __add__(x, y): # <<<<<<<<<<<<<< @@ -15503,12 +15505,13 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + EvaluationMetric *__pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":58 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":58 * * def __add__(x, y): * cdef SufficientStats sx = as_stats(x, y) # <<<<<<<<<<<<<< @@ -15520,7 +15523,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x __pyx_v_sx = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":59 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":59 * def __add__(x, y): * cdef SufficientStats sx = as_stats(x, y) * cdef SufficientStats sy = as_stats(y, x) # <<<<<<<<<<<<<< @@ -15532,7 +15535,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x __pyx_v_sy = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":60 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":60 * cdef SufficientStats sx = as_stats(x, y) * cdef SufficientStats sy = as_stats(y, x) * cdef SufficientStats result = SufficientStats() # <<<<<<<<<<<<<< @@ -15544,7 +15547,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x __pyx_v_result = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":61 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":61 * cdef SufficientStats sy = as_stats(y, x) * cdef SufficientStats result = SufficientStats() * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) # <<<<<<<<<<<<<< @@ -15553,16 +15556,17 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x */ __pyx_v_result->stats = new SufficientStats(operator+((__pyx_v_sx->stats[0]), (__pyx_v_sy->stats[0]))); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":62 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":62 * cdef SufficientStats result = SufficientStats() * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) * result.metric = sx.metric # <<<<<<<<<<<<<< * return result * */ - __pyx_v_result->metric = __pyx_v_sx->metric; + __pyx_t_2 = __pyx_v_sx->metric; + __pyx_v_result->metric = __pyx_t_2; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":63 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":63 * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) * result.metric = sx.metric * return result # <<<<<<<<<<<<<< @@ -15641,7 +15645,7 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":70 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":70 * cdef mteval.CandidateSet* cs * * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<< @@ -15652,9 +15656,10 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_evaluator) { int __pyx_r; __Pyx_RefNannyDeclarations + EvaluationMetric *__pyx_t_1; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":71 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":71 * * def __cinit__(self, SegmentEvaluator evaluator): * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) # <<<<<<<<<<<<<< @@ -15663,16 +15668,17 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand */ __pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator>((__pyx_v_evaluator->scorer[0])); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":72 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":72 * def __cinit__(self, SegmentEvaluator evaluator): * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) * self.metric = evaluator.metric # <<<<<<<<<<<<<< * self.cs = new mteval.CandidateSet() * */ - __pyx_v_self->metric = __pyx_v_evaluator->metric; + __pyx_t_1 = __pyx_v_evaluator->metric; + __pyx_v_self->metric = __pyx_t_1; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":73 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":73 * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) * self.metric = evaluator.metric * self.cs = new mteval.CandidateSet() # <<<<<<<<<<<<<< @@ -15695,7 +15701,7 @@ static void __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self) __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":75 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":75 * self.cs = new mteval.CandidateSet() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -15707,7 +15713,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":76 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":76 * * def __dealloc__(self): * del self.scorer # <<<<<<<<<<<<<< @@ -15716,7 +15722,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p */ delete __pyx_v_self->scorer; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":77 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":77 * def __dealloc__(self): * del self.scorer * del self.cs # <<<<<<<<<<<<<< @@ -15739,7 +15745,7 @@ static Py_ssize_t __pyx_pw_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":79 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":79 * del self.cs * * def __len__(self): # <<<<<<<<<<<<<< @@ -15752,7 +15758,7 @@ static Py_ssize_t __pyx_pf_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_5_cde __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":80 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":80 * * def __len__(self): * return self.cs.size() # <<<<<<<<<<<<<< @@ -15789,7 +15795,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":82 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":82 * return self.cs.size() * * def __getitem__(self,int k): # <<<<<<<<<<<<<< @@ -15809,7 +15815,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":83 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":83 * * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): # <<<<<<<<<<<<<< @@ -15823,14 +15829,14 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":84 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":84 * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<< * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_43), 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_44), 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; @@ -15839,7 +15845,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":85 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":85 * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') * cdef Candidate candidate = Candidate() # <<<<<<<<<<<<<< @@ -15851,7 +15857,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ __pyx_v_candidate = ((struct __pyx_obj_5_cdec_Candidate *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":86 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":86 * raise IndexError('candidate set index out of range') * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] # <<<<<<<<<<<<<< @@ -15860,7 +15866,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ */ __pyx_v_candidate->candidate = (&((__pyx_v_self->cs[0])[__pyx_v_k])); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":87 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":87 * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] * candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) # <<<<<<<<<<<<<< @@ -15869,7 +15875,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ */ __pyx_v_candidate->score = __pyx_v_self->metric->ComputeScore(((__pyx_v_self->cs[0])[__pyx_v_k]).eval_feats); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":88 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":88 * candidate.candidate = &self.cs[0][k] * candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) * return candidate # <<<<<<<<<<<<<< @@ -15906,7 +15912,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":90 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":90 * return candidate * * def __iter__(self): # <<<<<<<<<<<<<< @@ -15969,7 +15975,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":92 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":92 * def __iter__(self): * cdef unsigned i * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -15980,7 +15986,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":93 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":93 * cdef unsigned i * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -16078,7 +16084,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":95 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":95 * yield self[i] * * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<< @@ -16091,7 +16097,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_5_c __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_kbest", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":98 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":98 * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses * from the hypergraph and add them to the candidate set.""" * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) # <<<<<<<<<<<<<< @@ -16115,7 +16121,7 @@ static void __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_se __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":104 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":104 * cdef mteval.EvaluationMetric* metric * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -16127,7 +16133,7 @@ static void __pyx_pf_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":105 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":105 * * def __dealloc__(self): * del self.scorer # <<<<<<<<<<<<<< @@ -16151,7 +16157,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":107 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":107 * del self.scorer * * def evaluate(self, sentence): # <<<<<<<<<<<<<< @@ -16165,14 +16171,15 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - std::string __pyx_t_3; + EvaluationMetric *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + std::string __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("evaluate", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":110 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":110 * """se.evaluate(sentence) -> SufficientStats for the given hypothesis.""" * cdef vector[WordID] hyp * cdef SufficientStats sf = SufficientStats() # <<<<<<<<<<<<<< @@ -16184,16 +16191,17 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 __pyx_v_sf = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":111 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":111 * cdef vector[WordID] hyp * cdef SufficientStats sf = SufficientStats() * sf.metric = self.metric # <<<<<<<<<<<<<< * sf.stats = new mteval.SufficientStats() * ConvertSentence(as_str(sentence.strip()), &hyp) */ - __pyx_v_sf->metric = __pyx_v_self->metric; + __pyx_t_2 = __pyx_v_self->metric; + __pyx_v_sf->metric = __pyx_t_2; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":112 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":112 * cdef SufficientStats sf = SufficientStats() * sf.metric = self.metric * sf.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<< @@ -16202,7 +16210,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 */ __pyx_v_sf->stats = new SufficientStats(); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":113 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":113 * sf.metric = self.metric * sf.stats = new mteval.SufficientStats() * ConvertSentence(as_str(sentence.strip()), &hyp) # <<<<<<<<<<<<<< @@ -16211,17 +16219,17 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __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[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __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_t_1 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_2, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __pyx_convert_string_from_py_(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_convert_string_from_py_(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - TD::ConvertSentence(__pyx_t_3, (&__pyx_v_hyp)); + TD::ConvertSentence(__pyx_t_4, (&__pyx_v_hyp)); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":114 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":114 * sf.stats = new mteval.SufficientStats() * ConvertSentence(as_str(sentence.strip()), &hyp) * self.scorer.get().Evaluate(hyp, sf.stats) # <<<<<<<<<<<<<< @@ -16230,7 +16238,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 */ __pyx_v_self->scorer->get()->Evaluate(__pyx_v_hyp, __pyx_v_sf->stats); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":115 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":115 * ConvertSentence(as_str(sentence.strip()), &hyp) * self.scorer.get().Evaluate(hyp, sf.stats) * return sf # <<<<<<<<<<<<<< @@ -16246,7 +16254,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("_cdec.SegmentEvaluator.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -16268,7 +16276,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__p return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":117 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":117 * return sf * * def candidate_set(self): # <<<<<<<<<<<<<< @@ -16286,7 +16294,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("candidate_set", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":119 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":119 * def candidate_set(self): * """se.candidate_set() -> Candidate set using this segment evaluator for scoring.""" * return CandidateSet(self) # <<<<<<<<<<<<<< @@ -16330,7 +16338,7 @@ static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject * static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0}; PyObject* values[1] = {0}; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":125 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":125 * cdef mteval.EvaluationMetric* metric * * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<< @@ -16395,7 +16403,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":126 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":126 * * def __cinit__(self, bytes name=None): * if name: # <<<<<<<<<<<<<< @@ -16405,7 +16413,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p __pyx_t_1 = (((PyObject *)__pyx_v_name) != Py_None) && (PyBytes_GET_SIZE(((PyObject *)__pyx_v_name)) != 0); if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":127 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":127 * def __cinit__(self, bytes name=None): * if name: * self.name = new string(name) # <<<<<<<<<<<<<< @@ -16413,10 +16421,15 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p * */ __pyx_t_2 = PyBytes_AsString(((PyObject *)__pyx_v_name)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try {__pyx_t_3 = new std::string(__pyx_t_2);} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_3 = new std::string(__pyx_t_2); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_self->name = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":128 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":128 * if name: * self.name = new string(name) * self.metric = mteval.MetricInstance(self.name[0]) # <<<<<<<<<<<<<< @@ -16447,7 +16460,7 @@ static void __pyx_pw_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":130 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":130 * self.metric = mteval.MetricInstance(self.name[0]) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -16459,7 +16472,7 @@ static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":131 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":131 * * def __dealloc__(self): * del self.name # <<<<<<<<<<<<<< @@ -16518,7 +16531,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":133 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":133 * del self.name * * def __call__(self, refs): # <<<<<<<<<<<<<< @@ -16533,8 +16546,8 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; std::vector<std::vector<WordID> > *__pyx_t_3; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); @@ -16542,55 +16555,58 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score std::vector<WordID> *__pyx_t_7; PyObject *__pyx_t_8 = NULL; std::string __pyx_t_9; + EvaluationMetric *__pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__call__", 0); __Pyx_INCREF(__pyx_v_refs); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":134 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":134 * * def __call__(self, refs): * if isinstance(refs, basestring): # <<<<<<<<<<<<<< * refs = [refs] * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() */ - __pyx_t_1 = __pyx_builtin_basestring; - __Pyx_INCREF(__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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyObject_IsInstance(__pyx_v_refs, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":135 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":135 * def __call__(self, refs): * if isinstance(refs, basestring): * refs = [refs] # <<<<<<<<<<<<<< * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() * cdef vector[WordID]* refv */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_refs); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_refs); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_refs); __Pyx_GIVEREF(__pyx_v_refs); __Pyx_DECREF(__pyx_v_refs); - __pyx_v_refs = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_refs = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":136 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":136 * if isinstance(refs, basestring): * refs = [refs] * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<< * cdef vector[WordID]* refv * for ref in refs: */ - try {__pyx_t_3 = new std::vector<std::vector<WordID> >();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_3 = new std::vector<std::vector<WordID> >(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_refsv = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":138 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":138 * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() * cdef vector[WordID]* refv * for ref in refs: # <<<<<<<<<<<<<< @@ -16598,30 +16614,30 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score * ConvertSentence(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_4 = 0; + __pyx_t_2 = __pyx_v_refs; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { - __pyx_t_6 = __pyx_t_5(__pyx_t_1); + __pyx_t_6 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_6)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); @@ -16635,17 +16651,22 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __pyx_v_ref = __pyx_t_6; __pyx_t_6 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":139 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":139 * cdef vector[WordID]* refv * for ref in refs: * refv = new vector[WordID]() # <<<<<<<<<<<<<< * ConvertSentence(as_str(ref.strip()), refv) * refsv.push_back(refv[0]) */ - try {__pyx_t_7 = new std::vector<WordID>();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_7 = new std::vector<WordID>(); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_refv = __pyx_t_7; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":140 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":140 * for ref in refs: * refv = new vector[WordID]() * ConvertSentence(as_str(ref.strip()), refv) # <<<<<<<<<<<<<< @@ -16664,7 +16685,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; TD::ConvertSentence(__pyx_t_9, __pyx_v_refv); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":141 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":141 * refv = new vector[WordID]() * ConvertSentence(as_str(ref.strip()), refv) * refsv.push_back(refv[0]) # <<<<<<<<<<<<<< @@ -16673,7 +16694,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score */ __pyx_v_refsv->push_back((__pyx_v_refv[0])); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":142 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":142 * ConvertSentence(as_str(ref.strip()), refv) * refsv.push_back(refv[0]) * del refv # <<<<<<<<<<<<<< @@ -16682,30 +16703,31 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score */ delete __pyx_v_refv; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":144 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":144 * del refv * cdef unsigned i * cdef SegmentEvaluator evaluator = SegmentEvaluator() # <<<<<<<<<<<<<< * evaluator.metric = self.metric * evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SegmentEvaluator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_evaluator = ((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SegmentEvaluator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_evaluator = ((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":145 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":145 * cdef unsigned i * cdef SegmentEvaluator evaluator = SegmentEvaluator() * evaluator.metric = self.metric # <<<<<<<<<<<<<< * evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( * self.metric.CreateSegmentEvaluator(refsv[0])) */ - __pyx_v_evaluator->metric = __pyx_v_self->metric; + __pyx_t_10 = __pyx_v_self->metric; + __pyx_v_evaluator->metric = __pyx_t_10; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":146 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":146 * cdef SegmentEvaluator evaluator = SegmentEvaluator() * evaluator.metric = self.metric * evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( # <<<<<<<<<<<<<< @@ -16714,7 +16736,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score */ __pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator>(__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0]))); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":148 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":148 * evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( * self.metric.CreateSegmentEvaluator(refsv[0])) * del refsv # in theory should not delete but store in SegmentEvaluator # <<<<<<<<<<<<<< @@ -16723,7 +16745,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score */ delete __pyx_v_refsv; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":149 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":149 * self.metric.CreateSegmentEvaluator(refsv[0])) * del refsv # in theory should not delete but store in SegmentEvaluator * return evaluator # <<<<<<<<<<<<<< @@ -16738,7 +16760,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __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_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("_cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16763,7 +16785,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":151 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":151 * return evaluator * * def __str__(self): # <<<<<<<<<<<<<< @@ -16781,7 +16803,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":152 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":152 * * def __str__(self): * return str(self.name.c_str()) # <<<<<<<<<<<<<< @@ -16816,7 +16838,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":154 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":154 * return str(self.name.c_str()) * * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<< @@ -16842,7 +16864,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_compute_score", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":155 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":155 * * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): * cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<< @@ -16852,7 +16874,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_))); __pyx_v_metric = ((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":156 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":156 * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): * cdef Metric metric = <Metric> metric_ * cdef list ss = [] # <<<<<<<<<<<<<< @@ -16861,10 +16883,10 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ss = __pyx_t_1; + __pyx_v_ss = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":158 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":158 * cdef list ss = [] * cdef unsigned i * for i in range(stats.size()): # <<<<<<<<<<<<<< @@ -16875,7 +16897,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":159 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":159 * cdef unsigned i * for i in range(stats.size()): * ss.append(stats[0][i]) # <<<<<<<<<<<<<< @@ -16888,7 +16910,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":160 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":160 * for i in range(stats.size()): * ss.append(stats[0][i]) * return metric.score(ss) # <<<<<<<<<<<<<< @@ -16926,7 +16948,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":162 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":162 * return metric.score(ss) * * cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<< @@ -16953,7 +16975,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_compute_sufficient_stats", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":166 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":166 * vector[string]* refs, * mteval.SufficientStats* out): * cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<< @@ -16963,7 +16985,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_))); __pyx_v_metric = ((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":167 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":167 * mteval.SufficientStats* out): * cdef Metric metric = <Metric> metric_ * cdef list refs_ = [] # <<<<<<<<<<<<<< @@ -16972,10 +16994,10 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_refs_ = __pyx_t_1; + __pyx_v_refs_ = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":169 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":169 * cdef list refs_ = [] * cdef unsigned i * for i in range(refs.size()): # <<<<<<<<<<<<<< @@ -16986,7 +17008,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":170 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":170 * cdef unsigned i * for i in range(refs.size()): * refs_.append(str(refs[0][i].c_str())) # <<<<<<<<<<<<<< @@ -17007,7 +17029,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":171 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":171 * for i in range(refs.size()): * refs_.append(str(refs[0][i].c_str())) * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) # <<<<<<<<<<<<<< @@ -17042,7 +17064,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __pyx_v_ss = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":172 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":172 * refs_.append(str(refs[0][i].c_str())) * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) * out.fields.resize(len(ss)) # <<<<<<<<<<<<<< @@ -17056,7 +17078,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_out->fields.resize(__pyx_t_7); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":173 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":173 * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) * out.fields.resize(len(ss)) * for i in range(len(ss)): # <<<<<<<<<<<<<< @@ -17071,7 +17093,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":174 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":174 * out.fields.resize(len(ss)) * for i in range(len(ss)): * out.fields[i] = ss[i] # <<<<<<<<<<<<<< @@ -17116,7 +17138,7 @@ static int __pyx_pw_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":178 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":178 * cdef class Metric: * cdef Scorer scorer * def __cinit__(self): # <<<<<<<<<<<<<< @@ -17137,7 +17159,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":179 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":179 * cdef Scorer scorer * def __cinit__(self): * self.scorer = Scorer() # <<<<<<<<<<<<<< @@ -17152,7 +17174,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p __pyx_v_self->scorer = ((struct __pyx_obj_5_cdec_Scorer *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":180 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":180 * def __cinit__(self): * self.scorer = Scorer() * cdef bytes class_name = self.__class__.__name__ # <<<<<<<<<<<<<< @@ -17168,7 +17190,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p __pyx_v_class_name = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":181 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":181 * self.scorer = Scorer() * cdef bytes class_name = self.__class__.__name__ * self.scorer.name = new string(class_name) # <<<<<<<<<<<<<< @@ -17176,10 +17198,15 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p * <void*> self, _compute_sufficient_stats, _compute_score) */ __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_class_name)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - try {__pyx_t_4 = new std::string(__pyx_t_3);} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}} + try { + __pyx_t_4 = new std::string(__pyx_t_3); + } catch(...) { + __Pyx_CppExn2PyErr(); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_self->scorer->name = __pyx_t_4; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":182 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":182 * cdef bytes class_name = self.__class__.__name__ * self.scorer.name = new string(class_name) * self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0], # <<<<<<<<<<<<<< @@ -17248,7 +17275,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":185 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":185 * <void*> self, _compute_sufficient_stats, _compute_score) * * def __call__(self, refs): # <<<<<<<<<<<<<< @@ -17266,7 +17293,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metri int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__call__", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":186 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":186 * * def __call__(self, refs): * return self.scorer(refs) # <<<<<<<<<<<<<< @@ -17310,7 +17337,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_ return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":188 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":188 * return self.scorer(refs) * * def score(SufficientStats stats): # <<<<<<<<<<<<<< @@ -17323,7 +17350,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_5 __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("score", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":189 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":189 * * def score(SufficientStats stats): * return 0 # <<<<<<<<<<<<<< @@ -17398,7 +17425,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":191 +/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":191 * return 0 * * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<< @@ -17415,7 +17442,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("evaluate", 0); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":192 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":192 * * def evaluate(self, hyp, refs): * return [] # <<<<<<<<<<<<<< @@ -17650,7 +17677,9 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __Pyx_INCREF(__pyx_t_6); #else __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else @@ -17693,10 +17722,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener * for name, info in value.items(): * yield key, '%s %s' % (name, info) */ - __pyx_t_2 = ((PyObject *)((PyObject*)(&PyDict_Type))); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_9 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_value, __pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyDict_Check(__pyx_cur_scope->__pyx_v_value); if (__pyx_t_9) { /* "_cdec.pyx":35 @@ -17770,7 +17796,9 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __Pyx_INCREF(__pyx_t_7); #else __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else @@ -17821,7 +17849,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_44), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 36; __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 = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -17871,10 +17899,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener * for name in value: * yield key, name */ - __pyx_t_2 = ((PyObject *)((PyObject*)(&PyList_Type))); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_9 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_value, __pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = PyList_Check(__pyx_cur_scope->__pyx_v_value); if (__pyx_t_9) { /* "_cdec.pyx":38 @@ -18174,9 +18199,9 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_Generator if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)) { __Pyx_RaiseClosureNameError("config"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_config); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)); __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -18221,7 +18246,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_Generator __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_45), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_r = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; @@ -18311,13 +18336,10 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ * if formalism not in ('scfg', 'fst', 'lextrans', 'pb', * 'csplit', 'tagger', 'lexalign'): */ - __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_cur_scope->__pyx_v_config), ((PyObject *)__pyx_n_s__formalism), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __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; - __pyx_t_3 = 0; + __pyx_v_formalism = __pyx_t_2; + __pyx_t_2 = 0; /* "_cdec.pyx":53 * if config_str is None: @@ -18327,59 +18349,59 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ * raise InvalidConfig('formalism "%s" unknown' % formalism) */ __Pyx_INCREF(__pyx_v_formalism); - __pyx_t_3 = __pyx_v_formalism; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__scfg), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_v_formalism; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__scfg), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (((int)__pyx_t_1)) { - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fst), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__fst), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = ((int)__pyx_t_4); } else { __pyx_t_5 = ((int)__pyx_t_1); } if (__pyx_t_5) { - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__lextrans), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__lextrans), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = ((int)__pyx_t_1); } else { __pyx_t_4 = __pyx_t_5; } if (__pyx_t_4) { - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__pb), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__pb), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = ((int)__pyx_t_5); } else { __pyx_t_1 = __pyx_t_4; } if (__pyx_t_1) { - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__csplit), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__csplit), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = ((int)__pyx_t_4); } else { __pyx_t_5 = __pyx_t_1; } if (__pyx_t_5) { - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__tagger), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__tagger), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = ((int)__pyx_t_1); } else { __pyx_t_4 = __pyx_t_5; } if (__pyx_t_4) { - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__lexalign), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__lexalign), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = ((int)__pyx_t_5); } else { __pyx_t_1 = __pyx_t_4; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_1; if (__pyx_t_4) { @@ -18390,21 +18412,21 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ * config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) * cdef istringstream* config_stream = new istringstream(config_str) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__InvalidConfig); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), __pyx_v_formalism); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__InvalidConfig); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), __pyx_v_formalism); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } @@ -18417,19 +18439,19 @@ static int __pyx_pf_5_cdec_7Decoder___init__(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_38), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); 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_6 = __pyx_pf_5_cdec_7Decoder_8__init___genexpr(((PyObject*)__pyx_cur_scope)); 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); - __pyx_t_3 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); 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); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_config_str); __pyx_v_config_str = __pyx_t_6; __pyx_t_6 = 0; @@ -18615,8 +18637,8 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De PyObject *__pyx_v_fval = NULL; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); @@ -18636,11 +18658,8 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De * self.weights.vector[0] = (<DenseVector> weights).vector[0] * elif isinstance(weights, SparseVector): */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_DenseVector)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_DenseVector)); + if (__pyx_t_1) { /* "_cdec.pyx":73 * def __set__(self, weights): @@ -18660,11 +18679,8 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De * self.weights.vector.clear() * ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + if (__pyx_t_1) { /* "_cdec.pyx":75 * self.weights.vector[0] = (<DenseVector> weights).vector[0] @@ -18693,11 +18709,8 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De * self.weights.vector.clear() * for fname, fval in weights.items(): */ - __pyx_t_1 = ((PyObject *)((PyObject*)(&PyDict_Type))); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyDict_Check(__pyx_v_weights); + if (__pyx_t_1) { /* "_cdec.pyx":78 * ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) @@ -18715,37 +18728,37 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De * self.weights[fname] = fval * else: */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __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 = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { - __pyx_t_3 = __pyx_t_5(__pyx_t_1); + __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); @@ -18779,7 +18792,9 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __Pyx_INCREF(__pyx_t_7); #else __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else @@ -18820,7 +18835,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De */ if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } /*else*/ { @@ -18832,18 +18847,18 @@ 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_48), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __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[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __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_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -18851,7 +18866,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); @@ -19129,7 +19144,9 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __Pyx_INCREF(__pyx_t_11); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else @@ -19368,8 +19385,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_hg = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; std::string __pyx_t_4; int __pyx_lineno = 0; @@ -19384,11 +19401,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec * input_str = as_str(sentence.strip()) * elif isinstance(sentence, Lattice): */ - __pyx_t_1 = __pyx_builtin_basestring; - __Pyx_INCREF(__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 = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyObject_IsInstance(__pyx_v_sentence, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { /* "_cdec.pyx":102 * cdef bytes input_str @@ -19397,16 +19411,16 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec * 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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), 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(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_input_str = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_input_str = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; goto __pyx_L3; } @@ -19417,11 +19431,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec * input_str = str(sentence) # PLF format * else: */ - __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)); - __Pyx_INCREF(__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_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_sentence, ((PyObject*)__pyx_ptype_5_cdec_Lattice)); + if (__pyx_t_1) { /* "_cdec.pyx":104 * input_str = as_str(sentence.strip()) @@ -19430,14 +19441,14 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec * else: * raise TypeError('Cannot translate input type %s' % type(sentence)) */ - __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); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_sentence); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sentence); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sentence); __Pyx_GIVEREF(__pyx_v_sentence); - __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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_input_str = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; @@ -19454,14 +19465,14 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec */ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -19475,8 +19486,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec * if isinstance(grammar, basestring): * self.dec.AddSupplementalGrammarFromString(as_str(grammar)) */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { /* "_cdec.pyx":108 * raise TypeError('Cannot translate input type %s' % type(sentence)) @@ -19485,11 +19496,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec * self.dec.AddSupplementalGrammarFromString(as_str(grammar)) * else: */ - __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { + __pyx_t_1 = PyObject_IsInstance(__pyx_v_grammar, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { /* "_cdec.pyx":109 * if grammar: @@ -19519,11 +19527,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __Pyx_INCREF(__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_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __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; + __pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_5_cdec_TextGrammar *)__pyx_t_2)->__pyx_base.grammar[0])); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L5:; goto __pyx_L4; @@ -19556,8 +19564,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec * raise ParseFailed() * cdef Hypergraph hg = Hypergraph() */ - __pyx_t_2 = (__pyx_v_observer.hypergraph == NULL); - if (__pyx_t_2) { + __pyx_t_1 = (__pyx_v_observer.hypergraph == NULL); + if (__pyx_t_1) { /* "_cdec.pyx":115 * self.dec.Decode(input_str, &observer) @@ -19566,11 +19574,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -19611,7 +19619,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __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_XDECREF(__pyx_t_3); __Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -19623,7 +19631,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec return __pyx_r; } -/* "string.from_py":11 +/* "string.from_py":12 * * @cname("__pyx_convert_string_from_py_") * cdef string __pyx_convert_string_from_py_(object o) except *: # <<<<<<<<<<<<<< @@ -19641,15 +19649,15 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_", 0); - /* "string.from_py":12 + /* "string.from_py":13 * @cname("__pyx_convert_string_from_py_") * cdef string __pyx_convert_string_from_py_(object o) except *: * return string(<char*>o, len(o)) # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = std::string(((char *)__pyx_t_1), __pyx_t_2); goto __pyx_L0; @@ -20066,7 +20074,9 @@ static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject static void __pyx_tp_dealloc_5_cdec_NT(PyObject *o) { struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->cat); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -21493,7 +21503,9 @@ static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUS static void __pyx_tp_dealloc_5_cdec_HypergraphEdge(PyObject *o) { struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->trule); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -23074,7 +23086,9 @@ static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObj static void __pyx_tp_dealloc_5_cdec_Metric(PyObject *o) { struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->scorer); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -23267,6 +23281,7 @@ static PyObject *__pyx_tp_new_5_cdec_Decoder(PyTypeObject *t, CYTHON_UNUSED PyOb static void __pyx_tp_dealloc_5_cdec_Decoder(PyObject *o) { struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o; + PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -23277,6 +23292,7 @@ static void __pyx_tp_dealloc_5_cdec_Decoder(PyObject *o) { PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->weights); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -23493,7 +23509,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject * static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct____iter__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -23684,7 +23702,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -23875,7 +23895,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject * static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_phrase); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -24068,9 +24090,11 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject * static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_w); Py_CLEAR(p->__pyx_t_0); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -24273,7 +24297,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject * static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_4___get__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -24464,7 +24490,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(PyTypeObject * static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_5___str__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -24657,9 +24685,11 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject * static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_feat); Py_CLEAR(p->__pyx_t_0); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -24863,8 +24893,10 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_v_trule); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -25062,8 +25094,10 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_v_size); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -25263,10 +25297,12 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObje static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_e_tree); Py_CLEAR(p->__pyx_v_f_tree); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_v_size); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -25477,9 +25513,11 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyType static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_fmap); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_v_size); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -25682,7 +25720,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject * static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_sample(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -25873,7 +25913,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeOb static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -26064,7 +26106,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___get__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -26255,7 +26299,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_14___get__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -26446,7 +26492,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___get__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -26637,7 +26685,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16___get__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -26828,7 +26878,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___get__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -27019,7 +27071,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -27210,7 +27264,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -27407,6 +27463,7 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_delta); Py_CLEAR(p->__pyx_v_i); @@ -27414,6 +27471,7 @@ static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines(PyObject *o) { Py_CLEAR(p->__pyx_v_weight); Py_CLEAR(p->__pyx_t_1); Py_CLEAR(p->__pyx_t_3); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -27642,9 +27700,11 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_i); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_t_1); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -27847,7 +27907,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -28044,6 +28106,7 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config(PyTypeOb static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_23__make_config(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_config); Py_CLEAR(p->__pyx_v_info); Py_CLEAR(p->__pyx_v_key); @@ -28051,6 +28114,7 @@ static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_23__make_config(PyObject Py_CLEAR(p->__pyx_v_value); Py_CLEAR(p->__pyx_t_0); Py_CLEAR(p->__pyx_t_1); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -28277,7 +28341,9 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24___init__(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24___init__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_config); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -28294,7 +28360,7 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_24___init__(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_config); - p->__pyx_v_config = Py_None; Py_INCREF(Py_None); + p->__pyx_v_config = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } @@ -28470,9 +28536,11 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) { struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_kv); Py_CLEAR(p->__pyx_t_0); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -28670,7 +28738,11 @@ static PyMethodDef __pyx_methods[] = { #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else PyModuleDef_HEAD_INIT, + #endif __Pyx_NAMESTR("_cdec"), 0, /* m_doc */ -1, /* m_size */ @@ -28704,12 +28776,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0}, {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0}, {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0}, - {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0}, + {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1}, + {&__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_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_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_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0}, {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0}, {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0}, {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0}, @@ -28717,7 +28790,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 1}, {&__pyx_n_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 1}, {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, - {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 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}, @@ -28730,6 +28803,9 @@ 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__QCRI, __pyx_k__QCRI, sizeof(__pyx_k__QCRI), 0, 0, 1, 1}, + {&__pyx_n_s__QCRI_BLEU, __pyx_k__QCRI_BLEU, sizeof(__pyx_k__QCRI_BLEU), 0, 0, 1, 1}, + {&__pyx_n_s__SSK, __pyx_k__SSK, sizeof(__pyx_k__SSK), 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}, @@ -28767,7 +28843,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, {&__pyx_n_s__fst, __pyx_k__fst, sizeof(__pyx_k__fst), 0, 0, 1, 1}, {&__pyx_n_s__genexpr, __pyx_k__genexpr, sizeof(__pyx_k__genexpr), 0, 0, 1, 1}, - {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, {&__pyx_n_s__grammar, __pyx_k__grammar, sizeof(__pyx_k__grammar), 0, 0, 1, 1}, {&__pyx_n_s__hyp, __pyx_k__hyp, sizeof(__pyx_k__hyp), 0, 0, 1, 1}, {&__pyx_n_s__hypergraph, __pyx_k__hypergraph, sizeof(__pyx_k__hypergraph), 0, 0, 1, 1}, @@ -28842,207 +28917,139 @@ static int __Pyx_InitCachedConstants(void) { * elif isinstance(data, str): * ret = data */ - __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8)); - PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__utf8)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "/home/pauldb/workspace/cdec/python/src/vectors.pxi":95 + /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":95 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<< * * def __len__(self): */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); - PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":6 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":6 * * def _phrase(phrase): * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< * * cdef class NT: */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); - __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8)); - PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_n_s__utf8)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":226 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":226 * 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 = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __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)); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":244 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":244 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<< * * cdef class HypergraphNode: */ - __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __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)); - /* "/home/pauldb/workspace/cdec/python/src/hypergraph.pxi":281 + /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":281 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<< */ - __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __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)); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":26 + /* "/usr0/home/cdyer/cdec-merge/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 = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __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)); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":39 + /* "/usr0/home/cdyer/cdec-merge/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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __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)); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":69 + /* "/usr0/home/cdyer/cdec-merge/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_32 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_32 = PyTuple_Pack(2, ((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_32); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_30)); - PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_30)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); - PyTuple_SET_ITEM(__pyx_k_tuple_32, 1, ((PyObject *)__pyx_kp_s_31)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":63 + /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< * yield 'digraph lattice {' * yield 'rankdir = LR;' */ - __pyx_k_tuple_35 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_35 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_n_s__weight), ((PyObject *)__pyx_n_s__delta)); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_35); - __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); - PyTuple_SET_ITEM(__pyx_k_tuple_35, 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_35, 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_35, 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_35, 3, ((PyObject *)__pyx_n_s__delta)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_37, __pyx_n_s__lines, 63, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/lattice.pxi":72 + /* "/usr0/home/cdyer/cdec-merge/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_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_39); - __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8)); - PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_n_s__utf8)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); + __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_40); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":50 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":50 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<< * return self.stats[0][index] * */ - __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_41); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_40)); - PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_40)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + __pyx_k_tuple_42 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_41)); 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_GIVEREF(((PyObject *)__pyx_k_tuple_42)); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":84 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":84 * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<< * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] */ - __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __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)); - - /* "_cdec.pyx":52 - * Create a decoder using a given configuration. Formalism is required.""" - * if config_str is None: - * formalism = config.get('formalism', None) # <<<<<<<<<<<<<< - * if formalism not in ('scfg', 'fst', 'lextrans', 'pb', - * 'csplit', 'tagger', 'lexalign'): - */ - __pyx_k_tuple_46 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_46); - __Pyx_INCREF(((PyObject *)__pyx_n_s__formalism)); - PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_n_s__formalism)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__formalism)); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_k_tuple_46, 1, Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46)); + __pyx_k_tuple_44 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_43)); 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_GIVEREF(((PyObject *)__pyx_k_tuple_44)); /* "_cdec.pyx":93 * with open(weights) as fp: @@ -29051,11 +29058,8 @@ static int __Pyx_InitCachedConstants(void) { * fname, value = line.split() * self.weights[fname.strip()] = float(value) */ - __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_50); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_49)); - PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_s_49)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50)); /* "_cdec.pyx":91 @@ -29065,79 +29069,74 @@ static int __Pyx_InitCachedConstants(void) { * for line in fp: * if line.strip().startswith('#'): continue */ - __pyx_k_tuple_51 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_51 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_51); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_k_tuple_51, 1, Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_k_tuple_51, 2, Py_None); - __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":5 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) * */ - __pyx_k_tuple_55 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_55 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_55); - __Pyx_INCREF(((PyObject *)__pyx_n_s__phrase)); - PyTuple_SET_ITEM(__pyx_k_tuple_55, 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_55, 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_55, 2, ((PyObject *)__pyx_n_s__genexpr)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); __pyx_k_codeobj_56 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_57, __pyx_n_s___phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":194 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":194 * return [] * * BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<< + * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') - * CER = Scorer('CER') */ - __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__IBM_BLEU)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_58); - __Pyx_INCREF(((PyObject *)__pyx_n_s__IBM_BLEU)); - PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_n_s__IBM_BLEU)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IBM_BLEU)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58)); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":195 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":195 * * BLEU = Scorer('IBM_BLEU') - * TER = Scorer('TER') # <<<<<<<<<<<<<< + * QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<< + * 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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__QCRI_BLEU)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_59); - __Pyx_INCREF(((PyObject *)__pyx_n_s__TER)); - PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_n_s__TER)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TER)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":196 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":196 * BLEU = Scorer('IBM_BLEU') - * TER = Scorer('TER') - * CER = Scorer('CER') # <<<<<<<<<<<<<< + * QCRI = Scorer('QCRI_BLEU') + * TER = Scorer('TER') # <<<<<<<<<<<<<< + * CER = Scorer('CER') + * SSK = Scorer('SSK') */ - __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__TER)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_60); - __Pyx_INCREF(((PyObject *)__pyx_n_s__CER)); - PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__CER)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CER)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":197 + * QCRI = Scorer('QCRI_BLEU') + * TER = Scorer('TER') + * CER = Scorer('CER') # <<<<<<<<<<<<<< + * SSK = Scorer('SSK') + */ + __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__CER)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_61); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); + + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":198 + * TER = Scorer('TER') + * CER = Scorer('CER') + * SSK = Scorer('SSK') # <<<<<<<<<<<<<< + */ + __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SSK)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_62); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); + /* "_cdec.pyx":28 * class ParseFailed(Exception): pass * @@ -29145,13 +29144,10 @@ static int __Pyx_InitCachedConstants(void) { * """set_silent(bool): Configure the verbosity of cdec.""" * SetSilent(yn) */ - __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_61); - __Pyx_INCREF(((PyObject *)__pyx_n_s__yn)); - PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_n_s__yn)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__yn)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); - __pyx_k_codeobj_62 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__yn)); 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_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":32 * SetSilent(yn) @@ -29160,25 +29156,10 @@ static int __Pyx_InitCachedConstants(void) { * for key, value in config.items(): * if isinstance(value, dict): */ - __pyx_k_tuple_64 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_64); - __Pyx_INCREF(((PyObject *)__pyx_n_s__config)); - PyTuple_SET_ITEM(__pyx_k_tuple_64, 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_64, 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_64, 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_64, 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_64, 4, ((PyObject *)__pyx_n_s__info)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__info)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64)); - __pyx_k_codeobj_65 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s___make_config, 32, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_66 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__config), ((PyObject *)__pyx_n_s__key), ((PyObject *)__pyx_n_s__value), ((PyObject *)__pyx_n_s__name), ((PyObject *)__pyx_n_s__info)); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_66); + __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, 32, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -29244,6 +29225,14 @@ PyMODINIT_FUNC PyInit__cdec(void) __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "_cdec")) { + if (unlikely(PyDict_SetItemString(modules, "_cdec", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); @@ -29491,7 +29480,7 @@ PyMODINIT_FUNC PyInit__cdec(void) Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":3 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":3 * cimport grammar * cimport cdec.sa._sa as _sa * import cdec.sa._sa as _sa # <<<<<<<<<<<<<< @@ -29509,7 +29498,7 @@ PyMODINIT_FUNC PyInit__cdec(void) 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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauldb/workspace/cdec/python/src/grammar.pxi":5 + /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< @@ -29521,37 +29510,61 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s___phrase, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":194 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":194 * return [] * * BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<< + * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') - * CER = Scorer('CER') */ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __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 = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":195 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":195 * * BLEU = Scorer('IBM_BLEU') - * TER = Scorer('TER') # <<<<<<<<<<<<<< + * QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<< + * 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 = 195; __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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__QCRI, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauldb/workspace/cdec/python/src/mteval.pxi":196 + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":196 * BLEU = Scorer('IBM_BLEU') + * QCRI = Scorer('QCRI_BLEU') + * TER = Scorer('TER') # <<<<<<<<<<<<<< + * CER = Scorer('CER') + * SSK = Scorer('SSK') + */ + __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 = 196; __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 = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":197 + * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') * CER = Scorer('CER') # <<<<<<<<<<<<<< + * SSK = Scorer('SSK') */ - __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 = 196; __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 = 197; __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 = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":198 + * TER = Scorer('TER') + * CER = Scorer('CER') + * SSK = Scorer('SSK') # <<<<<<<<<<<<<< + */ + __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 = 198; __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 = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SSK, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "_cdec.pyx":22 @@ -29586,7 +29599,7 @@ PyMODINIT_FUNC PyInit__cdec(void) __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); - __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__InvalidConfig, __pyx_n_s___cdec); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__InvalidConfig, __pyx_n_s__InvalidConfig, __pyx_n_s___cdec); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__InvalidConfig, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -29607,7 +29620,7 @@ PyMODINIT_FUNC PyInit__cdec(void) __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); - __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__ParseFailed, __pyx_n_s___cdec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__ParseFailed, __pyx_n_s__ParseFailed, __pyx_n_s___cdec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ParseFailed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -29648,7 +29661,7 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - /* "string.from_py":11 + /* "string.from_py":12 * * @cname("__pyx_convert_string_from_py_") * cdef string __pyx_convert_string_from_py_(object o) except *: # <<<<<<<<<<<<<< @@ -30315,16 +30328,18 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) #endif } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { - PyObject *py_import = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import = 0; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; + #endif if (from_list) list = from_list; else { @@ -30344,13 +30359,17 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { - /* try package relative import first */ + #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; @@ -30361,12 +30380,17 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { } #endif if (!module) { + #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif } } #else @@ -30378,8 +30402,10 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { name, global_dict, empty_dict, list, NULL); #endif bad: - Py_XDECREF(empty_list); + #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } @@ -30410,11 +30436,13 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { } static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, - PyObject *modname) { + PyObject *qualname, PyObject *modname) { PyObject *result; PyObject *metaclass; if (PyDict_SetItemString(dict, "__module__", modname) < 0) return NULL; + if (PyDict_SetItemString(dict, "__qualname__", qualname) < 0) + return NULL; metaclass = PyDict_GetItemString(dict, "__metaclass__"); if (metaclass) { Py_INCREF(metaclass); @@ -30455,6 +30483,10 @@ static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject* x) { else return (WordID)__Pyx_PyInt_AsSignedLongLong(x); } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); + #else WordID val; PyObject *v = __Pyx_PyNumber_Int(x); #if PY_VERSION_HEX < 0x03000000 @@ -30474,6 +30506,7 @@ static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject* x) { if (likely(!ret)) return val; } + #endif return (WordID)-1; } } @@ -30529,16 +30562,19 @@ bad: static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { - if (op->func_doc == NULL && op->func.m_ml->ml_doc) { + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); #else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); #endif - } - if (op->func_doc == 0) { - Py_INCREF(Py_None); - return Py_None; + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } } Py_INCREF(op->func_doc); return op->func_doc; @@ -30548,22 +30584,23 @@ __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp = op->func_doc; if (value == NULL) - op->func_doc = Py_None; /* Mark as deleted */ - else - op->func_doc = value; - Py_INCREF(op->func_doc); + value = Py_None; /* Mark as deleted */ + Py_INCREF(value); + op->func_doc = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) { - if (op->func_name == NULL) { + if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); #else op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); #endif + if (unlikely(op->func_name == NULL)) + return NULL; } Py_INCREF(op->func_name); return op->func_name; @@ -30573,9 +30610,9 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 - if (value == NULL || !PyUnicode_Check(value)) { + if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else - if (value == NULL || !PyString_Check(value)) { + if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); @@ -30588,6 +30625,31 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) return 0; } static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) { PyObject *self; @@ -30600,9 +30662,9 @@ __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure static PyObject * __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) { - if (op->func_dict == NULL) { + if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); - if (op->func_dict == NULL) + if (unlikely(op->func_dict == NULL)) return NULL; } Py_INCREF(op->func_dict); @@ -30612,12 +30674,12 @@ static int __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; - if (value == NULL) { + if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); return -1; } - if (!PyDict_Check(value)) { + if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "setting function's dictionary to a non-dict"); return -1; @@ -30657,7 +30719,7 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) } if (op->defaults_getter) { PyObject *res = op->defaults_getter((PyObject *) op); - if (res) { + if (likely(res)) { Py_INCREF(res); op->defaults_tuple = res; } @@ -30671,6 +30733,7 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, @@ -30704,7 +30767,7 @@ static PyMethodDef __pyx_CyFunction_methods[] = { {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* code) { __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); if (op == NULL) @@ -30719,6 +30782,8 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f op->func.m_module = module; op->func_dict = NULL; op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; op->func_doc = NULL; op->func_classobj = NULL; Py_XINCREF(code); @@ -30737,6 +30802,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) Py_CLEAR(m->func.m_module); Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_code); Py_CLEAR(m->func_classobj); @@ -30765,6 +30831,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, Py_VISIT(m->func.m_module); Py_VISIT(m->func_dict); Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_code); Py_VISIT(m->func_classobj); @@ -30797,13 +30864,12 @@ static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObj static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { - PyObject *func_name = __Pyx_CyFunction_get_name(op); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromFormat("<cyfunction %U at %p>", - func_name, (void *)op); + op->func_qualname, (void *)op); #else return PyString_FromFormat("<cyfunction %s at %p>", - PyString_AsString(func_name), (void *)op); + PyString_AsString(op->func_qualname), (void *)op); #endif } #if CYTHON_COMPILING_IN_PYPY @@ -31936,6 +32002,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; @@ -31955,7 +32025,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -31965,7 +32047,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -32243,15 +32325,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } - -/* Type Conversion Functions */ - static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } - static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; @@ -32297,7 +32375,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { } return res; } - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); @@ -32306,7 +32383,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } - static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) @@ -32320,7 +32396,6 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); #endif } - static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { |