diff options
-rw-r--r-- | python/pkg/cdec/sa/__init__.py | 2 | ||||
-rw-r--r-- | python/pkg/cdec/sa/extractor.py | 5 | ||||
-rw-r--r-- | python/src/sa/_sa.c | 28743 | ||||
-rw-r--r-- | python/src/sa/sym.pxi | 13 |
4 files changed, 17288 insertions, 11475 deletions
diff --git a/python/pkg/cdec/sa/__init__.py b/python/pkg/cdec/sa/__init__.py index cc532fb9..d4b94484 100644 --- a/python/pkg/cdec/sa/__init__.py +++ b/python/pkg/cdec/sa/__init__.py @@ -1,4 +1,4 @@ -from cdec.sa._sa import sym_fromstring,\ +from cdec.sa._sa import make_lattice, decode_lattice, decode_sentence,\ SuffixArray, DataArray, LCP, Precomputation, Alignment, BiLex,\ HieroCachingRuleFactory, Sampler, Scorer from cdec.sa.extractor import GrammarExtractor diff --git a/python/pkg/cdec/sa/extractor.py b/python/pkg/cdec/sa/extractor.py index 940544fb..94392c30 100644 --- a/python/pkg/cdec/sa/extractor.py +++ b/python/pkg/cdec/sa/extractor.py @@ -75,7 +75,6 @@ class GrammarExtractor: def grammar(self, sentence): if isinstance(sentence, unicode): sentence = sentence.encode('utf8') - cnet = chain(('<s>',), sentence.split(), ('</s>',)) - cnet = (cdec.sa.sym_fromstring(word, terminal=True) for word in cnet) - cnet = tuple(((word, None, 1), ) for word in cnet) + words = chain(('<s>',), sentence.split(), ('</s>',)) + cnet = cdec.sa.make_lattice(words) return self.factory.input(cnet) diff --git a/python/src/sa/_sa.c b/python/src/sa/_sa.c index c85a54e7..68205b2e 100644 --- a/python/src/sa/_sa.c +++ b/python/src/sa/_sa.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Thu Sep 6 05:37:20 2012 */ +/* Generated by Cython 0.17 on Thu Sep 6 11:14:53 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include <stddef.h> /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,44 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (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 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" #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +67,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +80,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +89,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +134,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +152,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +159,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +176,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +187,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +205,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +217,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +225,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -267,7 +283,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -291,8 +307,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -336,18 +356,11 @@ static const char *__pyx_f[] = { "str_map.pxi", }; -static PyObject *__Pyx_Generator_Next(PyObject *self); -static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); -static PyObject *__Pyx_Generator_Close(PyObject *self); -static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args, CYTHON_UNUSED PyObject *kwds); - -typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); - /*--- Type declarations ---*/ struct __pyx_obj_3_sa_HieroCachingRuleFactory; -struct __pyx_Generator_object; -struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__; +struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence; struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats; +struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr; struct __pyx_obj_3_sa_IntList; struct __pyx_obj_3_sa_VEBIterator; struct __pyx_obj_3_sa_BiLex; @@ -355,32 +368,38 @@ struct __pyx_obj_3_sa_VEB; struct __pyx_obj_3_sa_LCP; struct __pyx_obj_3_sa_DataArray; struct __pyx_obj_3_sa_BitSetIterator; +struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments; struct __pyx_obj_3_sa_Precomputation; -struct __pyx_obj_3_sa___pyx_scope_struct_8_input; struct __pyx_obj_3_sa_SuffixArray; struct __pyx_obj_3_sa_Alphabet; struct __pyx_obj_3_sa_Rule; struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr; struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr; struct __pyx_obj_3_sa_PhraseLocation; -struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr; -struct __pyx_obj_3_sa___pyx_scope_struct_10___str__; +struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__; struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext; struct __pyx_obj_3_sa_FeatureVector; -struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments; +struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice; struct __pyx_obj_3_sa_Scorer; struct __pyx_obj_3_sa_Alignment; -struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__; struct __pyx_obj_3_sa_BitSet; struct __pyx_obj_3_sa_Sampler; struct __pyx_obj_3_sa_StringMap; +struct __pyx_obj_3_sa___pyx_scope_struct_17___str__; struct __pyx_obj_3_sa_TrieNode; struct __pyx_obj_3_sa_ExtendedTrieNode; struct __pyx_obj_3_sa_TrieMap; +struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr; +struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice; +struct __pyx_obj_3_sa___pyx_scope_struct_12___str__; +struct __pyx_obj_3_sa___pyx_scope_struct_15_input; +struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr; struct __pyx_obj_3_sa_Phrase; struct __pyx_obj_3_sa___pyx_scope_struct____iter__; struct __pyx_obj_3_sa_TrieTable; -struct __pyx_obj_3_sa___pyx_scope_struct_5___str__; +struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__; +struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr; +struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr; struct __pyx_obj_3_sa_FloatList; struct __pyx_t_3_sa__node; struct __pyx_t_3_sa__BitSet; @@ -390,7 +409,7 @@ struct __pyx_t_3_sa__Trie_Node; struct __pyx_t_3_sa_match_node; struct __pyx_t_3_sa_Matching; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":9 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":9 * from libc.string cimport memset, strcpy * * cdef struct _node: # <<<<<<<<<<<<<< @@ -404,7 +423,7 @@ struct __pyx_t_3_sa__node { int val; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":30 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":30 * _init_lower_mask() * * cdef struct _BitSet: # <<<<<<<<<<<<<< @@ -418,7 +437,7 @@ struct __pyx_t_3_sa__BitSet { int size; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":168 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":168 * return result * * cdef struct _VEB: # <<<<<<<<<<<<<< @@ -435,7 +454,7 @@ struct __pyx_t_3_sa__VEB { void **bottom; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":10 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":10 * cdef struct _Trie_Node # forward decl * * cdef struct _Trie_Edge: # <<<<<<<<<<<<<< @@ -449,7 +468,7 @@ struct __pyx_t_3_sa__Trie_Edge { struct __pyx_t_3_sa__Trie_Edge *smaller; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":8 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":8 * from libc.string cimport memset, memcpy * * cdef struct _Trie_Node # forward decl # <<<<<<<<<<<<<< @@ -462,7 +481,7 @@ struct __pyx_t_3_sa__Trie_Node { int arr_len; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":64 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":64 * * # linked list structure for storing matches in BaselineRuleFactory * cdef struct match_node: # <<<<<<<<<<<<<< @@ -474,7 +493,7 @@ struct __pyx_t_3_sa_match_node { struct __pyx_t_3_sa_match_node *next; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":160 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":160 * * # struct used to encapsulate a single matching * cdef struct Matching: # <<<<<<<<<<<<<< @@ -489,7 +508,7 @@ struct __pyx_t_3_sa_Matching { int size; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":216 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":216 * * * cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<< @@ -538,40 +557,19 @@ struct __pyx_obj_3_sa_HieroCachingRuleFactory { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":81 - * free(self.arr) +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":115 + * for arc in node for node in lattice) * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef int i - * for i in range(self.len): + * def decode_sentence(lattice): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) */ -struct __pyx_Generator_object { +struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence { PyObject_HEAD - __pyx_generator_body_t body; - int is_running; - int resume_label; - PyObject *exc_type; - PyObject *exc_value; - PyObject *exc_traceback; -}; - - -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":141 - * return self.syms[i] - * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef int i - * for i from 0 <= i < self.n: - */ -struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ { - struct __pyx_Generator_object __pyx_base; - int __pyx_v_i; - PyObject *__pyx_v_self; - int __pyx_t_0; + PyObject *__pyx_v_lattice; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":36 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":36 * logger.info("LCP array completed") * * def compute_stats(self, int max_n): # <<<<<<<<<<<<<< @@ -579,7 +577,7 @@ struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ { * particular, the frequency associated with each word is */ struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats { - struct __pyx_Generator_object __pyx_base; + PyObject_HEAD int __pyx_v_N; int __pyx_v_freq; int __pyx_v_h; @@ -595,13 +593,30 @@ struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats { PyObject *__pyx_v_ngram_starts; int __pyx_v_rs; struct __pyx_obj_3_sa_IntList *__pyx_v_run_start; - PyObject *__pyx_v_self; + struct __pyx_obj_3_sa_LCP *__pyx_v_self; int __pyx_v_valid; struct __pyx_obj_3_sa_VEB *__pyx_v_veb; int __pyx_t_0; }; +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":21 + * + * def __str__(self): + * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< + * + * cdef class Scorer: + */ +struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr { + PyObject_HEAD + struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *__pyx_outer_scope; + PyObject *__pyx_v_feat; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + /* "_sa.pxd":12 * cdef void read_handle(self, FILE* f) * @@ -619,7 +634,7 @@ struct __pyx_obj_3_sa_IntList { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":340 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":340 * * * cdef class VEBIterator: # <<<<<<<<<<<<<< @@ -633,7 +648,7 @@ struct __pyx_obj_3_sa_VEBIterator { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":47 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":47 * * * cdef class BiLex: # <<<<<<<<<<<<<< @@ -654,7 +669,7 @@ struct __pyx_obj_3_sa_BiLex { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":354 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":354 * * * cdef class VEB: # <<<<<<<<<<<<<< @@ -668,7 +683,7 @@ struct __pyx_obj_3_sa_VEB { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":5 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":5 * as k most frequent n-grams""" * * cdef class LCP: # <<<<<<<<<<<<<< @@ -682,7 +697,7 @@ struct __pyx_obj_3_sa_LCP { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":9 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":9 * from libc.string cimport memset, strcpy * * cdef class DataArray: # <<<<<<<<<<<<<< @@ -701,7 +716,7 @@ struct __pyx_obj_3_sa_DataArray { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":100 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":100 * * * cdef class BitSetIterator: # <<<<<<<<<<<<<< @@ -715,7 +730,24 @@ struct __pyx_obj_3_sa_BitSetIterator { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":188 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":190 + * return ' ||| '.join(fields) + * + * def alignments(self): # <<<<<<<<<<<<<< + * for point in self.word_alignments: + * yield point/65536, point%65536 + */ +struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments { + PyObject_HEAD + PyObject *__pyx_v_point; + struct __pyx_obj_3_sa_Rule *__pyx_v_self; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":188 * * * cdef class Precomputation: # <<<<<<<<<<<<<< @@ -736,89 +768,7 @@ struct __pyx_obj_3_sa_Precomputation { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":937 - * return sorted(result); - * - * def input(self, fwords): # <<<<<<<<<<<<<< - * '''When this function is called on the RuleFactory, - * it looks up all of the rules that can be used to translate - */ -struct __pyx_obj_3_sa___pyx_scope_struct_8_input { - struct __pyx_Generator_object __pyx_base; - PyObject *__pyx_v_alignment; - PyObject *__pyx_v_als; - PyObject *__pyx_v_alslist; - int __pyx_v_alt; - int __pyx_v_alt_id; - int __pyx_v_arity; - struct __pyx_obj_3_sa_IntList *__pyx_v_chunklen; - PyObject *__pyx_v_count; - PyObject *__pyx_v_e; - PyObject *__pyx_v_elist; - PyObject *__pyx_v_extract; - PyObject *__pyx_v_extract_start; - PyObject *__pyx_v_extract_stop; - PyObject *__pyx_v_extracts; - PyObject *__pyx_v_f; - PyObject *__pyx_v_fcount; - int __pyx_v_flen; - PyObject *__pyx_v_fphrases; - PyObject *__pyx_v_frontier; - PyObject *__pyx_v_frontier_nodes; - PyObject *__pyx_v_fwords; - struct __pyx_obj_3_sa_Phrase *__pyx_v_hiero_phrase; - long __pyx_v_hit; - int __pyx_v_i; - PyObject *__pyx_v_is_shadow_path; - int __pyx_v_j; - int __pyx_v_k; - PyObject *__pyx_v_key; - PyObject *__pyx_v_loc; - PyObject *__pyx_v_locs; - int __pyx_v_lookup_required; - struct __pyx_t_3_sa_Matching __pyx_v_matching; - PyObject *__pyx_v_max_locs; - PyObject *__pyx_v_new_frontier; - PyObject *__pyx_v_new_node; - PyObject *__pyx_v_next_states; - PyObject *__pyx_v_node; - PyObject *__pyx_v_nodes_isteps_away_buffer; - int __pyx_v_nualt; - int __pyx_v_num_samples; - int __pyx_v_num_subpatterns; - PyObject *__pyx_v_pathlen; - PyObject *__pyx_v_phrase; - struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_phrase_location; - PyObject *__pyx_v_prefix; - PyObject *__pyx_v_reachable_buffer; - PyObject *__pyx_v_sa_range; - struct __pyx_obj_3_sa_IntList *__pyx_v_sample; - struct __pyx_obj_3_sa_FeatureVector *__pyx_v_scores; - PyObject *__pyx_v_self; - PyObject *__pyx_v_spanlen; - float __pyx_v_start_time; - PyObject *__pyx_v_stop_time; - PyObject *__pyx_v_suffix_link; - int __pyx_v_suffix_link_xcat; - PyObject *__pyx_v_suffix_link_xcat_index; - PyObject *__pyx_v_word_id; - int __pyx_v_x1; - int __pyx_v_xcat; - PyObject *__pyx_v_xcat_index; - PyObject *__pyx_v_xnode; - PyObject *__pyx_v_xroot; - Py_ssize_t __pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2; - PyObject *__pyx_t_3; - PyObject *__pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); -}; - - -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":6 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":6 * from libc.stdio cimport FILE, fclose, fopen * * cdef class SuffixArray: # <<<<<<<<<<<<<< @@ -834,7 +784,7 @@ struct __pyx_obj_3_sa_SuffixArray { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":7 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":7 * cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 * * cdef class Alphabet: # <<<<<<<<<<<<<< @@ -870,24 +820,24 @@ struct __pyx_obj_3_sa_Rule { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":187 - * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] - * if self.word_alignments is not None: - * fields.append(' '.join('%d-%d' % a for a in self.alignments())) # <<<<<<<<<<<<<< - * return ' ||| '.join(fields) +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":109 + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) # <<<<<<<<<<<<<< * + * def decode_lattice(lattice): */ struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr { - struct __pyx_Generator_object __pyx_base; - struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *__pyx_outer_scope; - PyObject *__pyx_v_a; + PyObject_HEAD + struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *__pyx_outer_scope; + PyObject *__pyx_v_word; PyObject *__pyx_t_0; Py_ssize_t __pyx_t_1; PyObject *(*__pyx_t_2)(PyObject *); }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":76 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":76 * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: * data = (line.split(' ||| ')[side] for line in fp) # <<<<<<<<<<<<<< @@ -895,7 +845,7 @@ struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr { * */ struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr { - struct __pyx_Generator_object __pyx_base; + PyObject_HEAD struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *__pyx_outer_scope; PyObject *__pyx_v_line; PyObject *__pyx_t_0; @@ -904,7 +854,7 @@ struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":72 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":72 * # in the suffix array; if discontiguous, it is the set of * # actual locations (packed into an array) * cdef class PhraseLocation: # <<<<<<<<<<<<<< @@ -923,37 +873,23 @@ struct __pyx_obj_3_sa_PhraseLocation { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":21 - * - * def __str__(self): - * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< - * - * cdef class Scorer: - */ -struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr { - struct __pyx_Generator_object __pyx_base; - struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *__pyx_outer_scope; - PyObject *__pyx_v_feat; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":20 - * yield (FD.word(self.names[i]), self.values[i]) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return ' '.join('%s=%s' % feat for feat in self) +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":15 + * self.values.append(value) * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(self.names.len): */ -struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ { +struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ { PyObject_HEAD - PyObject *__pyx_v_self; + unsigned int __pyx_v_i; + struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self; + int __pyx_t_0; + unsigned int __pyx_t_1; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":74 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":74 * self.read_text_data(fp) * * def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<< @@ -981,24 +917,20 @@ struct __pyx_obj_3_sa_FeatureVector { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":190 - * return ' ||| '.join(fields) +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":111 + * return tuple(((word, None, 1), ) for word in word_ids) * - * def alignments(self): # <<<<<<<<<<<<<< - * for point in self.word_alignments: - * yield point/65536, point%65536 + * def decode_lattice(lattice): # <<<<<<<<<<<<<< + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc + * for arc in node for node in lattice) */ -struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments { - struct __pyx_Generator_object __pyx_base; - PyObject *__pyx_v_point; - PyObject *__pyx_v_self; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); +struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice { + PyObject_HEAD + PyObject *__pyx_v_lattice; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":23 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":23 * return ' '.join('%s=%s' % feat for feat in self) * * cdef class Scorer: # <<<<<<<<<<<<<< @@ -1012,7 +944,7 @@ struct __pyx_obj_3_sa_Scorer { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":8 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":8 * # May need to revisit if things get really tight, though. * * cdef class Alignment: # <<<<<<<<<<<<<< @@ -1027,23 +959,7 @@ struct __pyx_obj_3_sa_Alignment { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":15 - * self.values.append(value) - * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(self.names.len): - */ -struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ { - struct __pyx_Generator_object __pyx_base; - unsigned int __pyx_v_i; - PyObject *__pyx_v_self; - int __pyx_t_0; - unsigned int __pyx_t_1; -}; - - -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":118 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":118 * # (entirely C-implemented) _BitSet struct. * # Very slow; use only for debugging * cdef class BitSet: # <<<<<<<<<<<<<< @@ -1056,7 +972,7 @@ struct __pyx_obj_3_sa_BitSet { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":94 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":94 * * * cdef class Sampler: # <<<<<<<<<<<<<< @@ -1070,7 +986,7 @@ struct __pyx_obj_3_sa_Sampler { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":8 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":8 * char* stringmap_word(StrMap *vocab, int i) * * cdef class StringMap: # <<<<<<<<<<<<<< @@ -1084,7 +1000,20 @@ struct __pyx_obj_3_sa_StringMap { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":34 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":20 + * yield (FD.word(self.names[i]), self.values[i]) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return ' '.join('%s=%s' % feat for feat in self) + * + */ +struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ { + PyObject_HEAD + struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self; +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":34 * cdef int EPSILON = sym_fromstring('*EPS*', True) * * cdef class TrieNode: # <<<<<<<<<<<<<< @@ -1097,7 +1026,7 @@ struct __pyx_obj_3_sa_TrieNode { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":40 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":40 * self.children = {} * * cdef class ExtendedTrieNode(TrieNode): # <<<<<<<<<<<<<< @@ -1112,7 +1041,7 @@ struct __pyx_obj_3_sa_ExtendedTrieNode { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":109 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":109 * trie_node_to_map(edge.node, result, prefix, include_zeros) * * cdef class TrieMap: # <<<<<<<<<<<<<< @@ -1127,6 +1056,161 @@ struct __pyx_obj_3_sa_TrieMap { }; +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":112 + * + * def decode_lattice(lattice): + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< + * for arc in node for node in lattice) + * + */ +struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr { + PyObject_HEAD + struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_outer_scope; + PyObject *__pyx_v_arc; + PyObject *__pyx_v_dist; + PyObject *__pyx_v_node; + PyObject *__pyx_v_sym; + PyObject *__pyx_v_weight; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); + PyObject *__pyx_t_3; + PyObject *__pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":107 + * return ALPHABET.fromstring(string, terminal) + * + * def make_lattice(words): # <<<<<<<<<<<<<< + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) + */ +struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice { + PyObject_HEAD + PyObject *__pyx_v_word_ids; + PyObject *__pyx_v_words; +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":183 + * return self.f.arity() + * + * def __str__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] + */ +struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ { + PyObject_HEAD + struct __pyx_obj_3_sa_Rule *__pyx_v_self; +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":937 + * return sorted(result); + * + * def input(self, fwords): # <<<<<<<<<<<<<< + * '''When this function is called on the RuleFactory, + * it looks up all of the rules that can be used to translate + */ +struct __pyx_obj_3_sa___pyx_scope_struct_15_input { + PyObject_HEAD + PyObject *__pyx_v_alignment; + PyObject *__pyx_v_als; + PyObject *__pyx_v_alslist; + int __pyx_v_alt; + int __pyx_v_alt_id; + int __pyx_v_arity; + struct __pyx_obj_3_sa_IntList *__pyx_v_chunklen; + PyObject *__pyx_v_count; + PyObject *__pyx_v_e; + PyObject *__pyx_v_elist; + PyObject *__pyx_v_extract; + PyObject *__pyx_v_extract_start; + PyObject *__pyx_v_extract_stop; + PyObject *__pyx_v_extracts; + PyObject *__pyx_v_f; + PyObject *__pyx_v_fcount; + int __pyx_v_flen; + PyObject *__pyx_v_fphrases; + PyObject *__pyx_v_frontier; + PyObject *__pyx_v_frontier_nodes; + PyObject *__pyx_v_fwords; + struct __pyx_obj_3_sa_Phrase *__pyx_v_hiero_phrase; + long __pyx_v_hit; + int __pyx_v_i; + PyObject *__pyx_v_is_shadow_path; + int __pyx_v_j; + int __pyx_v_k; + PyObject *__pyx_v_key; + PyObject *__pyx_v_loc; + PyObject *__pyx_v_locs; + int __pyx_v_lookup_required; + struct __pyx_t_3_sa_Matching __pyx_v_matching; + PyObject *__pyx_v_max_locs; + PyObject *__pyx_v_new_frontier; + PyObject *__pyx_v_new_node; + PyObject *__pyx_v_next_states; + PyObject *__pyx_v_node; + PyObject *__pyx_v_nodes_isteps_away_buffer; + int __pyx_v_nualt; + int __pyx_v_num_samples; + int __pyx_v_num_subpatterns; + PyObject *__pyx_v_pathlen; + PyObject *__pyx_v_phrase; + struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_phrase_location; + PyObject *__pyx_v_prefix; + PyObject *__pyx_v_reachable_buffer; + PyObject *__pyx_v_sa_range; + struct __pyx_obj_3_sa_IntList *__pyx_v_sample; + struct __pyx_obj_3_sa_FeatureVector *__pyx_v_scores; + struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self; + PyObject *__pyx_v_spanlen; + float __pyx_v_start_time; + PyObject *__pyx_v_stop_time; + PyObject *__pyx_v_suffix_link; + int __pyx_v_suffix_link_xcat; + PyObject *__pyx_v_suffix_link_xcat_index; + PyObject *__pyx_v_word_id; + int __pyx_v_x1; + int __pyx_v_xcat; + PyObject *__pyx_v_xcat_index; + PyObject *__pyx_v_xnode; + PyObject *__pyx_v_xroot; + Py_ssize_t __pyx_t_0; + PyObject *__pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4; + PyObject *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":187 + * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] + * if self.word_alignments is not None: + * fields.append(' '.join('%d-%d' % a for a in self.alignments())) # <<<<<<<<<<<<<< + * return ' ||| '.join(fields) + * + */ +struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr { + PyObject_HEAD + struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *__pyx_outer_scope; + PyObject *__pyx_v_a; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + /* "_sa.pxd":29 * cdef FloatList values * @@ -1144,7 +1228,7 @@ struct __pyx_obj_3_sa_Phrase { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":81 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":81 * free(self.arr) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -1152,15 +1236,15 @@ struct __pyx_obj_3_sa_Phrase { * for i in range(self.len): */ struct __pyx_obj_3_sa___pyx_scope_struct____iter__ { - struct __pyx_Generator_object __pyx_base; + PyObject_HEAD int __pyx_v_i; - PyObject *__pyx_v_self; + struct __pyx_obj_3_sa_IntList *__pyx_v_self; int __pyx_t_0; int __pyx_t_1; }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":51 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":51 * * * cdef class TrieTable: # <<<<<<<<<<<<<< @@ -1175,16 +1259,51 @@ struct __pyx_obj_3_sa_TrieTable { }; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":183 - * return self.f.arity() +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":141 + * return self.syms[i] * - * def __str__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i from 0 <= i < self.n: */ -struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ { +struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ { PyObject_HEAD - PyObject *__pyx_v_self; + int __pyx_v_i; + struct __pyx_obj_3_sa_Phrase *__pyx_v_self; + int __pyx_t_0; +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":108 + * + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * return tuple(((word, None, 1), ) for word in word_ids) + * + */ +struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr { + PyObject_HEAD + struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *__pyx_outer_scope; + PyObject *__pyx_v_word; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":116 + * + * def decode_sentence(lattice): + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< + */ +struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr { + PyObject_HEAD + struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_outer_scope; + PyObject *__pyx_v__; + PyObject *__pyx_v_sym; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); }; @@ -1206,7 +1325,7 @@ struct __pyx_obj_3_sa_FloatList { -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":8 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":8 * char* stringmap_word(StrMap *vocab, int i) * * cdef class StringMap: # <<<<<<<<<<<<<< @@ -1221,7 +1340,7 @@ struct __pyx_vtabstruct_3_sa_StringMap { static struct __pyx_vtabstruct_3_sa_StringMap *__pyx_vtabptr_3_sa_StringMap; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":9 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":9 * from libc.string cimport memset, strcpy * * cdef class DataArray: # <<<<<<<<<<<<<< @@ -1236,7 +1355,7 @@ struct __pyx_vtabstruct_3_sa_DataArray { static struct __pyx_vtabstruct_3_sa_DataArray *__pyx_vtabptr_3_sa_DataArray; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":109 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":109 * trie_node_to_map(edge.node, result, prefix, include_zeros) * * cdef class TrieMap: # <<<<<<<<<<<<<< @@ -1251,7 +1370,7 @@ struct __pyx_vtabstruct_3_sa_TrieMap { static struct __pyx_vtabstruct_3_sa_TrieMap *__pyx_vtabptr_3_sa_TrieMap; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":8 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":8 * # May need to revisit if things get really tight, though. * * cdef class Alignment: # <<<<<<<<<<<<<< @@ -1267,7 +1386,7 @@ struct __pyx_vtabstruct_3_sa_Alignment { static struct __pyx_vtabstruct_3_sa_Alignment *__pyx_vtabptr_3_sa_Alignment; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":47 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":47 * * * cdef class BiLex: # <<<<<<<<<<<<<< @@ -1286,7 +1405,7 @@ struct __pyx_vtabstruct_3_sa_BiLex { static struct __pyx_vtabstruct_3_sa_BiLex *__pyx_vtabptr_3_sa_BiLex; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":9 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":9 * from libc.string cimport memset, memcpy * * cdef class IntList: # <<<<<<<<<<<<<< @@ -1306,7 +1425,7 @@ struct __pyx_vtabstruct_3_sa_IntList { static struct __pyx_vtabstruct_3_sa_IntList *__pyx_vtabptr_3_sa_IntList; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":4 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":4 * from libc.string cimport strsep, strcpy, strlen * * cdef class Phrase: # <<<<<<<<<<<<<< @@ -1321,7 +1440,7 @@ struct __pyx_vtabstruct_3_sa_Phrase { static struct __pyx_vtabstruct_3_sa_Phrase *__pyx_vtabptr_3_sa_Phrase; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":72 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":72 * # in the suffix array; if discontiguous, it is the set of * # actual locations (packed into an array) * cdef class PhraseLocation: # <<<<<<<<<<<<<< @@ -1335,7 +1454,7 @@ struct __pyx_vtabstruct_3_sa_PhraseLocation { static struct __pyx_vtabstruct_3_sa_PhraseLocation *__pyx_vtabptr_3_sa_PhraseLocation; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":188 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":188 * * * cdef class Precomputation: # <<<<<<<<<<<<<< @@ -1350,7 +1469,7 @@ struct __pyx_vtabstruct_3_sa_Precomputation { static struct __pyx_vtabstruct_3_sa_Precomputation *__pyx_vtabptr_3_sa_Precomputation; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":23 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":23 * return ' '.join('%s=%s' % feat for feat in self) * * cdef class Scorer: # <<<<<<<<<<<<<< @@ -1364,7 +1483,7 @@ struct __pyx_vtabstruct_3_sa_Scorer { static struct __pyx_vtabstruct_3_sa_Scorer *__pyx_vtabptr_3_sa_Scorer; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":9 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":9 * from libc.string cimport memset, strcpy, strlen * * cdef class FloatList: # <<<<<<<<<<<<<< @@ -1380,7 +1499,7 @@ struct __pyx_vtabstruct_3_sa_FloatList { static struct __pyx_vtabstruct_3_sa_FloatList *__pyx_vtabptr_3_sa_FloatList; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":354 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":354 * * * cdef class VEB: # <<<<<<<<<<<<<< @@ -1396,7 +1515,7 @@ struct __pyx_vtabstruct_3_sa_VEB { static struct __pyx_vtabstruct_3_sa_VEB *__pyx_vtabptr_3_sa_VEB; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":7 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":7 * cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 * * cdef class Alphabet: # <<<<<<<<<<<<<< @@ -1419,7 +1538,7 @@ struct __pyx_vtabstruct_3_sa_Alphabet { static struct __pyx_vtabstruct_3_sa_Alphabet *__pyx_vtabptr_3_sa_Alphabet; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":216 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":216 * * * cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<< @@ -1447,7 +1566,7 @@ struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory { static struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *__pyx_vtabptr_3_sa_HieroCachingRuleFactory; -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":6 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":6 * from libc.stdio cimport FILE, fclose, fopen * * cdef class SuffixArray: # <<<<<<<<<<<<<< @@ -1456,17 +1575,15 @@ static struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *__pyx_vtabptr_3_sa_ */ struct __pyx_vtabstruct_3_sa_SuffixArray { - int (*__search_high)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); - int (*__search_low)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); - PyObject *(*__get_range)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int, int); - PyObject *(*__lookup_helper)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); + int (*__pyx___search_high)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); + int (*__pyx___search_low)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); + PyObject *(*__pyx___get_range)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int, int); + PyObject *(*__pyx___lookup_helper)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int); }; static struct __pyx_vtabstruct_3_sa_SuffixArray *__pyx_vtabptr_3_sa_SuffixArray; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -1479,8 +1596,21 @@ static struct __pyx_vtabstruct_3_sa_SuffixArray *__pyx_vtabptr_3_sa_SuffixArray; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -1491,7 +1621,7 @@ static struct __pyx_vtabstruct_3_sa_SuffixArray *__pyx_vtabptr_3_sa_SuffixArray; #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1502,16 +1632,97 @@ static struct __pyx_vtabstruct_3_sa_SuffixArray *__pyx_vtabptr_3_sa_SuffixArray; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, - Py_ssize_t end, int direction); +static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, + Py_ssize_t end, int direction) +{ + const char* self_ptr = PyBytes_AS_STRING(self); + Py_ssize_t self_len = PyBytes_GET_SIZE(self); + const char* sub_ptr; + Py_ssize_t sub_len; + int retval; +#if PY_VERSION_HEX >= 0x02060000 + Py_buffer view; + view.obj = NULL; +#endif + if ( PyBytes_Check(arg) ) { + sub_ptr = PyBytes_AS_STRING(arg); + sub_len = PyBytes_GET_SIZE(arg); + } +#if PY_MAJOR_VERSION < 3 + else if ( PyUnicode_Check(arg) ) { + return PyUnicode_Tailmatch(self, arg, start, end, direction); + } +#endif + else { +#if PY_VERSION_HEX < 0x02060000 + if (unlikely(PyObject_AsCharBuffer(arg, &sub_ptr, &sub_len))) + return -1; +#else + if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1)) + return -1; + sub_ptr = (const char*) view.buf; + sub_len = view.len; +#endif + } + if (end > self_len) + end = self_len; + else if (end < 0) + end += self_len; + if (end < 0) + end = 0; + if (start < 0) + start += self_len; + if (start < 0) + start = 0; + if (direction > 0) { + if (end-sub_len > start) + start = end - sub_len; + } + if (start + sub_len <= end) + retval = !memcmp(self_ptr+start, sub_ptr, sub_len); + else + retval = 0; +#if PY_VERSION_HEX >= 0x02060000 + if (view.obj) + PyBuffer_Release(&view); +#endif + return retval; +} +static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start, + Py_ssize_t end, int direction) +{ + if (unlikely(PyTuple_Check(substr))) { + Py_ssize_t i, count = PyTuple_GET_SIZE(substr); + for (i = 0; i < count; i++) { + int result; +#if CYTHON_COMPILING_IN_CPYTHON + result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i), + start, end, direction); +#else + PyObject* sub = PySequence_GetItem(substr, i); + if (unlikely(!sub)) return -1; + result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction); + Py_DECREF(sub); +#endif + if (result) { + return result; + } + } + return 0; + } + return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction); +} -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ @@ -1523,9 +1734,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, - const char* function_name, int kw_allowed); /*proto*/ - +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; @@ -1534,86 +1743,96 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j Py_DECREF(j); return r; } - - #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - - #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { /* inlined PySequence_GetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } + return m->sq_item(o, i); + } } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - return r; +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { - return unlikely(b < 0) ? b : !b; -} -static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { - return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; + if (unlikely(PyList_Append(L, x) < 0)) return NULL; Py_INCREF(Py_None); return Py_None; /* this is just to have an accurate signature */ - } - else { + } else { PyObject *r, *m; m = __Pyx_GetAttrString(L, "append"); if (!m) return NULL; @@ -1631,16 +1850,17 @@ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_SetItemInt_Fast(o, i, v) : \ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) - static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -1648,130 +1868,126 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { /* inlined PySequence_SetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } + return m->sq_ass_item(o, i, v); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif return PySequence_SetItem(o, i, v); - else { - PyObject *j = PyInt_FromSsize_t(i); - return __Pyx_SetItemInt_Generic(o, j, v); } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ - +#if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_AsDouble(obj) \ - ((likely(PyFloat_CheckExact(obj))) ? \ - PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) +(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \ + likely(PyInt_CheckExact(obj)) ? \ + PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj)) +#else +#define __Pyx_PyObject_AsDouble(obj) \ +((likely(PyFloat_CheckExact(obj))) ? \ + PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) +#endif static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2, + int is_tuple, int has_known_size, int decref_tuple); + +static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name, + Py_ssize_t* p_orig_length, int* p_is_dict); +static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, + PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); + #if PY_VERSION_HEX < 0x02050000 #ifndef PyAnySet_CheckExact - #define PyAnySet_CheckExact(ob) \ ((ob)->ob_type == &PySet_Type || \ (ob)->ob_type == &PyFrozenSet_Type) - #define PySet_New(iterable) \ PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL) - #define Pyx_PyFrozenSet_New(iterable) \ PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL) - #define PySet_Size(anyset) \ PyObject_Size((anyset)) - #define PySet_Contains(anyset, key) \ PySequence_Contains((anyset), (key)) - #define PySet_Pop(set) \ PyObject_CallMethod(set, (char *)"pop", NULL) - static CYTHON_INLINE int PySet_Clear(PyObject *set) { PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); if (!ret) return -1; Py_DECREF(ret); return 0; } - static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) { PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); if (!ret) return -1; Py_DECREF(ret); return 0; } - static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); if (!ret) return -1; Py_DECREF(ret); return 0; } - #endif /* PyAnySet_CheckExact (<= Py2.4) */ - -#if PY_VERSION_HEX < 0x02040000 -#ifndef Py_SETOBJECT_H -#define Py_SETOBJECT_H - -static PyTypeObject *__Pyx_PySet_Type = NULL; -static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL; - -#define PySet_Type (*__Pyx_PySet_Type) -#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type) - -#define PyAnySet_Check(ob) \ - (PyAnySet_CheckExact(ob) || \ - PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ - PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) - -#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) - -static int __Pyx_Py23SetsImport(void) { - PyObject *sets=0, *Set=0, *ImmutableSet=0; - - sets = PyImport_ImportModule((char *)"sets"); - if (!sets) goto bad; - Set = PyObject_GetAttrString(sets, (char *)"Set"); - if (!Set) goto bad; - ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet"); - if (!ImmutableSet) goto bad; - Py_DECREF(sets); - - __Pyx_PySet_Type = (PyTypeObject*) Set; - __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet; - - return 0; - - bad: - Py_XDECREF(sets); - Py_XDECREF(Set); - Py_XDECREF(ImmutableSet); - return -1; -} - -#else -static int __Pyx_Py23SetsImport(void) { return 0; } -#endif /* !Py_SETOBJECT_H */ -#endif /* < Py2.4 */ #endif /* < Py2.5 */ -static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void); - #if PY_MAJOR_VERSION >= 3 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; - if (unlikely(d == Py_None)) { - __Pyx_RaiseNoneIndexingError(); - return NULL; - } value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) @@ -1790,10 +2006,9 @@ static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */ #define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) { -#if PY_VERSION_HEX >= 0x02040000 +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000 if (likely(PyList_CheckExact(L)) - /* Check that both the size is positive and no reallocation shrinking needs to be done. */ - && likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) { + && likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) { Py_SIZE(L) -= 1; return PyList_GET_ITEM(L, PyList_GET_SIZE(L)); } @@ -1811,31 +2026,49 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -#include <string.h> - -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ - -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ - -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -#define __pyx_binding_PyCFunctionType_USED 1 - +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); + +#define __Pyx_CyFunction_USED 1 +#include <structmember.h> +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f) \ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f) \ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f) \ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { PyCFunctionObject func; -} __pyx_binding_PyCFunctionType_object; - -static PyTypeObject __pyx_binding_PyCFunctionType_type; -static PyTypeObject *__pyx_binding_PyCFunctionType = NULL; - -static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */ -#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL) - -static int __pyx_binding_PyCFunctionType_init(void); /* proto */ + int flags; + PyObject *func_dict; + PyObject *func_weakreflist; + PyObject *func_name; + PyObject *func_doc; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; /* No-args super() class cell */ + void *defaults; + int defaults_pyobjects; + PyObject *defaults_tuple; /* Const defaults tuple */ + 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, + PyObject *self, PyObject *module, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static int __Pyx_CyFunction_init(void); static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); @@ -1874,17 +2107,59 @@ static void __Pyx_WriteUnraisable(const char *name, int clineno, static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +#define __Pyx_Generator_USED +#include <structmember.h> +#include <frameobject.h> +typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); +typedef struct { + PyObject_HEAD + __pyx_generator_body_t body; + PyObject *closure; + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; + PyObject *gi_weakreflist; + PyObject *classobj; + PyObject *yieldfrom; + int resume_label; + char is_running; // using T_BOOL for property below requires char value +} __pyx_GeneratorObject; +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure); +static int __pyx_Generator_init(void); +static int __Pyx_Generator_clear(PyObject* self); +#if 1 || PY_VERSION_HEX < 0x030300B0 +static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) +#endif + static int __Pyx_check_binary_version(void); static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'libc.stdio' */ /* Module declarations from 'libc.stdlib' */ @@ -1919,19 +2194,25 @@ static PyTypeObject *__pyx_ptype_3_sa_PhraseLocation = 0; static PyTypeObject *__pyx_ptype_3_sa_Sampler = 0; static PyTypeObject *__pyx_ptype_3_sa_HieroCachingRuleFactory = 0; static PyTypeObject *__pyx_ptype_3_sa_Scorer = 0; -static PyTypeObject *__pyx_ptype_3_sa___pyx_Generator = 0; static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct____iter__ = 0; static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_1_read_bitext = 0; static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_2_genexpr = 0; static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_3_compute_stats = 0; -static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_4___iter__ = 0; -static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_5___str__ = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_4_make_lattice = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_5_genexpr = 0; static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_6_genexpr = 0; -static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_7_alignments = 0; -static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_8_input = 0; -static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_9___iter__ = 0; -static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_10___str__ = 0; -static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_11_genexpr = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_7_decode_lattice = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_8_genexpr = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_9_decode_sentence = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_10_genexpr = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_11___iter__ = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_12___str__ = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_13_genexpr = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_14_alignments = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_15_input = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_16___iter__ = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_17___str__ = 0; +static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_18_genexpr = 0; static int __pyx_v_3_sa_MIN_BOTTOM_SIZE; static int __pyx_v_3_sa_MIN_BOTTOM_BITS; static int __pyx_v_3_sa_LOWER_MASK[32]; @@ -1944,7 +2225,6 @@ static int __pyx_v_3_sa_BAEZA_YATES; static int __pyx_v_3_sa_EPSILON; static struct __pyx_obj_3_sa_StringMap *__pyx_v_3_sa_FD = 0; static char *__pyx_f_3_sa_sym_tostring(int); /*proto*/ -static char *__pyx_f_3_sa_sym_tocat(int); /*proto*/ static int __pyx_f_3_sa_sym_isvar(int); /*proto*/ static int __pyx_f_3_sa_sym_getindex(int); /*proto*/ static float __pyx_f_3_sa_monitor_cpu(void); /*proto*/ @@ -1963,13 +2243,13 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *); /*proto*/ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *, int); /*proto*/ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *, int); /*proto*/ static int __pyx_f_3_sa_sym_setindex(int, int); /*proto*/ +static int __pyx_f_3_sa_sym_fromstring(char *, int); /*proto*/ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void); /*proto*/ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int); /*proto*/ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *); /*proto*/ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *); /*proto*/ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_sa__Trie_Node *, int); /*proto*/ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_Node *, int); /*proto*/ -static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_Node *, int *, int); /*proto*/ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3_sa__Trie_Node *, int); /*proto*/ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *, PyObject *, PyObject *, int); /*proto*/ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *, PyObject *, PyObject *, int); /*proto*/ @@ -1994,6 +2274,199 @@ static PyObject *__pyx_builtin_StopIteration; static PyObject *__pyx_builtin_cmp; static PyObject *__pyx_builtin_sorted; static PyObject *__pyx_builtin_max; +static PyObject *__pyx_pf_3_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename); /* proto */ +static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ +static void __pyx_pf_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static int __pyx_pf_3_sa_9FloatList_6__setitem__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_9FloatList_8__len__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, float __pyx_v_val); /* proto */ +static PyObject *__pyx_pf_3_sa_9FloatList_12write(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9FloatList_14read(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_val); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_10sort(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_12reset(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static void __pyx_pf_3_sa_7IntList_14__dealloc__(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_16__iter__(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_pf_3_sa_7IntList_21__setitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_7IntList_23__len__(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_25get_size(struct __pyx_obj_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_27append(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_29extend(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_31write(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_7IntList_33read(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static int __pyx_pf_3_sa_9StringMap___cinit__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self); /* proto */ +static void __pyx_pf_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side, int __pyx_v_use_sent_id); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_9DataArray_2__len__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_4get_data(struct __pyx_obj_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence_id(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_8get_sentence(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_10get_sentence_position(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_12get_id(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_14get_word(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_id); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_16write_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_18read_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_20read_bitext(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename, int __pyx_v_side); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_22read_text_data(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_24read_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_26write_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_28write_enhanced_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f); /* proto */ +static PyObject *__pyx_pf_3_sa_9DataArray_30write_enhanced(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id); /* proto */ +static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_8read_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_12write_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col); /* proto */ +static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_BitSetIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_6BitSet___cinit__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static void __pyx_pf_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_4__iter__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_12min(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6BitSet_14max(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_6BitSet_16__len__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_3VEB___cinit__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_size); /* proto */ +static void __pyx_pf_3_sa_3VEB_2__dealloc__(struct __pyx_obj_3_sa_VEB *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_3VEB_4__iter__(struct __pyx_obj_3_sa_VEB *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_3VEB_10__len__(struct __pyx_obj_3_sa_VEB *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_3VEB_12__contains__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sa); /* proto */ +static PyObject *__pyx_pf_3_sa_3LCP_2compute_stats(struct __pyx_obj_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n); /* proto */ +static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */ +static void __pyx_pf_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_12make_lattice_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3_sa_2make_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words); /* proto */ +static PyObject *__pyx_pf_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4decode_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice); /* proto */ +static PyObject *__pyx_pf_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6decode_sentence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice); /* proto */ +static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words); /* proto */ +static void __pyx_pf_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci); /* proto */ +#if PY_MAJOR_VERSION < 3 +static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +#endif +static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_3_sa_6Phrase_24__len__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_26__getitem__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_28__iter__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_children); /* proto */ +static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, int __pyx_v_lhs, struct __pyx_obj_3_sa_Phrase *__pyx_v_f, struct __pyx_obj_3_sa_Phrase *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_word_alignments); /* proto */ +static Py_hash_t __pyx_pf_3_sa_4Rule_2__hash__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +#if PY_MAJOR_VERSION < 3 +static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Rule *__pyx_v_other); /* proto */ +#endif +static PyObject *__pyx_pf_3_sa_4Rule_6fmerge(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Phrase *__pyx_v_f); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_8arity(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_7__str___genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_12alignments(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_7TrieMap___cinit__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size); /* proto */ +static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */ +static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_from_stats, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_precompute_rank, PyObject *__pyx_v_precompute_secondary_rank, PyObject *__pyx_v_max_length, PyObject *__pyx_v_max_nonterminals, PyObject *__pyx_v_train_max_initial_size, PyObject *__pyx_v_train_min_gap_size); /* proto */ +static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sarray); /* proto */ +static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_4get_sentence_id(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_6get_sentence(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_8get_sentence_position(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_10read_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_side); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_12q3sort(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_3_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_16read_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_18write_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_20write_enhanced(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_3_sa_11SuffixArray_22lookup(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_word, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high); /* proto */ +static int __pyx_pf_3_sa_8TrieNode___cinit__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link); /* proto */ +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9TrieTable___cinit__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended); /* proto */ +static PyObject *__pyx_pf_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sa_low, int __pyx_v_sa_high, int __pyx_v_arr_low, int __pyx_v_arr_high, PyObject *__pyx_v_arr, int __pyx_v_num_subpatterns); /* proto */ +static int __pyx_pf_3_sa_7Sampler___cinit__(struct __pyx_obj_3_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray); /* proto */ +static PyObject *__pyx_pf_3_sa_7Sampler_2sample(struct __pyx_obj_3_sa_Sampler *__pyx_v_self, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_phrase_location); /* proto */ +static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_Alignment *__pyx_v_alignment, float __pyx_v_by_slack_factor, char *__pyx_v_category, PyObject *__pyx_v_max_chunks, unsigned int __pyx_v_max_initial_size, unsigned int __pyx_v_max_length, unsigned int __pyx_v_max_nonterminals, PyObject *__pyx_v_max_target_chunks, PyObject *__pyx_v_max_target_length, unsigned int __pyx_v_min_gap_size, PyObject *__pyx_v_precompute_file, unsigned int __pyx_v_precompute_secondary_rank, unsigned int __pyx_v_precompute_rank, int __pyx_v_require_aligned_terminal, int __pyx_v_require_aligned_chunks, unsigned int __pyx_v_train_max_initial_size, unsigned int __pyx_v_train_min_gap_size, int __pyx_v_tight_phrases, int __pyx_v_use_baeza_yates, int __pyx_v_use_collocations, int __pyx_v_use_index); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_3_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_3_sa_Sampler *__pyx_v_sampler, struct __pyx_obj_3_sa_Scorer *__pyx_v_scorer); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_skip, PyObject *__pyx_v_i, PyObject *__pyx_v_spanlen, PyObject *__pyx_v_pathlen, PyObject *__pyx_v_fwords, PyObject *__pyx_v_next_states, PyObject *__pyx_v_reachable_buffer); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_dist); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_ito); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v__columns, PyObject *__pyx_v_curr_idx, PyObject *__pyx_v_min_dist); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords); /* proto */ +static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_13FeatureVector_2set(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str___genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self); /* proto */ +static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_models); /* proto */ static char __pyx_k_1[] = ".gz"; static char __pyx_k_2[] = "Requested index %d of %d-length FloatList"; static char __pyx_k_3[] = "IntList["; @@ -2088,8 +2561,10 @@ static char __pyx_k_132[] = "Subphrase [%d, %d] failed integrity check"; static char __pyx_k_133[] = "Didn't extract anything from [%d, %d] -> [%d, %d]"; static char __pyx_k_134[] = "Unable to extract basic phrase"; static char __pyx_k_135[] = "%s=%s"; -static char __pyx_k_136[] = "cdec.sa"; -static char __pyx_k_138[] = "*EPS*"; +static char __pyx_k_138[] = "/Users/vchahun/Sandbox/cdec/python/src/sa/_sa.pyx"; +static char __pyx_k_139[] = "cdec.sa"; +static char __pyx_k_143[] = "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi"; +static char __pyx_k_148[] = "*EPS*"; static char __pyx_k__gc[] = "gc"; static char __pyx_k__sa[] = "sa"; static char __pyx_k___sa[] = "_sa"; @@ -2161,7 +2636,6 @@ static char __pyx_k__scorer[] = "scorer"; static char __pyx_k__scores[] = "scores"; static char __pyx_k__sorted[] = "sorted"; static char __pyx_k__source[] = "source"; -static char __pyx_k__string[] = "string"; static char __pyx_k__unlink[] = "unlink"; static char __pyx_k__Counter[] = "Counter"; static char __pyx_k__advance[] = "advance"; @@ -2171,6 +2645,8 @@ static char __pyx_k__edarray[] = "edarray"; static char __pyx_k__ephrase[] = "ephrase"; static char __pyx_k__fphrase[] = "fphrase"; static char __pyx_k__fsarray[] = "fsarray"; +static char __pyx_k__genexpr[] = "genexpr"; +static char __pyx_k__lattice[] = "lattice"; static char __pyx_k__logging[] = "logging"; static char __pyx_k__matches[] = "matches"; static char __pyx_k__pathlen[] = "pathlen"; @@ -2199,7 +2675,7 @@ static char __pyx_k__resource[] = "resource"; static char __pyx_k__ru_stime[] = "ru_stime"; static char __pyx_k__ru_utime[] = "ru_utime"; static char __pyx_k__shortest[] = "shortest"; -static char __pyx_k__terminal[] = "terminal"; +static char __pyx_k__word_ids[] = "word_ids"; static char __pyx_k__Exception[] = "Exception"; static char __pyx_k__INCREMENT[] = "INCREMENT"; static char __pyx_k__TypeError[] = "TypeError"; @@ -2245,6 +2721,7 @@ static char __pyx_k__use_sent_id[] = "use_sent_id"; static char __pyx_k___doquicksort[] = "_doquicksort"; static char __pyx_k__get_sentence[] = "get_sentence"; static char __pyx_k__gzip_or_text[] = "gzip_or_text"; +static char __pyx_k__make_lattice[] = "make_lattice"; static char __pyx_k__min_gap_size[] = "min_gap_size"; static char __pyx_k__StopIteration[] = "StopIteration"; static char __pyx_k__alphabet_size[] = "alphabet_size"; @@ -2252,10 +2729,11 @@ static char __pyx_k__fsample_count[] = "fsample_count"; static char __pyx_k__test_sentence[] = "test_sentence"; static char __pyx_k__tight_phrases[] = "tight_phrases"; static char __pyx_k__FeatureContext[] = "FeatureContext"; +static char __pyx_k__decode_lattice[] = "decode_lattice"; static char __pyx_k__pattern2phrase[] = "pattern2phrase"; static char __pyx_k__read_text_data[] = "read_text_data"; -static char __pyx_k__sym_fromstring[] = "sym_fromstring"; static char __pyx_k__by_slack_factor[] = "by_slack_factor"; +static char __pyx_k__decode_sentence[] = "decode_sentence"; static char __pyx_k__get_next_states[] = "get_next_states"; static char __pyx_k__get_sentence_id[] = "get_sentence_id"; static char __pyx_k__num_subpatterns[] = "num_subpatterns"; @@ -2306,9 +2784,10 @@ static PyObject *__pyx_kp_s_132; static PyObject *__pyx_kp_s_133; static PyObject *__pyx_kp_s_134; static PyObject *__pyx_kp_s_135; -static PyObject *__pyx_kp_s_136; static PyObject *__pyx_kp_s_138; +static PyObject *__pyx_kp_s_139; static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_143; static PyObject *__pyx_kp_s_18; static PyObject *__pyx_kp_s_2; static PyObject *__pyx_kp_s_21; @@ -2400,6 +2879,8 @@ static PyObject *__pyx_n_s__collect; static PyObject *__pyx_n_s__collections; static PyObject *__pyx_n_s__curr_idx; static PyObject *__pyx_n_s__debug; +static PyObject *__pyx_n_s__decode_lattice; +static PyObject *__pyx_n_s__decode_sentence; static PyObject *__pyx_n_s__defaultdict; static PyObject *__pyx_n_s__dist; static PyObject *__pyx_n_s__e; @@ -2427,6 +2908,7 @@ static PyObject *__pyx_n_s__fsarray; static PyObject *__pyx_n_s__fword; static PyObject *__pyx_n_s__fwords; static PyObject *__pyx_n_s__gc; +static PyObject *__pyx_n_s__genexpr; static PyObject *__pyx_n_s__getLogger; static PyObject *__pyx_n_s__get_e_id; static PyObject *__pyx_n_s__get_f_id; @@ -2457,11 +2939,13 @@ static PyObject *__pyx_n_s__ito; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__join; static PyObject *__pyx_n_s__key; +static PyObject *__pyx_n_s__lattice; static PyObject *__pyx_n_s__lhs; static PyObject *__pyx_n_s__logger; static PyObject *__pyx_n_s__logging; static PyObject *__pyx_n_s__lookup; static PyObject *__pyx_n_s__low; +static PyObject *__pyx_n_s__make_lattice; static PyObject *__pyx_n_s__map; static PyObject *__pyx_n_s__matches; static PyObject *__pyx_n_s__max; @@ -2527,10 +3011,7 @@ static PyObject *__pyx_n_s__split; static PyObject *__pyx_n_s__start; static PyObject *__pyx_n_s__stats; static PyObject *__pyx_n_s__stop; -static PyObject *__pyx_n_s__string; static PyObject *__pyx_n_s__suffix_link; -static PyObject *__pyx_n_s__sym_fromstring; -static PyObject *__pyx_n_s__terminal; static PyObject *__pyx_n_s__test_sentence; static PyObject *__pyx_n_s__tight_phrases; static PyObject *__pyx_n_s__toMap; @@ -2545,6 +3026,7 @@ static PyObject *__pyx_n_s__w; static PyObject *__pyx_n_s__warn; static PyObject *__pyx_n_s__word; static PyObject *__pyx_n_s__word_alignments; +static PyObject *__pyx_n_s__word_ids; static PyObject *__pyx_n_s__words; static PyObject *__pyx_n_s__write; static PyObject *__pyx_n_s__write_text; @@ -2609,7 +3091,15 @@ static PyObject *__pyx_k_tuple_99; static PyObject *__pyx_k_tuple_103; static PyObject *__pyx_k_tuple_108; static PyObject *__pyx_k_tuple_123; -static PyObject *__pyx_k_tuple_137; +static PyObject *__pyx_k_tuple_136; +static PyObject *__pyx_k_tuple_140; +static PyObject *__pyx_k_tuple_141; +static PyObject *__pyx_k_tuple_144; +static PyObject *__pyx_k_tuple_146; +static PyObject *__pyx_k_codeobj_137; +static PyObject *__pyx_k_codeobj_142; +static PyObject *__pyx_k_codeobj_145; +static PyObject *__pyx_k_codeobj_147; /* "_sa.pyx":5 * import gzip @@ -2630,7 +3120,7 @@ static float __pyx_f_3_sa_monitor_cpu(void) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("monitor_cpu"); + __Pyx_RefNannySetupContext("monitor_cpu", 0); /* "_sa.pyx":6 * @@ -2650,7 +3140,7 @@ static float __pyx_f_3_sa_monitor_cpu(void) { __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -2680,7 +3170,7 @@ static float __pyx_f_3_sa_monitor_cpu(void) { __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__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 = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; @@ -2695,7 +3185,7 @@ static float __pyx_f_3_sa_monitor_cpu(void) { __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_5; goto __pyx_L0; @@ -2714,6 +3204,28 @@ static float __pyx_f_3_sa_monitor_cpu(void) { return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_1gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_1gzip_or_text = {__Pyx_NAMESTR("gzip_or_text"), (PyCFunction)__pyx_pw_3_sa_1gzip_or_text, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_1gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gzip_or_text (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_gzip_or_text(__pyx_self, ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "_sa.pyx":9 * resource.getrusage(resource.RUSAGE_SELF).ru_stime) * @@ -2722,10 +3234,7 @@ static float __pyx_f_3_sa_monitor_cpu(void) { * return gzip.GzipFile(filename) */ -static PyObject *__pyx_pf_3_sa_gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_gzip_or_text = {__Pyx_NAMESTR("gzip_or_text"), (PyCFunction)__pyx_pf_3_sa_gzip_or_text, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_3_sa_gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2735,17 +3244,7 @@ static PyObject *__pyx_pf_3_sa_gzip_or_text(PyObject *__pyx_self, PyObject *__py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("gzip_or_text"); - __pyx_self = __pyx_self; - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("gzip_or_text", 0); /* "_sa.pyx":10 * @@ -2776,7 +3275,7 @@ static PyObject *__pyx_pf_3_sa_gzip_or_text(PyObject *__pyx_self, PyObject *__py __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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; @@ -2787,7 +3286,7 @@ static PyObject *__pyx_pf_3_sa_gzip_or_text(PyObject *__pyx_self, PyObject *__py __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } /*else*/ { @@ -2802,7 +3301,7 @@ static PyObject *__pyx_pf_3_sa_gzip_or_text(PyObject *__pyx_self, PyObject *__py __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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; @@ -2813,7 +3312,7 @@ static PyObject *__pyx_pf_3_sa_gzip_or_text(PyObject *__pyx_self, PyObject *__py __pyx_t_1 = 0; goto __pyx_L0; } - __pyx_L5:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -2829,32 +3328,22 @@ static PyObject *__pyx_pf_3_sa_gzip_or_text(PyObject *__pyx_self, PyObject *__py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":11 - * cdef class FloatList: - * - * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< - * if initial_len > size: - * size = initial_len - */ - -static int __pyx_pf_3_sa_9FloatList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_9FloatList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_size; int __pyx_v_increment; int __pyx_v_initial_len; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -2862,7 +3351,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(PyObject *__pyx_v_self, PyObject * default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); @@ -2880,7 +3369,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(PyObject *__pyx_v_self, PyObject * } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2915,8 +3404,26 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(PyObject *__pyx_v_self, PyObject * __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9FloatList___cinit__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":12 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":11 + * cdef class FloatList: + * + * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< + * if initial_len > size: + * size = initial_len + */ + +static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":12 * * def __cinit__(self, int size=0, int increment=1, int initial_len=0): * if initial_len > size: # <<<<<<<<<<<<<< @@ -2926,7 +3433,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_1 = (__pyx_v_initial_len > __pyx_v_size); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":13 * def __cinit__(self, int size=0, int increment=1, int initial_len=0): * if initial_len > size: * size = initial_len # <<<<<<<<<<<<<< @@ -2934,61 +3441,70 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(PyObject *__pyx_v_self, PyObject * * self.increment = increment */ __pyx_v_size = __pyx_v_initial_len; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":14 * if initial_len > size: * size = initial_len * self.size = size # <<<<<<<<<<<<<< * self.increment = increment * self.len = initial_len */ - ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->size = __pyx_v_size; + __pyx_v_self->size = __pyx_v_size; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":15 * size = initial_len * self.size = size * self.increment = increment # <<<<<<<<<<<<<< * self.len = initial_len * self.arr = <float*> malloc(size*sizeof(float)) */ - ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->increment = __pyx_v_increment; + __pyx_v_self->increment = __pyx_v_increment; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":16 * self.size = size * self.increment = increment * self.len = initial_len # <<<<<<<<<<<<<< * self.arr = <float*> malloc(size*sizeof(float)) * memset(self.arr, 0, initial_len*sizeof(float)) */ - ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len = __pyx_v_initial_len; + __pyx_v_self->len = __pyx_v_initial_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":17 * self.increment = increment * self.len = initial_len * self.arr = <float*> malloc(size*sizeof(float)) # <<<<<<<<<<<<<< * memset(self.arr, 0, initial_len*sizeof(float)) * */ - ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->arr = ((float *)malloc((__pyx_v_size * (sizeof(float))))); + __pyx_v_self->arr = ((float *)malloc((__pyx_v_size * (sizeof(float))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":18 * self.len = initial_len * self.arr = <float*> malloc(size*sizeof(float)) * memset(self.arr, 0, initial_len*sizeof(float)) # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - memset(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->arr, 0, (__pyx_v_initial_len * (sizeof(float)))); + memset(__pyx_v_self->arr, 0, (__pyx_v_initial_len * (sizeof(float)))); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":20 +/* Python wrapper */ +static void __pyx_pw_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_3_sa_9FloatList_2__dealloc__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":20 * memset(self.arr, 0, initial_len*sizeof(float)) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2996,24 +3512,34 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(PyObject *__pyx_v_self, PyObject * * */ -static void __pyx_pf_3_sa_9FloatList_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_3_sa_9FloatList_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":21 * * def __dealloc__(self): * free(self.arr) # <<<<<<<<<<<<<< * * def __getitem__(self, i): */ - free(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->arr); + free(__pyx_v_self->arr); __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":23 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9FloatList_4__getitem__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":23 * free(self.arr) * * def __getitem__(self, i): # <<<<<<<<<<<<<< @@ -3021,8 +3547,7 @@ static void __pyx_pf_3_sa_9FloatList_1__dealloc__(PyObject *__pyx_v_self) { * if i<0: */ -static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_v_j = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3035,9 +3560,9 @@ static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, P int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__"); + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":24 * * def __getitem__(self, i): * j = i # <<<<<<<<<<<<<< @@ -3047,27 +3572,26 @@ static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, P __Pyx_INCREF(__pyx_v_i); __pyx_v_j = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":25 * def __getitem__(self, i): * j = i * if i<0: # <<<<<<<<<<<<<< * j = self.len + i * if j<0 or j>=self.len: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __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[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":26 * j = i * if i<0: * j = self.len + i # <<<<<<<<<<<<<< * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len)) */ - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -3075,26 +3599,24 @@ static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, P __Pyx_DECREF(__pyx_v_j); __pyx_v_j = __pyx_t_3; __pyx_t_3 = 0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":27 * if i<0: * j = self.len + i * if j<0 or j>=self.len: # <<<<<<<<<<<<<< * raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len)) * return self.arr[j] */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_j, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_j, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_2) { - __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_j, __pyx_t_3, Py_GE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_j, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3104,17 +3626,17 @@ static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, P } if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":28 * j = self.len + i * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len)) # <<<<<<<<<<<<<< * return self.arr[j] * */ - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); @@ -3125,7 +3647,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, P __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __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[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __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; @@ -3135,11 +3657,11 @@ static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, P __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":29 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":29 * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len)) * return self.arr[j] # <<<<<<<<<<<<<< @@ -3148,7 +3670,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, P */ __Pyx_XDECREF(__pyx_r); __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyFloat_FromDouble((((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->arr[__pyx_t_6])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->arr[__pyx_t_6])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3168,7 +3690,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_2__getitem__(PyObject *__pyx_v_self, P return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":31 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":31 * return self.arr[j] * * cdef void set(self, int i, float v): # <<<<<<<<<<<<<< @@ -3188,9 +3710,9 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set"); + __Pyx_RefNannySetupContext("set", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":32 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":32 * * cdef void set(self, int i, float v): * j = i # <<<<<<<<<<<<<< @@ -3199,7 +3721,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v */ __pyx_v_j = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":33 * cdef void set(self, int i, float v): * j = i * if i<0: # <<<<<<<<<<<<<< @@ -3209,7 +3731,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v __pyx_t_1 = (__pyx_v_i < 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":34 * j = i * if i<0: * j = self.len + i # <<<<<<<<<<<<<< @@ -3221,7 +3743,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":35 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":35 * if i<0: * j = self.len + i * if j<0 or j>=self.len: # <<<<<<<<<<<<<< @@ -3237,7 +3759,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":36 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":36 * j = self.len + i * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len)) # <<<<<<<<<<<<<< @@ -3249,7 +3771,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v __pyx_t_5 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); @@ -3260,7 +3782,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -3274,7 +3796,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":37 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":37 * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len)) * self.arr[j] = v # <<<<<<<<<<<<<< @@ -3293,7 +3815,18 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":39 +/* Python wrapper */ +static int __pyx_pw_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pw_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9FloatList_6__setitem__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":39 * self.arr[j] = v * * def __setitem__(self, i, val): # <<<<<<<<<<<<<< @@ -3301,8 +3834,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v * */ -static int __pyx_pf_3_sa_9FloatList_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ -static int __pyx_pf_3_sa_9FloatList_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +static int __pyx_pf_3_sa_9FloatList_6__setitem__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3310,9 +3842,9 @@ static int __pyx_pf_3_sa_9FloatList_3__setitem__(PyObject *__pyx_v_self, PyObjec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__"); + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":40 * * def __setitem__(self, i, val): * self.set(i, val) # <<<<<<<<<<<<<< @@ -3320,8 +3852,8 @@ static int __pyx_pf_3_sa_9FloatList_3__setitem__(PyObject *__pyx_v_self, PyObjec * def __len__(self): */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_vtabstruct_3_sa_FloatList *)((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->__pyx_vtab)->set(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), __pyx_t_1, __pyx_t_2); + __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_v_val); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2); __pyx_r = 0; goto __pyx_L0; @@ -3333,7 +3865,18 @@ static int __pyx_pf_3_sa_9FloatList_3__setitem__(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":42 +/* Python wrapper */ +static Py_ssize_t __pyx_pw_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9FloatList_8__len__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":42 * self.set(i, val) * * def __len__(self): # <<<<<<<<<<<<<< @@ -3341,20 +3884,19 @@ static int __pyx_pf_3_sa_9FloatList_3__setitem__(PyObject *__pyx_v_self, PyObjec * */ -static Py_ssize_t __pyx_pf_3_sa_9FloatList_4__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_3_sa_9FloatList_4__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_9FloatList_8__len__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__"); + __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":43 * * def __len__(self): * return self.len # <<<<<<<<<<<<<< * * def append(self, float val): */ - __pyx_r = ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len; + __pyx_r = __pyx_v_self->len; goto __pyx_L0; __pyx_r = 0; @@ -3363,26 +3905,15 @@ static Py_ssize_t __pyx_pf_3_sa_9FloatList_4__len__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":45 - * return self.len - * - * def append(self, float val): # <<<<<<<<<<<<<< - * if self.len == self.size: - * self.size = self.size + self.increment - */ - -static PyObject *__pyx_pf_3_sa_9FloatList_5append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pf_3_sa_9FloatList_5append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { float __pyx_v_val; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("append"); + __Pyx_RefNannySetupContext("append (wrapper)", 0); assert(__pyx_arg_val); { - __pyx_v_val = __pyx_PyFloat_AsDouble(__pyx_arg_val); if (unlikely((__pyx_v_val == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_val = __pyx_PyFloat_AsFloat(__pyx_arg_val); if (unlikely((__pyx_v_val == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3390,55 +3921,73 @@ static PyObject *__pyx_pf_3_sa_9FloatList_5append(PyObject *__pyx_v_self, PyObje __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9FloatList_10append(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((float)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":45 + * return self.len + * + * def append(self, float val): # <<<<<<<<<<<<<< + * if self.len == self.size: + * self.size = self.size + self.increment + */ + +static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, float __pyx_v_val) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("append", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":46 * * def append(self, float val): * if self.len == self.size: # <<<<<<<<<<<<<< * self.size = self.size + self.increment * self.arr = <float*> realloc(self.arr, self.size*sizeof(float)) */ - __pyx_t_1 = (((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len == ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->size); + __pyx_t_1 = (__pyx_v_self->len == __pyx_v_self->size); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":47 * def append(self, float val): * if self.len == self.size: * self.size = self.size + self.increment # <<<<<<<<<<<<<< * self.arr = <float*> realloc(self.arr, self.size*sizeof(float)) * self.arr[self.len] = val */ - ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->size = (((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->size + ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->increment); + __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":48 * if self.len == self.size: * self.size = self.size + self.increment * self.arr = <float*> realloc(self.arr, self.size*sizeof(float)) # <<<<<<<<<<<<<< * self.arr[self.len] = val * self.len = self.len + 1 */ - ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->arr = ((float *)realloc(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->arr, (((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->size * (sizeof(float))))); - goto __pyx_L5; + __pyx_v_self->arr = ((float *)realloc(__pyx_v_self->arr, (__pyx_v_self->size * (sizeof(float))))); + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":49 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":49 * self.size = self.size + self.increment * self.arr = <float*> realloc(self.arr, self.size*sizeof(float)) * self.arr[self.len] = val # <<<<<<<<<<<<<< * self.len = self.len + 1 * */ - (((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->arr[((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len]) = __pyx_v_val; + (__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":50 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":50 * self.arr = <float*> realloc(self.arr, self.size*sizeof(float)) * self.arr[self.len] = val * self.len = self.len + 1 # <<<<<<<<<<<<<< * * cdef void write_handle(self, FILE* f): */ - ((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len = (((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->len + 1); + __pyx_v_self->len = (__pyx_v_self->len + 1); __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); @@ -3446,7 +3995,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_5append(PyObject *__pyx_v_self, PyObje return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":52 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":52 * self.len = self.len + 1 * * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -3456,9 +4005,9 @@ static PyObject *__pyx_pf_3_sa_9FloatList_5append(PyObject *__pyx_v_self, PyObje static void __pyx_f_3_sa_9FloatList_write_handle(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_handle"); + __Pyx_RefNannySetupContext("write_handle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":53 * * cdef void write_handle(self, FILE* f): * fwrite(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<< @@ -3467,7 +4016,7 @@ static void __pyx_f_3_sa_9FloatList_write_handle(struct __pyx_obj_3_sa_FloatList */ fwrite((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":54 * cdef void write_handle(self, FILE* f): * fwrite(&(self.len), sizeof(float), 1, f) * fwrite(self.arr, sizeof(float), self.len, f) # <<<<<<<<<<<<<< @@ -3479,24 +4028,13 @@ static void __pyx_f_3_sa_9FloatList_write_handle(struct __pyx_obj_3_sa_FloatList __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":56 - * fwrite(self.arr, sizeof(float), self.len, f) - * - * def write(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_3_sa_9FloatList_6write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9FloatList_6write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write"); + __Pyx_RefNannySetupContext("write (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -3506,8 +4044,26 @@ static PyObject *__pyx_pf_3_sa_9FloatList_6write(PyObject *__pyx_v_self, PyObjec __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9FloatList_12write(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":58 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":56 + * fwrite(self.arr, sizeof(float), self.len, f) + * + * def write(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_3_sa_9FloatList_12write(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":58 * def write(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -3516,16 +4072,16 @@ static PyObject *__pyx_pf_3_sa_9FloatList_6write(PyObject *__pyx_v_self, PyObjec */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":59 * cdef FILE* f * f = fopen(filename, "w") * self.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":60 * f = fopen(filename, "w") * self.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -3540,7 +4096,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_6write(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":62 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":62 * fclose(f) * * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -3550,9 +4106,9 @@ static PyObject *__pyx_pf_3_sa_9FloatList_6write(PyObject *__pyx_v_self, PyObjec static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_handle"); + __Pyx_RefNannySetupContext("read_handle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":63 * * cdef void read_handle(self, FILE* f): * free(self.arr) # <<<<<<<<<<<<<< @@ -3561,7 +4117,7 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList */ free(__pyx_v_self->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":64 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":64 * cdef void read_handle(self, FILE* f): * free(self.arr) * fread(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<< @@ -3570,7 +4126,7 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList */ fread((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":65 * free(self.arr) * fread(&(self.len), sizeof(float), 1, f) * self.arr = <float*> malloc(self.len * sizeof(float)) # <<<<<<<<<<<<<< @@ -3579,7 +4135,7 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList */ __pyx_v_self->arr = ((float *)malloc((__pyx_v_self->len * (sizeof(float))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":66 * fread(&(self.len), sizeof(float), 1, f) * self.arr = <float*> malloc(self.len * sizeof(float)) * self.size = self.len # <<<<<<<<<<<<<< @@ -3588,7 +4144,7 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList */ __pyx_v_self->size = __pyx_v_self->len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":67 * self.arr = <float*> malloc(self.len * sizeof(float)) * self.size = self.len * fread(self.arr, sizeof(float), self.len, f) # <<<<<<<<<<<<<< @@ -3600,24 +4156,13 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":69 - * fread(self.arr, sizeof(float), self.len, f) - * - * def read(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_3_sa_9FloatList_7read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9FloatList_7read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read"); + __Pyx_RefNannySetupContext("read (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -3627,8 +4172,26 @@ static PyObject *__pyx_pf_3_sa_9FloatList_7read(PyObject *__pyx_v_self, PyObject __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9FloatList_14read(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":71 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":69 + * fread(self.arr, sizeof(float), self.len, f) + * + * def read(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_3_sa_9FloatList_14read(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":71 * def read(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -3637,15 +4200,15 @@ static PyObject *__pyx_pf_3_sa_9FloatList_7read(PyObject *__pyx_v_self, PyObject */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":72 * cdef FILE* f * f = fopen(filename, "r") * self.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/float_list.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":73 * f = fopen(filename, "r") * self.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -3658,32 +4221,22 @@ static PyObject *__pyx_pf_3_sa_9FloatList_7read(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":11 - * cdef class IntList: - * - * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< - * if initial_len > size: - * size = initial_len - */ - -static int __pyx_pf_3_sa_7IntList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_7IntList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_size; int __pyx_v_increment; int __pyx_v_initial_len; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3691,7 +4244,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(PyObject *__pyx_v_self, PyObject *__ default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); @@ -3709,7 +4262,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(PyObject *__pyx_v_self, PyObject *__ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3744,8 +4297,26 @@ static int __pyx_pf_3_sa_7IntList___cinit__(PyObject *__pyx_v_self, PyObject *__ __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_7IntList___cinit__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":12 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":11 + * cdef class IntList: + * + * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< + * if initial_len > size: + * size = initial_len + */ + +static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":12 * * def __cinit__(self, int size=0, int increment=1, int initial_len=0): * if initial_len > size: # <<<<<<<<<<<<<< @@ -3755,7 +4326,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(PyObject *__pyx_v_self, PyObject *__ __pyx_t_1 = (__pyx_v_initial_len > __pyx_v_size); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":13 * def __cinit__(self, int size=0, int increment=1, int initial_len=0): * if initial_len > size: * size = initial_len # <<<<<<<<<<<<<< @@ -3763,61 +4334,72 @@ static int __pyx_pf_3_sa_7IntList___cinit__(PyObject *__pyx_v_self, PyObject *__ * self.increment = increment */ __pyx_v_size = __pyx_v_initial_len; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":14 * if initial_len > size: * size = initial_len * self.size = size # <<<<<<<<<<<<<< * self.increment = increment * self.len = initial_len */ - ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->size = __pyx_v_size; + __pyx_v_self->size = __pyx_v_size; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":15 * size = initial_len * self.size = size * self.increment = increment # <<<<<<<<<<<<<< * self.len = initial_len * self.arr = <int*> malloc(size*sizeof(int)) */ - ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->increment = __pyx_v_increment; + __pyx_v_self->increment = __pyx_v_increment; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":16 * self.size = size * self.increment = increment * self.len = initial_len # <<<<<<<<<<<<<< * self.arr = <int*> malloc(size*sizeof(int)) * memset(self.arr, 0, initial_len*sizeof(int)) */ - ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len = __pyx_v_initial_len; + __pyx_v_self->len = __pyx_v_initial_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":17 * self.increment = increment * self.len = initial_len * self.arr = <int*> malloc(size*sizeof(int)) # <<<<<<<<<<<<<< * memset(self.arr, 0, initial_len*sizeof(int)) * */ - ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr = ((int *)malloc((__pyx_v_size * (sizeof(int))))); + __pyx_v_self->arr = ((int *)malloc((__pyx_v_size * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":18 * self.len = initial_len * self.arr = <int*> malloc(size*sizeof(int)) * memset(self.arr, 0, initial_len*sizeof(int)) # <<<<<<<<<<<<<< * * def __str__(self): */ - memset(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr, 0, (__pyx_v_initial_len * (sizeof(int)))); + memset(__pyx_v_self->arr, 0, (__pyx_v_initial_len * (sizeof(int)))); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":20 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_3__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_3__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_2__str__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":20 * memset(self.arr, 0, initial_len*sizeof(int)) * * def __str__(self): # <<<<<<<<<<<<<< @@ -3825,8 +4407,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(PyObject *__pyx_v_self, PyObject *__ * ret = "IntList[" */ -static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_v_ret = NULL; int __pyx_v_idx; PyObject *__pyx_r = NULL; @@ -3839,9 +4420,9 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__"); + __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":22 * def __str__(self): * cdef unsigned i * ret = "IntList[" # <<<<<<<<<<<<<< @@ -3851,18 +4432,18 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); __pyx_v_ret = ((PyObject *)__pyx_kp_s_3); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":23 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":23 * cdef unsigned i * ret = "IntList[" * for idx in range(self.size): # <<<<<<<<<<<<<< * if idx>0: * ret += "," */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->size; + __pyx_t_1 = __pyx_v_self->size; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_idx = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":24 * ret = "IntList[" * for idx in range(self.size): * if idx>0: # <<<<<<<<<<<<<< @@ -3872,7 +4453,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { __pyx_t_3 = (__pyx_v_idx > 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":25 * for idx in range(self.size): * if idx>0: * ret += "," # <<<<<<<<<<<<<< @@ -3884,21 +4465,21 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { __Pyx_DECREF(__pyx_v_ret); __pyx_v_ret = __pyx_t_4; __pyx_t_4 = 0; - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":26 * if idx>0: * ret += "," * ret += str(self.arr[idx]) # <<<<<<<<<<<<<< * ret += "]" * ret += "len=" */ - __pyx_t_4 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_v_idx])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_self->arr[__pyx_v_idx])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; @@ -3913,7 +4494,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { __pyx_t_5 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":27 * ret += "," * ret += str(self.arr[idx]) * ret += "]" # <<<<<<<<<<<<<< @@ -3926,7 +4507,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { __pyx_v_ret = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":28 * ret += str(self.arr[idx]) * ret += "]" * ret += "len=" # <<<<<<<<<<<<<< @@ -3939,14 +4520,14 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { __pyx_v_ret = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":29 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":29 * ret += "]" * ret += "len=" * ret += self.len # <<<<<<<<<<<<<< * return ret * */ - __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_ret, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); @@ -3955,7 +4536,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { __pyx_v_ret = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":30 * ret += "len=" * ret += self.len * return ret # <<<<<<<<<<<<<< @@ -3981,7 +4562,18 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":32 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("index (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_4index(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":32 * return ret * * def index(self, val): # <<<<<<<<<<<<<< @@ -3989,8 +4581,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_1__str__(PyObject *__pyx_v_self) { * for i in range(self.len): */ -static PyObject *__pyx_pf_3_sa_7IntList_2index(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_2index(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { +static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_val) { unsigned int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -4002,36 +4593,35 @@ static PyObject *__pyx_pf_3_sa_7IntList_2index(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("index"); + __Pyx_RefNannySetupContext("index", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":34 * def index(self, val): * cdef unsigned i * for i in range(self.len): # <<<<<<<<<<<<<< * if self.arr[i] == val: * return i */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len; + __pyx_t_1 = __pyx_v_self->len; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":35 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":35 * cdef unsigned i * for i in range(self.len): * if self.arr[i] == val: # <<<<<<<<<<<<<< * return i * return IndexError */ - __pyx_t_3 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->arr[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_val, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_val, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":36 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":36 * for i in range(self.len): * if self.arr[i] == val: * return i # <<<<<<<<<<<<<< @@ -4044,12 +4634,12 @@ static PyObject *__pyx_pf_3_sa_7IntList_2index(PyObject *__pyx_v_self, PyObject __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":37 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":37 * if self.arr[i] == val: * return i * return IndexError # <<<<<<<<<<<<<< @@ -4074,60 +4664,39 @@ static PyObject *__pyx_pf_3_sa_7IntList_2index(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":39 - * return IndexError - * - * def partition(self,start,end): # <<<<<<<<<<<<<< - * pivot = self.arr[end] - * bottom = start-1 - */ - -static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_end = 0; - PyObject *__pyx_v_pivot = NULL; - PyObject *__pyx_v_bottom = NULL; - PyObject *__pyx_v_top = NULL; - long __pyx_v_done; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; - __Pyx_RefNannySetupContext("partition"); + __Pyx_RefNannySetupContext("partition (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("partition", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "partition") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "partition") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4146,8 +4715,38 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_7IntList_6partition(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":40 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":39 + * return IndexError + * + * def partition(self,start,end): # <<<<<<<<<<<<<< + * pivot = self.arr[end] + * bottom = start-1 + */ + +static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { + PyObject *__pyx_v_pivot = NULL; + PyObject *__pyx_v_bottom = NULL; + PyObject *__pyx_v_top = NULL; + long __pyx_v_done; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("partition", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":40 * * def partition(self,start,end): * pivot = self.arr[end] # <<<<<<<<<<<<<< @@ -4155,12 +4754,12 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj * top = end */ __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_end); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_pivot = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":41 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":41 * def partition(self,start,end): * pivot = self.arr[end] * bottom = start-1 # <<<<<<<<<<<<<< @@ -4172,7 +4771,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj __pyx_v_bottom = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":42 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":42 * pivot = self.arr[end] * bottom = start-1 * top = end # <<<<<<<<<<<<<< @@ -4182,7 +4781,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj __Pyx_INCREF(__pyx_v_end); __pyx_v_top = __pyx_v_end; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":43 * bottom = start-1 * top = end * done = 0 # <<<<<<<<<<<<<< @@ -4191,7 +4790,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj */ __pyx_v_done = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":44 * top = end * done = 0 * while not done: # <<<<<<<<<<<<<< @@ -4202,7 +4801,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj __pyx_t_3 = (!__pyx_v_done); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":45 * done = 0 * while not done: * while not done: # <<<<<<<<<<<<<< @@ -4213,7 +4812,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj __pyx_t_3 = (!__pyx_v_done); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":46 * while not done: * while not done: * bottom += 1 # <<<<<<<<<<<<<< @@ -4226,20 +4825,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj __pyx_v_bottom = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":47 * while not done: * bottom += 1 * if bottom == top: # <<<<<<<<<<<<<< * done = 1 * break */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_bottom, __pyx_v_top, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_bottom, __pyx_v_top, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":48 * bottom += 1 * if bottom == top: * done = 1 # <<<<<<<<<<<<<< @@ -4248,19 +4846,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj */ __pyx_v_done = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":49 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":49 * if bottom == top: * done = 1 * break # <<<<<<<<<<<<<< * if self.arr[bottom] > pivot: * self.arr[top] = self.arr[bottom] */ - goto __pyx_L9_break; - goto __pyx_L10; + goto __pyx_L6_break; + goto __pyx_L7; } - __pyx_L10:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":50 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":50 * done = 1 * break * if self.arr[bottom] > pivot: # <<<<<<<<<<<<<< @@ -4268,16 +4866,15 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj * break */ __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_bottom); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_v_pivot, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_v_pivot, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":51 * break * if self.arr[bottom] > pivot: * self.arr[top] = self.arr[bottom] # <<<<<<<<<<<<<< @@ -4286,23 +4883,23 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj */ __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_bottom); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_top); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_t_5]) = (((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_t_1]); + (__pyx_v_self->arr[__pyx_t_5]) = (__pyx_v_self->arr[__pyx_t_1]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":52 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":52 * if self.arr[bottom] > pivot: * self.arr[top] = self.arr[bottom] * break # <<<<<<<<<<<<<< * while not done: * top -= 1 */ - goto __pyx_L9_break; - goto __pyx_L11; + goto __pyx_L6_break; + goto __pyx_L8; } - __pyx_L11:; + __pyx_L8:; } - __pyx_L9_break:; + __pyx_L6_break:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":53 * self.arr[top] = self.arr[bottom] * break * while not done: # <<<<<<<<<<<<<< @@ -4313,7 +4910,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj __pyx_t_3 = (!__pyx_v_done); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":54 * break * while not done: * top -= 1 # <<<<<<<<<<<<<< @@ -4326,20 +4923,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj __pyx_v_top = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":55 * while not done: * top -= 1 * if top == bottom: # <<<<<<<<<<<<<< * done = 1 * break */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_top, __pyx_v_bottom, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_top, __pyx_v_bottom, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":56 * top -= 1 * if top == bottom: * done = 1 # <<<<<<<<<<<<<< @@ -4348,19 +4944,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj */ __pyx_v_done = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":57 * if top == bottom: * done = 1 * break # <<<<<<<<<<<<<< * if self.arr[top] < pivot: * self.arr[bottom] = self.arr[top] */ - goto __pyx_L13_break; - goto __pyx_L14; + goto __pyx_L10_break; + goto __pyx_L11; } - __pyx_L14:; + __pyx_L11:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":58 * done = 1 * break * if self.arr[top] < pivot: # <<<<<<<<<<<<<< @@ -4368,16 +4964,15 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj * break */ __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_top); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_t_1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_pivot, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_pivot, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":59 * break * if self.arr[top] < pivot: * self.arr[bottom] = self.arr[top] # <<<<<<<<<<<<<< @@ -4386,24 +4981,24 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj */ __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_top); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_bottom); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_t_5]) = (((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_t_1]); + (__pyx_v_self->arr[__pyx_t_5]) = (__pyx_v_self->arr[__pyx_t_1]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":60 * if self.arr[top] < pivot: * self.arr[bottom] = self.arr[top] * break # <<<<<<<<<<<<<< * self.arr[top] = pivot * return top */ - goto __pyx_L13_break; - goto __pyx_L15; + goto __pyx_L10_break; + goto __pyx_L12; } - __pyx_L15:; + __pyx_L12:; } - __pyx_L13_break:; + __pyx_L10_break:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":61 * self.arr[bottom] = self.arr[top] * break * self.arr[top] = pivot # <<<<<<<<<<<<<< @@ -4412,9 +5007,9 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj */ __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_pivot); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_top); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_t_1]) = __pyx_t_6; + (__pyx_v_self->arr[__pyx_t_1]) = __pyx_t_6; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":62 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":62 * break * self.arr[top] = pivot * return top # <<<<<<<<<<<<<< @@ -4442,55 +5037,39 @@ static PyObject *__pyx_pf_3_sa_7IntList_3partition(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":64 - * return top - * - * def _doquicksort(self,start,end): # <<<<<<<<<<<<<< - * if start < end: - * split = self.partition(start,end) - */ - -static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_end = 0; - PyObject *__pyx_v_split = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; - __Pyx_RefNannySetupContext("_doquicksort"); + __Pyx_RefNannySetupContext("_doquicksort (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_doquicksort", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_doquicksort") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_doquicksort") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4509,31 +5088,55 @@ static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, Py __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_7IntList_8_doquicksort(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":65 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":64 + * return top + * + * def _doquicksort(self,start,end): # <<<<<<<<<<<<<< + * if start < end: + * split = self.partition(start,end) + */ + +static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { + PyObject *__pyx_v_split = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_doquicksort", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":65 * * def _doquicksort(self,start,end): * if start < end: # <<<<<<<<<<<<<< * split = self.partition(start,end) * self._doquicksort(start,split-1) */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __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[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":66 * def _doquicksort(self,start,end): * if start < end: * split = self.partition(start,end) # <<<<<<<<<<<<<< * self._doquicksort(start,split-1) * self._doquicksort(split+1,end) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__partition); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__partition); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_start); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_start); __Pyx_GIVEREF(__pyx_v_start); @@ -4547,19 +5150,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, Py __pyx_v_split = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":67 * if start < end: * split = self.partition(start,end) * self._doquicksort(start,split-1) # <<<<<<<<<<<<<< * self._doquicksort(split+1,end) * else: */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___doquicksort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___doquicksort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Subtract(__pyx_v_split, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_start); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_start); __Pyx_GIVEREF(__pyx_v_start); @@ -4572,19 +5175,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, Py __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":68 * split = self.partition(start,end) * self._doquicksort(start,split-1) * self._doquicksort(split+1,end) # <<<<<<<<<<<<<< * else: * return */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___doquicksort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___doquicksort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyNumber_Add(__pyx_v_split, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_end); @@ -4596,11 +5199,11 @@ static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, Py __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L6; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":70 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":70 * self._doquicksort(split+1,end) * else: * return # <<<<<<<<<<<<<< @@ -4611,7 +5214,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, Py __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; } - __pyx_L6:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -4628,7 +5231,18 @@ static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":72 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sort (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_10sort(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":72 * return * * def sort(self): # <<<<<<<<<<<<<< @@ -4636,8 +5250,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_4_doquicksort(PyObject *__pyx_v_self, Py * */ -static PyObject *__pyx_pf_3_sa_7IntList_5sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_5sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_7IntList_10sort(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4646,21 +5259,21 @@ static PyObject *__pyx_pf_3_sa_7IntList_5sort(PyObject *__pyx_v_self, CYTHON_UNU int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sort"); + __Pyx_RefNannySetupContext("sort", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":73 * * def sort(self): * self._doquicksort(0,self.len-1) # <<<<<<<<<<<<<< * * def reset(self): */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___doquicksort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___doquicksort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->len - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -4687,7 +5300,18 @@ static PyObject *__pyx_pf_3_sa_7IntList_5sort(PyObject *__pyx_v_self, CYTHON_UNU return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":75 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_12reset(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":75 * self._doquicksort(0,self.len-1) * * def reset(self): # <<<<<<<<<<<<<< @@ -4695,20 +5319,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_5sort(PyObject *__pyx_v_self, CYTHON_UNU * */ -static PyObject *__pyx_pf_3_sa_7IntList_6reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_6reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_7IntList_12reset(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset"); + __Pyx_RefNannySetupContext("reset", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":76 * * def reset(self): * self.len = 0 # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len = 0; + __pyx_v_self->len = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); @@ -4716,7 +5339,16 @@ static PyObject *__pyx_pf_3_sa_7IntList_6reset(PyObject *__pyx_v_self, CYTHON_UN return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":78 +/* Python wrapper */ +static void __pyx_pw_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_3_sa_7IntList_14__dealloc__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":78 * self.len = 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -4724,25 +5356,35 @@ static PyObject *__pyx_pf_3_sa_7IntList_6reset(PyObject *__pyx_v_self, CYTHON_UN * */ -static void __pyx_pf_3_sa_7IntList_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_3_sa_7IntList_7__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_3_sa_7IntList_14__dealloc__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":79 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":79 * * def __dealloc__(self): * free(self.arr) # <<<<<<<<<<<<<< * * def __iter__(self): */ - free(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr); + free(__pyx_v_self->arr); + + __Pyx_RefNannyFinishContext(); +} +static PyObject *__pyx_gb_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_16__iter__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyObject *__pyx_gb_3_sa_7IntList_9generator(struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":81 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":81 * free(self.arr) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -4750,43 +5392,52 @@ static PyObject *__pyx_gb_3_sa_7IntList_9generator(struct __pyx_obj_3_sa___pyx_s * for i in range(self.len): */ -static PyObject *__pyx_pf_3_sa_7IntList_8__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_8__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_7IntList_16__iter__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)__pyx_ptype_3_sa___pyx_scope_struct____iter__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __Pyx_INCREF(__pyx_v_self); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_7IntList_9generator; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_7IntList_18generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.IntList.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_7IntList_9generator(struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ @@ -4796,25 +5447,25 @@ static PyObject *__pyx_gb_3_sa_7IntList_9generator(struct __pyx_obj_3_sa___pyx_s __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":83 * def __iter__(self): * cdef int i * for i in range(self.len): # <<<<<<<<<<<<<< * yield self.arr[i] * */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_cur_scope->__pyx_v_self)->len; + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->len; 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/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":84 * cdef int i * for i in range(self.len): * yield self.arr[i] # <<<<<<<<<<<<<< * * def __getitem__(self, index): */ - __pyx_t_3 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_cur_scope->__pyx_v_self)->arr[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->arr[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -4823,26 +5474,38 @@ static PyObject *__pyx_gb_3_sa_7IntList_9generator(struct __pyx_obj_3_sa___pyx_s __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":86 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_19__getitem__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":86 * yield self.arr[i] * * def __getitem__(self, index): # <<<<<<<<<<<<<< @@ -4850,8 +5513,7 @@ static PyObject *__pyx_gb_3_sa_7IntList_9generator(struct __pyx_obj_3_sa___pyx_s * if isinstance(index, int): */ -static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { +static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; @@ -4871,9 +5533,9 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__"); + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":88 * def __getitem__(self, index): * cdef int i, j, k * if isinstance(index, int): # <<<<<<<<<<<<<< @@ -4886,7 +5548,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":89 * cdef int i, j, k * if isinstance(index, int): * j = index # <<<<<<<<<<<<<< @@ -4896,7 +5558,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_j = __pyx_t_3; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":90 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":90 * if isinstance(index, int): * j = index * if j < 0: # <<<<<<<<<<<<<< @@ -4906,19 +5568,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __pyx_t_2 = (__pyx_v_j < 0); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":91 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":91 * j = index * if j < 0: * j = self.len + j # <<<<<<<<<<<<<< * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length IntList" % (index, self.len)) */ - __pyx_v_j = (((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len + __pyx_v_j); - goto __pyx_L6; + __pyx_v_j = (__pyx_v_self->len + __pyx_v_j); + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":92 * if j < 0: * j = self.len + j * if j<0 or j>=self.len: # <<<<<<<<<<<<<< @@ -4927,24 +5589,24 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py */ __pyx_t_2 = (__pyx_v_j < 0); if (!__pyx_t_2) { - __pyx_t_4 = (__pyx_v_j >= ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len); + __pyx_t_4 = (__pyx_v_j >= __pyx_v_self->len); __pyx_t_5 = __pyx_t_4; } else { __pyx_t_5 = __pyx_t_2; } if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":93 * j = self.len + j * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length IntList" % (index, self.len)) # <<<<<<<<<<<<<< * return self.arr[j] * elif isinstance(index, slice): */ - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_index); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_index); __Pyx_GIVEREF(__pyx_v_index); @@ -4955,7 +5617,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -4965,11 +5627,11 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":94 * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length IntList" % (index, self.len)) * return self.arr[j] # <<<<<<<<<<<<<< @@ -4977,15 +5639,15 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py * i = index.start */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_v_j])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_self->arr[__pyx_v_j])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":95 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":95 * raise IndexError("Requested index %d of %d-length IntList" % (index, self.len)) * return self.arr[j] * elif isinstance(index, slice): # <<<<<<<<<<<<<< @@ -4998,7 +5660,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":96 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":96 * return self.arr[j] * elif isinstance(index, slice): * i = index.start # <<<<<<<<<<<<<< @@ -5011,7 +5673,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_i = __pyx_t_3; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":97 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":97 * elif isinstance(index, slice): * i = index.start * j = index.stop # <<<<<<<<<<<<<< @@ -5024,7 +5686,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_j = __pyx_t_3; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":98 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":98 * i = index.start * j = index.stop * if i < 0: # <<<<<<<<<<<<<< @@ -5034,19 +5696,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __pyx_t_5 = (__pyx_v_i < 0); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":99 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":99 * j = index.stop * if i < 0: * i = self.len + i # <<<<<<<<<<<<<< * if j < 0: * j = self.len + j */ - __pyx_v_i = (((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len + __pyx_v_i); - goto __pyx_L8; + __pyx_v_i = (__pyx_v_self->len + __pyx_v_i); + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":100 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":100 * if i < 0: * i = self.len + i * if j < 0: # <<<<<<<<<<<<<< @@ -5056,19 +5718,19 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __pyx_t_5 = (__pyx_v_j < 0); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":101 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":101 * i = self.len + i * if j < 0: * j = self.len + j # <<<<<<<<<<<<<< * if i < 0 or i >= self.len or j < 0 or j > self.len: * raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len)) */ - __pyx_v_j = (((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len + __pyx_v_j); - goto __pyx_L9; + __pyx_v_j = (__pyx_v_self->len + __pyx_v_j); + goto __pyx_L7; } - __pyx_L9:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":102 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":102 * if j < 0: * j = self.len + j * if i < 0 or i >= self.len or j < 0 or j > self.len: # <<<<<<<<<<<<<< @@ -5077,11 +5739,11 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py */ __pyx_t_5 = (__pyx_v_i < 0); if (!__pyx_t_5) { - __pyx_t_2 = (__pyx_v_i >= ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len); + __pyx_t_2 = (__pyx_v_i >= __pyx_v_self->len); if (!__pyx_t_2) { __pyx_t_4 = (__pyx_v_j < 0); if (!__pyx_t_4) { - __pyx_t_7 = (__pyx_v_j > ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len); + __pyx_t_7 = (__pyx_v_j > __pyx_v_self->len); __pyx_t_8 = __pyx_t_7; } else { __pyx_t_8 = __pyx_t_4; @@ -5096,7 +5758,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py } if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":103 * j = self.len + j * if i < 0 or i >= self.len or j < 0 or j > self.len: * raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len)) # <<<<<<<<<<<<<< @@ -5107,10 +5769,10 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyInt_FromLong(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); @@ -5124,7 +5786,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; @@ -5134,11 +5796,11 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + goto __pyx_L8; } - __pyx_L10:; + __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":104 * if i < 0 or i >= self.len or j < 0 or j > self.len: * raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len)) * result = () # <<<<<<<<<<<<<< @@ -5148,7 +5810,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __pyx_v_result = __pyx_empty_tuple; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":105 * raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len)) * result = () * for k from i <= k < j: # <<<<<<<<<<<<<< @@ -5158,17 +5820,17 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __pyx_t_3 = __pyx_v_j; for (__pyx_v_k = __pyx_v_i; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":106 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":106 * result = () * for k from i <= k < j: * result = result + (self.arr[k],) # <<<<<<<<<<<<<< * return result * else: */ - __pyx_t_9 = PyInt_FromLong((((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->arr[__pyx_v_k])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong((__pyx_v_self->arr[__pyx_v_k])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; @@ -5180,7 +5842,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __pyx_t_9 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":107 * for k from i <= k < j: * result = result + (self.arr[k],) * return result # <<<<<<<<<<<<<< @@ -5191,11 +5853,11 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":109 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":109 * return result * else: * raise TypeError("Illegal key type %s for IntList" % type(index)) # <<<<<<<<<<<<<< @@ -5205,7 +5867,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)Py_TYPE(__pyx_v_index))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; @@ -5216,7 +5878,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L5:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -5234,7 +5896,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10__getitem__(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":111 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":111 * raise TypeError("Illegal key type %s for IntList" % type(index)) * * cdef void set(self, int i, int val): # <<<<<<<<<<<<<< @@ -5254,9 +5916,9 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set"); + __Pyx_RefNannySetupContext("set", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":112 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":112 * * cdef void set(self, int i, int val): * j = i # <<<<<<<<<<<<<< @@ -5265,7 +5927,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel */ __pyx_v_j = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":113 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":113 * cdef void set(self, int i, int val): * j = i * if i<0: # <<<<<<<<<<<<<< @@ -5275,7 +5937,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel __pyx_t_1 = (__pyx_v_i < 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":114 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":114 * j = i * if i<0: * j = self.len + i # <<<<<<<<<<<<<< @@ -5287,7 +5949,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":115 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":115 * if i<0: * j = self.len + i * if j<0 or j>=self.len: # <<<<<<<<<<<<<< @@ -5303,7 +5965,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":116 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":116 * j = self.len + i * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length IntList" % (i, self.len)) # <<<<<<<<<<<<<< @@ -5315,7 +5977,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel __pyx_t_5 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); @@ -5326,7 +5988,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -5340,7 +6002,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":117 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":117 * if j<0 or j>=self.len: * raise IndexError("Requested index %d of %d-length IntList" % (i, self.len)) * self.arr[j] = val # <<<<<<<<<<<<<< @@ -5359,7 +6021,18 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":119 +/* Python wrapper */ +static int __pyx_pw_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pw_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_21__setitem__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":119 * self.arr[j] = val * * def __setitem__(self, i, val): # <<<<<<<<<<<<<< @@ -5367,8 +6040,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel * */ -static int __pyx_pf_3_sa_7IntList_11__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ -static int __pyx_pf_3_sa_7IntList_11__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +static int __pyx_pf_3_sa_7IntList_21__setitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -5376,9 +6048,9 @@ static int __pyx_pf_3_sa_7IntList_11__setitem__(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__"); + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":120 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":120 * * def __setitem__(self, i, val): * self.set(i, val) # <<<<<<<<<<<<<< @@ -5387,7 +6059,7 @@ static int __pyx_pf_3_sa_7IntList_11__setitem__(PyObject *__pyx_v_self, PyObject */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_val); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->__pyx_vtab)->set(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_t_1, __pyx_t_2); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2); __pyx_r = 0; goto __pyx_L0; @@ -5399,7 +6071,18 @@ static int __pyx_pf_3_sa_7IntList_11__setitem__(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":122 +/* Python wrapper */ +static Py_ssize_t __pyx_pw_3_sa_7IntList_24__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_3_sa_7IntList_24__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_23__len__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":122 * self.set(i, val) * * def __len__(self): # <<<<<<<<<<<<<< @@ -5407,20 +6090,19 @@ static int __pyx_pf_3_sa_7IntList_11__setitem__(PyObject *__pyx_v_self, PyObject * */ -static Py_ssize_t __pyx_pf_3_sa_7IntList_12__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_3_sa_7IntList_12__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_7IntList_23__len__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__"); + __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":123 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":123 * * def __len__(self): * return self.len # <<<<<<<<<<<<<< * * def get_size(self): */ - __pyx_r = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->len; + __pyx_r = __pyx_v_self->len; goto __pyx_L0; __pyx_r = 0; @@ -5429,7 +6111,18 @@ static Py_ssize_t __pyx_pf_3_sa_7IntList_12__len__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":125 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_size (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_25get_size(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":125 * return self.len * * def get_size(self): # <<<<<<<<<<<<<< @@ -5437,17 +6130,16 @@ static Py_ssize_t __pyx_pf_3_sa_7IntList_12__len__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_7IntList_13get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_13get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_7IntList_25get_size(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_size"); + __Pyx_RefNannySetupContext("get_size", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":126 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":126 * * def get_size(self): * return self.size # <<<<<<<<<<<<<< @@ -5455,7 +6147,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_13get_size(PyObject *__pyx_v_self, CYTHO * def append(self, int val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5473,23 +6165,13 @@ static PyObject *__pyx_pf_3_sa_7IntList_13get_size(PyObject *__pyx_v_self, CYTHO return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":128 - * return self.size - * - * def append(self, int val): # <<<<<<<<<<<<<< - * self._append(val) - * - */ - -static PyObject *__pyx_pf_3_sa_7IntList_14append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_14append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { int __pyx_v_val; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("append"); + __Pyx_RefNannySetupContext("append (wrapper)", 0); assert(__pyx_arg_val); { __pyx_v_val = __Pyx_PyInt_AsInt(__pyx_arg_val); if (unlikely((__pyx_v_val == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -5499,15 +6181,32 @@ static PyObject *__pyx_pf_3_sa_7IntList_14append(PyObject *__pyx_v_self, PyObjec __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_7IntList_27append(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":129 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":128 + * return self.size + * + * def append(self, int val): # <<<<<<<<<<<<<< + * self._append(val) + * + */ + +static PyObject *__pyx_pf_3_sa_7IntList_27append(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("append", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":129 * * def append(self, int val): * self._append(val) # <<<<<<<<<<<<<< * * cdef void _append(self, int val): */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->__pyx_vtab)->_append(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_val); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_append(__pyx_v_self, __pyx_v_val); __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); @@ -5515,7 +6214,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_14append(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":131 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":131 * self._append(val) * * cdef void _append(self, int val): # <<<<<<<<<<<<<< @@ -5526,9 +6225,9 @@ static PyObject *__pyx_pf_3_sa_7IntList_14append(PyObject *__pyx_v_self, PyObjec static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("_append"); + __Pyx_RefNannySetupContext("_append", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":132 * * cdef void _append(self, int val): * if self.len == self.size: # <<<<<<<<<<<<<< @@ -5538,7 +6237,7 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v __pyx_t_1 = (__pyx_v_self->len == __pyx_v_self->size); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":133 * cdef void _append(self, int val): * if self.len == self.size: * self.size = self.size + self.increment # <<<<<<<<<<<<<< @@ -5547,7 +6246,7 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v */ __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":134 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":134 * if self.len == self.size: * self.size = self.size + self.increment * self.arr = <int*> realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<< @@ -5559,7 +6258,7 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":135 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":135 * self.size = self.size + self.increment * self.arr = <int*> realloc(self.arr, self.size*sizeof(int)) * self.arr[self.len] = val # <<<<<<<<<<<<<< @@ -5568,7 +6267,7 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v */ (__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":136 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":136 * self.arr = <int*> realloc(self.arr, self.size*sizeof(int)) * self.arr[self.len] = val * self.len = self.len + 1 # <<<<<<<<<<<<<< @@ -5580,7 +6279,18 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":138 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("extend (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7IntList_29extend(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":138 * self.len = self.len + 1 * * def extend(self, other): # <<<<<<<<<<<<<< @@ -5588,17 +6298,16 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v * */ -static PyObject *__pyx_pf_3_sa_7IntList_15extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_15extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_3_sa_7IntList_29extend(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("extend"); + __Pyx_RefNannySetupContext("extend", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":139 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":139 * * def extend(self, other): * self._extend(other) # <<<<<<<<<<<<<< @@ -5608,7 +6317,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_15extend(PyObject *__pyx_v_self, PyObjec if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_other; __Pyx_INCREF(__pyx_t_1); - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->__pyx_vtab)->_extend(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1)); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_extend(__pyx_v_self, ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -5623,7 +6332,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_15extend(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":141 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":141 * self._extend(other) * * cdef void _extend(self, IntList other): # <<<<<<<<<<<<<< @@ -5633,9 +6342,9 @@ static PyObject *__pyx_pf_3_sa_7IntList_15extend(PyObject *__pyx_v_self, PyObjec static void __pyx_f_3_sa_7IntList__extend(struct __pyx_obj_3_sa_IntList *__pyx_v_self, struct __pyx_obj_3_sa_IntList *__pyx_v_other) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_extend"); + __Pyx_RefNannySetupContext("_extend", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":142 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":142 * * cdef void _extend(self, IntList other): * self._extend_arr(other.arr, other.len) # <<<<<<<<<<<<<< @@ -5647,7 +6356,7 @@ static void __pyx_f_3_sa_7IntList__extend(struct __pyx_obj_3_sa_IntList *__pyx_v __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":144 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":144 * self._extend_arr(other.arr, other.len) * * cdef void _extend_arr(self, int* other, int other_len): # <<<<<<<<<<<<<< @@ -5658,9 +6367,9 @@ static void __pyx_f_3_sa_7IntList__extend(struct __pyx_obj_3_sa_IntList *__pyx_v static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int *__pyx_v_other, int __pyx_v_other_len) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("_extend_arr"); + __Pyx_RefNannySetupContext("_extend_arr", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":145 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":145 * * cdef void _extend_arr(self, int* other, int other_len): * if self.size < self.len + other_len: # <<<<<<<<<<<<<< @@ -5670,7 +6379,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p __pyx_t_1 = (__pyx_v_self->size < (__pyx_v_self->len + __pyx_v_other_len)); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":146 * cdef void _extend_arr(self, int* other, int other_len): * if self.size < self.len + other_len: * self.size = self.len + other_len # <<<<<<<<<<<<<< @@ -5679,7 +6388,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p */ __pyx_v_self->size = (__pyx_v_self->len + __pyx_v_other_len); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":147 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":147 * if self.size < self.len + other_len: * self.size = self.len + other_len * self.arr = <int*> realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<< @@ -5691,7 +6400,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":148 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":148 * self.size = self.len + other_len * self.arr = <int*> realloc(self.arr, self.size*sizeof(int)) * memcpy(self.arr+self.len, other, other_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -5700,7 +6409,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p */ memcpy((__pyx_v_self->arr + __pyx_v_self->len), __pyx_v_other, (__pyx_v_other_len * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":149 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":149 * self.arr = <int*> realloc(self.arr, self.size*sizeof(int)) * memcpy(self.arr+self.len, other, other_len*sizeof(int)) * self.len = self.len + other_len # <<<<<<<<<<<<<< @@ -5712,7 +6421,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":151 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":151 * self.len = self.len + other_len * * cdef void _clear(self): # <<<<<<<<<<<<<< @@ -5722,9 +6431,9 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_clear"); + __Pyx_RefNannySetupContext("_clear", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":152 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":152 * * cdef void _clear(self): * free(self.arr) # <<<<<<<<<<<<<< @@ -5733,7 +6442,7 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ */ free(__pyx_v_self->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":153 * cdef void _clear(self): * free(self.arr) * self.len = 0 # <<<<<<<<<<<<<< @@ -5742,7 +6451,7 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ */ __pyx_v_self->len = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":154 * free(self.arr) * self.len = 0 * self.size = 0 # <<<<<<<<<<<<<< @@ -5751,7 +6460,7 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ */ __pyx_v_self->size = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":155 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":155 * self.len = 0 * self.size = 0 * self.arr = <int*> malloc(0) # <<<<<<<<<<<<<< @@ -5763,7 +6472,7 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":157 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":157 * self.arr = <int*> malloc(0) * * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -5773,9 +6482,9 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ static void __pyx_f_3_sa_7IntList_write_handle(struct __pyx_obj_3_sa_IntList *__pyx_v_self, FILE *__pyx_v_f) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_handle"); + __Pyx_RefNannySetupContext("write_handle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":158 * * cdef void write_handle(self, FILE* f): * fwrite(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -5784,7 +6493,7 @@ static void __pyx_f_3_sa_7IntList_write_handle(struct __pyx_obj_3_sa_IntList *__ */ fwrite((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":159 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":159 * cdef void write_handle(self, FILE* f): * fwrite(&(self.len), sizeof(int), 1, f) * fwrite(self.arr, sizeof(int), self.len, f) # <<<<<<<<<<<<<< @@ -5796,24 +6505,13 @@ static void __pyx_f_3_sa_7IntList_write_handle(struct __pyx_obj_3_sa_IntList *__ __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":161 - * fwrite(self.arr, sizeof(int), self.len, f) - * - * def write(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_3_sa_7IntList_16write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_16write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write"); + __Pyx_RefNannySetupContext("write (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -5823,8 +6521,26 @@ static PyObject *__pyx_pf_3_sa_7IntList_16write(PyObject *__pyx_v_self, PyObject __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_7IntList_31write(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":163 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":161 + * fwrite(self.arr, sizeof(int), self.len, f) + * + * def write(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_3_sa_7IntList_31write(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":163 * def write(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -5833,16 +6549,16 @@ static PyObject *__pyx_pf_3_sa_7IntList_16write(PyObject *__pyx_v_self, PyObject */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":164 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":164 * cdef FILE* f * f = fopen(filename, "w") * self.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":165 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":165 * f = fopen(filename, "w") * self.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -5857,7 +6573,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_16write(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":167 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":167 * fclose(f) * * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -5867,9 +6583,9 @@ static PyObject *__pyx_pf_3_sa_7IntList_16write(PyObject *__pyx_v_self, PyObject static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__pyx_v_self, FILE *__pyx_v_f) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_handle"); + __Pyx_RefNannySetupContext("read_handle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":168 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":168 * * cdef void read_handle(self, FILE* f): * (self.arr) # <<<<<<<<<<<<<< @@ -5878,7 +6594,7 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p */ __pyx_v_self->arr; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":169 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":169 * cdef void read_handle(self, FILE* f): * (self.arr) * fread(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -5887,7 +6603,7 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p */ fread((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":170 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":170 * (self.arr) * fread(&(self.len), sizeof(int), 1, f) * self.arr = <int*> malloc(self.len * sizeof(int)) # <<<<<<<<<<<<<< @@ -5896,7 +6612,7 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p */ __pyx_v_self->arr = ((int *)malloc((__pyx_v_self->len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":171 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":171 * fread(&(self.len), sizeof(int), 1, f) * self.arr = <int*> malloc(self.len * sizeof(int)) * self.size = self.len # <<<<<<<<<<<<<< @@ -5905,7 +6621,7 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p */ __pyx_v_self->size = __pyx_v_self->len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":172 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":172 * self.arr = <int*> malloc(self.len * sizeof(int)) * self.size = self.len * fread(self.arr, sizeof(int), self.len, f) # <<<<<<<<<<<<<< @@ -5917,24 +6633,13 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":174 - * fread(self.arr, sizeof(int), self.len, f) - * - * def read(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_3_sa_7IntList_17read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_7IntList_17read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read"); + __Pyx_RefNannySetupContext("read (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -5944,8 +6649,26 @@ static PyObject *__pyx_pf_3_sa_7IntList_17read(PyObject *__pyx_v_self, PyObject __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_7IntList_33read(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":174 + * fread(self.arr, sizeof(int), self.len, f) + * + * def read(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_3_sa_7IntList_33read(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":176 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":176 * def read(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -5954,15 +6677,15 @@ static PyObject *__pyx_pf_3_sa_7IntList_17read(PyObject *__pyx_v_self, PyObject */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":177 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":177 * cdef FILE* f * f = fopen(filename, "r") * self.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/int_list.pxi":178 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":178 * f = fopen(filename, "r") * self.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -5975,7 +6698,21 @@ static PyObject *__pyx_pf_3_sa_7IntList_17read(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":13 +/* Python wrapper */ +static int __pyx_pw_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_3_sa_9StringMap___cinit__(((struct __pyx_obj_3_sa_StringMap *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":13 * cdef int index(self, char *s) * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -5983,30 +6720,35 @@ static PyObject *__pyx_pf_3_sa_7IntList_17read(PyObject *__pyx_v_self, PyObject * */ -static int __pyx_pf_3_sa_9StringMap___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_9StringMap___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pf_3_sa_9StringMap___cinit__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":14 * * def __cinit__(self): * self.vocab = stringmap_new() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - ((struct __pyx_obj_3_sa_StringMap *)__pyx_v_self)->vocab = stringmap_new(); + __pyx_v_self->vocab = stringmap_new(); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":16 +/* Python wrapper */ +static void __pyx_pw_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_3_sa_9StringMap_2__dealloc__(((struct __pyx_obj_3_sa_StringMap *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":16 * self.vocab = stringmap_new() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -6014,24 +6756,23 @@ static int __pyx_pf_3_sa_9StringMap___cinit__(PyObject *__pyx_v_self, PyObject * * */ -static void __pyx_pf_3_sa_9StringMap_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_3_sa_9StringMap_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":17 * * def __dealloc__(self): * stringmap_delete(self.vocab) # <<<<<<<<<<<<<< * * cdef char *word(self, int i): */ - stringmap_delete(((struct __pyx_obj_3_sa_StringMap *)__pyx_v_self)->vocab); + stringmap_delete(__pyx_v_self->vocab); __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":19 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":19 * stringmap_delete(self.vocab) * * cdef char *word(self, int i): # <<<<<<<<<<<<<< @@ -6042,9 +6783,9 @@ static void __pyx_pf_3_sa_9StringMap_1__dealloc__(PyObject *__pyx_v_self) { static char *__pyx_f_3_sa_9StringMap_word(struct __pyx_obj_3_sa_StringMap *__pyx_v_self, int __pyx_v_i) { char *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("word"); + __Pyx_RefNannySetupContext("word", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":20 * * cdef char *word(self, int i): * return stringmap_word(self.vocab, i) # <<<<<<<<<<<<<< @@ -6060,7 +6801,7 @@ static char *__pyx_f_3_sa_9StringMap_word(struct __pyx_obj_3_sa_StringMap *__pyx return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":22 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":22 * return stringmap_word(self.vocab, i) * * cdef int index(self, char *s): # <<<<<<<<<<<<<< @@ -6070,9 +6811,9 @@ static char *__pyx_f_3_sa_9StringMap_word(struct __pyx_obj_3_sa_StringMap *__pyx static int __pyx_f_3_sa_9StringMap_index(struct __pyx_obj_3_sa_StringMap *__pyx_v_self, char *__pyx_v_s) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("index"); + __Pyx_RefNannySetupContext("index", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/str_map.pxi":23 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":23 * * cdef int index(self, char *s): * return stringmap_index(self.vocab, s) # <<<<<<<<<<<<<< @@ -6086,40 +6827,34 @@ static int __pyx_f_3_sa_9StringMap_index(struct __pyx_obj_3_sa_StringMap *__pyx_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":17 - * cdef bint use_sent_id - * - * def __cinit__(self, from_binary=None, from_text=None, side=None, bint use_sent_id=False): # <<<<<<<<<<<<<< - * self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} - * self.id2word = ["END_OF_FILE", "END_OF_LINE"] - */ - -static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; PyObject *__pyx_v_side = 0; int __pyx_v_use_sent_id; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - long __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,&__pyx_n_s__use_sent_id,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,&__pyx_n_s__use_sent_id,0}; PyObject* values[4] = {0,0,0,0}; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":17 + * cdef bint use_sent_id + * + * def __cinit__(self, from_binary=None, from_text=None, side=None, bint use_sent_id=False): # <<<<<<<<<<<<<< + * self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} + * self.id2word = ["END_OF_FILE", "END_OF_LINE"] + */ values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -6128,7 +6863,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_binary); @@ -6151,7 +6886,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6180,8 +6915,25 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9DataArray___cinit__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side, __pyx_v_use_sent_id); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side, int __pyx_v_use_sent_id) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + long __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":18 * * def __cinit__(self, from_binary=None, from_text=None, side=None, bint use_sent_id=False): * self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} # <<<<<<<<<<<<<< @@ -6193,12 +6945,12 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__END_OF_FILE), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__END_OF_LINE), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->word2id); - __Pyx_DECREF(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->word2id); - ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->word2id = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->word2id); + __Pyx_DECREF(__pyx_v_self->word2id); + __pyx_v_self->word2id = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":19 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":19 * def __cinit__(self, from_binary=None, from_text=None, side=None, bint use_sent_id=False): * self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} * self.id2word = ["END_OF_FILE", "END_OF_LINE"] # <<<<<<<<<<<<<< @@ -6206,7 +6958,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * * self.sent_id = IntList(1000,1000) */ __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__END_OF_FILE)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__END_OF_FILE)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__END_OF_FILE)); @@ -6214,12 +6966,12 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__END_OF_LINE)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__END_OF_LINE)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word); - __Pyx_DECREF(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word); - ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->id2word); + __Pyx_DECREF(__pyx_v_self->id2word); + __pyx_v_self->id2word = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":20 * self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} * self.id2word = ["END_OF_FILE", "END_OF_LINE"] * self.data = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -6229,12 +6981,12 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data)); - ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); + __pyx_v_self->data = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":21 * self.id2word = ["END_OF_FILE", "END_OF_LINE"] * self.data = IntList(1000,1000) * self.sent_id = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -6244,12 +6996,12 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id)); - ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sent_id); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); + __pyx_v_self->sent_id = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":22 * self.data = IntList(1000,1000) * self.sent_id = IntList(1000,1000) * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -6259,21 +7011,21 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index)); - ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sent_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); + __pyx_v_self->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":23 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":23 * self.sent_id = IntList(1000,1000) * self.sent_index = IntList(1000,1000) * self.use_sent_id = use_sent_id # <<<<<<<<<<<<<< * if from_binary: * self.read_binary(from_binary) */ - ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->use_sent_id = __pyx_v_use_sent_id; + __pyx_v_self->use_sent_id = __pyx_v_use_sent_id; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":24 * self.sent_index = IntList(1000,1000) * self.use_sent_id = use_sent_id * if from_binary: # <<<<<<<<<<<<<< @@ -6283,17 +7035,17 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":25 * self.use_sent_id = use_sent_id * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< * elif from_text: * if side: */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __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[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_from_binary); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_binary); __Pyx_GIVEREF(__pyx_v_from_binary); @@ -6302,10 +7054,10 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6; + goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":26 * if from_binary: * self.read_binary(from_binary) * elif from_text: # <<<<<<<<<<<<<< @@ -6315,7 +7067,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":27 * self.read_binary(from_binary) * elif from_text: * if side: # <<<<<<<<<<<<<< @@ -6325,16 +7077,18 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_side); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":28 * elif from_text: * if side: * self.read_bitext(from_text, (0 if side == 'source' else 1)) # <<<<<<<<<<<<<< * else: * self.read_text(from_text) */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_bitext); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_bitext); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyString_Equals(__pyx_v_side, ((PyObject *)__pyx_n_s__source), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_side, ((PyObject *)__pyx_n_s__source), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) { __pyx_t_5 = 0; } else { @@ -6343,7 +7097,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_3 = PyInt_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_from_text); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_from_text); __Pyx_GIVEREF(__pyx_v_from_text); @@ -6355,21 +7109,21 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7; + goto __pyx_L4; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":30 * self.read_bitext(from_text, (0 if side == 'source' else 1)) * else: * self.read_text(from_text) # <<<<<<<<<<<<<< * * def __len__(self): */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_from_text); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_from_text); __Pyx_GIVEREF(__pyx_v_from_text); @@ -6379,10 +7133,10 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_L7:; - goto __pyx_L6; + __pyx_L4:; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; __pyx_r = 0; goto __pyx_L0; @@ -6397,7 +7151,18 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":32 +/* Python wrapper */ +static Py_ssize_t __pyx_pw_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_2__len__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":32 * self.read_text(from_text) * * def __len__(self): # <<<<<<<<<<<<<< @@ -6405,8 +7170,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(PyObject *__pyx_v_self, PyObject * * */ -static Py_ssize_t __pyx_pf_3_sa_9DataArray_1__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_3_sa_9DataArray_1__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_9DataArray_2__len__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6414,16 +7178,16 @@ static Py_ssize_t __pyx_pf_3_sa_9DataArray_1__len__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__len__"); + __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":33 * * def __len__(self): * return len(self.data) # <<<<<<<<<<<<<< * * def get_data(self): */ - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data); + __pyx_t_1 = ((PyObject *)__pyx_v_self->data); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6441,7 +7205,18 @@ static Py_ssize_t __pyx_pf_3_sa_9DataArray_1__len__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":35 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_5get_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_5get_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_data (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_4get_data(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":35 * return len(self.data) * * def get_data(self): # <<<<<<<<<<<<<< @@ -6449,13 +7224,12 @@ static Py_ssize_t __pyx_pf_3_sa_9DataArray_1__len__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_9DataArray_2get_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_2get_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_9DataArray_4get_data(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_data"); + __Pyx_RefNannySetupContext("get_data", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":36 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":36 * * def get_data(self): * return self.data # <<<<<<<<<<<<<< @@ -6463,8 +7237,8 @@ static PyObject *__pyx_pf_3_sa_9DataArray_2get_data(PyObject *__pyx_v_self, CYTH * def get_sentence_id(self, i): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data)); - __pyx_r = ((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data); + __Pyx_INCREF(((PyObject *)__pyx_v_self->data)); + __pyx_r = ((PyObject *)__pyx_v_self->data); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -6474,7 +7248,18 @@ static PyObject *__pyx_pf_3_sa_9DataArray_2get_data(PyObject *__pyx_v_self, CYTH return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":38 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_7get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_7get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence_id (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_6get_sentence_id(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":38 * return self.data * * def get_sentence_id(self, i): # <<<<<<<<<<<<<< @@ -6482,8 +7267,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_2get_data(PyObject *__pyx_v_self, CYTH * */ -static PyObject *__pyx_pf_3_sa_9DataArray_3get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_3get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence_id(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -6491,9 +7275,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_3get_sentence_id(PyObject *__pyx_v_sel int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sentence_id"); + __Pyx_RefNannySetupContext("get_sentence_id", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":39 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":39 * * def get_sentence_id(self, i): * return self.sent_id.arr[i] # <<<<<<<<<<<<<< @@ -6502,7 +7286,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_3get_sentence_id(PyObject *__pyx_v_sel */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sent_id->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -6520,7 +7304,18 @@ static PyObject *__pyx_pf_3_sa_9DataArray_3get_sentence_id(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":41 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_9get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_9get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_8get_sentence(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":41 * return self.sent_id.arr[i] * * def get_sentence(self, i): # <<<<<<<<<<<<<< @@ -6528,8 +7323,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_3get_sentence_id(PyObject *__pyx_v_sel * sent = [] */ -static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_9DataArray_8get_sentence(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_v_start; int __pyx_v_stop; PyObject *__pyx_v_sent = NULL; @@ -6543,10 +7337,10 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sentence"); + __Pyx_RefNannySetupContext("get_sentence", 0); __Pyx_INCREF(__pyx_v_i); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":43 * def get_sentence(self, i): * cdef int j, start, stop * sent = [] # <<<<<<<<<<<<<< @@ -6554,11 +7348,11 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, * stop = self.sent_index.arr[i+1] */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_sent = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":44 * cdef int j, start, stop * sent = [] * start = self.sent_index.arr[i] # <<<<<<<<<<<<<< @@ -6566,9 +7360,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, * for i from start <= i < stop: */ __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_start = (((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index->arr[__pyx_t_2]); + __pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_t_2]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":45 * sent = [] * start = self.sent_index.arr[i] * stop = self.sent_index.arr[i+1] # <<<<<<<<<<<<<< @@ -6579,9 +7373,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_stop = (((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index->arr[__pyx_t_2]); + __pyx_v_stop = (__pyx_v_self->sent_index->arr[__pyx_t_2]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":46 * start = self.sent_index.arr[i] * stop = self.sent_index.arr[i+1] * for i from start <= i < stop: # <<<<<<<<<<<<<< @@ -6596,25 +7390,22 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":47 * stop = self.sent_index.arr[i+1] * for i from start <= i < stop: * sent.append(self.id2word[self.data.arr[i]]) # <<<<<<<<<<<<<< * return sent * */ - if (unlikely(((PyObject *)__pyx_v_sent) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_GetItemInt(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word, (((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data->arr[__pyx_t_2]), sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->id2word, (__pyx_v_self->data->arr[__pyx_t_2]), sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyList_Append(__pyx_v_sent, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":46 * start = self.sent_index.arr[i] * stop = self.sent_index.arr[i+1] * for i from start <= i < stop: # <<<<<<<<<<<<<< @@ -6627,7 +7418,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":48 * for i from start <= i < stop: * sent.append(self.id2word[self.data.arr[i]]) * return sent # <<<<<<<<<<<<<< @@ -6653,7 +7444,18 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":50 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_11get_sentence_position(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_11get_sentence_position(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence_position (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_10get_sentence_position(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":50 * return sent * * def get_sentence_position(self, loc): # <<<<<<<<<<<<<< @@ -6661,8 +7463,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence(PyObject *__pyx_v_self, * */ -static PyObject *__pyx_pf_3_sa_9DataArray_5get_sentence_position(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_5get_sentence_position(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pf_3_sa_9DataArray_10get_sentence_position(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -6671,9 +7472,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_5get_sentence_position(PyObject *__pyx int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sentence_position"); + __Pyx_RefNannySetupContext("get_sentence_position", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":51 * * def get_sentence_position(self, loc): * return loc - self.sent_index.arr[self.sent_id.arr[loc]] # <<<<<<<<<<<<<< @@ -6682,7 +7483,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_5get_sentence_position(PyObject *__pyx */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loc); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index->arr[(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id->arr[__pyx_t_1])])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sent_index->arr[(__pyx_v_self->sent_id->arr[__pyx_t_1])])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_Subtract(__pyx_v_loc, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -6704,7 +7505,18 @@ static PyObject *__pyx_pf_3_sa_9DataArray_5get_sentence_position(PyObject *__pyx return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":53 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_13get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_13get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_id (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_12get_id(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_word)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":53 * return loc - self.sent_index.arr[self.sent_id.arr[loc]] * * def get_id(self, word): # <<<<<<<<<<<<<< @@ -6712,8 +7524,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_5get_sentence_position(PyObject *__pyx * self.word2id[word] = len(self.id2word) */ -static PyObject *__pyx_pf_3_sa_9DataArray_6get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_6get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word) { +static PyObject *__pyx_pf_3_sa_9DataArray_12get_id(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -6723,50 +7534,50 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_id(PyObject *__pyx_v_self, PyObje int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_id"); + __Pyx_RefNannySetupContext("get_id", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":54 * * def get_id(self, word): * if not word in self.word2id: # <<<<<<<<<<<<<< * self.word2id[word] = len(self.id2word) * self.id2word.append(word) */ - __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->word2id, __pyx_v_word))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_word, __pyx_v_self->word2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":55 * def get_id(self, word): * if not word in self.word2id: * self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<< * self.id2word.append(word) * return self.word2id[word] */ - __pyx_t_3 = ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word; + __pyx_t_3 = __pyx_v_self->id2word; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetItem(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->word2id, __pyx_v_word, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_self->word2id, __pyx_v_word, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":56 * if not word in self.word2id: * self.word2id[word] = len(self.id2word) * self.id2word.append(word) # <<<<<<<<<<<<<< * return self.word2id[word] * */ - __pyx_t_3 = __Pyx_PyObject_Append(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word, __pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->id2word, __pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":57 * self.word2id[word] = len(self.id2word) * self.id2word.append(word) * return self.word2id[word] # <<<<<<<<<<<<<< @@ -6774,7 +7585,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_id(PyObject *__pyx_v_self, PyObje * def get_word(self, id): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyObject_GetItem(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->word2id, __pyx_v_word); if (!__pyx_t_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_self->word2id, __pyx_v_word); if (!__pyx_t_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -6792,7 +7603,18 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_id(PyObject *__pyx_v_self, PyObje return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":59 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_15get_word(PyObject *__pyx_v_self, PyObject *__pyx_v_id); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_15get_word(PyObject *__pyx_v_self, PyObject *__pyx_v_id) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_word (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_14get_word(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_id)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":59 * return self.word2id[word] * * def get_word(self, id): # <<<<<<<<<<<<<< @@ -6800,17 +7622,16 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_id(PyObject *__pyx_v_self, PyObje * */ -static PyObject *__pyx_pf_3_sa_9DataArray_7get_word(PyObject *__pyx_v_self, PyObject *__pyx_v_id); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_7get_word(PyObject *__pyx_v_self, PyObject *__pyx_v_id) { +static PyObject *__pyx_pf_3_sa_9DataArray_14get_word(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_id) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_word"); + __Pyx_RefNannySetupContext("get_word", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":60 * * def get_word(self, id): * return self.id2word[id] # <<<<<<<<<<<<<< @@ -6818,7 +7639,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_7get_word(PyObject *__pyx_v_self, PyOb * def write_text(self, char* filename): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word, __pyx_v_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_self->id2word, __pyx_v_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6836,7 +7657,28 @@ static PyObject *__pyx_pf_3_sa_9DataArray_7get_word(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":62 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_text (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9DataArray_16write_text(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":62 * return self.id2word[id] * * def write_text(self, char* filename): # <<<<<<<<<<<<<< @@ -6844,9 +7686,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_7get_word(PyObject *__pyx_v_self, PyOb * for w_id in self.data: */ -static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_9DataArray_16write_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_w_id = NULL; PyObject *__pyx_r = NULL; @@ -6857,10 +7697,10 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, Py PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; @@ -6868,18 +7708,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, Py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_text"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_text", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":63 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -6890,7 +7721,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, Py __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); @@ -6902,153 +7733,160 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, Py __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":64 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":64 * def write_text(self, char* filename): * with open(filename, "w") as f: * for w_id in self.data: # <<<<<<<<<<<<<< * if w_id > 1: * f.write("%s " % self.get_word(w_id)) */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data))) { - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data); __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->data)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->data))) { + __pyx_t_4 = ((PyObject *)__pyx_v_self->data); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->data)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { + __pyx_t_1 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF(__pyx_v_w_id); - __pyx_v_w_id = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_w_id = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":65 * with open(filename, "w") as f: * for w_id in self.data: * if w_id > 1: # <<<<<<<<<<<<<< * f.write("%s " % self.get_word(w_id)) * if w_id == 1: */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_w_id, __pyx_int_1, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_9) { + __pyx_t_1 = PyObject_RichCompare(__pyx_v_w_id, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":66 * for w_id in self.data: * if w_id > 1: * f.write("%s " % self.get_word(w_id)) # <<<<<<<<<<<<<< * if w_id == 1: * f.write("\n") */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_word); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_word); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_v_w_id); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_w_id); __Pyx_GIVEREF(__pyx_v_w_id); - __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_11)); __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L19; + goto __pyx_L18; } - __pyx_L19:; + __pyx_L18:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":67 * if w_id > 1: * f.write("%s " % self.get_word(w_id)) * if w_id == 1: # <<<<<<<<<<<<<< * f.write("\n") * */ - __pyx_t_11 = PyObject_RichCompare(__pyx_v_w_id, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyObject_RichCompare(__pyx_v_w_id, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_9) { + if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":68 * f.write("%s " % self.get_word(w_id)) * if w_id == 1: * f.write("\n") # <<<<<<<<<<<<<< * * def read_text(self, char* filename): */ - __pyx_t_11 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L20; + goto __pyx_L19; } - __pyx_L20:; + __pyx_L19:; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":63 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -7057,75 +7895,75 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, Py */ /*except:*/ { __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_12, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_12, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_12); __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); + __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_13); + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_13); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __pyx_t_14 = (!__pyx_t_9); + if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_14 = (!__pyx_t_10); if (__pyx_t_14) { - __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_11); - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_12, __pyx_t_11); - __pyx_t_1 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L23; + __Pyx_ErrRestore(__pyx_t_4, __pyx_t_12, __pyx_t_11); + __pyx_t_4 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; } - __pyx_L23:; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L10_exception_handled; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - __pyx_L16_try_end:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L14_try_end:; } } /*finally:*/ { if (__pyx_t_3) { - __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_16, NULL); + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_16, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L24; - __pyx_L5_error:; + goto __pyx_L23; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L1_error; - __pyx_L24:; + __pyx_L23:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -7133,7 +7971,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, Py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -7146,7 +7984,28 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":70 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_19read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_19read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_text (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9DataArray_18read_text(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":70 * f.write("\n") * * def read_text(self, char* filename): # <<<<<<<<<<<<<< @@ -7154,9 +8013,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8write_text(PyObject *__pyx_v_self, Py * self.read_text_data(fp) */ -static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_9DataArray_18read_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_fp = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7174,18 +8031,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyO int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("read_text", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":71 * * def read_text(self, char* filename): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -7198,7 +8046,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyO __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -7208,12 +8056,12 @@ static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyO __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_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_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); @@ -7221,39 +8069,40 @@ static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyO __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_fp = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_fp = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":72 * def read_text(self, char* filename): * with gzip_or_text(filename) as fp: * self.read_text_data(fp) # <<<<<<<<<<<<<< * * def read_bitext(self, char* filename, int side): */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_text_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_text_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_fp); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fp); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fp); __Pyx_GIVEREF(__pyx_v_fp); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":71 * * def read_text(self, char* filename): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -7262,57 +8111,57 @@ static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyO */ /*except:*/ { __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __pyx_t_10 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_11 = (!__pyx_t_9); if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_2); - __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L19; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L18; } - __pyx_L19:; + __pyx_L18:; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L10_exception_handled; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); - __pyx_L16_try_end:; + __pyx_L14_try_end:; } } /*finally:*/ { @@ -7326,11 +8175,11 @@ static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyO if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L20; - __pyx_L5_error:; + goto __pyx_L19; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L1_error; - __pyx_L20:; + __pyx_L19:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -7348,9 +8197,65 @@ static PyObject *__pyx_pf_3_sa_9DataArray_9read_text(PyObject *__pyx_v_self, PyO __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":76 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_21read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_21read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_filename; + int __pyx_v_side; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_bitext (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__side,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_bitext") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_filename = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_side = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9DataArray_20read_bitext(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_3_sa_9DataArray_11read_bitext_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":76 * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: * data = (line.split(' ||| ')[side] for line in fp) # <<<<<<<<<<<<<< @@ -7358,37 +8263,45 @@ static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa__ * */ -static PyObject *__pyx_pf_3_sa_11read_bitext_genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_11read_bitext_genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_self) { struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("genexpr"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_2_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)__pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - __pyx_self = __pyx_self; - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_11read_bitext_1generator6; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_9DataArray_11read_bitext_2generator6, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.DataArray.read_bitext.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_9DataArray_11read_bitext_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -7396,8 +8309,8 @@ static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa__ PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ @@ -7406,7 +8319,8 @@ static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa__ } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp)) { __Pyx_RaiseClosureNameError("fp"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp)) { + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp)) { __Pyx_RaiseClosureNameError("fp"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp)) { __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { @@ -7415,12 +8329,20 @@ static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa__ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -7454,7 +8376,7 @@ static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa__ __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; @@ -7465,7 +8387,7 @@ static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa__ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -7474,12 +8396,13 @@ static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa__ __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":74 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":74 * self.read_text_data(fp) * * def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<< @@ -7487,10 +8410,8 @@ static PyObject *__pyx_gb_3_sa_11read_bitext_1generator6(struct __pyx_obj_3_sa__ * data = (line.split(' ||| ')[side] for line in fp) */ -static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_3_sa_9DataArray_20read_bitext(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename, int __pyx_v_side) { struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *__pyx_cur_scope; - char *__pyx_v_filename; PyObject *__pyx_v_data = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7508,60 +8429,16 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__side,0}; - __Pyx_RefNannySetupContext("read_bitext"); + __Pyx_RefNannySetupContext("read_bitext", 0); __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)__pyx_ptype_3_sa___pyx_scope_struct_1_read_bitext->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_1_read_bitext, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - { - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_bitext") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_filename = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_cur_scope->__pyx_v_side = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_cur_scope->__pyx_v_side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __pyx_cur_scope->__pyx_v_side = __pyx_v_side; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":75 * * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -7574,7 +8451,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -7584,12 +8461,12 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_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_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); @@ -7597,52 +8474,53 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_fp = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_fp = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":76 * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: * data = (line.split(' ||| ')[side] for line in fp) # <<<<<<<<<<<<<< * self.read_text_data(data) * */ - __pyx_t_2 = __pyx_pf_3_sa_11read_bitext_genexpr(((PyObject*)__pyx_cur_scope), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_data = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __pyx_pf_3_sa_9DataArray_11read_bitext_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_data = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":77 * with gzip_or_text(filename) as fp: * data = (line.split(' ||| ')[side] for line in fp) * self.read_text_data(data) # <<<<<<<<<<<<<< * * def read_text_data(self, data): */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_text_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_text_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_data); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data); __Pyx_GIVEREF(__pyx_v_data); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L10_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L17_try_end; - __pyx_L10_error:; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":75 * * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -7650,58 +8528,58 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, * self.read_text_data(data) */ /*except:*/ { - __Pyx_AddTraceback("_sa.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_AddTraceback("_sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __pyx_t_10 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_11 = (!__pyx_t_9); if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_2); - __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} - goto __pyx_L20; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L18; } - __pyx_L20:; + __pyx_L18:; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L11_exception_handled; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; } - __pyx_L12_except_error:; + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L11_exception_handled:; + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); - __pyx_L17_try_end:; + __pyx_L14_try_end:; } } /*finally:*/ { @@ -7715,11 +8593,11 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L21; - __pyx_L6_error:; + goto __pyx_L19; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L1_error; - __pyx_L21:; + __pyx_L19:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -7739,7 +8617,18 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":79 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_23read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_23read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_text_data (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_22read_text_data(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_data)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":79 * self.read_text_data(data) * * def read_text_data(self, data): # <<<<<<<<<<<<<< @@ -7747,8 +8636,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10read_bitext(PyObject *__pyx_v_self, * for line_num, line in enumerate(data): */ -static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) { +static PyObject *__pyx_pf_3_sa_9DataArray_22read_text_data(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_data) { int __pyx_v_word_count; PyObject *__pyx_v_line_num = NULL; PyObject *__pyx_v_line = NULL; @@ -7768,9 +8656,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text_data"); + __Pyx_RefNannySetupContext("read_text_data", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":80 * * def read_text_data(self, data): * cdef int word_count = 0 # <<<<<<<<<<<<<< @@ -7779,7 +8667,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel */ __pyx_v_word_count = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":81 * def read_text_data(self, data): * cdef int word_count = 0 * for line_num, line in enumerate(data): # <<<<<<<<<<<<<< @@ -7797,12 +8685,20 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_5 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_5)) { @@ -7826,7 +8722,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":82 * cdef int word_count = 0 * for line_num, line in enumerate(data): * self.sent_index.append(word_count) # <<<<<<<<<<<<<< @@ -7835,12 +8731,12 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel */ __pyx_t_5 = PyInt_FromLong(__pyx_v_word_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":83 * for line_num, line in enumerate(data): * self.sent_index.append(word_count) * for word in line.split(): # <<<<<<<<<<<<<< @@ -7862,12 +8758,20 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_6)) { + if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_6)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_5 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_5)) { @@ -7883,17 +8787,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel __pyx_v_word = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":84 * self.sent_index.append(word_count) * for word in line.split(): * self.data.append(self.get_id(word)) # <<<<<<<<<<<<<< * if self.use_sent_id: * self.sent_id.append(line_num) */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_word); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_word); __Pyx_GIVEREF(__pyx_v_word); @@ -7901,35 +8805,35 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data), __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":85 * for word in line.split(): * self.data.append(self.get_id(word)) * if self.use_sent_id: # <<<<<<<<<<<<<< * self.sent_id.append(line_num) * word_count = word_count + 1 */ - if (((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->use_sent_id) { + if (__pyx_v_self->use_sent_id) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":86 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":86 * self.data.append(self.get_id(word)) * if self.use_sent_id: * self.sent_id.append(line_num) # <<<<<<<<<<<<<< * word_count = word_count + 1 * self.data.append(1) */ - __pyx_t_9 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id), __pyx_v_line_num); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_id), __pyx_v_line_num); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9; + goto __pyx_L7; } - __pyx_L9:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":87 * if self.use_sent_id: * self.sent_id.append(line_num) * word_count = word_count + 1 # <<<<<<<<<<<<<< @@ -7940,41 +8844,41 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":88 * self.sent_id.append(line_num) * word_count = word_count + 1 * self.data.append(1) # <<<<<<<<<<<<<< * if self.use_sent_id: * self.sent_id.append(line_num) */ - __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data), __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":89 * word_count = word_count + 1 * self.data.append(1) * if self.use_sent_id: # <<<<<<<<<<<<<< * self.sent_id.append(line_num) * word_count = word_count + 1 */ - if (((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->use_sent_id) { + if (__pyx_v_self->use_sent_id) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":90 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":90 * self.data.append(1) * if self.use_sent_id: * self.sent_id.append(line_num) # <<<<<<<<<<<<<< * word_count = word_count + 1 * self.data.append(0) */ - __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id), __pyx_v_line_num); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_id), __pyx_v_line_num); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L10; + goto __pyx_L8; } - __pyx_L10:; + __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":91 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":91 * if self.use_sent_id: * self.sent_id.append(line_num) * word_count = word_count + 1 # <<<<<<<<<<<<<< @@ -7986,18 +8890,18 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":92 * self.sent_id.append(line_num) * word_count = word_count + 1 * self.data.append(0) # <<<<<<<<<<<<<< * self.sent_index.append(word_count) * */ - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data), __pyx_int_0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_int_0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":93 * word_count = word_count + 1 * self.data.append(0) * self.sent_index.append(word_count) # <<<<<<<<<<<<<< @@ -8006,7 +8910,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel */ __pyx_t_1 = PyInt_FromLong(__pyx_v_word_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -8031,24 +8935,13 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_text_data(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":96 - * - * - * def read_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_3_sa_9DataArray_12read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_12read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_25read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_25read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_binary"); + __Pyx_RefNannySetupContext("read_binary (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -8058,8 +8951,26 @@ static PyObject *__pyx_pf_3_sa_9DataArray_12read_binary(PyObject *__pyx_v_self, __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9DataArray_24read_binary(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":98 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":96 + * + * + * def read_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_3_sa_9DataArray_24read_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_binary", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":98 * def read_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -8068,16 +8979,16 @@ static PyObject *__pyx_pf_3_sa_9DataArray_12read_binary(PyObject *__pyx_v_self, */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":99 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":99 * cdef FILE* f * f = fopen(filename, "r") * self.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_DataArray *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":100 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":100 * f = fopen(filename, "r") * self.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -8092,7 +9003,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_12read_binary(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":102 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":102 * fclose(f) * * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -8103,7 +9014,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_12read_binary(PyObject *__pyx_v_self, static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, FILE *__pyx_v_f) { int __pyx_v_num_words; int __pyx_v_word_len; - unsigned int __pyx_v_i; + CYTHON_UNUSED unsigned int __pyx_v_i; char *__pyx_v_word; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8115,9 +9026,9 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_handle"); + __Pyx_RefNannySetupContext("read_handle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":107 * cdef char* word * * self.data.read_handle(f) # <<<<<<<<<<<<<< @@ -8126,7 +9037,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->read_handle(__pyx_v_self->data, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":108 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":108 * * self.data.read_handle(f) * self.sent_index.read_handle(f) # <<<<<<<<<<<<<< @@ -8135,7 +9046,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->read_handle(__pyx_v_self->sent_index, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":109 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":109 * self.data.read_handle(f) * self.sent_index.read_handle(f) * self.sent_id.read_handle(f) # <<<<<<<<<<<<<< @@ -8144,7 +9055,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_id->__pyx_vtab)->read_handle(__pyx_v_self->sent_id, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":110 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":110 * self.sent_index.read_handle(f) * self.sent_id.read_handle(f) * fread(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -8153,7 +9064,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":111 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":111 * self.sent_id.read_handle(f) * fread(&(num_words), sizeof(int), 1, f) * for i in range(num_words): # <<<<<<<<<<<<<< @@ -8164,7 +9075,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":112 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":112 * fread(&(num_words), sizeof(int), 1, f) * for i in range(num_words): * fread(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -8173,7 +9084,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":113 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":113 * for i in range(num_words): * fread(&(word_len), sizeof(int), 1, f) * word = <char*> malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<< @@ -8182,7 +9093,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ __pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":114 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":114 * fread(&(word_len), sizeof(int), 1, f) * word = <char*> malloc (word_len * sizeof(char)) * fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< @@ -8191,7 +9102,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":115 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":115 * word = <char*> malloc (word_len * sizeof(char)) * fread(word, sizeof(char), word_len, f) * self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<< @@ -8210,7 +9121,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":116 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":116 * fread(word, sizeof(char), word_len, f) * self.word2id[word] = len(self.id2word) * self.id2word.append(word) # <<<<<<<<<<<<<< @@ -8224,7 +9135,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":117 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":117 * self.word2id[word] = len(self.id2word) * self.id2word.append(word) * free(word) # <<<<<<<<<<<<<< @@ -8234,7 +9145,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray free(__pyx_v_word); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":118 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":118 * self.id2word.append(word) * free(word) * if len(self.sent_id) == 0: # <<<<<<<<<<<<<< @@ -8248,7 +9159,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray __pyx_t_6 = (__pyx_t_4 == 0); if (__pyx_t_6) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":119 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":119 * free(word) * if len(self.sent_id) == 0: * self.use_sent_id = False # <<<<<<<<<<<<<< @@ -8260,7 +9171,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":121 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":121 * self.use_sent_id = False * else: * self.use_sent_id = True # <<<<<<<<<<<<<< @@ -8280,7 +9191,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":123 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":123 * self.use_sent_id = True * * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -8302,9 +9213,9 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_handle"); + __Pyx_RefNannySetupContext("write_handle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":127 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":127 * cdef int num_words * * self.data.write_handle(f) # <<<<<<<<<<<<<< @@ -8313,7 +9224,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->write_handle(__pyx_v_self->data, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":128 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":128 * * self.data.write_handle(f) * self.sent_index.write_handle(f) # <<<<<<<<<<<<<< @@ -8322,7 +9233,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->write_handle(__pyx_v_self->sent_index, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":129 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":129 * self.data.write_handle(f) * self.sent_index.write_handle(f) * self.sent_id.write_handle(f) # <<<<<<<<<<<<<< @@ -8331,7 +9242,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_id->__pyx_vtab)->write_handle(__pyx_v_self->sent_id, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":130 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":130 * self.sent_index.write_handle(f) * self.sent_id.write_handle(f) * num_words = len(self.id2word) - 2 # <<<<<<<<<<<<<< @@ -8344,7 +9255,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_num_words = (__pyx_t_2 - 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":131 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":131 * self.sent_id.write_handle(f) * num_words = len(self.id2word) - 2 * fwrite(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -8353,7 +9264,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray */ fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":132 * num_words = len(self.id2word) - 2 * fwrite(&(num_words), sizeof(int), 1, f) * for word in self.id2word[2:]: # <<<<<<<<<<<<<< @@ -8372,12 +9283,20 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_3)) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_3)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) { @@ -8393,7 +9312,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray __pyx_v_word = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":133 * fwrite(&(num_words), sizeof(int), 1, f) * for word in self.id2word[2:]: * word_len = len(word) + 1 # <<<<<<<<<<<<<< @@ -8403,7 +9322,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray __pyx_t_5 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_word_len = (__pyx_t_5 + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":134 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":134 * for word in self.id2word[2:]: * word_len = len(word) + 1 * fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -8412,7 +9331,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray */ fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":135 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":135 * word_len = len(word) + 1 * fwrite(&(word_len), sizeof(int), 1, f) * fwrite(<char *>word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< @@ -8434,24 +9353,13 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":137 - * fwrite(<char *>word, sizeof(char), word_len, f) - * - * def write_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_3_sa_9DataArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_27write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_27write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_binary"); + __Pyx_RefNannySetupContext("write_binary (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -8461,8 +9369,26 @@ static PyObject *__pyx_pf_3_sa_9DataArray_13write_binary(PyObject *__pyx_v_self, __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9DataArray_26write_binary(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":139 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":137 + * fwrite(<char *>word, sizeof(char), word_len, f) + * + * def write_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_3_sa_9DataArray_26write_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_binary", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":139 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -8471,16 +9397,16 @@ static PyObject *__pyx_pf_3_sa_9DataArray_13write_binary(PyObject *__pyx_v_self, */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":140 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":140 * cdef FILE* f * f = fopen(filename, "w") * self.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_DataArray *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":141 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":141 * f = fopen(filename, "w") * self.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -8495,7 +9421,18 @@ static PyObject *__pyx_pf_3_sa_9DataArray_13write_binary(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":143 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_29write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_29write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_enhanced_handle (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9DataArray_28write_enhanced_handle(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_f)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":143 * fclose(f) * * def write_enhanced_handle(self, f): # <<<<<<<<<<<<<< @@ -8503,8 +9440,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_13write_binary(PyObject *__pyx_v_self, * f.write("%d " %i) */ -static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { +static PyObject *__pyx_pf_3_sa_9DataArray_28write_enhanced_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f) { PyObject *__pyx_v_i = NULL; PyObject *__pyx_v_word = NULL; PyObject *__pyx_r = NULL; @@ -8518,30 +9454,38 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced_handle"); + __Pyx_RefNannySetupContext("write_enhanced_handle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":144 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":144 * * def write_enhanced_handle(self, f): * for i in self.data: # <<<<<<<<<<<<<< * f.write("%d " %i) * f.write("\n") */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data))) { - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->data)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->data))) { + __pyx_t_1 = ((PyObject *)__pyx_v_self->data); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->data)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->data)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -8557,7 +9501,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __pyx_v_i = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":145 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":145 * def write_enhanced_handle(self, f): * for i in self.data: * f.write("%d " %i) # <<<<<<<<<<<<<< @@ -8569,7 +9513,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -8581,7 +9525,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":146 * for i in self.data: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -8595,28 +9539,36 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":147 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":147 * f.write("%d " %i) * f.write("\n") * for i in self.sent_index: # <<<<<<<<<<<<<< * f.write("%d " %i) * f.write("\n") */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index))) { - __pyx_t_5 = ((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index); __Pyx_INCREF(__pyx_t_5); __pyx_t_2 = 0; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->sent_index)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_index))) { + __pyx_t_5 = ((PyObject *)__pyx_v_self->sent_index); __Pyx_INCREF(__pyx_t_5); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_index)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_index)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = Py_TYPE(__pyx_t_5)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_5)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_5)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_5)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_5)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_1 = __pyx_t_3(__pyx_t_5); if (unlikely(!__pyx_t_1)) { @@ -8632,7 +9584,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":148 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":148 * f.write("\n") * for i in self.sent_index: * f.write("%d " %i) # <<<<<<<<<<<<<< @@ -8644,7 +9596,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; @@ -8656,7 +9608,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":149 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":149 * for i in self.sent_index: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -8670,28 +9622,36 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":150 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":150 * f.write("%d " %i) * f.write("\n") * for i in self.sent_id: # <<<<<<<<<<<<<< * f.write("%d " %i) * f.write("\n") */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id))) { - __pyx_t_6 = ((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id); __Pyx_INCREF(__pyx_t_6); __pyx_t_2 = 0; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->sent_id)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_id))) { + __pyx_t_6 = ((PyObject *)__pyx_v_self->sent_id); __Pyx_INCREF(__pyx_t_6); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->sent_id)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_id)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = Py_TYPE(__pyx_t_6)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_6)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_6)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_6)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_6)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_6)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_5 = __pyx_t_3(__pyx_t_6); if (unlikely(!__pyx_t_5)) { @@ -8707,7 +9667,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __pyx_v_i = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":151 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":151 * f.write("\n") * for i in self.sent_id: * f.write("%d " %i) # <<<<<<<<<<<<<< @@ -8719,7 +9679,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -8731,7 +9691,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":152 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":152 * for i in self.sent_id: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -8745,28 +9705,36 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":153 * f.write("%d " %i) * f.write("\n") * for word in self.id2word: # <<<<<<<<<<<<<< * f.write("%s %d " % (word, self.word2id[word])) * f.write("\n") */ - if (PyList_CheckExact(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word) || PyTuple_CheckExact(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word)) { - __pyx_t_4 = ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_v_self->id2word) || PyTuple_CheckExact(__pyx_v_self->id2word)) { + __pyx_t_4 = __pyx_v_self->id2word; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->id2word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->id2word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_4)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_4)) { + #if CYTHON_COMPILING_IN_CPYTHON + __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[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __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[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_6 = __pyx_t_3(__pyx_t_4); if (unlikely(!__pyx_t_6)) { @@ -8782,7 +9750,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __pyx_v_word = __pyx_t_6; __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":154 * f.write("\n") * for word in self.id2word: * f.write("%s %d " % (word, self.word2id[word])) # <<<<<<<<<<<<<< @@ -8791,10 +9759,10 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py */ __pyx_t_6 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)->word2id, __pyx_v_word); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_self->word2id, __pyx_v_word); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_word); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_word); __Pyx_GIVEREF(__pyx_v_word); @@ -8805,7 +9773,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -8817,7 +9785,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":155 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":155 * for word in self.id2word: * f.write("%s %d " % (word, self.word2id[word])) * f.write("\n") # <<<<<<<<<<<<<< @@ -8848,7 +9816,28 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":157 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9DataArray_31write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9DataArray_31write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_enhanced (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9DataArray_30write_enhanced(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":157 * f.write("\n") * * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< @@ -8856,9 +9845,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_enhanced_handle(PyObject *__py * self.write_enhanced_handle(self, f) */ -static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_9DataArray_30write_enhanced(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8876,18 +9863,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_sel int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_enhanced", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":158 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -8897,7 +9875,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_sel __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); 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 = PyTuple_New(2); 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_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); @@ -8909,53 +9887,54 @@ static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_sel __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); 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); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":159 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":159 * def write_enhanced(self, char* filename): * with open(filename, "w") as f: * self.write_enhanced_handle(self, f) # <<<<<<<<<<<<<< */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_27); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_f); __Pyx_GIVEREF(__pyx_v_f); - __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":158 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -8963,75 +9942,75 @@ static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_sel */ /*except:*/ { __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_INCREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_10 = PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_11 = (!__pyx_t_9); if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_2, __pyx_t_1); - __pyx_t_7 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L19; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_4); + __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L18; } - __pyx_L19:; + __pyx_L18:; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L10_exception_handled; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - __pyx_L16_try_end:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L14_try_end:; } } /*finally:*/ { if (__pyx_t_3) { - __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_28, NULL); + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_28, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L20; - __pyx_L5_error:; + goto __pyx_L19; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L1_error; - __pyx_L20:; + __pyx_L19:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -9039,7 +10018,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_sel __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -9050,7 +10029,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":12 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":12 * cdef IntList sent_index * * cdef int link(self, int i, int j): # <<<<<<<<<<<<<< @@ -9058,12 +10037,12 @@ static PyObject *__pyx_pf_3_sa_9DataArray_15write_enhanced(PyObject *__pyx_v_sel * return i*65536 + j */ -static int __pyx_f_3_sa_9Alignment_link(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_i, int __pyx_v_j) { +static int __pyx_f_3_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_i, int __pyx_v_j) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("link"); + __Pyx_RefNannySetupContext("link", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":14 * cdef int link(self, int i, int j): * """Integerizes an alignment link pair""" * return i*65536 + j # <<<<<<<<<<<<<< @@ -9079,7 +10058,19 @@ static int __pyx_f_3_sa_9Alignment_link(struct __pyx_obj_3_sa_Alignment *__pyx_v return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":16 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link); /*proto*/ +static char __pyx_doc_3_sa_9Alignment_unlink[] = "De-integerizes an alignment link pair"; +static PyObject *__pyx_pw_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unlink (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9Alignment_unlink(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_link)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":16 * return i*65536 + j * * def unlink(self, link): # <<<<<<<<<<<<<< @@ -9087,9 +10078,7 @@ static int __pyx_f_3_sa_9Alignment_link(struct __pyx_obj_3_sa_Alignment *__pyx_v * return (link/65536, link%65536) */ -static PyObject *__pyx_pf_3_sa_9Alignment_unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link); /*proto*/ -static char __pyx_doc_3_sa_9Alignment_unlink[] = "De-integerizes an alignment link pair"; -static PyObject *__pyx_pf_3_sa_9Alignment_unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link) { +static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9098,9 +10087,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(PyObject *__pyx_v_self, PyObjec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unlink"); + __Pyx_RefNannySetupContext("unlink", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":18 * def unlink(self, link): * """De-integerizes an alignment link pair""" * return (link/65536, link%65536) # <<<<<<<<<<<<<< @@ -9113,7 +10102,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(PyObject *__pyx_v_self, PyObjec __pyx_t_2 = PyNumber_Remainder(__pyx_v_link, __pyx_int_65536); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); @@ -9138,7 +10127,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":20 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":20 * return (link/65536, link%65536) * * cdef _unlink(self, int link, int* f, int* e): # <<<<<<<<<<<<<< @@ -9146,12 +10135,12 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(PyObject *__pyx_v_self, PyObjec * e[0] = link%65536 */ -static PyObject *__pyx_f_3_sa_9Alignment__unlink(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_link, int *__pyx_v_f, int *__pyx_v_e) { +static PyObject *__pyx_f_3_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_link, int *__pyx_v_f, int *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_unlink"); + __Pyx_RefNannySetupContext("_unlink", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":21 * * cdef _unlink(self, int link, int* f, int* e): * f[0] = link/65536 # <<<<<<<<<<<<<< @@ -9160,7 +10149,7 @@ static PyObject *__pyx_f_3_sa_9Alignment__unlink(struct __pyx_obj_3_sa_Alignment */ (__pyx_v_f[0]) = __Pyx_div_long(__pyx_v_link, 65536); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":22 * cdef _unlink(self, int link, int* f, int* e): * f[0] = link/65536 * e[0] = link%65536 # <<<<<<<<<<<<<< @@ -9175,7 +10164,28 @@ static PyObject *__pyx_f_3_sa_9Alignment__unlink(struct __pyx_obj_3_sa_Alignment return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":24 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id); /*proto*/ +static PyObject *__pyx_pw_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id) { + int __pyx_v_sent_id; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sent_links (wrapper)", 0); + assert(__pyx_arg_sent_id); { + __pyx_v_sent_id = __Pyx_PyInt_AsInt(__pyx_arg_sent_id); if (unlikely((__pyx_v_sent_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9Alignment_2get_sent_links(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((int)__pyx_v_sent_id)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":24 * e[0] = link%65536 * * def get_sent_links(self, int sent_id): # <<<<<<<<<<<<<< @@ -9183,9 +10193,7 @@ static PyObject *__pyx_f_3_sa_9Alignment__unlink(struct __pyx_obj_3_sa_Alignment * cdef int* arr */ -static PyObject *__pyx_pf_3_sa_9Alignment_1get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id); /*proto*/ -static PyObject *__pyx_pf_3_sa_9Alignment_1get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id) { - int __pyx_v_sent_id; +static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id) { struct __pyx_obj_3_sa_IntList *__pyx_v_sent_links = 0; int *__pyx_v_arr; int __pyx_v_arr_len; @@ -9195,18 +10203,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_1get_sent_links(PyObject *__pyx_v_self int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sent_links"); - assert(__pyx_arg_sent_id); { - __pyx_v_sent_id = __Pyx_PyInt_AsInt(__pyx_arg_sent_id); if (unlikely((__pyx_v_sent_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("get_sent_links", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":28 * cdef int* arr * cdef int arr_len * sent_links = IntList() # <<<<<<<<<<<<<< @@ -9218,16 +10217,16 @@ static PyObject *__pyx_pf_3_sa_9Alignment_1get_sent_links(PyObject *__pyx_v_self __pyx_v_sent_links = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":29 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":29 * cdef int arr_len * sent_links = IntList() * arr = self._get_sent_links(sent_id, &arr_len) # <<<<<<<<<<<<<< * sent_links._extend_arr(arr, arr_len*2) * free(arr) */ - __pyx_v_arr = ((struct __pyx_vtabstruct_3_sa_Alignment *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->__pyx_vtab)->_get_sent_links(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), __pyx_v_sent_id, (&__pyx_v_arr_len)); + __pyx_v_arr = ((struct __pyx_vtabstruct_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->_get_sent_links(__pyx_v_self, __pyx_v_sent_id, (&__pyx_v_arr_len)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":30 * sent_links = IntList() * arr = self._get_sent_links(sent_id, &arr_len) * sent_links._extend_arr(arr, arr_len*2) # <<<<<<<<<<<<<< @@ -9236,7 +10235,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_1get_sent_links(PyObject *__pyx_v_self */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sent_links->__pyx_vtab)->_extend_arr(__pyx_v_sent_links, __pyx_v_arr, (__pyx_v_arr_len * 2)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":31 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":31 * arr = self._get_sent_links(sent_id, &arr_len) * sent_links._extend_arr(arr, arr_len*2) * free(arr) # <<<<<<<<<<<<<< @@ -9245,7 +10244,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_1get_sent_links(PyObject *__pyx_v_self */ free(__pyx_v_arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":32 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":32 * sent_links._extend_arr(arr, arr_len*2) * free(arr) * return sent_links # <<<<<<<<<<<<<< @@ -9270,7 +10269,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_1get_sent_links(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":34 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":34 * return sent_links * * cdef int* _get_sent_links(self, int sent_id, int* num_links): # <<<<<<<<<<<<<< @@ -9290,9 +10289,9 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_get_sent_links"); + __Pyx_RefNannySetupContext("_get_sent_links", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":37 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":37 * cdef int* sent_links * cdef int i, start, end * start = self.sent_index.arr[sent_id] # <<<<<<<<<<<<<< @@ -9301,7 +10300,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm */ __pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_v_sent_id]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":38 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":38 * cdef int i, start, end * start = self.sent_index.arr[sent_id] * end = self.sent_index.arr[sent_id+1] # <<<<<<<<<<<<<< @@ -9310,7 +10309,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm */ __pyx_v_end = (__pyx_v_self->sent_index->arr[(__pyx_v_sent_id + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":39 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":39 * start = self.sent_index.arr[sent_id] * end = self.sent_index.arr[sent_id+1] * num_links[0] = end - start # <<<<<<<<<<<<<< @@ -9319,7 +10318,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm */ (__pyx_v_num_links[0]) = (__pyx_v_end - __pyx_v_start); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":40 * end = self.sent_index.arr[sent_id+1] * num_links[0] = end - start * sent_links = <int*> malloc(2*num_links[0]*sizeof(int)) # <<<<<<<<<<<<<< @@ -9328,7 +10327,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm */ __pyx_v_sent_links = ((int *)malloc(((2 * (__pyx_v_num_links[0])) * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":41 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":41 * num_links[0] = end - start * sent_links = <int*> malloc(2*num_links[0]*sizeof(int)) * for i from 0 <= i < num_links[0]: # <<<<<<<<<<<<<< @@ -9338,7 +10337,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm __pyx_t_1 = (__pyx_v_num_links[0]); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":42 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":42 * sent_links = <int*> malloc(2*num_links[0]*sizeof(int)) * for i from 0 <= i < num_links[0]: * self._unlink(self.links.arr[start + i], sent_links + (2*i), sent_links + (2*i) + 1) # <<<<<<<<<<<<<< @@ -9350,7 +10349,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":43 * for i from 0 <= i < num_links[0]: * self._unlink(self.links.arr[start + i], sent_links + (2*i), sent_links + (2*i) + 1) * return sent_links # <<<<<<<<<<<<<< @@ -9371,43 +10370,38 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":45 - * return sent_links - * - * def __cinit__(self, from_binary=None, from_text=None): # <<<<<<<<<<<<<< - * self.links = IntList(1000,1000) - * self.sent_index = IntList(1000,1000) - */ - -static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,0}; PyObject* values[2] = {0,0}; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":45 + * return sent_links + * + * def __cinit__(self, from_binary=None, from_text=None): # <<<<<<<<<<<<<< + * self.links = IntList(1000,1000) + * self.sent_index = IntList(1000,1000) + */ values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_binary); @@ -9420,7 +10414,7 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -9441,8 +10435,24 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9Alignment_4__cinit__(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":46 * * def __cinit__(self, from_binary=None, from_text=None): * self.links = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -9452,12 +10462,12 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links)); - ((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->links); + __Pyx_DECREF(((PyObject *)__pyx_v_self->links)); + __pyx_v_self->links = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":47 * def __cinit__(self, from_binary=None, from_text=None): * self.links = IntList(1000,1000) * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -9467,12 +10477,12 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index)); - ((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sent_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); + __pyx_v_self->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":48 * self.links = IntList(1000,1000) * self.sent_index = IntList(1000,1000) * if from_binary: # <<<<<<<<<<<<<< @@ -9482,17 +10492,17 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":49 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":49 * self.sent_index = IntList(1000,1000) * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< * elif from_text: * self.read_text(from_text) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_from_binary); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_binary); __Pyx_GIVEREF(__pyx_v_from_binary); @@ -9501,10 +10511,10 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6; + goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":50 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":50 * if from_binary: * self.read_binary(from_binary) * elif from_text: # <<<<<<<<<<<<<< @@ -9514,17 +10524,17 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":51 * self.read_binary(from_binary) * elif from_text: * self.read_text(from_text) # <<<<<<<<<<<<<< * * def read_text(self, char* filename): */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_from_text); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_text); __Pyx_GIVEREF(__pyx_v_from_text); @@ -9533,9 +10543,9 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; __pyx_r = 0; goto __pyx_L0; @@ -9550,7 +10560,28 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":53 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_text (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9Alignment_6read_text(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":53 * self.read_text(from_text) * * def read_text(self, char* filename): # <<<<<<<<<<<<<< @@ -9558,9 +10589,7 @@ static int __pyx_pf_3_sa_9Alignment_2__cinit__(PyObject *__pyx_v_self, PyObject * for line in f: */ -static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_line = NULL; PyObject *__pyx_v_pairs = NULL; @@ -9592,18 +10621,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("read_text", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":54 * * def read_text(self, char* filename): * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -9616,7 +10636,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __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[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -9626,12 +10646,12 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_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_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); @@ -9639,10 +10659,11 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_f = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":55 * def read_text(self, char* filename): * with gzip_or_text(filename) as f: * for line in f: # <<<<<<<<<<<<<< @@ -9650,70 +10671,78 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO * pairs = line.split() */ if (PyList_CheckExact(__pyx_v_f) || PyTuple_CheckExact(__pyx_v_f)) { - __pyx_t_2 = __pyx_v_f; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; __pyx_t_9 = NULL; } else { - __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_3 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF(__pyx_v_line); - __pyx_v_line = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_line = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":56 * with gzip_or_text(filename) as f: * for line in f: * self.sent_index.append(len(self.links)) # <<<<<<<<<<<<<< * pairs = line.split() * for pair in pairs: */ - __pyx_t_3 = ((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_2 = ((PyObject *)__pyx_v_self->links); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":57 * for line in f: * self.sent_index.append(len(self.links)) * pairs = line.split() # <<<<<<<<<<<<<< * for pair in pairs: * (i, j) = map(int, pair.split('-')) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L9_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[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_pairs); - __pyx_v_pairs = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_pairs = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":58 * self.sent_index.append(len(self.links)) * pairs = line.split() * for pair in pairs: # <<<<<<<<<<<<<< @@ -9721,158 +10750,173 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO * self.links.append(self.link(i, j)) */ if (PyList_CheckExact(__pyx_v_pairs) || PyTuple_CheckExact(__pyx_v_pairs)) { - __pyx_t_3 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; + __pyx_t_2 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_3)) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; - } else if (PyTuple_CheckExact(__pyx_t_3)) { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_1 = __pyx_t_11(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { + __pyx_t_3 = __pyx_t_11(__pyx_t_2); + if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF(__pyx_v_pair); - __pyx_v_pair = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_pair = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":59 * pairs = line.split() * for pair in pairs: * (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<< * self.links.append(self.link(i, j)) * self.sent_index.append(len(self.links)) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_pair, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_pair, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) { PyObject* sequence = __pyx_t_12; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - } - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - } - __pyx_t_1 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 0); __pyx_t_13 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_13); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_14 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_14 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_1)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L21_unpacking_failed; + index = 0; __pyx_t_3 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L20_unpacking_failed; __Pyx_GOTREF(__pyx_t_13); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_15 = NULL; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L22_unpacking_done; - __pyx_L21_unpacking_failed:; + goto __pyx_L21_unpacking_done; + __pyx_L20_unpacking_failed:; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_L22_unpacking_done:; + __pyx_t_15 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_L21_unpacking_done:; } __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_3; + __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_j); __pyx_v_j = __pyx_t_13; __pyx_t_13 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":60 * for pair in pairs: * (i, j) = map(int, pair.split('-')) * self.links.append(self.link(i, j)) # <<<<<<<<<<<<<< * self.sent_index.append(len(self.links)) * */ - __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_j); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_12 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Alignment *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->__pyx_vtab)->link(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), __pyx_t_16, __pyx_t_17)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_j); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->link(__pyx_v_self, __pyx_t_16, __pyx_t_17)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links), __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_13 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->links), __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":61 * (i, j) = map(int, pair.split('-')) * self.links.append(self.link(i, j)) * self.sent_index.append(len(self.links)) # <<<<<<<<<<<<<< * * def read_binary(self, char* filename): */ - __pyx_t_2 = ((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = ((PyObject *)__pyx_v_self->links); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_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_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; + goto __pyx_L14_try_end; + __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":54 * * def read_text(self, char* filename): * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -9881,57 +10925,57 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO */ /*except:*/ { __Pyx_AddTraceback("_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __Pyx_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_19 = PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_19); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_20 = (!__pyx_t_18); if (__pyx_t_20) { - __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_13); - __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_13); - __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_13 = 0; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L25; + __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_13); + __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_13 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L24; } - __pyx_L25:; + __pyx_L24:; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L10_exception_handled; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); - __pyx_L16_try_end:; + __pyx_L14_try_end:; } } /*finally:*/ { @@ -9945,11 +10989,11 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO if (unlikely(__pyx_t_20 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L26; - __pyx_L5_error:; + goto __pyx_L25; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L1_error; - __pyx_L26:; + __pyx_L25:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -9975,24 +11019,13 @@ static PyObject *__pyx_pf_3_sa_9Alignment_3read_text(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":63 - * self.sent_index.append(len(self.links)) - * - * def read_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_3_sa_9Alignment_4read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9Alignment_4read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_binary"); + __Pyx_RefNannySetupContext("read_binary (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -10002,8 +11035,26 @@ static PyObject *__pyx_pf_3_sa_9Alignment_4read_binary(PyObject *__pyx_v_self, P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9Alignment_8read_binary(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":63 + * self.sent_index.append(len(self.links)) + * + * def read_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_3_sa_9Alignment_8read_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_binary", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":65 * def read_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -10012,25 +11063,25 @@ static PyObject *__pyx_pf_3_sa_9Alignment_4read_binary(PyObject *__pyx_v_self, P */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":66 * cdef FILE* f * f = fopen(filename, "r") * self.links.read_handle(f) # <<<<<<<<<<<<<< * self.sent_index.read_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->read_handle(__pyx_v_self->links, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":67 * f = fopen(filename, "r") * self.links.read_handle(f) * self.sent_index.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->read_handle(__pyx_v_self->sent_index, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":68 * self.links.read_handle(f) * self.sent_index.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -10045,7 +11096,28 @@ static PyObject *__pyx_pf_3_sa_9Alignment_4read_binary(PyObject *__pyx_v_self, P return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":70 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_text (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9Alignment_10write_text(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":70 * fclose(f) * * def write_text(self, char* filename): # <<<<<<<<<<<<<< @@ -10053,9 +11125,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_4read_binary(PyObject *__pyx_v_self, P * sent_num = 0 */ -static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_sent_num = NULL; PyObject *__pyx_v_i = NULL; @@ -10068,9 +11138,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); PyObject *__pyx_t_10 = NULL; int __pyx_t_11; PyObject *__pyx_t_12 = NULL; @@ -10080,18 +11150,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_text"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_text", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":71 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -10102,7 +11163,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); @@ -10114,23 +11175,24 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":72 * def write_text(self, char* filename): * with open(filename, "w") as f: * sent_num = 0 # <<<<<<<<<<<<<< @@ -10140,7 +11202,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py __Pyx_INCREF(__pyx_int_0); __pyx_v_sent_num = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":73 * with open(filename, "w") as f: * sent_num = 0 * for i, link in enumerate(self.links): # <<<<<<<<<<<<<< @@ -10148,46 +11210,54 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py * f.write("\n") */ __Pyx_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links))) { - __pyx_t_2 = ((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links); __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + __pyx_t_4 = __pyx_int_0; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->links)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->links))) { + __pyx_t_1 = ((PyObject *)__pyx_v_self->links); __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->links)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_2); - if (unlikely(!__pyx_t_9)) { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF(__pyx_v_link); - __pyx_v_link = __pyx_t_9; - __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_t_1); + __pyx_v_link = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_4); __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_i = __pyx_t_4; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":74 * sent_num = 0 * for i, link in enumerate(self.links): * while i >= self.sent_index[sent_num]: # <<<<<<<<<<<<<< @@ -10195,107 +11265,106 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py * sent_num = sent_num + 1 */ while (1) { - __pyx_t_9 = PyObject_GetItem(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index), __pyx_v_sent_num); if (!__pyx_t_9) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_RichCompare(__pyx_v_i, __pyx_t_9, Py_GE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->sent_index), __pyx_v_sent_num); if (!__pyx_t_2) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (!__pyx_t_11) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":75 * for i, link in enumerate(self.links): * while i >= self.sent_index[sent_num]: * f.write("\n") # <<<<<<<<<<<<<< * sent_num = sent_num + 1 * f.write("%d-%d " % self.unlink(link)) */ - __pyx_t_10 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":76 * while i >= self.sent_index[sent_num]: * f.write("\n") * sent_num = sent_num + 1 # <<<<<<<<<<<<<< * f.write("%d-%d " % self.unlink(link)) * f.write("\n") */ - __pyx_t_9 = PyNumber_Add(__pyx_v_sent_num, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyNumber_Add(__pyx_v_sent_num, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_sent_num); - __pyx_v_sent_num = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_sent_num = __pyx_t_2; + __pyx_t_2 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":77 * f.write("\n") * sent_num = sent_num + 1 * f.write("%d-%d " % self.unlink(link)) # <<<<<<<<<<<<<< * f.write("\n") * */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__unlink); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__unlink); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_link); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_link); __Pyx_GIVEREF(__pyx_v_link); - __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12)); __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":78 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":78 * sent_num = sent_num + 1 * f.write("%d-%d " % self.unlink(link)) * f.write("\n") # <<<<<<<<<<<<<< * * def write_binary(self, char* filename): */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":71 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -10304,75 +11373,75 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py */ /*except:*/ { __Pyx_AddTraceback("_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_13); __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_14 = PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_15 = (!__pyx_t_11); if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_12); - __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_12 = 0; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L23; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_12); + __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_12 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; } - __pyx_L23:; + __pyx_L22:; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L10_exception_handled; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - __pyx_L16_try_end:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L14_try_end:; } } /*finally:*/ { if (__pyx_t_3) { - __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_37, NULL); + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_37, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L24; - __pyx_L5_error:; + goto __pyx_L23; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L1_error; - __pyx_L24:; + __pyx_L23:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -10380,7 +11449,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); @@ -10396,24 +11465,13 @@ static PyObject *__pyx_pf_3_sa_9Alignment_5write_text(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":80 - * f.write("\n") - * - * def write_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_3_sa_9Alignment_6write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9Alignment_6write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_binary"); + __Pyx_RefNannySetupContext("write_binary (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -10423,8 +11481,26 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6write_binary(PyObject *__pyx_v_self, __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9Alignment_12write_binary(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":80 + * f.write("\n") + * + * def write_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_3_sa_9Alignment_12write_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_binary", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":82 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -10433,25 +11509,25 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6write_binary(PyObject *__pyx_v_self, */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":83 * cdef FILE* f * f = fopen(filename, "w") * self.links.write_handle(f) # <<<<<<<<<<<<<< * self.sent_index.write_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->write_handle(__pyx_v_self->links, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":84 * f = fopen(filename, "w") * self.links.write_handle(f) * self.sent_index.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->write_handle(__pyx_v_self->sent_index, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":85 * self.links.write_handle(f) * self.sent_index.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -10466,7 +11542,28 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6write_binary(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":87 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_enhanced (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9Alignment_14write_enhanced(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":87 * fclose(f) * * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< @@ -10474,11 +11571,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6write_binary(PyObject *__pyx_v_self, * sent_num = 1 */ -static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; - long __pyx_v_sent_num; + CYTHON_UNUSED long __pyx_v_sent_num; PyObject *__pyx_v_link = NULL; PyObject *__pyx_v_i = NULL; PyObject *__pyx_r = NULL; @@ -10489,9 +11584,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); PyObject *__pyx_t_10 = NULL; int __pyx_t_11; PyObject *__pyx_t_12 = NULL; @@ -10499,18 +11594,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_enhanced", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":88 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -10521,7 +11607,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); @@ -10533,23 +11619,24 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":89 * def write_enhanced(self, char* filename): * with open(filename, "w") as f: * sent_num = 1 # <<<<<<<<<<<<<< @@ -10558,167 +11645,183 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self */ __pyx_v_sent_num = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":90 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":90 * with open(filename, "w") as f: * sent_num = 1 * for link in self.links: # <<<<<<<<<<<<<< * f.write("%d " % link) * f.write("\n") */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links))) { - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links); __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->links)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->links))) { + __pyx_t_4 = ((PyObject *)__pyx_v_self->links); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->links)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { + __pyx_t_1 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF(__pyx_v_link); - __pyx_v_link = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_link = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":91 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":91 * sent_num = 1 * for link in self.links: * f.write("%d " % link) # <<<<<<<<<<<<<< * f.write("\n") * for i in self.sent_index: */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_link); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_link); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":92 * for link in self.links: * f.write("%d " % link) * f.write("\n") # <<<<<<<<<<<<<< * for i in self.sent_index: * f.write("%d " % i) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":93 * f.write("%d " % link) * f.write("\n") * for i in self.sent_index: # <<<<<<<<<<<<<< * f.write("%d " % i) * f.write("\n") */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index))) { - __pyx_t_9 = ((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index); __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->sent_index)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_index))) { + __pyx_t_2 = ((PyObject *)__pyx_v_self->sent_index); __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = Py_TYPE(__pyx_t_9)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_index)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_9)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_9)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_9); - if (unlikely(!__pyx_t_1)) { + __pyx_t_4 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); } __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":94 * f.write("\n") * for i in self.sent_index: * f.write("%d " % i) # <<<<<<<<<<<<<< * f.write("\n") * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_10)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_10)); __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":95 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":95 * for i in self.sent_index: * f.write("%d " % i) * f.write("\n") # <<<<<<<<<<<<<< * * def alignment(self, i): */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":88 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -10727,75 +11830,75 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self */ /*except:*/ { __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_13 = (!__pyx_t_11); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_2); - __Pyx_ErrRestore(__pyx_t_10, __pyx_t_9, __pyx_t_2); - __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L23; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_ErrRestore(__pyx_t_10, __pyx_t_2, __pyx_t_1); + __pyx_t_10 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; } - __pyx_L23:; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L10_exception_handled; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - __pyx_L16_try_end:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L14_try_end:; } } /*finally:*/ { if (__pyx_t_3) { - __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_40, NULL); + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_40, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L24; - __pyx_L5_error:; + goto __pyx_L23; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L1_error; - __pyx_L24:; + __pyx_L23:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -10803,7 +11906,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -10816,7 +11919,19 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":97 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static char __pyx_doc_3_sa_9Alignment_16alignment[] = "Return all (e,f) pairs for sentence i"; +static PyObject *__pyx_pw_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("alignment (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9Alignment_16alignment(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":97 * f.write("\n") * * def alignment(self, i): # <<<<<<<<<<<<<< @@ -10824,9 +11939,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_7write_enhanced(PyObject *__pyx_v_self * cdef int j, start, end */ -static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static char __pyx_doc_3_sa_9Alignment_8alignment[] = "Return all (e,f) pairs for sentence i"; -static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_v_j; int __pyx_v_start; int __pyx_v_end; @@ -10842,9 +11955,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyO int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("alignment"); + __Pyx_RefNannySetupContext("alignment", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":100 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":100 * """Return all (e,f) pairs for sentence i""" * cdef int j, start, end * result = [] # <<<<<<<<<<<<<< @@ -10852,11 +11965,11 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyO * end = self.sent_index.arr[i+1] */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":101 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":101 * cdef int j, start, end * result = [] * start = self.sent_index.arr[i] # <<<<<<<<<<<<<< @@ -10864,9 +11977,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyO * for j from start <= j < end: */ __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_start = (((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index->arr[__pyx_t_2]); + __pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_t_2]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":102 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":102 * result = [] * start = self.sent_index.arr[i] * end = self.sent_index.arr[i+1] # <<<<<<<<<<<<<< @@ -10877,9 +11990,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyO __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_end = (((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->sent_index->arr[__pyx_t_2]); + __pyx_v_end = (__pyx_v_self->sent_index->arr[__pyx_t_2]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":103 * start = self.sent_index.arr[i] * end = self.sent_index.arr[i+1] * for j from start <= j < end: # <<<<<<<<<<<<<< @@ -10889,21 +12002,18 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyO __pyx_t_3 = __pyx_v_end; for (__pyx_v_j = __pyx_v_start; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":104 * end = self.sent_index.arr[i+1] * for j from start <= j < end: * result.append(self.unlink(self.links.arr[j])) # <<<<<<<<<<<<<< * return result */ - if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__unlink); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__unlink); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong((((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self)->links->arr[__pyx_v_j])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_self->links->arr[__pyx_v_j])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; @@ -10915,7 +12025,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyO __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":105 * for j from start <= j < end: * result.append(self.unlink(self.links.arr[j])) * return result # <<<<<<<<<<<<<< @@ -10940,7 +12050,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8alignment(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":15 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":15 * int val * * cdef _node* new_node(int key): # <<<<<<<<<<<<<< @@ -10952,9 +12062,9 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { struct __pyx_t_3_sa__node *__pyx_v_n; struct __pyx_t_3_sa__node *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("new_node"); + __Pyx_RefNannySetupContext("new_node", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":17 * cdef _node* new_node(int key): * cdef _node* n * n = <_node*> malloc(sizeof(_node)) # <<<<<<<<<<<<<< @@ -10963,7 +12073,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n = ((struct __pyx_t_3_sa__node *)malloc((sizeof(struct __pyx_t_3_sa__node)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":18 * cdef _node* n * n = <_node*> malloc(sizeof(_node)) * n.smaller = NULL # <<<<<<<<<<<<<< @@ -10972,7 +12082,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n->smaller = NULL; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":19 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":19 * n = <_node*> malloc(sizeof(_node)) * n.smaller = NULL * n.bigger = NULL # <<<<<<<<<<<<<< @@ -10981,7 +12091,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n->bigger = NULL; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":20 * n.smaller = NULL * n.bigger = NULL * n.key = key # <<<<<<<<<<<<<< @@ -10990,7 +12100,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n->key = __pyx_v_key; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":21 * n.bigger = NULL * n.key = key * n.val = 0 # <<<<<<<<<<<<<< @@ -10999,7 +12109,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n->val = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":22 * n.key = key * n.val = 0 * return n # <<<<<<<<<<<<<< @@ -11015,7 +12125,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":25 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":25 * * * cdef del_node(_node* n): # <<<<<<<<<<<<<< @@ -11031,9 +12141,9 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("del_node"); + __Pyx_RefNannySetupContext("del_node", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":26 * * cdef del_node(_node* n): * if n.smaller != NULL: # <<<<<<<<<<<<<< @@ -11043,7 +12153,7 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { __pyx_t_1 = (__pyx_v_n->smaller != NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":27 * cdef del_node(_node* n): * if n.smaller != NULL: * del_node(n.smaller) # <<<<<<<<<<<<<< @@ -11057,7 +12167,7 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":28 * if n.smaller != NULL: * del_node(n.smaller) * if n.bigger != NULL: # <<<<<<<<<<<<<< @@ -11067,7 +12177,7 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { __pyx_t_1 = (__pyx_v_n->bigger != NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":29 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":29 * del_node(n.smaller) * if n.bigger != NULL: * del_node(n.bigger) # <<<<<<<<<<<<<< @@ -11081,7 +12191,7 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":30 * if n.bigger != NULL: * del_node(n.bigger) * free(n) # <<<<<<<<<<<<<< @@ -11102,7 +12212,7 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":32 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":32 * free(n) * * cdef int* get_val(_node* n, int key): # <<<<<<<<<<<<<< @@ -11114,9 +12224,9 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx int *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_val"); + __Pyx_RefNannySetupContext("get_val", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":33 * * cdef int* get_val(_node* n, int key): * if key == n.key: # <<<<<<<<<<<<<< @@ -11126,7 +12236,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx __pyx_t_1 = (__pyx_v_key == __pyx_v_n->key); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":34 * cdef int* get_val(_node* n, int key): * if key == n.key: * return &n.val # <<<<<<<<<<<<<< @@ -11138,7 +12248,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":35 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":35 * if key == n.key: * return &n.val * elif key < n.key: # <<<<<<<<<<<<<< @@ -11148,7 +12258,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx __pyx_t_1 = (__pyx_v_key < __pyx_v_n->key); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":36 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":36 * return &n.val * elif key < n.key: * if n.smaller == NULL: # <<<<<<<<<<<<<< @@ -11158,7 +12268,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx __pyx_t_1 = (__pyx_v_n->smaller == NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":37 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":37 * elif key < n.key: * if n.smaller == NULL: * n.smaller = new_node(key) # <<<<<<<<<<<<<< @@ -11167,7 +12277,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx */ __pyx_v_n->smaller = __pyx_f_3_sa_new_node(__pyx_v_key); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":38 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":38 * if n.smaller == NULL: * n.smaller = new_node(key) * return &(n.smaller.val) # <<<<<<<<<<<<<< @@ -11180,7 +12290,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":39 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":39 * n.smaller = new_node(key) * return &(n.smaller.val) * return get_val(n.smaller, key) # <<<<<<<<<<<<<< @@ -11193,7 +12303,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":41 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":41 * return get_val(n.smaller, key) * else: * if n.bigger == NULL: # <<<<<<<<<<<<<< @@ -11203,7 +12313,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx __pyx_t_1 = (__pyx_v_n->bigger == NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":42 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":42 * else: * if n.bigger == NULL: * n.bigger = new_node(key) # <<<<<<<<<<<<<< @@ -11212,7 +12322,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx */ __pyx_v_n->bigger = __pyx_f_3_sa_new_node(__pyx_v_key); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":43 * if n.bigger == NULL: * n.bigger = new_node(key) * return &(n.bigger.val) # <<<<<<<<<<<<<< @@ -11225,7 +12335,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":44 * n.bigger = new_node(key) * return &(n.bigger.val) * return get_val(n.bigger, key) # <<<<<<<<<<<<<< @@ -11243,16 +12353,9 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":54 - * cdef id2eword, id2fword, eword2id, fword2id - * - * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< - * earray=None, fsarray=None, alignment=None): - * self.id2eword = [] - */ - -static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_from_text = 0; PyObject *__pyx_v_from_data = 0; PyObject *__pyx_v_from_binary = 0; @@ -11261,23 +12364,23 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py PyObject *__pyx_v_alignment = 0; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_text,&__pyx_n_s__from_data,&__pyx_n_s__from_binary,&__pyx_n_s__earray,&__pyx_n_s__fsarray,&__pyx_n_s__alignment,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_text,&__pyx_n_s__from_data,&__pyx_n_s__from_binary,&__pyx_n_s__earray,&__pyx_n_s__fsarray,&__pyx_n_s__alignment,0}; PyObject* values[6] = {0,0,0,0,0,0}; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":54 + * cdef id2eword, id2fword, eword2id, fword2id + * + * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< + * earray=None, fsarray=None, alignment=None): + * self.id2eword = [] + */ values[0] = ((PyObject *)Py_None); values[1] = __pyx_k_41; values[2] = ((PyObject *)Py_None); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":55 * * def __cinit__(self, from_text=None, from_data=False, from_binary=None, * earray=None, fsarray=None, alignment=None): # <<<<<<<<<<<<<< @@ -11289,7 +12392,8 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py values[5] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -11300,7 +12404,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_text); @@ -11333,7 +12437,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -11362,8 +12466,33 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_5BiLex___cinit__(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), __pyx_v_from_text, __pyx_v_from_data, __pyx_v_from_binary, __pyx_v_earray, __pyx_v_fsarray, __pyx_v_alignment); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":56 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":54 + * cdef id2eword, id2fword, eword2id, fword2id + * + * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< + * earray=None, fsarray=None, alignment=None): + * self.id2eword = [] + */ + +static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":56 * def __cinit__(self, from_text=None, from_data=False, from_binary=None, * earray=None, fsarray=None, alignment=None): * self.id2eword = [] # <<<<<<<<<<<<<< @@ -11371,14 +12500,14 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py * self.eword2id = {} */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword); - __Pyx_DECREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->id2eword); + __Pyx_DECREF(__pyx_v_self->id2eword); + __pyx_v_self->id2eword = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":57 * earray=None, fsarray=None, alignment=None): * self.id2eword = [] * self.id2fword = [] # <<<<<<<<<<<<<< @@ -11386,14 +12515,14 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py * self.fword2id = {} */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword); - __Pyx_DECREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->id2fword); + __Pyx_DECREF(__pyx_v_self->id2fword); + __pyx_v_self->id2fword = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":58 * self.id2eword = [] * self.id2fword = [] * self.eword2id = {} # <<<<<<<<<<<<<< @@ -11403,12 +12532,12 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id); - __Pyx_DECREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->eword2id); + __Pyx_DECREF(__pyx_v_self->eword2id); + __pyx_v_self->eword2id = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":59 * self.id2fword = [] * self.eword2id = {} * self.fword2id = {} # <<<<<<<<<<<<<< @@ -11418,12 +12547,12 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id); - __Pyx_DECREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->fword2id); + __Pyx_DECREF(__pyx_v_self->fword2id); + __pyx_v_self->fword2id = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":60 * self.eword2id = {} * self.fword2id = {} * self.e_index = IntList() # <<<<<<<<<<<<<< @@ -11433,12 +12562,12 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index)); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->e_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->e_index)); + __pyx_v_self->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":61 * self.fword2id = {} * self.e_index = IntList() * self.f_index = IntList() # <<<<<<<<<<<<<< @@ -11448,12 +12577,12 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index)); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->f_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->f_index)); + __pyx_v_self->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":62 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":62 * self.e_index = IntList() * self.f_index = IntList() * self.col1 = FloatList() # <<<<<<<<<<<<<< @@ -11463,12 +12592,12 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1)); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col1); + __Pyx_DECREF(((PyObject *)__pyx_v_self->col1)); + __pyx_v_self->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":63 * self.f_index = IntList() * self.col1 = FloatList() * self.col2 = FloatList() # <<<<<<<<<<<<<< @@ -11478,12 +12607,12 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2)); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col2); + __Pyx_DECREF(((PyObject *)__pyx_v_self->col2)); + __pyx_v_self->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":64 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":64 * self.col1 = FloatList() * self.col2 = FloatList() * if from_binary: # <<<<<<<<<<<<<< @@ -11493,17 +12622,17 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":65 * self.col2 = FloatList() * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< * elif from_data: * self.compute_from_data(fsarray, earray, alignment) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __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[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_from_binary); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_binary); __Pyx_GIVEREF(__pyx_v_from_binary); @@ -11512,10 +12641,10 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6; + goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":66 * if from_binary: * self.read_binary(from_binary) * elif from_data: # <<<<<<<<<<<<<< @@ -11525,7 +12654,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_data); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":67 * self.read_binary(from_binary) * elif from_data: * self.compute_from_data(fsarray, earray, alignment) # <<<<<<<<<<<<<< @@ -11541,27 +12670,27 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py if (!(likely(((__pyx_v_alignment) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_alignment, __pyx_ptype_3_sa_Alignment))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_alignment; __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = ((struct __pyx_vtabstruct_3_sa_BiLex *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->__pyx_vtab)->compute_from_data(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_t_4), ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_3), ((struct __pyx_obj_3_sa_Alignment *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->compute_from_data(__pyx_v_self, ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_t_4), ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_3), ((struct __pyx_obj_3_sa_Alignment *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L6; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":69 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":69 * self.compute_from_data(fsarray, earray, alignment) * else: * self.read_text(from_text) # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_text); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_text); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_from_text); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_from_text); __Pyx_GIVEREF(__pyx_v_from_text); @@ -11571,7 +12700,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_L6:; + __pyx_L3:; __pyx_r = 0; goto __pyx_L0; @@ -11587,7 +12716,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(PyObject *__pyx_v_self, PyObject *__py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":72 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":72 * * * cdef compute_from_data(self, SuffixArray fsa, DataArray eda, Alignment aa): # <<<<<<<<<<<<<< @@ -11639,9 +12768,9 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("compute_from_data"); + __Pyx_RefNannySetupContext("compute_from_data", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":79 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":79 * cdef int null_word * * null_word = 0 # <<<<<<<<<<<<<< @@ -11650,7 +12779,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_null_word = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":80 * * null_word = 0 * for word in fsa.darray.id2word: # I miss list comprehensions # <<<<<<<<<<<<<< @@ -11666,12 +12795,20 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -11687,7 +12824,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":81 * null_word = 0 * for word in fsa.darray.id2word: # I miss list comprehensions * self.id2fword.append(word) # <<<<<<<<<<<<<< @@ -11700,7 +12837,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":82 * for word in fsa.darray.id2word: # I miss list comprehensions * self.id2fword.append(word) * self.id2fword[null_word] = "NULL" # <<<<<<<<<<<<<< @@ -11709,7 +12846,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ if (__Pyx_SetItemInt(__pyx_v_self->id2fword, __pyx_v_null_word, ((PyObject *)__pyx_n_s__NULL), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":83 * self.id2fword.append(word) * self.id2fword[null_word] = "NULL" * for id, word in enumerate(self.id2fword): # <<<<<<<<<<<<<< @@ -11727,12 +12864,20 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_4)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_4)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_5 = __pyx_t_3(__pyx_t_4); if (unlikely(!__pyx_t_5)) { @@ -11756,7 +12901,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":84 * self.id2fword[null_word] = "NULL" * for id, word in enumerate(self.id2fword): * self.fword2id[word] = id # <<<<<<<<<<<<<< @@ -11768,7 +12913,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":86 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":86 * self.fword2id[word] = id * * for word in eda.id2word: # <<<<<<<<<<<<<< @@ -11784,12 +12929,20 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -11805,7 +12958,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":87 * * for word in eda.id2word: * self.id2eword.append(word) # <<<<<<<<<<<<<< @@ -11818,7 +12971,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":88 * for word in eda.id2word: * self.id2eword.append(word) * self.id2eword[null_word] = "NULL" # <<<<<<<<<<<<<< @@ -11827,7 +12980,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ if (__Pyx_SetItemInt(__pyx_v_self->id2eword, __pyx_v_null_word, ((PyObject *)__pyx_n_s__NULL), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":89 * self.id2eword.append(word) * self.id2eword[null_word] = "NULL" * for id, word in enumerate(self.id2eword): # <<<<<<<<<<<<<< @@ -11845,12 +12998,20 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_4)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_4)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_5 = __pyx_t_3(__pyx_t_4); if (unlikely(!__pyx_t_5)) { @@ -11874,7 +13035,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":90 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":90 * self.id2eword[null_word] = "NULL" * for id, word in enumerate(self.id2eword): * self.eword2id[word] = id # <<<<<<<<<<<<<< @@ -11886,7 +13047,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":92 * self.eword2id[word] = id * * num_pairs = 0 # <<<<<<<<<<<<<< @@ -11895,7 +13056,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_num_pairs = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":94 * num_pairs = 0 * * V_E = len(eda.id2word) # <<<<<<<<<<<<<< @@ -11908,7 +13069,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_V_E = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":95 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":95 * * V_E = len(eda.id2word) * V_F = len(fsa.darray.id2word) # <<<<<<<<<<<<<< @@ -11921,7 +13082,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_V_F = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":96 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":96 * V_E = len(eda.id2word) * V_F = len(fsa.darray.id2word) * fmargin = <int*> malloc(V_F*sizeof(int)) # <<<<<<<<<<<<<< @@ -11930,7 +13091,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_fmargin = ((int *)malloc((__pyx_v_V_F * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":97 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":97 * V_F = len(fsa.darray.id2word) * fmargin = <int*> malloc(V_F*sizeof(int)) * emargin = <int*> malloc(V_E*sizeof(int)) # <<<<<<<<<<<<<< @@ -11939,7 +13100,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_emargin = ((int *)malloc((__pyx_v_V_E * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":98 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":98 * fmargin = <int*> malloc(V_F*sizeof(int)) * emargin = <int*> malloc(V_E*sizeof(int)) * memset(fmargin, 0, V_F*sizeof(int)) # <<<<<<<<<<<<<< @@ -11948,7 +13109,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_fmargin, 0, (__pyx_v_V_F * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":99 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":99 * emargin = <int*> malloc(V_E*sizeof(int)) * memset(fmargin, 0, V_F*sizeof(int)) * memset(emargin, 0, V_E*sizeof(int)) # <<<<<<<<<<<<<< @@ -11957,7 +13118,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_emargin, 0, (__pyx_v_V_E * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":101 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":101 * memset(emargin, 0, V_E*sizeof(int)) * * dict = <_node**> malloc(V_F*sizeof(_node*)) # <<<<<<<<<<<<<< @@ -11966,7 +13127,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_dict = ((struct __pyx_t_3_sa__node **)malloc((__pyx_v_V_F * (sizeof(struct __pyx_t_3_sa__node *))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":102 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":102 * * dict = <_node**> malloc(V_F*sizeof(_node*)) * memset(dict, 0, V_F*sizeof(_node*)) # <<<<<<<<<<<<<< @@ -11975,7 +13136,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_dict, 0, (__pyx_v_V_F * (sizeof(struct __pyx_t_3_sa__node *)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":104 * memset(dict, 0, V_F*sizeof(_node*)) * * num_sents = len(fsa.darray.sent_index) # <<<<<<<<<<<<<< @@ -11991,7 +13152,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_num_sents = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":105 * * num_sents = len(fsa.darray.sent_index) * for sent_id from 0 <= sent_id < num_sents-1: # <<<<<<<<<<<<<< @@ -12004,7 +13165,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (__pyx_v_sent_id = 0; __pyx_v_sent_id < __pyx_t_6; __pyx_v_sent_id++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":107 * for sent_id from 0 <= sent_id < num_sents-1: * * fsent = fsa.darray.data.arr + fsa.darray.sent_index.arr[sent_id] # <<<<<<<<<<<<<< @@ -12013,7 +13174,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_fsent = (__pyx_v_fsa->darray->data->arr + (__pyx_v_fsa->darray->sent_index->arr[__pyx_v_sent_id])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":108 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":108 * * fsent = fsa.darray.data.arr + fsa.darray.sent_index.arr[sent_id] * I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1 # <<<<<<<<<<<<<< @@ -12022,7 +13183,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_I = (((__pyx_v_fsa->darray->sent_index->arr[(__pyx_v_sent_id + 1)]) - (__pyx_v_fsa->darray->sent_index->arr[__pyx_v_sent_id])) - 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":109 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":109 * fsent = fsa.darray.data.arr + fsa.darray.sent_index.arr[sent_id] * I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1 * faligned = <int*> malloc(I*sizeof(int)) # <<<<<<<<<<<<<< @@ -12031,7 +13192,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_faligned = ((int *)malloc((__pyx_v_I * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":110 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":110 * I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1 * faligned = <int*> malloc(I*sizeof(int)) * memset(faligned, 0, I*sizeof(int)) # <<<<<<<<<<<<<< @@ -12040,7 +13201,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_faligned, 0, (__pyx_v_I * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":112 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":112 * memset(faligned, 0, I*sizeof(int)) * * esent = eda.data.arr + eda.sent_index.arr[sent_id] # <<<<<<<<<<<<<< @@ -12049,7 +13210,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_esent = (__pyx_v_eda->data->arr + (__pyx_v_eda->sent_index->arr[__pyx_v_sent_id])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":113 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":113 * * esent = eda.data.arr + eda.sent_index.arr[sent_id] * J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1 # <<<<<<<<<<<<<< @@ -12058,7 +13219,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_J = (((__pyx_v_eda->sent_index->arr[(__pyx_v_sent_id + 1)]) - (__pyx_v_eda->sent_index->arr[__pyx_v_sent_id])) - 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":114 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":114 * esent = eda.data.arr + eda.sent_index.arr[sent_id] * J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1 * ealigned = <int*> malloc(J*sizeof(int)) # <<<<<<<<<<<<<< @@ -12067,7 +13228,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_ealigned = ((int *)malloc((__pyx_v_J * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":115 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":115 * J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1 * ealigned = <int*> malloc(J*sizeof(int)) * memset(ealigned, 0, J*sizeof(int)) # <<<<<<<<<<<<<< @@ -12076,7 +13237,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_ealigned, 0, (__pyx_v_J * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":117 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":117 * memset(ealigned, 0, J*sizeof(int)) * * links = aa._get_sent_links(sent_id, &num_links) # <<<<<<<<<<<<<< @@ -12085,7 +13246,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_links = ((struct __pyx_vtabstruct_3_sa_Alignment *)__pyx_v_aa->__pyx_vtab)->_get_sent_links(__pyx_v_aa, __pyx_v_sent_id, (&__pyx_v_num_links)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":119 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":119 * links = aa._get_sent_links(sent_id, &num_links) * * for l from 0 <= l < num_links: # <<<<<<<<<<<<<< @@ -12095,7 +13256,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_7 = __pyx_v_num_links; for (__pyx_v_l = 0; __pyx_v_l < __pyx_t_7; __pyx_v_l++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":120 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":120 * * for l from 0 <= l < num_links: * i = links[l*2] # <<<<<<<<<<<<<< @@ -12104,7 +13265,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_i = (__pyx_v_links[(__pyx_v_l * 2)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":121 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":121 * for l from 0 <= l < num_links: * i = links[l*2] * j = links[l*2+1] # <<<<<<<<<<<<<< @@ -12113,7 +13274,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_j = (__pyx_v_links[((__pyx_v_l * 2) + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":122 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":122 * i = links[l*2] * j = links[l*2+1] * if i >= I or j >= J: # <<<<<<<<<<<<<< @@ -12129,7 +13290,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":123 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":123 * j = links[l*2+1] * if i >= I or j >= J: * raise Exception("%d-%d out of bounds (I=%d,J=%d) in line %d\n" % (i,j,I,J,sent_id+1)) # <<<<<<<<<<<<<< @@ -12147,7 +13308,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_12 = PyInt_FromLong((__pyx_v_sent_id + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = PyTuple_New(5); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4); @@ -12167,7 +13328,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(((PyObject *)__pyx_t_12)); __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12)); __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; @@ -12181,7 +13342,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L15:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":124 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":124 * if i >= I or j >= J: * raise Exception("%d-%d out of bounds (I=%d,J=%d) in line %d\n" % (i,j,I,J,sent_id+1)) * f_i = fsent[i] # <<<<<<<<<<<<<< @@ -12190,7 +13351,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":125 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":125 * raise Exception("%d-%d out of bounds (I=%d,J=%d) in line %d\n" % (i,j,I,J,sent_id+1)) * f_i = fsent[i] * e_j = esent[j] # <<<<<<<<<<<<<< @@ -12199,7 +13360,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":126 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":126 * f_i = fsent[i] * e_j = esent[j] * fmargin[f_i] = fmargin[f_i]+1 # <<<<<<<<<<<<<< @@ -12208,7 +13369,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":127 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":127 * e_j = esent[j] * fmargin[f_i] = fmargin[f_i]+1 * emargin[e_j] = emargin[e_j]+1 # <<<<<<<<<<<<<< @@ -12217,7 +13378,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":128 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":128 * fmargin[f_i] = fmargin[f_i]+1 * emargin[e_j] = emargin[e_j]+1 * if dict[f_i] == NULL: # <<<<<<<<<<<<<< @@ -12227,7 +13388,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_dict[__pyx_v_f_i]) == NULL); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":129 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":129 * emargin[e_j] = emargin[e_j]+1 * if dict[f_i] == NULL: * dict[f_i] = new_node(e_j) # <<<<<<<<<<<<<< @@ -12236,7 +13397,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_3_sa_new_node(__pyx_v_e_j); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":130 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":130 * if dict[f_i] == NULL: * dict[f_i] = new_node(e_j) * dict[f_i].val = 1 # <<<<<<<<<<<<<< @@ -12245,7 +13406,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_f_i])->val = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":131 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":131 * dict[f_i] = new_node(e_j) * dict[f_i].val = 1 * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -12257,7 +13418,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":133 * num_pairs = num_pairs + 1 * else: * count = get_val(dict[f_i], e_j) # <<<<<<<<<<<<<< @@ -12266,7 +13427,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_e_j); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":134 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":134 * else: * count = get_val(dict[f_i], e_j) * if count[0] == 0: # <<<<<<<<<<<<<< @@ -12276,7 +13437,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_count[0]) == 0); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":135 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":135 * count = get_val(dict[f_i], e_j) * if count[0] == 0: * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -12288,7 +13449,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L17:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":136 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":136 * if count[0] == 0: * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 # <<<<<<<<<<<<<< @@ -12299,7 +13460,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L16:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":138 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":138 * count[0] = count[0] + 1 * # add count * faligned[i] = 1 # <<<<<<<<<<<<<< @@ -12308,7 +13469,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_faligned[__pyx_v_i]) = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":139 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":139 * # add count * faligned[i] = 1 * ealigned[j] = 1 # <<<<<<<<<<<<<< @@ -12318,7 +13479,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL (__pyx_v_ealigned[__pyx_v_j]) = 1; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":140 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":140 * faligned[i] = 1 * ealigned[j] = 1 * for i from 0 <= i < I: # <<<<<<<<<<<<<< @@ -12328,7 +13489,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_7 = __pyx_v_I; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":141 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":141 * ealigned[j] = 1 * for i from 0 <= i < I: * if faligned[i] == 0: # <<<<<<<<<<<<<< @@ -12338,7 +13499,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_faligned[__pyx_v_i]) == 0); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":142 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":142 * for i from 0 <= i < I: * if faligned[i] == 0: * f_i = fsent[i] # <<<<<<<<<<<<<< @@ -12347,7 +13508,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":143 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":143 * if faligned[i] == 0: * f_i = fsent[i] * fmargin[f_i] = fmargin[f_i] + 1 # <<<<<<<<<<<<<< @@ -12356,7 +13517,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":144 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":144 * f_i = fsent[i] * fmargin[f_i] = fmargin[f_i] + 1 * emargin[null_word] = emargin[null_word] + 1 # <<<<<<<<<<<<<< @@ -12365,7 +13526,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_emargin[__pyx_v_null_word]) = ((__pyx_v_emargin[__pyx_v_null_word]) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":145 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":145 * fmargin[f_i] = fmargin[f_i] + 1 * emargin[null_word] = emargin[null_word] + 1 * if dict[f_i] == NULL: # <<<<<<<<<<<<<< @@ -12375,7 +13536,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_dict[__pyx_v_f_i]) == NULL); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":146 * emargin[null_word] = emargin[null_word] + 1 * if dict[f_i] == NULL: * dict[f_i] = new_node(null_word) # <<<<<<<<<<<<<< @@ -12384,7 +13545,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_3_sa_new_node(__pyx_v_null_word); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":147 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":147 * if dict[f_i] == NULL: * dict[f_i] = new_node(null_word) * dict[f_i].val = 1 # <<<<<<<<<<<<<< @@ -12393,7 +13554,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_f_i])->val = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":148 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":148 * dict[f_i] = new_node(null_word) * dict[f_i].val = 1 * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -12405,7 +13566,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":150 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":150 * num_pairs = num_pairs + 1 * else: * count = get_val(dict[f_i], null_word) # <<<<<<<<<<<<<< @@ -12414,7 +13575,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_null_word); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":151 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":151 * else: * count = get_val(dict[f_i], null_word) * if count[0] == 0: # <<<<<<<<<<<<<< @@ -12424,7 +13585,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_count[0]) == 0); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":152 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":152 * count = get_val(dict[f_i], null_word) * if count[0] == 0: * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -12436,7 +13597,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L22:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":153 * if count[0] == 0: * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 # <<<<<<<<<<<<<< @@ -12451,7 +13612,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_L20:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":154 * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 * for j from 0 <= j < J: # <<<<<<<<<<<<<< @@ -12461,7 +13622,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_7 = __pyx_v_J; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_7; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":155 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":155 * count[0] = count[0] + 1 * for j from 0 <= j < J: * if ealigned[j] == 0: # <<<<<<<<<<<<<< @@ -12471,7 +13632,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_ealigned[__pyx_v_j]) == 0); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":156 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":156 * for j from 0 <= j < J: * if ealigned[j] == 0: * e_j = esent[j] # <<<<<<<<<<<<<< @@ -12480,7 +13641,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":157 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":157 * if ealigned[j] == 0: * e_j = esent[j] * fmargin[null_word] = fmargin[null_word] + 1 # <<<<<<<<<<<<<< @@ -12489,7 +13650,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_fmargin[__pyx_v_null_word]) = ((__pyx_v_fmargin[__pyx_v_null_word]) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":158 * e_j = esent[j] * fmargin[null_word] = fmargin[null_word] + 1 * emargin[e_j] = emargin[e_j] + 1 # <<<<<<<<<<<<<< @@ -12498,7 +13659,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":159 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":159 * fmargin[null_word] = fmargin[null_word] + 1 * emargin[e_j] = emargin[e_j] + 1 * if dict[null_word] == NULL: # <<<<<<<<<<<<<< @@ -12508,7 +13669,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_dict[__pyx_v_null_word]) == NULL); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":160 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":160 * emargin[e_j] = emargin[e_j] + 1 * if dict[null_word] == NULL: * dict[null_word] = new_node(e_j) # <<<<<<<<<<<<<< @@ -12517,7 +13678,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_null_word]) = __pyx_f_3_sa_new_node(__pyx_v_e_j); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":161 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":161 * if dict[null_word] == NULL: * dict[null_word] = new_node(e_j) * dict[null_word].val = 1 # <<<<<<<<<<<<<< @@ -12526,7 +13687,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_null_word])->val = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":162 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":162 * dict[null_word] = new_node(e_j) * dict[null_word].val = 1 * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -12538,7 +13699,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":164 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":164 * num_pairs = num_pairs + 1 * else: * count = get_val(dict[null_word], e_j) # <<<<<<<<<<<<<< @@ -12547,7 +13708,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_null_word]), __pyx_v_e_j); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":165 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":165 * else: * count = get_val(dict[null_word], e_j) * if count[0] == 0: # <<<<<<<<<<<<<< @@ -12557,7 +13718,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_count[0]) == 0); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":166 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":166 * count = get_val(dict[null_word], e_j) * if count[0] == 0: * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -12569,7 +13730,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L27:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":167 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":167 * if count[0] == 0: * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 # <<<<<<<<<<<<<< @@ -12584,7 +13745,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_L25:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":168 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":168 * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 * free(links) # <<<<<<<<<<<<<< @@ -12593,7 +13754,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_links); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":169 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":169 * count[0] = count[0] + 1 * free(links) * free(faligned) # <<<<<<<<<<<<<< @@ -12602,7 +13763,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_faligned); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":170 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":170 * free(links) * free(faligned) * free(ealigned) # <<<<<<<<<<<<<< @@ -12612,7 +13773,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL free(__pyx_v_ealigned); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":171 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":171 * free(faligned) * free(ealigned) * self.f_index = IntList(initial_len=V_F) # <<<<<<<<<<<<<< @@ -12625,7 +13786,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_GIVEREF(__pyx_t_13); @@ -12634,7 +13795,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_self->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_13); __pyx_t_13 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":172 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":172 * free(ealigned) * self.f_index = IntList(initial_len=V_F) * self.e_index = IntList(initial_len=num_pairs) # <<<<<<<<<<<<<< @@ -12647,7 +13808,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_12); if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __Pyx_GIVEREF(__pyx_t_12); @@ -12656,7 +13817,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_self->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":173 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":173 * self.f_index = IntList(initial_len=V_F) * self.e_index = IntList(initial_len=num_pairs) * self.col1 = FloatList(initial_len=num_pairs) # <<<<<<<<<<<<<< @@ -12669,7 +13830,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_GIVEREF(__pyx_t_13); @@ -12678,7 +13839,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_self->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_13); __pyx_t_13 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":174 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":174 * self.e_index = IntList(initial_len=num_pairs) * self.col1 = FloatList(initial_len=num_pairs) * self.col2 = FloatList(initial_len=num_pairs) # <<<<<<<<<<<<<< @@ -12691,7 +13852,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_12); if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __Pyx_GIVEREF(__pyx_t_12); @@ -12700,7 +13861,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_self->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":176 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":176 * self.col2 = FloatList(initial_len=num_pairs) * * num_pairs = 0 # <<<<<<<<<<<<<< @@ -12709,7 +13870,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_num_pairs = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":177 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":177 * * num_pairs = 0 * for i from 0 <= i < V_F: # <<<<<<<<<<<<<< @@ -12719,7 +13880,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_6 = __pyx_v_V_F; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":179 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":179 * for i from 0 <= i < V_F: * #self.f_index[i] = num_pairs * self.f_index.set(i, num_pairs) # <<<<<<<<<<<<<< @@ -12728,7 +13889,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->set(__pyx_v_self->f_index, __pyx_v_i, __pyx_v_num_pairs); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":180 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":180 * #self.f_index[i] = num_pairs * self.f_index.set(i, num_pairs) * if dict[i] != NULL: # <<<<<<<<<<<<<< @@ -12738,7 +13899,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = ((__pyx_v_dict[__pyx_v_i]) != NULL); if (__pyx_t_10) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":181 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":181 * self.f_index.set(i, num_pairs) * if dict[i] != NULL: * self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin) # <<<<<<<<<<<<<< @@ -12749,7 +13910,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":182 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":182 * if dict[i] != NULL: * self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin) * del_node(dict[i]) # <<<<<<<<<<<<<< @@ -12764,7 +13925,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_L30:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":183 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":183 * self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin) * del_node(dict[i]) * free(fmargin) # <<<<<<<<<<<<<< @@ -12773,7 +13934,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_fmargin); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":184 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":184 * del_node(dict[i]) * free(fmargin) * free(emargin) # <<<<<<<<<<<<<< @@ -12782,7 +13943,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_emargin); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":185 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":185 * free(fmargin) * free(emargin) * free(dict) # <<<<<<<<<<<<<< @@ -12791,7 +13952,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_dict); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":186 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":186 * free(emargin) * free(dict) * return # <<<<<<<<<<<<<< @@ -12822,7 +13983,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":189 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":189 * * * cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): # <<<<<<<<<<<<<< @@ -12839,9 +14000,9 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_add_node"); + __Pyx_RefNannySetupContext("_add_node", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":191 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":191 * cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): * cdef int loc * if n.smaller != NULL: # <<<<<<<<<<<<<< @@ -12851,7 +14012,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py __pyx_t_1 = (__pyx_v_n->smaller != NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":192 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":192 * cdef int loc * if n.smaller != NULL: * self._add_node(n.smaller, num_pairs, fmargin, emargin) # <<<<<<<<<<<<<< @@ -12865,7 +14026,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":193 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":193 * if n.smaller != NULL: * self._add_node(n.smaller, num_pairs, fmargin, emargin) * loc = num_pairs[0] # <<<<<<<<<<<<<< @@ -12874,7 +14035,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py */ __pyx_v_loc = (__pyx_v_num_pairs[0]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":194 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":194 * self._add_node(n.smaller, num_pairs, fmargin, emargin) * loc = num_pairs[0] * self.e_index.set(loc, n.key) # <<<<<<<<<<<<<< @@ -12883,7 +14044,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->set(__pyx_v_self->e_index, __pyx_v_loc, __pyx_v_n->key); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":195 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":195 * loc = num_pairs[0] * self.e_index.set(loc, n.key) * self.col1.set(loc, float(n.val)/fmargin) # <<<<<<<<<<<<<< @@ -12896,7 +14057,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py } ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->set(__pyx_v_self->col1, __pyx_v_loc, (((double)__pyx_v_n->val) / __pyx_v_fmargin)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":196 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":196 * self.e_index.set(loc, n.key) * self.col1.set(loc, float(n.val)/fmargin) * self.col2.set(loc, float(n.val)/float(emargin[n.key])) # <<<<<<<<<<<<<< @@ -12909,7 +14070,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py } ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->set(__pyx_v_self->col2, __pyx_v_loc, (((double)__pyx_v_n->val) / ((double)(__pyx_v_emargin[__pyx_v_n->key])))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":197 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":197 * self.col1.set(loc, float(n.val)/fmargin) * self.col2.set(loc, float(n.val)/float(emargin[n.key])) * num_pairs[0] = loc + 1 # <<<<<<<<<<<<<< @@ -12918,7 +14079,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py */ (__pyx_v_num_pairs[0]) = (__pyx_v_loc + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":198 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":198 * self.col2.set(loc, float(n.val)/float(emargin[n.key])) * num_pairs[0] = loc + 1 * if n.bigger != NULL: # <<<<<<<<<<<<<< @@ -12928,7 +14089,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py __pyx_t_1 = (__pyx_v_n->bigger != NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":199 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":199 * num_pairs[0] = loc + 1 * if n.bigger != NULL: * self._add_node(n.bigger, num_pairs, fmargin, emargin) # <<<<<<<<<<<<<< @@ -12954,7 +14115,28 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":202 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_binary (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_5BiLex_2write_binary(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":202 * * * def write_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -12962,9 +14144,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_5BiLex_1write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_5BiLex_1write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -12973,18 +14153,9 @@ static PyObject *__pyx_pf_3_sa_5BiLex_1write_binary(PyObject *__pyx_v_self, PyOb int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_binary"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_binary", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":204 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":204 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -12993,71 +14164,71 @@ static PyObject *__pyx_pf_3_sa_5BiLex_1write_binary(PyObject *__pyx_v_self, PyOb */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":205 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":205 * cdef FILE* f * f = fopen(filename, "w") * self.f_index.write_handle(f) # <<<<<<<<<<<<<< * self.e_index.write_handle(f) * self.col1.write_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->write_handle(__pyx_v_self->f_index, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":206 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":206 * f = fopen(filename, "w") * self.f_index.write_handle(f) * self.e_index.write_handle(f) # <<<<<<<<<<<<<< * self.col1.write_handle(f) * self.col2.write_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->write_handle(__pyx_v_self->e_index, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":207 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":207 * self.f_index.write_handle(f) * self.e_index.write_handle(f) * self.col1.write_handle(f) # <<<<<<<<<<<<<< * self.col2.write_handle(f) * self.write_wordlist(self.id2fword, f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->write_handle(__pyx_v_self->col1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":208 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":208 * self.e_index.write_handle(f) * self.col1.write_handle(f) * self.col2.write_handle(f) # <<<<<<<<<<<<<< * self.write_wordlist(self.id2fword, f) * self.write_wordlist(self.id2eword, f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->write_handle(__pyx_v_self->col2, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":209 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":209 * self.col1.write_handle(f) * self.col2.write_handle(f) * self.write_wordlist(self.id2fword, f) # <<<<<<<<<<<<<< * self.write_wordlist(self.id2eword, f) * fclose(f) */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword; + __pyx_t_1 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_BiLex *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->__pyx_vtab)->write_wordlist(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->write_wordlist(__pyx_v_self, __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":210 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":210 * self.col2.write_handle(f) * self.write_wordlist(self.id2fword, f) * self.write_wordlist(self.id2eword, f) # <<<<<<<<<<<<<< * fclose(f) * */ - __pyx_t_2 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword; + __pyx_t_2 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_BiLex *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->__pyx_vtab)->write_wordlist(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->write_wordlist(__pyx_v_self, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":211 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":211 * self.write_wordlist(self.id2fword, f) * self.write_wordlist(self.id2eword, f) * fclose(f) # <<<<<<<<<<<<<< @@ -13079,7 +14250,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_1write_binary(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":214 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":214 * * * cdef write_wordlist(self, wordlist, FILE* f): # <<<<<<<<<<<<<< @@ -13087,7 +14258,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_1write_binary(PyObject *__pyx_v_self, PyOb * cdef int num_words */ -static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_wordlist, FILE *__pyx_v_f) { +static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_wordlist, FILE *__pyx_v_f) { int __pyx_v_word_len; int __pyx_v_num_words; PyObject *__pyx_v_word = NULL; @@ -13102,9 +14273,9 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_wordlist"); + __Pyx_RefNannySetupContext("write_wordlist", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":218 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":218 * cdef int num_words * * num_words = len(wordlist) # <<<<<<<<<<<<<< @@ -13114,7 +14285,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex __pyx_t_1 = PyObject_Length(__pyx_v_wordlist); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_num_words = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":219 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":219 * * num_words = len(wordlist) * fwrite(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -13123,7 +14294,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex */ fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":220 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":220 * num_words = len(wordlist) * fwrite(&(num_words), sizeof(int), 1, f) * for word in wordlist: # <<<<<<<<<<<<<< @@ -13139,12 +14310,20 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_2); if (unlikely(!__pyx_t_4)) { @@ -13160,7 +14339,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex __pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":221 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":221 * fwrite(&(num_words), sizeof(int), 1, f) * for word in wordlist: * word_len = len(word) + 1 # <<<<<<<<<<<<<< @@ -13170,7 +14349,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex __pyx_t_5 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_word_len = (__pyx_t_5 + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":222 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":222 * for word in wordlist: * word_len = len(word) + 1 * fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -13179,7 +14358,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex */ fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":223 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":223 * word_len = len(word) + 1 * fwrite(&(word_len), sizeof(int), 1, f) * fwrite(<char *>word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< @@ -13205,7 +14384,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":226 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":226 * * * cdef read_wordlist(self, word2id, id2word, FILE* f): # <<<<<<<<<<<<<< @@ -13213,11 +14392,11 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(struct __pyx_obj_3_sa_BiLex * cdef int word_len */ -static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_word2id, PyObject *__pyx_v_id2word, FILE *__pyx_v_f) { +static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_word2id, PyObject *__pyx_v_id2word, FILE *__pyx_v_f) { int __pyx_v_num_words; int __pyx_v_word_len; char *__pyx_v_word; - long __pyx_v_i; + CYTHON_UNUSED long __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -13227,9 +14406,9 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_wordlist"); + __Pyx_RefNannySetupContext("read_wordlist", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":231 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":231 * cdef char* word * * fread(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -13238,7 +14417,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * */ fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":232 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":232 * * fread(&(num_words), sizeof(int), 1, f) * for i from 0 <= i < num_words: # <<<<<<<<<<<<<< @@ -13248,7 +14427,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * __pyx_t_1 = __pyx_v_num_words; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":233 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":233 * fread(&(num_words), sizeof(int), 1, f) * for i from 0 <= i < num_words: * fread(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -13257,7 +14436,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * */ fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":234 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":234 * for i from 0 <= i < num_words: * fread(&(word_len), sizeof(int), 1, f) * word = <char*> malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<< @@ -13266,7 +14445,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * */ __pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":235 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":235 * fread(&(word_len), sizeof(int), 1, f) * word = <char*> malloc (word_len * sizeof(char)) * fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< @@ -13275,7 +14454,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * */ fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":236 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":236 * word = <char*> malloc (word_len * sizeof(char)) * fread(word, sizeof(char), word_len, f) * word2id[word] = len(id2word) # <<<<<<<<<<<<<< @@ -13291,7 +14470,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":237 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":237 * fread(word, sizeof(char), word_len, f) * word2id[word] = len(id2word) * id2word.append(word) # <<<<<<<<<<<<<< @@ -13305,7 +14484,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":238 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":238 * word2id[word] = len(id2word) * id2word.append(word) * free(word) # <<<<<<<<<<<<<< @@ -13328,7 +14507,28 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":240 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_binary (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_5BiLex_4read_binary(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":240 * free(word) * * def read_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -13336,9 +14536,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(struct __pyx_obj_3_sa_BiLex * * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_5BiLex_2read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_5BiLex_2read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -13348,18 +14546,9 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2read_binary(PyObject *__pyx_v_self, PyObj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_binary"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("read_binary", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":242 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":242 * def read_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -13368,77 +14557,77 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2read_binary(PyObject *__pyx_v_self, PyObj */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":243 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":243 * cdef FILE* f * f = fopen(filename, "r") * self.f_index.read_handle(f) # <<<<<<<<<<<<<< * self.e_index.read_handle(f) * self.col1.read_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->read_handle(__pyx_v_self->f_index, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":244 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":244 * f = fopen(filename, "r") * self.f_index.read_handle(f) * self.e_index.read_handle(f) # <<<<<<<<<<<<<< * self.col1.read_handle(f) * self.col2.read_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->read_handle(__pyx_v_self->e_index, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":245 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":245 * self.f_index.read_handle(f) * self.e_index.read_handle(f) * self.col1.read_handle(f) # <<<<<<<<<<<<<< * self.col2.read_handle(f) * self.read_wordlist(self.fword2id, self.id2fword, f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->read_handle(__pyx_v_self->col1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":246 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":246 * self.e_index.read_handle(f) * self.col1.read_handle(f) * self.col2.read_handle(f) # <<<<<<<<<<<<<< * self.read_wordlist(self.fword2id, self.id2fword, f) * self.read_wordlist(self.eword2id, self.id2eword, f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->read_handle(__pyx_v_self->col2, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":247 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":247 * self.col1.read_handle(f) * self.col2.read_handle(f) * self.read_wordlist(self.fword2id, self.id2fword, f) # <<<<<<<<<<<<<< * self.read_wordlist(self.eword2id, self.id2eword, f) * fclose(f) */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id; + __pyx_t_1 = __pyx_v_self->fword2id; __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword; + __pyx_t_2 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_3_sa_BiLex *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->__pyx_vtab)->read_wordlist(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), __pyx_t_1, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->read_wordlist(__pyx_v_self, __pyx_t_1, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 247; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":248 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":248 * self.col2.read_handle(f) * self.read_wordlist(self.fword2id, self.id2fword, f) * self.read_wordlist(self.eword2id, self.id2eword, f) # <<<<<<<<<<<<<< * fclose(f) * */ - __pyx_t_3 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id; + __pyx_t_3 = __pyx_v_self->eword2id; __Pyx_INCREF(__pyx_t_3); - __pyx_t_2 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword; + __pyx_t_2 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_BiLex *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->__pyx_vtab)->read_wordlist(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), __pyx_t_3, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->read_wordlist(__pyx_v_self, __pyx_t_3, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":249 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":249 * self.read_wordlist(self.fword2id, self.id2fword, f) * self.read_wordlist(self.eword2id, self.id2eword, f) * fclose(f) # <<<<<<<<<<<<<< @@ -13461,7 +14650,18 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2read_binary(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":252 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/ +static PyObject *__pyx_pw_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_e_id (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_5BiLex_6get_e_id(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":252 * * * def get_e_id(self, eword): # <<<<<<<<<<<<<< @@ -13469,9 +14669,8 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2read_binary(PyObject *__pyx_v_self, PyObj * e_id = len(self.id2eword) */ -static PyObject *__pyx_pf_3_sa_5BiLex_3get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/ -static PyObject *__pyx_pf_3_sa_5BiLex_3get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) { - Py_ssize_t __pyx_v_e_id; +static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) { + PyObject *__pyx_v_e_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -13480,58 +14679,58 @@ static PyObject *__pyx_pf_3_sa_5BiLex_3get_e_id(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_e_id"); + __Pyx_RefNannySetupContext("get_e_id", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":253 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":253 * * def get_e_id(self, eword): * if eword not in self.eword2id: # <<<<<<<<<<<<<< * e_id = len(self.id2eword) * self.id2eword.append(eword) */ - __pyx_t_1 = (__Pyx_NegateNonNeg(PySequence_Contains(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id, __pyx_v_eword))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":254 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":254 * def get_e_id(self, eword): * if eword not in self.eword2id: * e_id = len(self.id2eword) # <<<<<<<<<<<<<< * self.id2eword.append(eword) * self.eword2id[eword] = e_id */ - __pyx_t_2 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword; + __pyx_t_2 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_e_id = __pyx_t_3; + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_e_id = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":255 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":255 * if eword not in self.eword2id: * e_id = len(self.id2eword) * self.id2eword.append(eword) # <<<<<<<<<<<<<< * self.eword2id[eword] = e_id * return self.eword2id[eword] */ - __pyx_t_2 = __Pyx_PyObject_Append(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword, __pyx_v_eword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_eword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":256 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":256 * e_id = len(self.id2eword) * self.id2eword.append(eword) * self.eword2id[eword] = e_id # <<<<<<<<<<<<<< * return self.eword2id[eword] * */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_e_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id, __pyx_v_eword, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L5; + if (PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_eword, __pyx_v_e_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":257 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":257 * self.id2eword.append(eword) * self.eword2id[eword] = e_id * return self.eword2id[eword] # <<<<<<<<<<<<<< @@ -13539,7 +14738,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_3get_e_id(PyObject *__pyx_v_self, PyObject * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id, __pyx_v_eword); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -13552,12 +14751,24 @@ static PyObject *__pyx_pf_3_sa_5BiLex_3get_e_id(PyObject *__pyx_v_self, PyObject __Pyx_AddTraceback("_sa.BiLex.get_e_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_e_id); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":260 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/ +static PyObject *__pyx_pw_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_f_id (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_5BiLex_8get_f_id(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":260 * * * def get_f_id(self, fword): # <<<<<<<<<<<<<< @@ -13565,9 +14776,8 @@ static PyObject *__pyx_pf_3_sa_5BiLex_3get_e_id(PyObject *__pyx_v_self, PyObject * f_id = len(self.id2fword) */ -static PyObject *__pyx_pf_3_sa_5BiLex_4get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/ -static PyObject *__pyx_pf_3_sa_5BiLex_4get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) { - Py_ssize_t __pyx_v_f_id; +static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) { + PyObject *__pyx_v_f_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -13576,58 +14786,58 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4get_f_id(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_f_id"); + __Pyx_RefNannySetupContext("get_f_id", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":261 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":261 * * def get_f_id(self, fword): * if fword not in self.fword2id: # <<<<<<<<<<<<<< * f_id = len(self.id2fword) * self.id2fword.append(fword) */ - __pyx_t_1 = (__Pyx_NegateNonNeg(PySequence_Contains(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id, __pyx_v_fword))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":262 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":262 * def get_f_id(self, fword): * if fword not in self.fword2id: * f_id = len(self.id2fword) # <<<<<<<<<<<<<< * self.id2fword.append(fword) * self.fword2id[fword] = f_id */ - __pyx_t_2 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword; + __pyx_t_2 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_f_id = __pyx_t_3; + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_f_id = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":263 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":263 * if fword not in self.fword2id: * f_id = len(self.id2fword) * self.id2fword.append(fword) # <<<<<<<<<<<<<< * self.fword2id[fword] = f_id * return self.fword2id[fword] */ - __pyx_t_2 = __Pyx_PyObject_Append(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword, __pyx_v_fword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_fword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":264 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":264 * f_id = len(self.id2fword) * self.id2fword.append(fword) * self.fword2id[fword] = f_id # <<<<<<<<<<<<<< * return self.fword2id[fword] * */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_f_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id, __pyx_v_fword, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L5; + if (PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_fword, __pyx_v_f_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":265 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":265 * self.id2fword.append(fword) * self.fword2id[fword] = f_id * return self.fword2id[fword] # <<<<<<<<<<<<<< @@ -13635,7 +14845,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4get_f_id(PyObject *__pyx_v_self, PyObject * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id, __pyx_v_fword); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -13648,12 +14858,34 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4get_f_id(PyObject *__pyx_v_self, PyObject __Pyx_AddTraceback("_sa.BiLex.get_f_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f_id); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":268 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_text (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_5BiLex_10read_text(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":268 * * * def read_text(self, char* filename): # <<<<<<<<<<<<<< @@ -13661,9 +14893,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4get_f_id(PyObject *__pyx_v_self, PyObject * cdef IntList fcount */ -static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_i = 0; PyObject *__pyx_v_j = 0; PyObject *__pyx_v_e_id = 0; @@ -13708,18 +14938,9 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("read_text", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":272 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":272 * cdef IntList fcount * * fcount = IntList() # <<<<<<<<<<<<<< @@ -13731,7 +14952,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec __pyx_v_fcount = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":273 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":273 * * fcount = IntList() * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -13744,7 +14965,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __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[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -13754,12 +14975,12 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L3_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_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); @@ -13767,10 +14988,11 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_f = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":275 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":275 * with gzip_or_text(filename) as f: * # first loop merely establishes size of array objects * for line in f: # <<<<<<<<<<<<<< @@ -13778,102 +15000,119 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec * f_id = self.get_f_id(fword) */ if (PyList_CheckExact(__pyx_v_f) || PyTuple_CheckExact(__pyx_v_f)) { - __pyx_t_2 = __pyx_v_f; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; __pyx_t_9 = NULL; } else { - __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_3 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF(__pyx_v_line); - __pyx_v_line = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_line = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":276 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":276 * # first loop merely establishes size of array objects * for line in f: * (fword, eword, score1, score2) = line.split() # <<<<<<<<<<<<<< * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_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[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) { - if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - } - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 4)) { - if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - } - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_10 = PyList_GET_ITEM(sequence, 1); __pyx_t_11 = PyList_GET_ITEM(sequence, 2); __pyx_t_12 = PyList_GET_ITEM(sequence, 3); } - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { + #else + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + *(temps[i]) = item; + } + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + { Py_ssize_t index = -1; - __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12}; + __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L19_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_10 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L19_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 2; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L19_unpacking_failed; - __Pyx_GOTREF(__pyx_t_11); - index = 3; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L19_unpacking_failed; - __Pyx_GOTREF(__pyx_t_12); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L18_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_14 = NULL; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L20_unpacking_done; - __pyx_L19_unpacking_failed:; + goto __pyx_L19_unpacking_done; + __pyx_L18_unpacking_failed:; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_L20_unpacking_done:; + __pyx_t_14 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_L19_unpacking_done:; } __Pyx_XDECREF(__pyx_v_fword); - __pyx_v_fword = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_fword = __pyx_t_2; + __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_eword); __pyx_v_eword = __pyx_t_10; __pyx_t_10 = 0; @@ -13884,51 +15123,51 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec __pyx_v_score2 = __pyx_t_12; __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":277 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":277 * for line in f: * (fword, eword, score1, score2) = line.split() * f_id = self.get_f_id(fword) # <<<<<<<<<<<<<< * e_id = self.get_e_id(eword) * while f_id >= len(fcount): */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_f_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_fword); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_fword); __Pyx_GIVEREF(__pyx_v_fword); - __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_v_f_id); __pyx_v_f_id = __pyx_t_11; __pyx_t_11 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":278 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":278 * (fword, eword, score1, score2) = line.split() * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) # <<<<<<<<<<<<<< * while f_id >= len(fcount): * fcount.append(0) */ - __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_e_id); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_e_id); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_eword); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_eword); __Pyx_GIVEREF(__pyx_v_eword); - __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_v_e_id); - __pyx_v_e_id = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_e_id = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":279 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":279 * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) * while f_id >= len(fcount): # <<<<<<<<<<<<<< @@ -13936,42 +15175,41 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec * fcount.arr[f_id] = fcount.arr[f_id] + 1 */ while (1) { - __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = PyObject_RichCompare(__pyx_v_f_id, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyObject_RichCompare(__pyx_v_f_id, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (!__pyx_t_16) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":280 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":280 * e_id = self.get_e_id(eword) * while f_id >= len(fcount): * fcount.append(0) # <<<<<<<<<<<<<< * fcount.arr[f_id] = fcount.arr[f_id] + 1 * */ - __pyx_t_12 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_fcount), __pyx_int_0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_fcount), __pyx_int_0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":281 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":281 * while f_id >= len(fcount): * fcount.append(0) * fcount.arr[f_id] = fcount.arr[f_id] + 1 # <<<<<<<<<<<<<< * * # Allocate space for dictionary in arrays */ - __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} (__pyx_v_fcount->arr[__pyx_t_17]) = ((__pyx_v_fcount->arr[__pyx_t_15]) + 1); } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":284 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":284 * * # Allocate space for dictionary in arrays * N = 0 # <<<<<<<<<<<<<< @@ -13981,192 +15219,192 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec __Pyx_INCREF(__pyx_int_0); __pyx_v_N = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":285 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":285 * # Allocate space for dictionary in arrays * N = 0 * n_f = len(fcount) # <<<<<<<<<<<<<< * self.f_index = IntList(initial_len=n_f+1) * for i from 0 <= i < n_f: */ - __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_n_f = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_n_f = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":286 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":286 * N = 0 * n_f = len(fcount) * self.f_index = IntList(initial_len=n_f+1) # <<<<<<<<<<<<<< * for i from 0 <= i < n_f: * self.f_index.arr[i] = N */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_12 = PyNumber_Add(__pyx_v_n_f, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_12 = PyNumber_Add(__pyx_v_n_f, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_12); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index)); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); + __Pyx_GOTREF(__pyx_v_self->f_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->f_index)); + __pyx_v_self->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":287 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":287 * n_f = len(fcount) * self.f_index = IntList(initial_len=n_f+1) * for i from 0 <= i < n_f: # <<<<<<<<<<<<<< * self.f_index.arr[i] = N * N = N + fcount.arr[i] */ - __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19++) { - __pyx_t_12 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_12; __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":288 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":288 * self.f_index = IntList(initial_len=n_f+1) * for i from 0 <= i < n_f: * self.f_index.arr[i] = N # <<<<<<<<<<<<<< * N = N + fcount.arr[i] * fcount.arr[i] = 0 */ - __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - (((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->arr[__pyx_t_8]) = __pyx_t_20; + __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":289 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":289 * for i from 0 <= i < n_f: * self.f_index.arr[i] = N * N = N + fcount.arr[i] # <<<<<<<<<<<<<< * fcount.arr[i] = 0 * self.f_index.arr[n_f] = N */ - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_12 = PyInt_FromLong((__pyx_v_fcount->arr[__pyx_t_8])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyInt_FromLong((__pyx_v_fcount->arr[__pyx_t_8])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = PyNumber_Add(__pyx_v_N, __pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Add(__pyx_v_N, __pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_v_N); - __pyx_v_N = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_N = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":290 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":290 * self.f_index.arr[i] = N * N = N + fcount.arr[i] * fcount.arr[i] = 0 # <<<<<<<<<<<<<< * self.f_index.arr[n_f] = N * self.e_index = IntList(initial_len=N) */ - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;} (__pyx_v_fcount->arr[__pyx_t_8]) = 0; - __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":287 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":287 * n_f = len(fcount) * self.f_index = IntList(initial_len=n_f+1) * for i from 0 <= i < n_f: # <<<<<<<<<<<<<< * self.f_index.arr[i] = N * N = N + fcount.arr[i] */ - __pyx_t_2 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":291 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":291 * N = N + fcount.arr[i] * fcount.arr[i] = 0 * self.f_index.arr[n_f] = N # <<<<<<<<<<<<<< * self.e_index = IntList(initial_len=N) * self.col1 = FloatList(initial_len=N) */ - __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_n_f); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - (((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->arr[__pyx_t_8]) = __pyx_t_20; + __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_n_f); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":292 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":292 * fcount.arr[i] = 0 * self.f_index.arr[n_f] = N * self.e_index = IntList(initial_len=N) # <<<<<<<<<<<<<< * self.col1 = FloatList(initial_len=N) * self.col2 = FloatList(initial_len=N) */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_12 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_12); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index)); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); + __Pyx_GOTREF(__pyx_v_self->e_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->e_index)); + __pyx_v_self->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":293 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":293 * self.f_index.arr[n_f] = N * self.e_index = IntList(initial_len=N) * self.col1 = FloatList(initial_len=N) # <<<<<<<<<<<<<< * self.col2 = FloatList(initial_len=N) * */ - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1)); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col1); + __Pyx_DECREF(((PyObject *)__pyx_v_self->col1)); + __pyx_v_self->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":294 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":294 * self.e_index = IntList(initial_len=N) * self.col1 = FloatList(initial_len=N) * self.col2 = FloatList(initial_len=N) # <<<<<<<<<<<<<< * * # Re-read file, placing words into buckets */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_12 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_12); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2)); - ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_12); + __Pyx_GOTREF(__pyx_v_self->col2); + __Pyx_DECREF(((PyObject *)__pyx_v_self->col2)); + __pyx_v_self->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":297 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":297 * * # Re-read file, placing words into buckets * f.seek(0) # <<<<<<<<<<<<<< * for line in f: * (fword, eword, score1, score2) = line.split() */ - __pyx_t_12 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__seek); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__seek); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":298 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":298 * # Re-read file, placing words into buckets * f.seek(0) * for line in f: # <<<<<<<<<<<<<< @@ -14174,26 +15412,34 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec * f_id = self.get_f_id(fword) */ if (PyList_CheckExact(__pyx_v_f) || PyTuple_CheckExact(__pyx_v_f)) { - __pyx_t_2 = __pyx_v_f; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; __pyx_t_9 = NULL; } else { - __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_12 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_12 = __pyx_t_9(__pyx_t_2); + __pyx_t_12 = __pyx_t_9(__pyx_t_1); if (unlikely(!__pyx_t_12)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } @@ -14203,69 +15449,78 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec __pyx_v_line = __pyx_t_12; __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":299 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":299 * f.seek(0) * for line in f: * (fword, eword, score1, score2) = line.split() # <<<<<<<<<<<<<< * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) */ - __pyx_t_12 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) { - if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - } __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 4)) { - if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - } __pyx_t_12 = PyList_GET_ITEM(sequence, 0); __pyx_t_11 = PyList_GET_ITEM(sequence, 1); __pyx_t_10 = PyList_GET_ITEM(sequence, 2); - __pyx_t_3 = PyList_GET_ITEM(sequence, 3); + __pyx_t_2 = PyList_GET_ITEM(sequence, 3); } __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { + __Pyx_INCREF(__pyx_t_2); + #else + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_2}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + *(temps[i]) = item; + } + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + { Py_ssize_t index = -1; - __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_2}; + __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext; - index = 0; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L27_unpacking_failed; - __Pyx_GOTREF(__pyx_t_12); - index = 1; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L27_unpacking_failed; - __Pyx_GOTREF(__pyx_t_11); - index = 2; __pyx_t_10 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L27_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 3; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L27_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L26_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_14 = NULL; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L28_unpacking_done; - __pyx_L27_unpacking_failed:; + goto __pyx_L27_unpacking_done; + __pyx_L26_unpacking_failed:; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_L28_unpacking_done:; + __pyx_t_14 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_L27_unpacking_done:; } __Pyx_XDECREF(__pyx_v_fword); __pyx_v_fword = __pyx_t_12; @@ -14277,141 +15532,141 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec __pyx_v_score1 = __pyx_t_10; __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_v_score2); - __pyx_v_score2 = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_score2 = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":300 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":300 * for line in f: * (fword, eword, score1, score2) = line.split() * f_id = self.get_f_id(fword) # <<<<<<<<<<<<<< * e_id = self.get_e_id(eword) * index = self.f_index.arr[f_id] + fcount.arr[f_id] */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_f_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_fword); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fword); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fword); __Pyx_GIVEREF(__pyx_v_fword); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_XDECREF(__pyx_v_f_id); __pyx_v_f_id = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":301 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":301 * (fword, eword, score1, score2) = line.split() * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) # <<<<<<<<<<<<<< * index = self.f_index.arr[f_id] + fcount.arr[f_id] * fcount.arr[f_id] = fcount.arr[f_id] + 1 */ - __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_e_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_e_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_eword); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_eword); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_eword); __Pyx_GIVEREF(__pyx_v_eword); - __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_e_id); - __pyx_v_e_id = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_e_id = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":302 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":302 * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) * index = self.f_index.arr[f_id] + fcount.arr[f_id] # <<<<<<<<<<<<<< * fcount.arr[f_id] = fcount.arr[f_id] + 1 * self.e_index.arr[index] = int(e_id) */ - __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_1 = PyInt_FromLong(((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->arr[__pyx_t_15]) + (__pyx_v_fcount->arr[__pyx_t_17]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_3 = PyInt_FromLong(((__pyx_v_self->f_index->arr[__pyx_t_15]) + (__pyx_v_fcount->arr[__pyx_t_17]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_index); - __pyx_v_index = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_index = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":303 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":303 * e_id = self.get_e_id(eword) * index = self.f_index.arr[f_id] + fcount.arr[f_id] * fcount.arr[f_id] = fcount.arr[f_id] + 1 # <<<<<<<<<<<<<< * self.e_index.arr[index] = int(e_id) * self.col1[index] = float(score1) */ - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;} (__pyx_v_fcount->arr[__pyx_t_15]) = ((__pyx_v_fcount->arr[__pyx_t_17]) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":304 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":304 * index = self.f_index.arr[f_id] + fcount.arr[f_id] * fcount.arr[f_id] = fcount.arr[f_id] + 1 * self.e_index.arr[index] = int(e_id) # <<<<<<<<<<<<<< * self.col1[index] = float(score1) * self.col2[index] = float(score2) */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_e_id); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_e_id); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e_id); __Pyx_GIVEREF(__pyx_v_e_id); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - (((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index->arr[__pyx_t_17]) = __pyx_t_20; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_self->e_index->arr[__pyx_t_17]) = __pyx_t_20; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":305 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":305 * fcount.arr[f_id] = fcount.arr[f_id] + 1 * self.e_index.arr[index] = int(e_id) * self.col1[index] = float(score1) # <<<<<<<<<<<<<< * self.col2[index] = float(score2) * */ - __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score1); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_3 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetItem(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1), __pyx_v_index, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score1); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(((PyObject *)__pyx_v_self->col1), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":306 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":306 * self.e_index.arr[index] = int(e_id) * self.col1[index] = float(score1) * self.col2[index] = float(score2) # <<<<<<<<<<<<<< * * # Sort buckets by eword */ - __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score2); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_3 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetItem(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2), __pyx_v_index, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score2); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(((PyObject *)__pyx_v_self->col2), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; + goto __pyx_L14_try_end; + __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":273 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":273 * * fcount = IntList() * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -14420,57 +15675,57 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec */ /*except:*/ { __Pyx_AddTraceback("_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); __pyx_t_22 = PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_22); __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_22); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_23 = (!__pyx_t_16); if (__pyx_t_23) { + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_ErrRestore(__pyx_t_2, __pyx_t_3, __pyx_t_1); - __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L31; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L30; } - __pyx_L31:; + __pyx_L30:; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L10_exception_handled; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); - __pyx_L16_try_end:; + __pyx_L14_try_end:; } } /*finally:*/ { @@ -14484,29 +15739,30 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec if (unlikely(__pyx_t_23 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L32; - __pyx_L5_error:; + goto __pyx_L31; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L1_error; - __pyx_L32:; + __pyx_L31:; } - if (unlikely(!__pyx_v_n_f)) { __Pyx_RaiseUnboundLocalError("n_f"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":309 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":309 * * # Sort buckets by eword * for b from 0 <= b < n_f: # <<<<<<<<<<<<<< * i = self.f_index.arr[b] * j = self.f_index.arr[b+1] */ + if (unlikely(!__pyx_v_n_f)) { __Pyx_RaiseUnboundLocalError("n_f"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_19; __pyx_t_18++) { - __pyx_t_1 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_b = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":310 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":310 * # Sort buckets by eword * for b from 0 <= b < n_f: * i = self.f_index.arr[b] # <<<<<<<<<<<<<< @@ -14514,30 +15770,30 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec * self.qsort(i,j, "") */ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_b); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":311 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":311 * for b from 0 <= b < n_f: * i = self.f_index.arr[b] * j = self.f_index.arr[b+1] # <<<<<<<<<<<<<< * self.qsort(i,j, "") * */ - __pyx_t_1 = PyNumber_Add(__pyx_v_b, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_v_b, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_j = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":312 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":312 * i = self.f_index.arr[b] * j = self.f_index.arr[b+1] * self.qsort(i,j, "") # <<<<<<<<<<<<<< @@ -14546,27 +15802,27 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec */ __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_24 = __Pyx_PyInt_AsInt(__pyx_v_j); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((PyObject *)__pyx_kp_s_45); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = ((struct __pyx_vtabstruct_3_sa_BiLex *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->__pyx_vtab)->qsort(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), __pyx_t_20, __pyx_t_24, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((PyObject *)__pyx_kp_s_45); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_b); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":309 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":309 * * # Sort buckets by eword * for b from 0 <= b < n_f: # <<<<<<<<<<<<<< * i = self.f_index.arr[b] * j = self.f_index.arr[b+1] */ - __pyx_t_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -14601,7 +15857,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_5read_text(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":315 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":315 * * * cdef swap(self, int i, int j): # <<<<<<<<<<<<<< @@ -14615,9 +15871,9 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("swap"); + __Pyx_RefNannySetupContext("swap", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":319 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":319 * cdef float ftmp * * if i == j: # <<<<<<<<<<<<<< @@ -14627,7 +15883,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __pyx_t_1 = (__pyx_v_i == __pyx_v_j); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":320 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":320 * * if i == j: * return # <<<<<<<<<<<<<< @@ -14641,7 +15897,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":322 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":322 * return * * itmp = self.e_index.arr[i] # <<<<<<<<<<<<<< @@ -14650,7 +15906,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ __pyx_v_itmp = (__pyx_v_self->e_index->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":323 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":323 * * itmp = self.e_index.arr[i] * self.e_index.arr[i] = self.e_index.arr[j] # <<<<<<<<<<<<<< @@ -14659,7 +15915,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->e_index->arr[__pyx_v_i]) = (__pyx_v_self->e_index->arr[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":324 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":324 * itmp = self.e_index.arr[i] * self.e_index.arr[i] = self.e_index.arr[j] * self.e_index.arr[j] = itmp # <<<<<<<<<<<<<< @@ -14668,7 +15924,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->e_index->arr[__pyx_v_j]) = __pyx_v_itmp; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":326 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":326 * self.e_index.arr[j] = itmp * * ftmp = self.col1.arr[i] # <<<<<<<<<<<<<< @@ -14677,7 +15933,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ __pyx_v_ftmp = (__pyx_v_self->col1->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":327 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":327 * * ftmp = self.col1.arr[i] * self.col1.arr[i] = self.col1.arr[j] # <<<<<<<<<<<<<< @@ -14686,7 +15942,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->col1->arr[__pyx_v_i]) = (__pyx_v_self->col1->arr[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":328 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":328 * ftmp = self.col1.arr[i] * self.col1.arr[i] = self.col1.arr[j] * self.col1.arr[j] = ftmp # <<<<<<<<<<<<<< @@ -14695,7 +15951,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->col1->arr[__pyx_v_j]) = __pyx_v_ftmp; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":330 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":330 * self.col1.arr[j] = ftmp * * ftmp = self.col2.arr[i] # <<<<<<<<<<<<<< @@ -14704,7 +15960,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ __pyx_v_ftmp = (__pyx_v_self->col2->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":331 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":331 * * ftmp = self.col2.arr[i] * self.col2.arr[i] = self.col2.arr[j] # <<<<<<<<<<<<<< @@ -14713,7 +15969,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->col2->arr[__pyx_v_i]) = (__pyx_v_self->col2->arr[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":332 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":332 * ftmp = self.col2.arr[i] * self.col2.arr[i] = self.col2.arr[j] * self.col2.arr[j] = ftmp # <<<<<<<<<<<<<< @@ -14729,7 +15985,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":335 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":335 * * * cdef qsort(self, int i, int j, pad): # <<<<<<<<<<<<<< @@ -14750,9 +16006,9 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("qsort"); + __Pyx_RefNannySetupContext("qsort", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":338 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":338 * cdef int pval, p * * if i > j: # <<<<<<<<<<<<<< @@ -14762,7 +16018,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_1 = (__pyx_v_i > __pyx_v_j); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":339 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":339 * * if i > j: * raise Exception("Sort error in CLex") # <<<<<<<<<<<<<< @@ -14778,7 +16034,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":340 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":340 * if i > j: * raise Exception("Sort error in CLex") * if i == j: #empty interval # <<<<<<<<<<<<<< @@ -14788,7 +16044,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_1 = (__pyx_v_i == __pyx_v_j); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":341 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":341 * raise Exception("Sort error in CLex") * if i == j: #empty interval * return # <<<<<<<<<<<<<< @@ -14802,7 +16058,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":342 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":342 * if i == j: #empty interval * return * if i == j-1: # singleton interval # <<<<<<<<<<<<<< @@ -14812,7 +16068,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_1 = (__pyx_v_i == (__pyx_v_j - 1)); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":343 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":343 * return * if i == j-1: # singleton interval * return # <<<<<<<<<<<<<< @@ -14826,7 +16082,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":345 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":345 * return * * p = (i+j)/2 # <<<<<<<<<<<<<< @@ -14835,7 +16091,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ */ __pyx_v_p = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":346 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":346 * * p = (i+j)/2 * pval = self.e_index.arr[p] # <<<<<<<<<<<<<< @@ -14844,7 +16100,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ */ __pyx_v_pval = (__pyx_v_self->e_index->arr[__pyx_v_p]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":347 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":347 * p = (i+j)/2 * pval = self.e_index.arr[p] * self.swap(i, p) # <<<<<<<<<<<<<< @@ -14855,7 +16111,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":348 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":348 * pval = self.e_index.arr[p] * self.swap(i, p) * p = i # <<<<<<<<<<<<<< @@ -14864,7 +16120,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ */ __pyx_v_p = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":349 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":349 * self.swap(i, p) * p = i * for k from i+1 <= k < j: # <<<<<<<<<<<<<< @@ -14874,7 +16130,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_3 = __pyx_v_j; for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":350 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":350 * p = i * for k from i+1 <= k < j: * if pval >= self.e_index.arr[k]: # <<<<<<<<<<<<<< @@ -14884,7 +16140,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_1 = (__pyx_v_pval >= (__pyx_v_self->e_index->arr[__pyx_v_k])); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":351 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":351 * for k from i+1 <= k < j: * if pval >= self.e_index.arr[k]: * self.swap(p+1, k) # <<<<<<<<<<<<<< @@ -14895,7 +16151,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":352 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":352 * if pval >= self.e_index.arr[k]: * self.swap(p+1, k) * self.swap(p, p+1) # <<<<<<<<<<<<<< @@ -14906,7 +16162,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":353 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":353 * self.swap(p+1, k) * self.swap(p, p+1) * p = p + 1 # <<<<<<<<<<<<<< @@ -14919,7 +16175,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_L8:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":354 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":354 * self.swap(p, p+1) * p = p + 1 * self.qsort(i,p, pad+" ") # <<<<<<<<<<<<<< @@ -14933,7 +16189,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":355 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":355 * p = p + 1 * self.qsort(i,p, pad+" ") * self.qsort(p+1,j, pad+" ") # <<<<<<<<<<<<<< @@ -14960,7 +16216,28 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":358 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_enhanced (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_5BiLex_12write_enhanced(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":358 * * * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< @@ -14968,9 +16245,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ * for i in self.f_index: */ -static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_i = NULL; PyObject *__pyx_v_s1 = NULL; @@ -14984,9 +16259,9 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; @@ -14997,18 +16272,9 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_enhanced", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":359 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":359 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -15019,7 +16285,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); @@ -15031,213 +16297,238 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":360 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":360 * def write_enhanced(self, char* filename): * with open(filename, "w") as f: * for i in self.f_index: # <<<<<<<<<<<<<< * f.write("%d " % i) * f.write("\n") */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index))) { - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index); __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->f_index)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->f_index))) { + __pyx_t_4 = ((PyObject *)__pyx_v_self->f_index); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->f_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { + __pyx_t_1 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":361 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":361 * with open(filename, "w") as f: * for i in self.f_index: * f.write("%d " % i) # <<<<<<<<<<<<<< * f.write("\n") * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":362 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":362 * for i in self.f_index: * f.write("%d " % i) * f.write("\n") # <<<<<<<<<<<<<< * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): * f.write("%d %f %f " % (i, s1, s2)) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":363 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":363 * f.write("%d " % i) * f.write("\n") * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): # <<<<<<<<<<<<<< * f.write("%d %f %f " % (i, s1, s2)) * f.write("\n") */ - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1)); - PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2)); - PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2)); - __pyx_t_1 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self->e_index)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->e_index)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->e_index)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->col1)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->col1)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->col1)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->col2)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->col2)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->col2)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = Py_TYPE(__pyx_t_9)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_9)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_9)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_9); - if (unlikely(!__pyx_t_1)) { + __pyx_t_4 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - } __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - } __pyx_t_10 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); + __pyx_t_1 = PyList_GET_ITEM(sequence, 1); __pyx_t_11 = PyList_GET_ITEM(sequence, 2); } __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { + #else + __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + { Py_ssize_t index = -1; - __pyx_t_12 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext; - index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L21_unpacking_failed; + index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L20_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); - index = 1; __pyx_t_2 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_2)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 2; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L21_unpacking_failed; + index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 2; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L20_unpacking_failed; __Pyx_GOTREF(__pyx_t_11); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_13 = NULL; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L22_unpacking_done; - __pyx_L21_unpacking_failed:; + goto __pyx_L21_unpacking_done; + __pyx_L20_unpacking_failed:; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_L22_unpacking_done:; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_L21_unpacking_done:; } __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_10; __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_v_s1); - __pyx_v_s1 = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_s1 = __pyx_t_1; + __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_s2); __pyx_v_s2 = __pyx_t_11; __pyx_t_11 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":364 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":364 * f.write("\n") * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): * f.write("%d %f %f " % (i, s1, s2)) # <<<<<<<<<<<<<< * f.write("\n") * for i, w in enumerate(self.id2fword): */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); @@ -15247,37 +16538,37 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py __Pyx_INCREF(__pyx_v_s2); PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_s2); __Pyx_GIVEREF(__pyx_v_s2); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); - PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":365 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":365 * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): * f.write("%d %f %f " % (i, s1, s2)) * f.write("\n") # <<<<<<<<<<<<<< * for i, w in enumerate(self.id2fword): * f.write("%d %s " % (i, w)) */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":366 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":366 * f.write("%d %f %f " % (i, s1, s2)) * f.write("\n") * for i, w in enumerate(self.id2fword): # <<<<<<<<<<<<<< @@ -15285,28 +16576,36 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py * f.write("\n") */ __Pyx_INCREF(__pyx_int_0); - __pyx_t_2 = __pyx_int_0; - if (PyList_CheckExact(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword) || PyTuple_CheckExact(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword)) { - __pyx_t_9 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword; __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + __pyx_t_1 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_self->id2fword) || PyTuple_CheckExact(__pyx_v_self->id2fword)) { + __pyx_t_2 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = Py_TYPE(__pyx_t_9)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->id2fword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_9)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break; - __pyx_t_11 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_11); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_9)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_11); __pyx_t_7++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_11 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_11 = __pyx_t_8(__pyx_t_9); + __pyx_t_11 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_11)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } @@ -15315,64 +16614,64 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py __Pyx_XDECREF(__pyx_v_w); __pyx_v_w = __pyx_t_11; __pyx_t_11 = 0; - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_11 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_v_i = __pyx_t_1; + __pyx_t_11 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); - __pyx_t_2 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_11; __pyx_t_11 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":367 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":367 * f.write("\n") * for i, w in enumerate(self.id2fword): * f.write("%d %s " % (i, w)) # <<<<<<<<<<<<<< * f.write("\n") * for i, w in enumerate(self.id2eword): */ - __pyx_t_11 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); __Pyx_INCREF(__pyx_v_w); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_w); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w); __Pyx_GIVEREF(__pyx_v_w); - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_10)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_10)); __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":368 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":368 * for i, w in enumerate(self.id2fword): * f.write("%d %s " % (i, w)) * f.write("\n") # <<<<<<<<<<<<<< * for i, w in enumerate(self.id2eword): * f.write("%d %s " % (i, w)) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":369 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":369 * f.write("%d %s " % (i, w)) * f.write("\n") * for i, w in enumerate(self.id2eword): # <<<<<<<<<<<<<< @@ -15380,28 +16679,36 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py * f.write("\n") */ __Pyx_INCREF(__pyx_int_0); - __pyx_t_9 = __pyx_int_0; - if (PyList_CheckExact(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword) || PyTuple_CheckExact(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword)) { - __pyx_t_2 = ((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + __pyx_t_2 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_self->id2eword) || PyTuple_CheckExact(__pyx_v_self->id2eword)) { + __pyx_t_1 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->id2eword); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_10); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_10); __pyx_t_7++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_10 = __pyx_t_8(__pyx_t_2); + __pyx_t_10 = __pyx_t_9(__pyx_t_1); if (unlikely(!__pyx_t_10)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } @@ -15410,76 +16717,76 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py __Pyx_XDECREF(__pyx_v_w); __pyx_v_w = __pyx_t_10; __pyx_t_10 = 0; - __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_9; - __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_v_i = __pyx_t_2; + __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); - __pyx_t_9 = __pyx_t_10; + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":370 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":370 * f.write("\n") * for i, w in enumerate(self.id2eword): * f.write("%d %s " % (i, w)) # <<<<<<<<<<<<<< * f.write("\n") * */ - __pyx_t_10 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); __Pyx_INCREF(__pyx_v_w); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_w); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w); __Pyx_GIVEREF(__pyx_v_w); - __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_11)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_11)); __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":371 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":371 * for i, w in enumerate(self.id2eword): * f.write("%d %s " % (i, w)) * f.write("\n") # <<<<<<<<<<<<<< * * */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":359 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":359 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -15488,75 +16795,75 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py */ /*except:*/ { __Pyx_AddTraceback("_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_9, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); + __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_15); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_16 = (!__pyx_t_14); if (__pyx_t_16) { + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_11); - __Pyx_ErrRestore(__pyx_t_2, __pyx_t_9, __pyx_t_11); - __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_11 = 0; - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L29; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_11); + __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_11 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L28; } - __pyx_L29:; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_L28:; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L10_exception_handled; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - __pyx_L16_try_end:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L14_try_end:; } } /*finally:*/ { if (__pyx_t_3) { - __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_55, NULL); + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_55, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L30; - __pyx_L5_error:; + goto __pyx_L29; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L1_error; - __pyx_L30:; + __pyx_L29:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -15564,7 +16871,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); @@ -15581,41 +16888,22 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6write_enhanced(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":374 - * - * - * def get_score(self, fword, eword, col): # <<<<<<<<<<<<<< - * cdef e_id, f_id, low, high, midpoint, val - * - */ - -static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fword = 0; PyObject *__pyx_v_eword = 0; PyObject *__pyx_v_col = 0; - PyObject *__pyx_v_e_id = 0; - PyObject *__pyx_v_f_id = 0; - PyObject *__pyx_v_low = 0; - PyObject *__pyx_v_high = 0; - PyObject *__pyx_v_midpoint = 0; - PyObject *__pyx_v_val = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fword,&__pyx_n_s__eword,&__pyx_n_s__col,0}; - __Pyx_RefNannySetupContext("get_score"); + __Pyx_RefNannySetupContext("get_score (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fword,&__pyx_n_s__eword,&__pyx_n_s__col,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -15623,26 +16911,23 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fword); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fword)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eword); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eword)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__col); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__col)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_score") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_score") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -15663,18 +16948,48 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_5BiLex_14get_score(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), __pyx_v_fword, __pyx_v_eword, __pyx_v_col); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":377 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":374 + * + * + * def get_score(self, fword, eword, col): # <<<<<<<<<<<<<< + * cdef e_id, f_id, low, high, midpoint, val + * + */ + +static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col) { + PyObject *__pyx_v_e_id = 0; + PyObject *__pyx_v_f_id = 0; + PyObject *__pyx_v_low = 0; + PyObject *__pyx_v_high = 0; + PyObject *__pyx_v_midpoint = 0; + PyObject *__pyx_v_val = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_score", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":377 * cdef e_id, f_id, low, high, midpoint, val * * if eword not in self.eword2id: # <<<<<<<<<<<<<< * return None * if fword not in self.fword2id: */ - __pyx_t_1 = (__Pyx_NegateNonNeg(PySequence_Contains(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id, __pyx_v_eword))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":378 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":378 * * if eword not in self.eword2id: * return None # <<<<<<<<<<<<<< @@ -15685,21 +17000,21 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":379 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":379 * if eword not in self.eword2id: * return None * if fword not in self.fword2id: # <<<<<<<<<<<<<< * return None * f_id = self.fword2id[fword] */ - __pyx_t_1 = (__Pyx_NegateNonNeg(PySequence_Contains(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id, __pyx_v_fword))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":380 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":380 * return None * if fword not in self.fword2id: * return None # <<<<<<<<<<<<<< @@ -15710,35 +17025,35 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":381 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":381 * if fword not in self.fword2id: * return None * f_id = self.fword2id[fword] # <<<<<<<<<<<<<< * e_id = self.eword2id[eword] * low = self.f_index.arr[f_id] */ - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->fword2id, __pyx_v_fword); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_f_id = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":382 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":382 * return None * f_id = self.fword2id[fword] * e_id = self.eword2id[eword] # <<<<<<<<<<<<<< * low = self.f_index.arr[f_id] * high = self.f_index.arr[f_id+1] */ - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->eword2id, __pyx_v_eword); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_e_id = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":383 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":383 * f_id = self.fword2id[fword] * e_id = self.eword2id[eword] * low = self.f_index.arr[f_id] # <<<<<<<<<<<<<< @@ -15746,12 +17061,12 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec * while high - low > 0: */ __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_low = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":384 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":384 * e_id = self.eword2id[eword] * low = self.f_index.arr[f_id] * high = self.f_index.arr[f_id+1] # <<<<<<<<<<<<<< @@ -15762,12 +17077,12 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_high = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":385 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":385 * low = self.f_index.arr[f_id] * high = self.f_index.arr[f_id+1] * while high - low > 0: # <<<<<<<<<<<<<< @@ -15777,14 +17092,13 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec while (1) { __pyx_t_2 = PyNumber_Subtract(__pyx_v_high, __pyx_v_low); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_1) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":386 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":386 * high = self.f_index.arr[f_id+1] * while high - low > 0: * midpoint = (low+high)/2 # <<<<<<<<<<<<<< @@ -15800,7 +17114,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec __pyx_v_midpoint = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":387 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":387 * while high - low > 0: * midpoint = (low+high)/2 * val = self.e_index.arr[midpoint] # <<<<<<<<<<<<<< @@ -15808,39 +17122,37 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec * if col == 0: */ __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_val); __pyx_v_val = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":388 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":388 * midpoint = (low+high)/2 * val = self.e_index.arr[midpoint] * if val == e_id: # <<<<<<<<<<<<<< * if col == 0: * return self.col1.arr[midpoint] */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 388; __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 = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":389 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":389 * val = self.e_index.arr[midpoint] * if val == e_id: * if col == 0: # <<<<<<<<<<<<<< * return self.col1.arr[midpoint] * if col == 1: */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_col, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_col, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":390 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":390 * if val == e_id: * if col == 0: * return self.col1.arr[midpoint] # <<<<<<<<<<<<<< @@ -15849,29 +17161,28 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyFloat_FromDouble((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __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_L11; + goto __pyx_L8; } - __pyx_L11:; + __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":391 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":391 * if col == 0: * return self.col1.arr[midpoint] * if col == 1: # <<<<<<<<<<<<<< * return self.col2.arr[midpoint] * if val > e_id: */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_col, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_col, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __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 = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":392 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":392 * return self.col1.arr[midpoint] * if col == 1: * return self.col2.arr[midpoint] # <<<<<<<<<<<<<< @@ -15880,32 +17191,31 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyFloat_FromDouble((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __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_L12; + goto __pyx_L9; } - __pyx_L12:; - goto __pyx_L10; + __pyx_L9:; + goto __pyx_L7; } - __pyx_L10:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":393 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":393 * if col == 1: * return self.col2.arr[midpoint] * if val > e_id: # <<<<<<<<<<<<<< * high = midpoint * if val < e_id: */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __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 = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":394 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":394 * return self.col2.arr[midpoint] * if val > e_id: * high = midpoint # <<<<<<<<<<<<<< @@ -15915,24 +17225,23 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec __Pyx_INCREF(__pyx_v_midpoint); __Pyx_DECREF(__pyx_v_high); __pyx_v_high = __pyx_v_midpoint; - goto __pyx_L13; + goto __pyx_L10; } - __pyx_L13:; + __pyx_L10:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":395 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":395 * if val > e_id: * high = midpoint * if val < e_id: # <<<<<<<<<<<<<< * low = midpoint + 1 * return None */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 395; __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 = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":396 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":396 * high = midpoint * if val < e_id: * low = midpoint + 1 # <<<<<<<<<<<<<< @@ -15944,12 +17253,12 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec __Pyx_DECREF(__pyx_v_low); __pyx_v_low = __pyx_t_2; __pyx_t_2 = 0; - goto __pyx_L14; + goto __pyx_L11; } - __pyx_L14:; + __pyx_L11:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":397 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":397 * if val < e_id: * low = midpoint + 1 * return None # <<<<<<<<<<<<<< @@ -15980,7 +17289,29 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":400 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static char __pyx_doc_3_sa_5BiLex_16write_text[] = "Note: does not guarantee writing the dictionary in the original order"; +static PyObject *__pyx_pw_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_text (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_5BiLex_16write_text(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":400 * * * def write_text(self, char* filename): # <<<<<<<<<<<<<< @@ -15988,10 +17319,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_7get_score(PyObject *__pyx_v_self, PyObjec * cdef i, N, e_id, f_id */ -static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static char __pyx_doc_3_sa_5BiLex_8write_text[] = "Note: does not guarantee writing the dictionary in the original order"; -static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_i = 0; PyObject *__pyx_v_N = 0; PyObject *__pyx_v_e_id = 0; @@ -16007,29 +17335,20 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObje PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - long __pyx_t_8; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; long __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; + long __pyx_t_10; + int __pyx_t_11; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; int __pyx_t_14; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_text"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_text", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":404 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":404 * cdef i, N, e_id, f_id * * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -16040,7 +17359,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObje __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); @@ -16052,39 +17371,40 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObje __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":405 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":405 * * with open(filename, "w") as f: * N = len(self.e_index) # <<<<<<<<<<<<<< * f_id = 0 * for i from 0 <= i < N: */ - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_7 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_N = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_4 = ((PyObject *)__pyx_v_self->e_index); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_N = __pyx_t_4; + __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":406 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":406 * with open(filename, "w") as f: * N = len(self.e_index) * f_id = 0 # <<<<<<<<<<<<<< @@ -16094,22 +17414,22 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObje __Pyx_INCREF(__pyx_int_0); __pyx_v_f_id = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":407 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":407 * N = len(self.e_index) * f_id = 0 * for i from 0 <= i < N: # <<<<<<<<<<<<<< * while self.f_index.arr[f_id+1] == i: * f_id = f_id + 1 */ - __pyx_t_8 = __Pyx_PyInt_AsLong(__pyx_v_N); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9++) { - __pyx_t_1 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_N); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10++) { + __pyx_t_4 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":408 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":408 * f_id = 0 * for i from 0 <= i < N: * while self.f_index.arr[f_id+1] == i: # <<<<<<<<<<<<<< @@ -16117,139 +17437,138 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObje * e_id = self.e_index.arr[i] */ while (1) { - __pyx_t_1 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->f_index->arr[__pyx_t_7])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_i, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_10) break; + if (!__pyx_t_11) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":409 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":409 * for i from 0 <= i < N: * while self.f_index.arr[f_id+1] == i: * f_id = f_id + 1 # <<<<<<<<<<<<<< * e_id = self.e_index.arr[i] * score1 = self.col1.arr[i] */ - __pyx_t_2 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_f_id); - __pyx_v_f_id = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_f_id = __pyx_t_1; + __pyx_t_1 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":410 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":410 * while self.f_index.arr[f_id+1] == i: * f_id = f_id + 1 * e_id = self.e_index.arr[i] # <<<<<<<<<<<<<< * score1 = self.col1.arr[i] * score2 = self.col2.arr[i] */ - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->e_index->arr[__pyx_t_7])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_e_id); - __pyx_v_e_id = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_e_id = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":411 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":411 * f_id = f_id + 1 * e_id = self.e_index.arr[i] * score1 = self.col1.arr[i] # <<<<<<<<<<<<<< * score2 = self.col2.arr[i] * f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2)) */ - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_2 = PyFloat_FromDouble((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col1->arr[__pyx_t_7])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_score1); - __pyx_v_score1 = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_score1 = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":412 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":412 * e_id = self.e_index.arr[i] * score1 = self.col1.arr[i] * score2 = self.col2.arr[i] # <<<<<<<<<<<<<< * f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2)) */ - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __pyx_t_2 = PyFloat_FromDouble((((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->col2->arr[__pyx_t_7])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_score2); - __pyx_v_score2 = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_score2 = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":413 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":413 * score1 = self.col1.arr[i] * score2 = self.col2.arr[i] * f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2)) # <<<<<<<<<<<<<< */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2fword, __pyx_v_f_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = PyObject_GetItem(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self)->id2eword, __pyx_v_e_id); if (!__pyx_t_11) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_4 = PyObject_GetItem(__pyx_v_self->id2fword, __pyx_v_f_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->id2eword, __pyx_v_e_id); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_score1); PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_v_score1); __Pyx_GIVEREF(__pyx_v_score1); __Pyx_INCREF(__pyx_v_score2); PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_v_score2); __Pyx_GIVEREF(__pyx_v_score2); - __pyx_t_1 = 0; - __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_56), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_56), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":407 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":407 * N = len(self.e_index) * f_id = 0 * for i from 0 <= i < N: # <<<<<<<<<<<<<< * while self.f_index.arr[f_id+1] == i: * f_id = f_id + 1 */ - __pyx_t_11 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_11; - __pyx_t_11 = 0; + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 0; } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":404 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":404 * cdef i, N, e_id, f_id * * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -16258,75 +17577,75 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObje */ /*except:*/ { __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_12, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __Pyx_INCREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); + __Pyx_INCREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_13); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __pyx_t_14 = (!__pyx_t_10); + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_14 = (!__pyx_t_11); if (__pyx_t_14) { - __Pyx_GIVEREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_2); - __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_2); - __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L23; + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_ErrRestore(__pyx_t_2, __pyx_t_12, __pyx_t_1); + __pyx_t_2 = 0; __pyx_t_12 = 0; __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; } - __pyx_L23:; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L10_exception_handled; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - __pyx_L16_try_end:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L14_try_end:; } } /*finally:*/ { if (__pyx_t_3) { - __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_57, NULL); + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_57, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L24; - __pyx_L5_error:; + goto __pyx_L23; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L1_error; - __pyx_L24:; + __pyx_L23:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -16334,7 +17653,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObje __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -16351,7 +17670,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8write_text(PyObject *__pyx_v_self, PyObje return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":21 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":21 * cdef int LOWER_MASK[32] * * cdef void _init_lower_mask(): # <<<<<<<<<<<<<< @@ -16365,9 +17684,9 @@ static void __pyx_f_3_sa__init_lower_mask(void) { __Pyx_RefNannyDeclarations int __pyx_t_1; unsigned int __pyx_t_2; - __Pyx_RefNannySetupContext("_init_lower_mask"); + __Pyx_RefNannySetupContext("_init_lower_mask", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":23 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":23 * cdef void _init_lower_mask(): * cdef unsigned i * cdef int mask = 0 # <<<<<<<<<<<<<< @@ -16376,7 +17695,7 @@ static void __pyx_f_3_sa__init_lower_mask(void) { */ __pyx_v_mask = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":24 * cdef unsigned i * cdef int mask = 0 * for i in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<< @@ -16387,7 +17706,7 @@ static void __pyx_f_3_sa__init_lower_mask(void) { for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":25 * cdef int mask = 0 * for i in range(MIN_BOTTOM_SIZE): * mask = (mask << 1) + 1 # <<<<<<<<<<<<<< @@ -16396,7 +17715,7 @@ static void __pyx_f_3_sa__init_lower_mask(void) { */ __pyx_v_mask = ((__pyx_v_mask << 1) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":26 * for i in range(MIN_BOTTOM_SIZE): * mask = (mask << 1) + 1 * LOWER_MASK[i] = mask # <<<<<<<<<<<<<< @@ -16409,7 +17728,7 @@ static void __pyx_f_3_sa__init_lower_mask(void) { __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":37 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":37 * * * cdef _BitSet* new_BitSet(): # <<<<<<<<<<<<<< @@ -16421,9 +17740,9 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { struct __pyx_t_3_sa__BitSet *__pyx_v_b; struct __pyx_t_3_sa__BitSet *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("new_BitSet"); + __Pyx_RefNannySetupContext("new_BitSet", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":40 * cdef _BitSet* b * * b = <_BitSet*> malloc(sizeof(_BitSet)) # <<<<<<<<<<<<<< @@ -16432,7 +17751,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b = ((struct __pyx_t_3_sa__BitSet *)malloc((sizeof(struct __pyx_t_3_sa__BitSet)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":41 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":41 * * b = <_BitSet*> malloc(sizeof(_BitSet)) * b.bitset = 0 # <<<<<<<<<<<<<< @@ -16441,7 +17760,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b->bitset = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":42 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":42 * b = <_BitSet*> malloc(sizeof(_BitSet)) * b.bitset = 0 * b.min_val = -1 # <<<<<<<<<<<<<< @@ -16450,7 +17769,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b->min_val = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":43 * b.bitset = 0 * b.min_val = -1 * b.max_val = -1 # <<<<<<<<<<<<<< @@ -16459,7 +17778,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b->max_val = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":44 * b.min_val = -1 * b.max_val = -1 * b.size = 0 # <<<<<<<<<<<<<< @@ -16468,7 +17787,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b->size = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":45 * b.max_val = -1 * b.size = 0 * return b # <<<<<<<<<<<<<< @@ -16484,7 +17803,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":48 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":48 * * * cdef int bitset_findsucc(_BitSet* b, int i): # <<<<<<<<<<<<<< @@ -16503,9 +17822,9 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("bitset_findsucc"); + __Pyx_RefNannySetupContext("bitset_findsucc", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":52 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":52 * cdef int low, high, mid * * if b.max_val == -1 or i >= b.max_val: # <<<<<<<<<<<<<< @@ -16521,7 +17840,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":53 * * if b.max_val == -1 or i >= b.max_val: * return -1 # <<<<<<<<<<<<<< @@ -16534,7 +17853,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":54 * if b.max_val == -1 or i >= b.max_val: * return -1 * if i < b.min_val: # <<<<<<<<<<<<<< @@ -16544,7 +17863,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_t_3 = (__pyx_v_i < __pyx_v_b->min_val); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":55 * return -1 * if i < b.min_val: * return b.min_val # <<<<<<<<<<<<<< @@ -16557,7 +17876,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":57 * return b.min_val * * bitset = b.bitset & ~LOWER_MASK[i] # <<<<<<<<<<<<<< @@ -16566,7 +17885,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_bitset = (__pyx_v_b->bitset & (~(__pyx_v_3_sa_LOWER_MASK[__pyx_v_i]))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":58 * * bitset = b.bitset & ~LOWER_MASK[i] * low = i+1 # <<<<<<<<<<<<<< @@ -16575,7 +17894,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_low = (__pyx_v_i + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":59 * bitset = b.bitset & ~LOWER_MASK[i] * low = i+1 * high = b.max_val+1 # <<<<<<<<<<<<<< @@ -16584,7 +17903,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_high = (__pyx_v_b->max_val + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":60 * low = i+1 * high = b.max_val+1 * while low < high-1: # <<<<<<<<<<<<<< @@ -16595,7 +17914,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_t_3 = (__pyx_v_low < (__pyx_v_high - 1)); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":61 * high = b.max_val+1 * while low < high-1: * mid = (high + low)/2 # <<<<<<<<<<<<<< @@ -16604,7 +17923,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_mid = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":62 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":62 * while low < high-1: * mid = (high + low)/2 * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) # <<<<<<<<<<<<<< @@ -16613,7 +17932,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_mask = (~((__pyx_v_3_sa_LOWER_MASK[(__pyx_v_high - 1)]) ^ (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_mid - 1)]))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":63 * mid = (high + low)/2 * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) * if bitset & mask == 0: # <<<<<<<<<<<<<< @@ -16623,7 +17942,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_t_3 = ((__pyx_v_bitset & __pyx_v_mask) == 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":64 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":64 * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) * if bitset & mask == 0: * low = mid # <<<<<<<<<<<<<< @@ -16635,7 +17954,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":66 * low = mid * else: * bitset = bitset & mask # <<<<<<<<<<<<<< @@ -16644,7 +17963,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_bitset = (__pyx_v_bitset & __pyx_v_mask); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":67 * else: * bitset = bitset & mask * high = mid # <<<<<<<<<<<<<< @@ -16656,7 +17975,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_L7:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":68 * bitset = bitset & mask * high = mid * return low # <<<<<<<<<<<<<< @@ -16672,7 +17991,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":71 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":71 * * * cdef int bitset_insert(_BitSet* b, int i): # <<<<<<<<<<<<<< @@ -16685,9 +18004,9 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("bitset_insert"); + __Pyx_RefNannySetupContext("bitset_insert", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":74 * cdef int val * * val = 1 << i # <<<<<<<<<<<<<< @@ -16696,7 +18015,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in */ __pyx_v_val = (1 << __pyx_v_i); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":75 * * val = 1 << i * if b.bitset & val == 0: # <<<<<<<<<<<<<< @@ -16706,7 +18025,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in __pyx_t_1 = ((__pyx_v_b->bitset & __pyx_v_val) == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":76 * val = 1 << i * if b.bitset & val == 0: * b.bitset = b.bitset | val # <<<<<<<<<<<<<< @@ -16715,7 +18034,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in */ __pyx_v_b->bitset = (__pyx_v_b->bitset | __pyx_v_val); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":77 * if b.bitset & val == 0: * b.bitset = b.bitset | val * if b.size == 0: # <<<<<<<<<<<<<< @@ -16725,7 +18044,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in __pyx_t_1 = (__pyx_v_b->size == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":78 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":78 * b.bitset = b.bitset | val * if b.size == 0: * b.min_val = i # <<<<<<<<<<<<<< @@ -16734,7 +18053,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in */ __pyx_v_b->min_val = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":79 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":79 * if b.size == 0: * b.min_val = i * b.max_val = i # <<<<<<<<<<<<<< @@ -16746,7 +18065,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":81 * b.max_val = i * else: * if i < b.min_val: # <<<<<<<<<<<<<< @@ -16756,7 +18075,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in __pyx_t_1 = (__pyx_v_i < __pyx_v_b->min_val); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":82 * else: * if i < b.min_val: * b.min_val = i # <<<<<<<<<<<<<< @@ -16768,7 +18087,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":83 * if i < b.min_val: * b.min_val = i * if i > b.max_val: # <<<<<<<<<<<<<< @@ -16778,7 +18097,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in __pyx_t_1 = (__pyx_v_i > __pyx_v_b->max_val); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":84 * b.min_val = i * if i > b.max_val: * b.max_val = i # <<<<<<<<<<<<<< @@ -16792,7 +18111,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":85 * if i > b.max_val: * b.max_val = i * b.size = b.size + 1 # <<<<<<<<<<<<<< @@ -16801,7 +18120,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in */ __pyx_v_b->size = (__pyx_v_b->size + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":86 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":86 * b.max_val = i * b.size = b.size + 1 * return 1 # <<<<<<<<<<<<<< @@ -16814,7 +18133,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":87 * b.size = b.size + 1 * return 1 * return 0 # <<<<<<<<<<<<<< @@ -16830,7 +18149,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":90 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":90 * * * cdef int bitset_contains(_BitSet* b, int i): # <<<<<<<<<<<<<< @@ -16843,9 +18162,9 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("bitset_contains"); + __Pyx_RefNannySetupContext("bitset_contains", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":93 * cdef int val * * val = 1 << i # <<<<<<<<<<<<<< @@ -16854,7 +18173,7 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_val = (1 << __pyx_v_i); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":94 * * val = 1 << i * if b.bitset & val == 0: # <<<<<<<<<<<<<< @@ -16864,7 +18183,7 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_t_1 = ((__pyx_v_b->bitset & __pyx_v_val) == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":95 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":95 * val = 1 << i * if b.bitset & val == 0: * return 0 # <<<<<<<<<<<<<< @@ -16877,7 +18196,7 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":97 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":97 * return 0 * else: * return 1 # <<<<<<<<<<<<<< @@ -16895,7 +18214,18 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":104 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_14BitSetIterator___next__(((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":104 * cdef int next_val * * def __next__(self): # <<<<<<<<<<<<<< @@ -16903,8 +18233,7 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, * */ -static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_BitSetIterator *__pyx_v_self) { int __pyx_v_ret_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -16913,19 +18242,19 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(PyObject *__pyx_v_self) int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__next__"); + __Pyx_RefNannySetupContext("__next__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":107 * cdef int ret_val * * if self.next_val == -1: # <<<<<<<<<<<<<< * raise StopIteration() * ret_val = self.next_val */ - __pyx_t_1 = (((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_v_self)->next_val == -1); + __pyx_t_1 = (__pyx_v_self->next_val == -1); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":108 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":108 * * if self.next_val == -1: * raise StopIteration() # <<<<<<<<<<<<<< @@ -16937,29 +18266,29 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(PyObject *__pyx_v_self) __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":109 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":109 * if self.next_val == -1: * raise StopIteration() * ret_val = self.next_val # <<<<<<<<<<<<<< * self.next_val = bitset_findsucc(self.b, ret_val) * return ret_val */ - __pyx_v_ret_val = ((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_v_self)->next_val; + __pyx_v_ret_val = __pyx_v_self->next_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":110 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":110 * raise StopIteration() * ret_val = self.next_val * self.next_val = bitset_findsucc(self.b, ret_val) # <<<<<<<<<<<<<< * return ret_val * */ - ((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_v_self)->next_val = __pyx_f_3_sa_bitset_findsucc(((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_v_self)->b, __pyx_v_ret_val); + __pyx_v_self->next_val = __pyx_f_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_v_ret_val); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":111 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":111 * ret_val = self.next_val * self.next_val = bitset_findsucc(self.b, ret_val) * return ret_val # <<<<<<<<<<<<<< @@ -16985,7 +18314,21 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":122 +/* Python wrapper */ +static int __pyx_pw_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_3_sa_6BitSet___cinit__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":122 * cdef _BitSet* b * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -16993,30 +18336,35 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(PyObject *__pyx_v_self) * */ -static int __pyx_pf_3_sa_6BitSet___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_6BitSet___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pf_3_sa_6BitSet___cinit__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":123 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":123 * * def __cinit__(self): * self.b = new_BitSet() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - ((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b = __pyx_f_3_sa_new_BitSet(); + __pyx_v_self->b = __pyx_f_3_sa_new_BitSet(); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":125 +/* Python wrapper */ +static void __pyx_pw_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_3_sa_6BitSet_2__dealloc__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":125 * self.b = new_BitSet() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -17024,24 +18372,34 @@ static int __pyx_pf_3_sa_6BitSet___cinit__(PyObject *__pyx_v_self, PyObject *__p * */ -static void __pyx_pf_3_sa_6BitSet_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_3_sa_6BitSet_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":126 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":126 * * def __dealloc__(self): * free(self.b) # <<<<<<<<<<<<<< * * def __iter__(self): */ - free(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b); + free(__pyx_v_self->b); __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":128 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6BitSet_4__iter__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":128 * free(self.b) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -17049,8 +18407,7 @@ static void __pyx_pf_3_sa_6BitSet_1__dealloc__(PyObject *__pyx_v_self) { * it = BitSetIterator() */ -static PyObject *__pyx_pf_3_sa_6BitSet_2__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_6BitSet_2__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6BitSet_4__iter__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { struct __pyx_obj_3_sa_BitSetIterator *__pyx_v_it = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -17058,9 +18415,9 @@ static PyObject *__pyx_pf_3_sa_6BitSet_2__iter__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__iter__"); + __Pyx_RefNannySetupContext("__iter__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":130 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":130 * def __iter__(self): * cdef BitSetIterator it * it = BitSetIterator() # <<<<<<<<<<<<<< @@ -17072,25 +18429,25 @@ static PyObject *__pyx_pf_3_sa_6BitSet_2__iter__(PyObject *__pyx_v_self) { __pyx_v_it = ((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":131 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":131 * cdef BitSetIterator it * it = BitSetIterator() * it.b = self.b # <<<<<<<<<<<<<< * it.next_val = self.b.min_val * return it */ - __pyx_v_it->b = ((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b; + __pyx_v_it->b = __pyx_v_self->b; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":132 * it = BitSetIterator() * it.b = self.b * it.next_val = self.b.min_val # <<<<<<<<<<<<<< * return it * */ - __pyx_v_it->next_val = ((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b->min_val; + __pyx_v_it->next_val = __pyx_v_self->b->min_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":133 * it.b = self.b * it.next_val = self.b.min_val * return it # <<<<<<<<<<<<<< @@ -17115,7 +18472,18 @@ static PyObject *__pyx_pf_3_sa_6BitSet_2__iter__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":135 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("insert (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6BitSet_6insert(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":135 * return it * * def insert(self, i): # <<<<<<<<<<<<<< @@ -17123,8 +18491,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_2__iter__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_6BitSet_3insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_6BitSet_3insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -17132,9 +18499,9 @@ static PyObject *__pyx_pf_3_sa_6BitSet_3insert(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("insert"); + __Pyx_RefNannySetupContext("insert", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":136 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":136 * * def insert(self, i): * return bitset_insert(self.b, i) # <<<<<<<<<<<<<< @@ -17143,7 +18510,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_3insert(PyObject *__pyx_v_self, PyObject */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_insert(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_insert(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -17161,7 +18528,18 @@ static PyObject *__pyx_pf_3_sa_6BitSet_3insert(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":138 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6BitSet_8findsucc(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":138 * return bitset_insert(self.b, i) * * def findsucc(self, i): # <<<<<<<<<<<<<< @@ -17169,8 +18547,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_3insert(PyObject *__pyx_v_self, PyObject * */ -static PyObject *__pyx_pf_3_sa_6BitSet_4findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_6BitSet_4findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -17178,9 +18555,9 @@ static PyObject *__pyx_pf_3_sa_6BitSet_4findsucc(PyObject *__pyx_v_self, PyObjec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("findsucc"); + __Pyx_RefNannySetupContext("findsucc", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":139 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":139 * * def findsucc(self, i): * return bitset_findsucc(self.b, i) # <<<<<<<<<<<<<< @@ -17189,7 +18566,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_4findsucc(PyObject *__pyx_v_self, PyObjec */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_findsucc(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -17207,7 +18584,18 @@ static PyObject *__pyx_pf_3_sa_6BitSet_4findsucc(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":141 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6BitSet_10__str__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":141 * return bitset_findsucc(self.b, i) * * def __str__(self): # <<<<<<<<<<<<<< @@ -17215,8 +18603,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_4findsucc(PyObject *__pyx_v_self, PyObjec * */ -static PyObject *__pyx_pf_3_sa_6BitSet_5__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_6BitSet_5__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -17225,9 +18612,9 @@ static PyObject *__pyx_pf_3_sa_6BitSet_5__str__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__"); + __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":142 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":142 * * def __str__(self): * return dec2bin(self.b.bitset)+" ("+str(self.b.size)+","+str(self.b.min_val)+","+str(self.b.max_val)+")" # <<<<<<<<<<<<<< @@ -17235,15 +18622,15 @@ static PyObject *__pyx_pf_3_sa_6BitSet_5__str__(PyObject *__pyx_v_self) { * def min(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_3_sa_dec2bin(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b->bitset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_3_sa_dec2bin(__pyx_v_self->b->bitset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17257,10 +18644,10 @@ static PyObject *__pyx_pf_3_sa_6BitSet_5__str__(PyObject *__pyx_v_self) { __pyx_t_1 = PyNumber_Add(__pyx_t_3, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b->min_val); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->b->min_val); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -17274,10 +18661,10 @@ static PyObject *__pyx_pf_3_sa_6BitSet_5__str__(PyObject *__pyx_v_self) { __pyx_t_3 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b->max_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->b->max_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; @@ -17309,7 +18696,18 @@ static PyObject *__pyx_pf_3_sa_6BitSet_5__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":144 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("min (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6BitSet_12min(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":144 * return dec2bin(self.b.bitset)+" ("+str(self.b.size)+","+str(self.b.min_val)+","+str(self.b.max_val)+")" * * def min(self): # <<<<<<<<<<<<<< @@ -17317,17 +18715,16 @@ static PyObject *__pyx_pf_3_sa_6BitSet_5__str__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_6BitSet_6min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_6BitSet_6min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_6BitSet_12min(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("min"); + __Pyx_RefNannySetupContext("min", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":145 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":145 * * def min(self): * return self.b.min_val # <<<<<<<<<<<<<< @@ -17335,7 +18732,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_6min(PyObject *__pyx_v_self, CYTHON_UNUSE * def max(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b->min_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->min_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -17353,7 +18750,18 @@ static PyObject *__pyx_pf_3_sa_6BitSet_6min(PyObject *__pyx_v_self, CYTHON_UNUSE return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":147 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("max (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6BitSet_14max(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":147 * return self.b.min_val * * def max(self): # <<<<<<<<<<<<<< @@ -17361,17 +18769,16 @@ static PyObject *__pyx_pf_3_sa_6BitSet_6min(PyObject *__pyx_v_self, CYTHON_UNUSE * */ -static PyObject *__pyx_pf_3_sa_6BitSet_7max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_6BitSet_7max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_6BitSet_14max(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("max"); + __Pyx_RefNannySetupContext("max", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":148 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":148 * * def max(self): * return self.b.max_val # <<<<<<<<<<<<<< @@ -17379,7 +18786,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_7max(PyObject *__pyx_v_self, CYTHON_UNUSE * def __len__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b->max_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->max_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -17397,7 +18804,18 @@ static PyObject *__pyx_pf_3_sa_6BitSet_7max(PyObject *__pyx_v_self, CYTHON_UNUSE return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":150 +/* Python wrapper */ +static Py_ssize_t __pyx_pw_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6BitSet_16__len__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":150 * return self.b.max_val * * def __len__(self): # <<<<<<<<<<<<<< @@ -17405,20 +18823,19 @@ static PyObject *__pyx_pf_3_sa_6BitSet_7max(PyObject *__pyx_v_self, CYTHON_UNUSE * */ -static Py_ssize_t __pyx_pf_3_sa_6BitSet_8__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_3_sa_6BitSet_8__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_6BitSet_16__len__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__"); + __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":151 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":151 * * def __len__(self): * return self.b.size # <<<<<<<<<<<<<< * * def __contains__(self, i): */ - __pyx_r = ((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b->size; + __pyx_r = __pyx_v_self->b->size; goto __pyx_L0; __pyx_r = 0; @@ -17427,7 +18844,18 @@ static Py_ssize_t __pyx_pf_3_sa_6BitSet_8__len__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":153 +/* Python wrapper */ +static int __pyx_pw_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static int __pyx_pw_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6BitSet_18__contains__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":153 * return self.b.size * * def __contains__(self, i): # <<<<<<<<<<<<<< @@ -17435,8 +18863,7 @@ static Py_ssize_t __pyx_pf_3_sa_6BitSet_8__len__(PyObject *__pyx_v_self) { * */ -static int __pyx_pf_3_sa_6BitSet_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static int __pyx_pf_3_sa_6BitSet_9__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -17445,9 +18872,9 @@ static int __pyx_pf_3_sa_6BitSet_9__contains__(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__contains__"); + __Pyx_RefNannySetupContext("__contains__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":154 * * def __contains__(self, i): * return bool(bitset_contains(self.b, i)) # <<<<<<<<<<<<<< @@ -17455,7 +18882,7 @@ static int __pyx_pf_3_sa_6BitSet_9__contains__(PyObject *__pyx_v_self, PyObject * */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_contains(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_contains(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -17473,7 +18900,7 @@ static int __pyx_pf_3_sa_6BitSet_9__contains__(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":157 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":157 * * * cdef str dec2bin(long i): # <<<<<<<<<<<<<< @@ -17483,7 +18910,7 @@ static int __pyx_pf_3_sa_6BitSet_9__contains__(PyObject *__pyx_v_self, PyObject static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { PyObject *__pyx_v_result = 0; - unsigned int __pyx_v_d; + CYTHON_UNUSED unsigned int __pyx_v_d; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -17493,9 +18920,9 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dec2bin"); + __Pyx_RefNannySetupContext("dec2bin", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":158 * * cdef str dec2bin(long i): * cdef str result = "" # <<<<<<<<<<<<<< @@ -17505,7 +18932,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { __Pyx_INCREF(((PyObject *)__pyx_kp_s_45)); __pyx_v_result = __pyx_kp_s_45; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":160 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":160 * cdef str result = "" * cdef unsigned d * for d in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<< @@ -17516,7 +18943,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_d = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":161 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":161 * cdef unsigned d * for d in range(MIN_BOTTOM_SIZE): * if i & LOWER_MASK[0] == 0: # <<<<<<<<<<<<<< @@ -17526,7 +18953,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { __pyx_t_3 = ((__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[0])) == 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":162 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":162 * for d in range(MIN_BOTTOM_SIZE): * if i & LOWER_MASK[0] == 0: * result = "0"+result # <<<<<<<<<<<<<< @@ -17542,7 +18969,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":164 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":164 * result = "0"+result * else: * result = "1"+result # <<<<<<<<<<<<<< @@ -17557,7 +18984,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":165 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":165 * else: * result = "1"+result * i = i >> 1 # <<<<<<<<<<<<<< @@ -17567,7 +18994,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { __pyx_v_i = (__pyx_v_i >> 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":166 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":166 * result = "1"+result * i = i >> 1 * return result # <<<<<<<<<<<<<< @@ -17592,7 +19019,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":177 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":177 * void** bottom * * cdef _VEB* new_VEB(int n): # <<<<<<<<<<<<<< @@ -17611,9 +19038,9 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("new_VEB"); + __Pyx_RefNannySetupContext("new_VEB", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":181 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":181 * cdef int num_bits, num_top_bits, i * * veb = <_VEB*> malloc(sizeof(_VEB)) # <<<<<<<<<<<<<< @@ -17622,7 +19049,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb = ((struct __pyx_t_3_sa__VEB *)malloc((sizeof(struct __pyx_t_3_sa__VEB)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":183 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":183 * veb = <_VEB*> malloc(sizeof(_VEB)) * * num_bits = int(ceil(log(n) / log(2))) # <<<<<<<<<<<<<< @@ -17637,7 +19064,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { } __pyx_v_num_bits = ((int)ceil((__pyx_t_1 / __pyx_t_2))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":184 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":184 * * num_bits = int(ceil(log(n) / log(2))) * veb.num_bottom_bits = num_bits/2 # <<<<<<<<<<<<<< @@ -17646,7 +19073,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->num_bottom_bits = __Pyx_div_long(__pyx_v_num_bits, 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":185 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":185 * num_bits = int(ceil(log(n) / log(2))) * veb.num_bottom_bits = num_bits/2 * if veb.num_bottom_bits < MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< @@ -17656,7 +19083,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { __pyx_t_3 = (__pyx_v_veb->num_bottom_bits < __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":186 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":186 * veb.num_bottom_bits = num_bits/2 * if veb.num_bottom_bits < MIN_BOTTOM_BITS: * veb.num_bottom_bits = MIN_BOTTOM_BITS # <<<<<<<<<<<<<< @@ -17668,7 +19095,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":187 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":187 * if veb.num_bottom_bits < MIN_BOTTOM_BITS: * veb.num_bottom_bits = MIN_BOTTOM_BITS * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 # <<<<<<<<<<<<<< @@ -17677,7 +19104,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->top_universe_size = ((__pyx_v_n >> __pyx_v_veb->num_bottom_bits) + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":189 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":189 * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 * * veb.bottom = <void**> malloc(veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<< @@ -17686,7 +19113,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->bottom = ((void **)malloc((__pyx_v_veb->top_universe_size * (sizeof(void *))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":190 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":190 * * veb.bottom = <void**> malloc(veb.top_universe_size * sizeof(void*)) * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<< @@ -17695,7 +19122,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ memset(__pyx_v_veb->bottom, 0, (__pyx_v_veb->top_universe_size * (sizeof(void *)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":192 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":192 * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) * * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< @@ -17705,7 +19132,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":193 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":193 * * if veb.top_universe_size > MIN_BOTTOM_SIZE: * veb.top = new_VEB(veb.top_universe_size) # <<<<<<<<<<<<<< @@ -17717,7 +19144,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":195 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":195 * veb.top = new_VEB(veb.top_universe_size) * else: * veb.top = new_BitSet() # <<<<<<<<<<<<<< @@ -17728,7 +19155,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":197 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":197 * veb.top = new_BitSet() * * veb.max_val = -1 # <<<<<<<<<<<<<< @@ -17737,7 +19164,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->max_val = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":198 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":198 * * veb.max_val = -1 * veb.min_val = -1 # <<<<<<<<<<<<<< @@ -17746,7 +19173,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->min_val = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":199 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":199 * veb.max_val = -1 * veb.min_val = -1 * veb.size = 0 # <<<<<<<<<<<<<< @@ -17755,7 +19182,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->size = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":200 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":200 * veb.min_val = -1 * veb.size = 0 * return veb # <<<<<<<<<<<<<< @@ -17775,7 +19202,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":203 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":203 * * * cdef int VEB_insert(_VEB* veb, int i): # <<<<<<<<<<<<<< @@ -17794,9 +19221,9 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("VEB_insert"); + __Pyx_RefNannySetupContext("VEB_insert", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":208 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":208 * cdef int a, b, tmp * * if veb.size == 0: # <<<<<<<<<<<<<< @@ -17806,7 +19233,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_1 = (__pyx_v_veb->size == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":209 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":209 * * if veb.size == 0: * veb.min_val = i # <<<<<<<<<<<<<< @@ -17815,7 +19242,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_veb->min_val = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":210 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":210 * if veb.size == 0: * veb.min_val = i * veb.max_val = i # <<<<<<<<<<<<<< @@ -17826,7 +19253,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":211 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":211 * veb.min_val = i * veb.max_val = i * elif i == veb.min_val or i == veb.max_val: # <<<<<<<<<<<<<< @@ -17842,7 +19269,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":212 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":212 * veb.max_val = i * elif i == veb.min_val or i == veb.max_val: * return 0 # <<<<<<<<<<<<<< @@ -17855,7 +19282,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":214 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":214 * return 0 * else: * if i < veb.min_val: # <<<<<<<<<<<<<< @@ -17865,7 +19292,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = (__pyx_v_i < __pyx_v_veb->min_val); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":215 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":215 * else: * if i < veb.min_val: * tmp = i # <<<<<<<<<<<<<< @@ -17874,7 +19301,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_tmp = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":216 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":216 * if i < veb.min_val: * tmp = i * i = veb.min_val # <<<<<<<<<<<<<< @@ -17883,7 +19310,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_i = __pyx_v_veb->min_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":217 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":217 * tmp = i * i = veb.min_val * veb.min_val = tmp # <<<<<<<<<<<<<< @@ -17895,7 +19322,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":218 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":218 * i = veb.min_val * veb.min_val = tmp * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< @@ -17904,7 +19331,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":219 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":219 * veb.min_val = tmp * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< @@ -17913,7 +19340,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":220 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":220 * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] * if veb.bottom[a] == NULL: # <<<<<<<<<<<<<< @@ -17923,7 +19350,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = ((__pyx_v_veb->bottom[__pyx_v_a]) == NULL); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":221 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":221 * b = i & LOWER_MASK[veb.num_bottom_bits-1] * if veb.bottom[a] == NULL: * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< @@ -17933,7 +19360,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":222 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":222 * if veb.bottom[a] == NULL: * if veb.top_universe_size > MIN_BOTTOM_SIZE: * subv = <_VEB*> veb.top # <<<<<<<<<<<<<< @@ -17942,7 +19369,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":223 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":223 * if veb.top_universe_size > MIN_BOTTOM_SIZE: * subv = <_VEB*> veb.top * VEB_insert(subv, a) # <<<<<<<<<<<<<< @@ -17954,7 +19381,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":225 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":225 * VEB_insert(subv, a) * else: * subb = <_BitSet*> veb.top # <<<<<<<<<<<<<< @@ -17963,7 +19390,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":226 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":226 * else: * subb = <_BitSet*> veb.top * bitset_insert(subb, a) # <<<<<<<<<<<<<< @@ -17974,7 +19401,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":227 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":227 * subb = <_BitSet*> veb.top * bitset_insert(subb, a) * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< @@ -17984,7 +19411,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":228 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":228 * bitset_insert(subb, a) * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits) # <<<<<<<<<<<<<< @@ -17996,7 +19423,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":230 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":230 * veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits) * else: * veb.bottom[a] = new_BitSet() # <<<<<<<<<<<<<< @@ -18010,7 +19437,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":231 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":231 * else: * veb.bottom[a] = new_BitSet() * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< @@ -18020,7 +19447,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":232 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":232 * veb.bottom[a] = new_BitSet() * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< @@ -18029,7 +19456,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":233 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":233 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] * if VEB_insert(subv, b) == 0: # <<<<<<<<<<<<<< @@ -18039,7 +19466,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = (__pyx_f_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_b) == 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":234 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":234 * subv = <_VEB*> veb.bottom[a] * if VEB_insert(subv, b) == 0: * return 0 # <<<<<<<<<<<<<< @@ -18055,7 +19482,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":236 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":236 * return 0 * else: * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< @@ -18064,7 +19491,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":237 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":237 * else: * subb = <_BitSet*> veb.bottom[a] * if bitset_insert(subb, b) == 0: # <<<<<<<<<<<<<< @@ -18074,7 +19501,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = (__pyx_f_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_b) == 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":238 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":238 * subb = <_BitSet*> veb.bottom[a] * if bitset_insert(subb, b) == 0: * return 0 # <<<<<<<<<<<<<< @@ -18089,7 +19516,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":240 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":240 * return 0 * * if i > veb.max_val: # <<<<<<<<<<<<<< @@ -18099,7 +19526,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = (__pyx_v_i > __pyx_v_veb->max_val); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":241 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":241 * * if i > veb.max_val: * veb.max_val = i # <<<<<<<<<<<<<< @@ -18113,7 +19540,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":242 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":242 * if i > veb.max_val: * veb.max_val = i * veb.size = veb.size + 1 # <<<<<<<<<<<<<< @@ -18122,7 +19549,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_veb->size = (__pyx_v_veb->size + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":243 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":243 * veb.max_val = i * veb.size = veb.size + 1 * return 1 # <<<<<<<<<<<<<< @@ -18138,7 +19565,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":246 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":246 * * * cdef del_VEB(_VEB* veb): # <<<<<<<<<<<<<< @@ -18155,9 +19582,9 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("del_VEB"); + __Pyx_RefNannySetupContext("del_VEB", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":249 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":249 * cdef int i * * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< @@ -18167,7 +19594,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":250 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":250 * * if veb.top_universe_size > MIN_BOTTOM_SIZE: * i = (<_VEB*> veb.top).min_val # <<<<<<<<<<<<<< @@ -18179,7 +19606,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":252 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":252 * i = (<_VEB*> veb.top).min_val * else: * i = (<_BitSet*> veb.top).min_val # <<<<<<<<<<<<<< @@ -18190,7 +19617,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":254 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":254 * i = (<_BitSet*> veb.top).min_val * * while i != -1: # <<<<<<<<<<<<<< @@ -18201,7 +19628,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { __pyx_t_1 = (__pyx_v_i != -1); if (!__pyx_t_1) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":255 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":255 * * while i != -1: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< @@ -18211,7 +19638,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { __pyx_t_1 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":256 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":256 * while i != -1: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * del_VEB(<_VEB*> veb.bottom[i]) # <<<<<<<<<<<<<< @@ -18225,7 +19652,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":258 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":258 * del_VEB(<_VEB*> veb.bottom[i]) * else: * free(<_BitSet*> veb.bottom[i]) # <<<<<<<<<<<<<< @@ -18236,7 +19663,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { } __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":260 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":260 * free(<_BitSet*> veb.bottom[i]) * * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< @@ -18246,7 +19673,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":261 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":261 * * if veb.top_universe_size > MIN_BOTTOM_SIZE: * i = VEB_findsucc(<_VEB*> veb.top, i) # <<<<<<<<<<<<<< @@ -18258,7 +19685,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":263 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":263 * i = VEB_findsucc(<_VEB*> veb.top, i) * else: * i = bitset_findsucc(<_BitSet*> veb.top, i) # <<<<<<<<<<<<<< @@ -18270,7 +19697,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { __pyx_L7:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":265 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":265 * i = bitset_findsucc(<_BitSet*> veb.top, i) * * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< @@ -18280,7 +19707,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { __pyx_t_1 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":266 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":266 * * if veb.top_universe_size > MIN_BOTTOM_SIZE: * del_VEB(<_VEB*> veb.top) # <<<<<<<<<<<<<< @@ -18294,7 +19721,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":268 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":268 * del_VEB(<_VEB*> veb.top) * else: * free(<_BitSet*> veb.top) # <<<<<<<<<<<<<< @@ -18305,7 +19732,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { } __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":269 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":269 * else: * free(<_BitSet*> veb.top) * free(veb.bottom) # <<<<<<<<<<<<<< @@ -18314,7 +19741,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { */ free(__pyx_v_veb->bottom); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":270 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":270 * free(<_BitSet*> veb.top) * free(veb.bottom) * free(veb) # <<<<<<<<<<<<<< @@ -18335,7 +19762,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":273 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":273 * * * cdef int VEB_findsucc(_VEB* veb, int i): # <<<<<<<<<<<<<< @@ -18356,9 +19783,9 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("VEB_findsucc"); + __Pyx_RefNannySetupContext("VEB_findsucc", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":278 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":278 * cdef int a, b, j, c, found * * if veb.max_val == -1 or i>=veb.max_val: # <<<<<<<<<<<<<< @@ -18374,7 +19801,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":279 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":279 * * if veb.max_val == -1 or i>=veb.max_val: * return -1 # <<<<<<<<<<<<<< @@ -18387,7 +19814,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":280 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":280 * if veb.max_val == -1 or i>=veb.max_val: * return -1 * if i < veb.min_val: # <<<<<<<<<<<<<< @@ -18397,7 +19824,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = (__pyx_v_i < __pyx_v_veb->min_val); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":281 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":281 * return -1 * if i < veb.min_val: * return veb.min_val # <<<<<<<<<<<<<< @@ -18410,7 +19837,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":283 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":283 * return veb.min_val * * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< @@ -18419,7 +19846,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":284 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":284 * * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< @@ -18428,7 +19855,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":285 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":285 * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] * found = 0 # <<<<<<<<<<<<<< @@ -18437,7 +19864,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_found = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":286 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":286 * b = i & LOWER_MASK[veb.num_bottom_bits-1] * found = 0 * if veb.bottom[a] != NULL: # <<<<<<<<<<<<<< @@ -18447,7 +19874,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = ((__pyx_v_veb->bottom[__pyx_v_a]) != NULL); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":287 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":287 * found = 0 * if veb.bottom[a] != NULL: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< @@ -18457,7 +19884,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":288 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":288 * if veb.bottom[a] != NULL: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< @@ -18466,7 +19893,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":289 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":289 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] * if subv.max_val > b: # <<<<<<<<<<<<<< @@ -18476,7 +19903,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = (__pyx_v_subv->max_val > __pyx_v_b); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":290 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":290 * subv = <_VEB*> veb.bottom[a] * if subv.max_val > b: * j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b) # <<<<<<<<<<<<<< @@ -18485,7 +19912,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_b)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":291 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":291 * if subv.max_val > b: * j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b) * found = 1 # <<<<<<<<<<<<<< @@ -18500,7 +19927,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":293 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":293 * found = 1 * else: * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< @@ -18509,7 +19936,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":294 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":294 * else: * subb = <_BitSet*> veb.bottom[a] * if subb.max_val > b: # <<<<<<<<<<<<<< @@ -18519,7 +19946,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = (__pyx_v_subb->max_val > __pyx_v_b); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":295 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":295 * subb = <_BitSet*> veb.bottom[a] * if subb.max_val > b: * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) # <<<<<<<<<<<<<< @@ -18528,7 +19955,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_b)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":296 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":296 * if subb.max_val > b: * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) * found = 1 # <<<<<<<<<<<<<< @@ -18545,7 +19972,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":297 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":297 * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) * found = 1 * if found==0: # <<<<<<<<<<<<<< @@ -18555,7 +19982,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = (__pyx_v_found == 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":298 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":298 * found = 1 * if found==0: * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< @@ -18565,7 +19992,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = (__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":299 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":299 * if found==0: * if veb.top_universe_size > MIN_BOTTOM_SIZE: * subv = <_VEB*> veb.top # <<<<<<<<<<<<<< @@ -18574,7 +20001,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":300 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":300 * if veb.top_universe_size > MIN_BOTTOM_SIZE: * subv = <_VEB*> veb.top * c = VEB_findsucc(subv, a) # <<<<<<<<<<<<<< @@ -18586,7 +20013,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":302 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":302 * c = VEB_findsucc(subv, a) * else: * subb = <_BitSet*> veb.top # <<<<<<<<<<<<<< @@ -18595,7 +20022,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":303 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":303 * else: * subb = <_BitSet*> veb.top * c = bitset_findsucc(subb, a) # <<<<<<<<<<<<<< @@ -18606,7 +20033,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L10:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":304 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":304 * subb = <_BitSet*> veb.top * c = bitset_findsucc(subb, a) * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< @@ -18616,7 +20043,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":305 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":305 * c = bitset_findsucc(subb, a) * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[c] # <<<<<<<<<<<<<< @@ -18625,7 +20052,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_c])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":306 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":306 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[c] * j = (c << veb.num_bottom_bits) + subv.min_val # <<<<<<<<<<<<<< @@ -18637,7 +20064,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":308 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":308 * j = (c << veb.num_bottom_bits) + subv.min_val * else: * subb = <_BitSet*> veb.bottom[c] # <<<<<<<<<<<<<< @@ -18646,7 +20073,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_c])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":309 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":309 * else: * subb = <_BitSet*> veb.bottom[c] * j = (c << veb.num_bottom_bits) + subb.min_val # <<<<<<<<<<<<<< @@ -18660,7 +20087,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L9:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":310 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":310 * subb = <_BitSet*> veb.bottom[c] * j = (c << veb.num_bottom_bits) + subb.min_val * return j # <<<<<<<<<<<<<< @@ -18676,7 +20103,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":313 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":313 * * * cdef int VEB_contains(_VEB* veb, int i): # <<<<<<<<<<<<<< @@ -18695,9 +20122,9 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - __Pyx_RefNannySetupContext("VEB_contains"); + __Pyx_RefNannySetupContext("VEB_contains", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":318 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":318 * cdef int a, b * * if veb.size == 0 or i < veb.min_val or i > veb.max_val: # <<<<<<<<<<<<<< @@ -18719,7 +20146,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":319 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":319 * * if veb.size == 0 or i < veb.min_val or i > veb.max_val: * return 0 # <<<<<<<<<<<<<< @@ -18732,7 +20159,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":321 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":321 * return 0 * * if veb.min_val == i: # <<<<<<<<<<<<<< @@ -18742,7 +20169,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_2 = (__pyx_v_veb->min_val == __pyx_v_i); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":322 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":322 * * if veb.min_val == i: * return 1 # <<<<<<<<<<<<<< @@ -18755,7 +20182,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":324 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":324 * return 1 * else: * if veb.size == 1: # <<<<<<<<<<<<<< @@ -18765,7 +20192,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_2 = (__pyx_v_veb->size == 1); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":325 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":325 * else: * if veb.size == 1: * return 0 # <<<<<<<<<<<<<< @@ -18780,7 +20207,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":327 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":327 * return 0 * * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< @@ -18789,7 +20216,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":328 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":328 * * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< @@ -18798,7 +20225,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":329 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":329 * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] * if veb.bottom[a] == NULL: # <<<<<<<<<<<<<< @@ -18808,7 +20235,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_2 = ((__pyx_v_veb->bottom[__pyx_v_a]) == NULL); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":330 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":330 * b = i & LOWER_MASK[veb.num_bottom_bits-1] * if veb.bottom[a] == NULL: * return 0 # <<<<<<<<<<<<<< @@ -18821,7 +20248,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":332 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":332 * return 0 * else: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< @@ -18831,7 +20258,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_2 = (__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":333 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":333 * else: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< @@ -18840,7 +20267,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":334 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":334 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] * return VEB_contains(subv, b) # <<<<<<<<<<<<<< @@ -18853,7 +20280,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":336 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":336 * return VEB_contains(subv, b) * else: * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< @@ -18862,7 +20289,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":337 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":337 * else: * subb = <_BitSet*> veb.bottom[a] * return bitset_contains(subb, b) # <<<<<<<<<<<<<< @@ -18882,7 +20309,18 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":344 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_11VEBIterator___next__(((struct __pyx_obj_3_sa_VEBIterator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":344 * cdef int next_val * * def __next__(self): # <<<<<<<<<<<<<< @@ -18890,8 +20328,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int * */ -static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBIterator *__pyx_v_self) { int __pyx_v_ret_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18900,19 +20337,19 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__next__"); + __Pyx_RefNannySetupContext("__next__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":347 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":347 * cdef int ret_val * * if self.next_val == -1: # <<<<<<<<<<<<<< * raise StopIteration() * ret_val = self.next_val */ - __pyx_t_1 = (((struct __pyx_obj_3_sa_VEBIterator *)__pyx_v_self)->next_val == -1); + __pyx_t_1 = (__pyx_v_self->next_val == -1); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":348 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":348 * * if self.next_val == -1: * raise StopIteration() # <<<<<<<<<<<<<< @@ -18924,29 +20361,29 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(PyObject *__pyx_v_self) { __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[6]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":349 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":349 * if self.next_val == -1: * raise StopIteration() * ret_val = self.next_val # <<<<<<<<<<<<<< * self.next_val = VEB_findsucc(self.v, ret_val) * return ret_val */ - __pyx_v_ret_val = ((struct __pyx_obj_3_sa_VEBIterator *)__pyx_v_self)->next_val; + __pyx_v_ret_val = __pyx_v_self->next_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":350 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":350 * raise StopIteration() * ret_val = self.next_val * self.next_val = VEB_findsucc(self.v, ret_val) # <<<<<<<<<<<<<< * return ret_val * */ - ((struct __pyx_obj_3_sa_VEBIterator *)__pyx_v_self)->next_val = __pyx_f_3_sa_VEB_findsucc(((struct __pyx_obj_3_sa_VEBIterator *)__pyx_v_self)->v, __pyx_v_ret_val); + __pyx_v_self->next_val = __pyx_f_3_sa_VEB_findsucc(__pyx_v_self->v, __pyx_v_ret_val); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":351 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":351 * ret_val = self.next_val * self.next_val = VEB_findsucc(self.v, ret_val) * return ret_val # <<<<<<<<<<<<<< @@ -18972,42 +20409,32 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":360 - * cdef int _first(self) - * - * def __cinit__(self, int size): # <<<<<<<<<<<<<< - * self.veb = new_VEB(size) - * - */ - -static int __pyx_pf_3_sa_3VEB___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_3VEB___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_size; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -19024,22 +20451,48 @@ static int __pyx_pf_3_sa_3VEB___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_3VEB___cinit__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), __pyx_v_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":361 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":360 + * cdef int _first(self) + * + * def __cinit__(self, int size): # <<<<<<<<<<<<<< + * self.veb = new_VEB(size) + * + */ + +static int __pyx_pf_3_sa_3VEB___cinit__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":361 * * def __cinit__(self, int size): * self.veb = new_VEB(size) # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - ((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)->veb = __pyx_f_3_sa_new_VEB(__pyx_v_size); + __pyx_v_self->veb = __pyx_f_3_sa_new_VEB(__pyx_v_size); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":363 +/* Python wrapper */ +static void __pyx_pw_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_3_sa_3VEB_2__dealloc__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":363 * self.veb = new_VEB(size) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -19047,23 +20500,22 @@ static int __pyx_pf_3_sa_3VEB___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ * */ -static void __pyx_pf_3_sa_3VEB_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_3_sa_3VEB_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_3_sa_3VEB_2__dealloc__(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":364 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":364 * * def __dealloc__(self): * del_VEB(self.veb) # <<<<<<<<<<<<<< * * def __iter__(self): */ - __pyx_t_1 = __pyx_f_3_sa_del_VEB(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)->veb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_3_sa_del_VEB(__pyx_v_self->veb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -19075,7 +20527,18 @@ static void __pyx_pf_3_sa_3VEB_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":366 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_3VEB_4__iter__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":366 * del_VEB(self.veb) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -19083,8 +20546,7 @@ static void __pyx_pf_3_sa_3VEB_1__dealloc__(PyObject *__pyx_v_self) { * it = VEBIterator() */ -static PyObject *__pyx_pf_3_sa_3VEB_2__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_3VEB_2__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_3VEB_4__iter__(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { struct __pyx_obj_3_sa_VEBIterator *__pyx_v_it = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -19092,9 +20554,9 @@ static PyObject *__pyx_pf_3_sa_3VEB_2__iter__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__iter__"); + __Pyx_RefNannySetupContext("__iter__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":368 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":368 * def __iter__(self): * cdef VEBIterator it * it = VEBIterator() # <<<<<<<<<<<<<< @@ -19106,25 +20568,25 @@ static PyObject *__pyx_pf_3_sa_3VEB_2__iter__(PyObject *__pyx_v_self) { __pyx_v_it = ((struct __pyx_obj_3_sa_VEBIterator *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":369 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":369 * cdef VEBIterator it * it = VEBIterator() * it.v = self.veb # <<<<<<<<<<<<<< * it.next_val = self.veb.min_val * return it */ - __pyx_v_it->v = ((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)->veb; + __pyx_v_it->v = __pyx_v_self->veb; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":370 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":370 * it = VEBIterator() * it.v = self.veb * it.next_val = self.veb.min_val # <<<<<<<<<<<<<< * return it * */ - __pyx_v_it->next_val = ((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)->veb->min_val; + __pyx_v_it->next_val = __pyx_v_self->veb->min_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":371 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":371 * it.v = self.veb * it.next_val = self.veb.min_val * return it # <<<<<<<<<<<<<< @@ -19149,7 +20611,18 @@ static PyObject *__pyx_pf_3_sa_3VEB_2__iter__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":373 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("insert (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_3VEB_6insert(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":373 * return it * * def insert(self, i): # <<<<<<<<<<<<<< @@ -19157,8 +20630,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_2__iter__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_3VEB_3insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_3VEB_3insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19166,9 +20638,9 @@ static PyObject *__pyx_pf_3_sa_3VEB_3insert(PyObject *__pyx_v_self, PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("insert"); + __Pyx_RefNannySetupContext("insert", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":374 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":374 * * def insert(self, i): * return VEB_insert(self.veb, i) # <<<<<<<<<<<<<< @@ -19177,7 +20649,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_3insert(PyObject *__pyx_v_self, PyObject *__ */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_VEB_insert(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -19195,7 +20667,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_3insert(PyObject *__pyx_v_self, PyObject *__ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":376 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":376 * return VEB_insert(self.veb, i) * * cdef int _insert(self, int i): # <<<<<<<<<<<<<< @@ -19206,9 +20678,9 @@ static PyObject *__pyx_pf_3_sa_3VEB_3insert(PyObject *__pyx_v_self, PyObject *__ static int __pyx_f_3_sa_3VEB__insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_insert"); + __Pyx_RefNannySetupContext("_insert", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":377 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":377 * * cdef int _insert(self, int i): * return VEB_insert(self.veb, i) # <<<<<<<<<<<<<< @@ -19224,7 +20696,18 @@ static int __pyx_f_3_sa_3VEB__insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, in return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":379 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_3VEB_8findsucc(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":379 * return VEB_insert(self.veb, i) * * def findsucc(self, i): # <<<<<<<<<<<<<< @@ -19232,8 +20715,7 @@ static int __pyx_f_3_sa_3VEB__insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, in * */ -static PyObject *__pyx_pf_3_sa_3VEB_4findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_3VEB_4findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19241,9 +20723,9 @@ static PyObject *__pyx_pf_3_sa_3VEB_4findsucc(PyObject *__pyx_v_self, PyObject * int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("findsucc"); + __Pyx_RefNannySetupContext("findsucc", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":380 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":380 * * def findsucc(self, i): * return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<< @@ -19252,7 +20734,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_4findsucc(PyObject *__pyx_v_self, PyObject * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_VEB_findsucc(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -19270,7 +20752,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_4findsucc(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":382 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":382 * return VEB_findsucc(self.veb, i) * * cdef int _first(self): # <<<<<<<<<<<<<< @@ -19281,9 +20763,9 @@ static PyObject *__pyx_pf_3_sa_3VEB_4findsucc(PyObject *__pyx_v_self, PyObject * static int __pyx_f_3_sa_3VEB__first(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_first"); + __Pyx_RefNannySetupContext("_first", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":383 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":383 * * cdef int _first(self): * return self.veb.min_val # <<<<<<<<<<<<<< @@ -19299,7 +20781,7 @@ static int __pyx_f_3_sa_3VEB__first(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":385 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":385 * return self.veb.min_val * * cdef int _findsucc(self, int i): # <<<<<<<<<<<<<< @@ -19310,9 +20792,9 @@ static int __pyx_f_3_sa_3VEB__first(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { static int __pyx_f_3_sa_3VEB__findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_findsucc"); + __Pyx_RefNannySetupContext("_findsucc", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":386 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":386 * * cdef int _findsucc(self, int i): * return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<< @@ -19328,7 +20810,18 @@ static int __pyx_f_3_sa_3VEB__findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":388 +/* Python wrapper */ +static Py_ssize_t __pyx_pw_3_sa_3VEB_11__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_3_sa_3VEB_11__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_3VEB_10__len__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":388 * return VEB_findsucc(self.veb, i) * * def __len__(self): # <<<<<<<<<<<<<< @@ -19336,20 +20829,19 @@ static int __pyx_f_3_sa_3VEB__findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, * */ -static Py_ssize_t __pyx_pf_3_sa_3VEB_5__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_3_sa_3VEB_5__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_3VEB_10__len__(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__"); + __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":389 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":389 * * def __len__(self): * return self.veb.size # <<<<<<<<<<<<<< * * def __contains__(self, i): */ - __pyx_r = ((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)->veb->size; + __pyx_r = __pyx_v_self->veb->size; goto __pyx_L0; __pyx_r = 0; @@ -19358,30 +20850,40 @@ static Py_ssize_t __pyx_pf_3_sa_3VEB_5__len__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":391 +/* Python wrapper */ +static int __pyx_pw_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static int __pyx_pw_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_3VEB_12__contains__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":391 * return self.veb.size * * def __contains__(self, i): # <<<<<<<<<<<<<< * return VEB_contains(self.veb, i) */ -static int __pyx_pf_3_sa_3VEB_6__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static int __pyx_pf_3_sa_3VEB_6__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static int __pyx_pf_3_sa_3VEB_12__contains__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__contains__"); + __Pyx_RefNannySetupContext("__contains__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":392 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":392 * * def __contains__(self, i): * return VEB_contains(self.veb, i) # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_f_3_sa_VEB_contains(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)->veb, __pyx_t_1); + __pyx_r = __pyx_f_3_sa_VEB_contains(__pyx_v_self->veb, __pyx_t_1); goto __pyx_L0; __pyx_r = 0; @@ -19394,55 +20896,32 @@ static int __pyx_pf_3_sa_3VEB_6__contains__(PyObject *__pyx_v_self, PyObject *__ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":9 - * cdef IntList lcp - * - * def __cinit__(self, SuffixArray sa): # <<<<<<<<<<<<<< - * cdef int i, k, j, h, n - * cdef IntList rank - */ - -static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sa = 0; - int __pyx_v_i; - int __pyx_v_k; - int __pyx_v_j; - int __pyx_v_h; - int __pyx_v_n; - struct __pyx_obj_3_sa_IntList *__pyx_v_rank = 0; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sa,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sa,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -19460,8 +20939,45 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sa), __pyx_ptype_3_sa_SuffixArray, 1, "sa", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_3LCP___cinit__(((struct __pyx_obj_3_sa_LCP *)__pyx_v_self), __pyx_v_sa); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":13 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":9 + * cdef IntList lcp + * + * def __cinit__(self, SuffixArray sa): # <<<<<<<<<<<<<< + * cdef int i, k, j, h, n + * cdef IntList rank + */ + +static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sa) { + int __pyx_v_i; + int __pyx_v_k; + int __pyx_v_j; + int __pyx_v_h; + int __pyx_v_n; + struct __pyx_obj_3_sa_IntList *__pyx_v_rank = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":13 * cdef IntList rank * * logger.info("Constructing LCP array") # <<<<<<<<<<<<<< @@ -19478,7 +20994,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":14 * * logger.info("Constructing LCP array") * self.sa = sa # <<<<<<<<<<<<<< @@ -19487,20 +21003,20 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ */ __Pyx_INCREF(((PyObject *)__pyx_v_sa)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sa)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->sa); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->sa)); - ((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->sa = __pyx_v_sa; + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = __pyx_v_sa; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":15 * logger.info("Constructing LCP array") * self.sa = sa * n = self.sa.sa.len # <<<<<<<<<<<<<< * self.lcp = IntList(initial_len=n) * */ - __pyx_v_n = ((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->sa->sa->len; + __pyx_v_n = __pyx_v_self->sa->sa->len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":16 * self.sa = sa * n = self.sa.sa.len * self.lcp = IntList(initial_len=n) # <<<<<<<<<<<<<< @@ -19513,16 +21029,16 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->lcp); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->lcp)); - ((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->lcp = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->lcp); + __Pyx_DECREF(((PyObject *)__pyx_v_self->lcp)); + __pyx_v_self->lcp = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":18 * self.lcp = IntList(initial_len=n) * * rank = IntList(initial_len=n) # <<<<<<<<<<<<<< @@ -19535,13 +21051,13 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":19 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":19 * * rank = IntList(initial_len=n) * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -19551,7 +21067,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __pyx_t_3 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":20 * rank = IntList(initial_len=n) * for i from 0 <= i < n: * rank.arr[sa.sa.arr[i]] = i # <<<<<<<<<<<<<< @@ -19561,7 +21077,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ (__pyx_v_rank->arr[(__pyx_v_sa->sa->arr[__pyx_v_i])]) = __pyx_v_i; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":22 * rank.arr[sa.sa.arr[i]] = i * * h = 0 # <<<<<<<<<<<<<< @@ -19570,7 +21086,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ */ __pyx_v_h = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":23 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":23 * * h = 0 * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -19580,7 +21096,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __pyx_t_3 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":24 * h = 0 * for i from 0 <= i < n: * k = rank.arr[i] # <<<<<<<<<<<<<< @@ -19589,7 +21105,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ */ __pyx_v_k = (__pyx_v_rank->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":25 * for i from 0 <= i < n: * k = rank.arr[i] * if k == 0: # <<<<<<<<<<<<<< @@ -19599,19 +21115,19 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __pyx_t_4 = (__pyx_v_k == 0); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":26 * k = rank.arr[i] * if k == 0: * self.lcp.arr[k] = -1 # <<<<<<<<<<<<<< * else: * j = sa.sa.arr[k-1] */ - (((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->lcp->arr[__pyx_v_k]) = -1; - goto __pyx_L10; + (__pyx_v_self->lcp->arr[__pyx_v_k]) = -1; + goto __pyx_L7; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":28 * self.lcp.arr[k] = -1 * else: * j = sa.sa.arr[k-1] # <<<<<<<<<<<<<< @@ -19620,7 +21136,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ */ __pyx_v_j = (__pyx_v_sa->sa->arr[(__pyx_v_k - 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":29 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":29 * else: * j = sa.sa.arr[k-1] * while i+h < n and j+h < n and sa.darray.data.arr[i+h] == sa.darray.data.arr[j+h]: # <<<<<<<<<<<<<< @@ -19643,7 +21159,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ } if (!__pyx_t_5) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":30 * j = sa.sa.arr[k-1] * while i+h < n and j+h < n and sa.darray.data.arr[i+h] == sa.darray.data.arr[j+h]: * h = h+1 # <<<<<<<<<<<<<< @@ -19653,18 +21169,18 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __pyx_v_h = (__pyx_v_h + 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":31 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":31 * while i+h < n and j+h < n and sa.darray.data.arr[i+h] == sa.darray.data.arr[j+h]: * h = h+1 * self.lcp.arr[k] = h # <<<<<<<<<<<<<< * if h > 0: * h = h-1 */ - (((struct __pyx_obj_3_sa_LCP *)__pyx_v_self)->lcp->arr[__pyx_v_k]) = __pyx_v_h; + (__pyx_v_self->lcp->arr[__pyx_v_k]) = __pyx_v_h; } - __pyx_L10:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":32 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":32 * h = h+1 * self.lcp.arr[k] = h * if h > 0: # <<<<<<<<<<<<<< @@ -19674,7 +21190,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __pyx_t_5 = (__pyx_v_h > 0); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":33 * self.lcp.arr[k] = h * if h > 0: * h = h-1 # <<<<<<<<<<<<<< @@ -19682,12 +21198,12 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ * */ __pyx_v_h = (__pyx_v_h - 1); - goto __pyx_L13; + goto __pyx_L10; } - __pyx_L13:; + __pyx_L10:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":34 * if h > 0: * h = h-1 * logger.info("LCP array completed") # <<<<<<<<<<<<<< @@ -19716,9 +21232,31 @@ static int __pyx_pf_3_sa_3LCP___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n); /*proto*/ +static char __pyx_doc_3_sa_3LCP_2compute_stats[] = "Note: the output of this function is not exact. In\n particular, the frequency associated with each word is \n not guaranteed to be correct. This is due to a bit of\n laxness in the design; the function is intended only to\n obtain a list of the most frequent words; for this \n purpose it is perfectly fine"; +static PyObject *__pyx_pw_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n) { + int __pyx_v_max_n; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("compute_stats (wrapper)", 0); + assert(__pyx_arg_max_n); { + __pyx_v_max_n = __Pyx_PyInt_AsInt(__pyx_arg_max_n); if (unlikely((__pyx_v_max_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_3LCP_2compute_stats(((struct __pyx_obj_3_sa_LCP *)__pyx_v_self), ((int)__pyx_v_max_n)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":36 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":36 * logger.info("LCP array completed") * * def compute_stats(self, int max_n): # <<<<<<<<<<<<<< @@ -19726,51 +21264,46 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop * particular, the frequency associated with each word is */ -static PyObject *__pyx_pf_3_sa_3LCP_1compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n); /*proto*/ -static char __pyx_doc_3_sa_3LCP_1compute_stats[] = "Note: the output of this function is not exact. In\n particular, the frequency associated with each word is \n not guaranteed to be correct. This is due to a bit of\n laxness in the design; the function is intended only to\n obtain a list of the most frequent words; for this \n purpose it is perfectly fine"; -static PyObject *__pyx_pf_3_sa_3LCP_1compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n) { +static PyObject *__pyx_pf_3_sa_3LCP_2compute_stats(struct __pyx_obj_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n) { struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("compute_stats"); + __Pyx_RefNannySetupContext("compute_stats", 0); __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_ptype_3_sa___pyx_scope_struct_3_compute_stats->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_3_compute_stats, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __Pyx_INCREF(__pyx_v_self); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - assert(__pyx_arg_max_n); { - __pyx_cur_scope->__pyx_v_max_n = __Pyx_PyInt_AsInt(__pyx_arg_max_n); if (unlikely((__pyx_cur_scope->__pyx_v_max_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_XDECREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __pyx_cur_scope->__pyx_v_self = 0; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_3LCP_2generator1; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + __pyx_cur_scope->__pyx_v_max_n = __pyx_v_max_n; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_3LCP_4generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; @@ -19783,8 +21316,8 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop long __pyx_t_9; PyObject *__pyx_t_10 = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L26_resume_from_yield; default: /* CPython raises the right error here */ @@ -19794,16 +21327,16 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":48 * cdef VEB veb * * N = self.sa.sa.len # <<<<<<<<<<<<<< * * ngram_starts = [] */ - __pyx_cur_scope->__pyx_v_N = ((struct __pyx_obj_3_sa_LCP *)__pyx_cur_scope->__pyx_v_self)->sa->sa->len; + __pyx_cur_scope->__pyx_v_N = __pyx_cur_scope->__pyx_v_self->sa->sa->len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":50 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":50 * N = self.sa.sa.len * * ngram_starts = [] # <<<<<<<<<<<<<< @@ -19811,12 +21344,12 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop * ngram_starts.append(IntList(initial_len=N)) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_cur_scope->__pyx_v_ngram_starts = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":51 * * ngram_starts = [] * for n from 0 <= n < max_n: # <<<<<<<<<<<<<< @@ -19826,30 +21359,27 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_2 = __pyx_cur_scope->__pyx_v_max_n; for (__pyx_cur_scope->__pyx_v_n = 0; __pyx_cur_scope->__pyx_v_n < __pyx_t_2; __pyx_cur_scope->__pyx_v_n++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":52 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":52 * ngram_starts = [] * for n from 0 <= n < max_n: * ngram_starts.append(IntList(initial_len=N)) # <<<<<<<<<<<<<< * * run_start = IntList(initial_len=max_n) */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_4 = PyList_Append(__pyx_cur_scope->__pyx_v_ngram_starts, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":54 * ngram_starts.append(IntList(initial_len=N)) * * run_start = IntList(initial_len=max_n) # <<<<<<<<<<<<<< @@ -19862,14 +21392,14 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_run_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":55 * * run_start = IntList(initial_len=max_n) * veb = VEB(N) # <<<<<<<<<<<<<< @@ -19879,7 +21409,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __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[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -19890,7 +21420,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_cur_scope->__pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":57 * veb = VEB(N) * * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -19900,16 +21430,16 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_2 = __pyx_cur_scope->__pyx_v_N; for (__pyx_cur_scope->__pyx_v_i = 0; __pyx_cur_scope->__pyx_v_i < __pyx_t_2; __pyx_cur_scope->__pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":58 * * for i from 0 <= i < N: * h = self.lcp.arr[i] # <<<<<<<<<<<<<< * if h < 0: * h = 0 */ - __pyx_cur_scope->__pyx_v_h = (((struct __pyx_obj_3_sa_LCP *)__pyx_cur_scope->__pyx_v_self)->lcp->arr[__pyx_cur_scope->__pyx_v_i]); + __pyx_cur_scope->__pyx_v_h = (__pyx_cur_scope->__pyx_v_self->lcp->arr[__pyx_cur_scope->__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":59 * for i from 0 <= i < N: * h = self.lcp.arr[i] * if h < 0: # <<<<<<<<<<<<<< @@ -19919,7 +21449,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_5 = (__pyx_cur_scope->__pyx_v_h < 0); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":60 * h = self.lcp.arr[i] * if h < 0: * h = 0 # <<<<<<<<<<<<<< @@ -19931,7 +21461,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop } __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":61 * if h < 0: * h = 0 * for n from h <= n < max_n: # <<<<<<<<<<<<<< @@ -19941,7 +21471,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_6 = __pyx_cur_scope->__pyx_v_max_n; for (__pyx_cur_scope->__pyx_v_n = __pyx_cur_scope->__pyx_v_h; __pyx_cur_scope->__pyx_v_n < __pyx_t_6; __pyx_cur_scope->__pyx_v_n++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":62 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":62 * h = 0 * for n from h <= n < max_n: * rs = run_start.arr[n] # <<<<<<<<<<<<<< @@ -19950,7 +21480,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":63 * for n from h <= n < max_n: * rs = run_start.arr[n] * run_start.arr[n] = i # <<<<<<<<<<<<<< @@ -19959,7 +21489,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]) = __pyx_cur_scope->__pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":64 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":64 * rs = run_start.arr[n] * run_start.arr[n] = i * freq = i - rs # <<<<<<<<<<<<<< @@ -19968,7 +21498,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ __pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_rs); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":65 * run_start.arr[n] = i * freq = i - rs * if freq > 1000: # arbitrary, but see note below # <<<<<<<<<<<<<< @@ -19978,7 +21508,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_5 = (__pyx_cur_scope->__pyx_v_freq > 1000); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":66 * freq = i - rs * if freq > 1000: # arbitrary, but see note below * veb._insert(freq) # <<<<<<<<<<<<<< @@ -19987,7 +21517,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ ((struct __pyx_vtabstruct_3_sa_VEB *)__pyx_cur_scope->__pyx_v_veb->__pyx_vtab)->_insert(__pyx_cur_scope->__pyx_v_veb, __pyx_cur_scope->__pyx_v_freq); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":67 * if freq > 1000: # arbitrary, but see note below * veb._insert(freq) * ngram_start = ngram_starts[n] # <<<<<<<<<<<<<< @@ -20003,7 +21533,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":68 * veb._insert(freq) * ngram_start = ngram_starts[n] * while ngram_start.arr[freq] > 0: # <<<<<<<<<<<<<< @@ -20014,7 +21544,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_freq]) > 0); if (!__pyx_t_5) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":69 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":69 * ngram_start = ngram_starts[n] * while ngram_start.arr[freq] > 0: * freq = freq + 1 # cheating a bit, should be ok for sparse histogram # <<<<<<<<<<<<<< @@ -20024,7 +21554,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_freq + 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":70 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":70 * while ngram_start.arr[freq] > 0: * freq = freq + 1 # cheating a bit, should be ok for sparse histogram * ngram_start.arr[freq] = rs # <<<<<<<<<<<<<< @@ -20038,7 +21568,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop } } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":71 * freq = freq + 1 # cheating a bit, should be ok for sparse histogram * ngram_start.arr[freq] = rs * i = veb.veb.min_val # <<<<<<<<<<<<<< @@ -20047,7 +21577,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ __pyx_cur_scope->__pyx_v_i = __pyx_cur_scope->__pyx_v_veb->veb->min_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":72 * ngram_start.arr[freq] = rs * i = veb.veb.min_val * while i != -1: # <<<<<<<<<<<<<< @@ -20058,7 +21588,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_5 = (__pyx_cur_scope->__pyx_v_i != -1); if (!__pyx_t_5) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":73 * i = veb.veb.min_val * while i != -1: * ii = veb._findsucc(i) # <<<<<<<<<<<<<< @@ -20067,7 +21597,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ __pyx_cur_scope->__pyx_v_ii = ((struct __pyx_vtabstruct_3_sa_VEB *)__pyx_cur_scope->__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_cur_scope->__pyx_v_veb, __pyx_cur_scope->__pyx_v_i); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":74 * while i != -1: * ii = veb._findsucc(i) * for n from 0 <= n < max_n: # <<<<<<<<<<<<<< @@ -20077,7 +21607,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_2 = __pyx_cur_scope->__pyx_v_max_n; for (__pyx_cur_scope->__pyx_v_n = 0; __pyx_cur_scope->__pyx_v_n < __pyx_t_2; __pyx_cur_scope->__pyx_v_n++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":75 * ii = veb._findsucc(i) * for n from 0 <= n < max_n: * ngram_start = ngram_starts[n] # <<<<<<<<<<<<<< @@ -20093,7 +21623,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":76 * for n from 0 <= n < max_n: * ngram_start = ngram_starts[n] * iii = i # <<<<<<<<<<<<<< @@ -20102,7 +21632,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ __pyx_cur_scope->__pyx_v_iii = __pyx_cur_scope->__pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":77 * ngram_start = ngram_starts[n] * iii = i * rs = ngram_start.arr[iii] # <<<<<<<<<<<<<< @@ -20111,7 +21641,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_iii]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":78 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":78 * iii = i * rs = ngram_start.arr[iii] * while (ii==-1 or iii < ii) and rs != 0: # <<<<<<<<<<<<<< @@ -20134,16 +21664,16 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop } if (!__pyx_t_7) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":79 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":79 * rs = ngram_start.arr[iii] * while (ii==-1 or iii < ii) and rs != 0: * j = self.sa.sa.arr[rs] # <<<<<<<<<<<<<< * valid = 1 * for k from 0 <= k < n+1: */ - __pyx_cur_scope->__pyx_v_j = (((struct __pyx_obj_3_sa_LCP *)__pyx_cur_scope->__pyx_v_self)->sa->sa->arr[__pyx_cur_scope->__pyx_v_rs]); + __pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_self->sa->sa->arr[__pyx_cur_scope->__pyx_v_rs]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":80 * while (ii==-1 or iii < ii) and rs != 0: * j = self.sa.sa.arr[rs] * valid = 1 # <<<<<<<<<<<<<< @@ -20152,7 +21682,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ __pyx_cur_scope->__pyx_v_valid = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":81 * j = self.sa.sa.arr[rs] * valid = 1 * for k from 0 <= k < n+1: # <<<<<<<<<<<<<< @@ -20162,17 +21692,17 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_9 = (__pyx_cur_scope->__pyx_v_n + 1); for (__pyx_cur_scope->__pyx_v_k = 0; __pyx_cur_scope->__pyx_v_k < __pyx_t_9; __pyx_cur_scope->__pyx_v_k++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":82 * valid = 1 * for k from 0 <= k < n+1: * if self.sa.darray.data.arr[j+k] < 2: # <<<<<<<<<<<<<< * valid = 0 * if valid: */ - __pyx_t_7 = ((((struct __pyx_obj_3_sa_LCP *)__pyx_cur_scope->__pyx_v_self)->sa->darray->data->arr[(__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_k)]) < 2); + __pyx_t_7 = ((__pyx_cur_scope->__pyx_v_self->sa->darray->data->arr[(__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_k)]) < 2); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":83 * for k from 0 <= k < n+1: * if self.sa.darray.data.arr[j+k] < 2: * valid = 0 # <<<<<<<<<<<<<< @@ -20185,7 +21715,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_L22:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":84 * if self.sa.darray.data.arr[j+k] < 2: * valid = 0 * if valid: # <<<<<<<<<<<<<< @@ -20194,7 +21724,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ if (__pyx_cur_scope->__pyx_v_valid) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":85 * valid = 0 * if valid: * ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)]) # <<<<<<<<<<<<<< @@ -20202,13 +21732,13 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop * iii = iii + 1 */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = (__pyx_cur_scope->__pyx_v_n + 1); for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_9; __pyx_t_6+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_6; - __pyx_t_3 = PyInt_FromLong((((struct __pyx_obj_3_sa_LCP *)__pyx_cur_scope->__pyx_v_self)->sa->darray->data->arr[(__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_k)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->sa->darray->data->arr[(__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_k)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_3 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -20220,7 +21750,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_cur_scope->__pyx_v_ngram = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":86 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":86 * if valid: * ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)]) * yield i, n+1, ngram # <<<<<<<<<<<<<< @@ -20232,7 +21762,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __pyx_t_1 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_n + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); @@ -20248,7 +21778,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L26_resume_from_yield:; __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; @@ -20257,7 +21787,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop } __pyx_L23:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":87 * ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)]) * yield i, n+1, ngram * iii = iii + 1 # <<<<<<<<<<<<<< @@ -20266,7 +21796,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop */ __pyx_cur_scope->__pyx_v_iii = (__pyx_cur_scope->__pyx_v_iii + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":88 * yield i, n+1, ngram * iii = iii + 1 * rs = ngram_start.arr[iii] # <<<<<<<<<<<<<< @@ -20276,14 +21806,14 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop } } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":89 * iii = iii + 1 * rs = ngram_start.arr[iii] * i = ii # <<<<<<<<<<<<<< */ __pyx_cur_scope->__pyx_v_i = __pyx_cur_scope->__pyx_v_ii; } - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -20292,12 +21822,27 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop __Pyx_AddTraceback("compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":12 +/* Python wrapper */ +static int __pyx_pw_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_3_sa_8Alphabet___cinit__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":12 * cdef dict id2sym * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -20305,20 +21850,16 @@ static PyObject *__pyx_gb_3_sa_3LCP_2generator1(struct __pyx_obj_3_sa___pyx_scop * self.nonterminals = StringMap() */ -static int __pyx_pf_3_sa_8Alphabet___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_8Alphabet___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":13 * * def __cinit__(self): * self.terminals = StringMap() # <<<<<<<<<<<<<< @@ -20328,12 +21869,12 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(PyObject *__pyx_v_self, PyObject *_ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->terminals); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->terminals)); - ((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->terminals = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->terminals); + __Pyx_DECREF(((PyObject *)__pyx_v_self->terminals)); + __pyx_v_self->terminals = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":14 * def __cinit__(self): * self.terminals = StringMap() * self.nonterminals = StringMap() # <<<<<<<<<<<<<< @@ -20343,12 +21884,12 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(PyObject *__pyx_v_self, PyObject *_ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->nonterminals); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->nonterminals)); - ((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->nonterminals = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->nonterminals); + __Pyx_DECREF(((PyObject *)__pyx_v_self->nonterminals)); + __pyx_v_self->nonterminals = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":15 * self.terminals = StringMap() * self.nonterminals = StringMap() * self.id2sym = {} # <<<<<<<<<<<<<< @@ -20358,19 +21899,19 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(PyObject *__pyx_v_self, PyObject *_ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->id2sym); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->id2sym)); - ((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->id2sym = __pyx_t_1; + __Pyx_GOTREF(__pyx_v_self->id2sym); + __Pyx_DECREF(((PyObject *)__pyx_v_self->id2sym)); + __pyx_v_self->id2sym = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":16 * self.nonterminals = StringMap() * self.id2sym = {} * self.first_nonterminal = -1 # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - ((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->first_nonterminal = -1; + __pyx_v_self->first_nonterminal = -1; __pyx_r = 0; goto __pyx_L0; @@ -20383,7 +21924,16 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(PyObject *__pyx_v_self, PyObject *_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":18 +/* Python wrapper */ +static void __pyx_pw_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_3_sa_8Alphabet_2__dealloc__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":18 * self.first_nonterminal = -1 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -20391,15 +21941,14 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(PyObject *__pyx_v_self, PyObject *_ * */ -static void __pyx_pf_3_sa_8Alphabet_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_3_sa_8Alphabet_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":21 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":21 * pass * * cdef int isvar(self, int sym): # <<<<<<<<<<<<<< @@ -20407,12 +21956,12 @@ static void __pyx_pf_3_sa_8Alphabet_1__dealloc__(PyObject *__pyx_v_self) { * */ -static int __pyx_f_3_sa_8Alphabet_isvar(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static int __pyx_f_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isvar"); + __Pyx_RefNannySetupContext("isvar", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":22 * * cdef int isvar(self, int sym): * return sym < 0 # <<<<<<<<<<<<<< @@ -20428,7 +21977,7 @@ static int __pyx_f_3_sa_8Alphabet_isvar(struct __pyx_obj_3_sa_Alphabet *__pyx_v_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":24 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":24 * return sym < 0 * * cdef int isword(self, int sym): # <<<<<<<<<<<<<< @@ -20436,12 +21985,12 @@ static int __pyx_f_3_sa_8Alphabet_isvar(struct __pyx_obj_3_sa_Alphabet *__pyx_v_ * */ -static int __pyx_f_3_sa_8Alphabet_isword(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static int __pyx_f_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isword"); + __Pyx_RefNannySetupContext("isword", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":25 * * cdef int isword(self, int sym): * return sym >= 0 # <<<<<<<<<<<<<< @@ -20457,7 +22006,7 @@ static int __pyx_f_3_sa_8Alphabet_isword(struct __pyx_obj_3_sa_Alphabet *__pyx_v return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":27 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":27 * return sym >= 0 * * cdef int getindex(self, int sym): # <<<<<<<<<<<<<< @@ -20465,12 +22014,12 @@ static int __pyx_f_3_sa_8Alphabet_isword(struct __pyx_obj_3_sa_Alphabet *__pyx_v * */ -static int __pyx_f_3_sa_8Alphabet_getindex(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static int __pyx_f_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getindex"); + __Pyx_RefNannySetupContext("getindex", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":28 * * cdef int getindex(self, int sym): * return -sym & INDEX_MASK # <<<<<<<<<<<<<< @@ -20486,7 +22035,7 @@ static int __pyx_f_3_sa_8Alphabet_getindex(struct __pyx_obj_3_sa_Alphabet *__pyx return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":30 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":30 * return -sym & INDEX_MASK * * cdef int setindex(self, int sym, int ind): # <<<<<<<<<<<<<< @@ -20494,12 +22043,12 @@ static int __pyx_f_3_sa_8Alphabet_getindex(struct __pyx_obj_3_sa_Alphabet *__pyx * */ -static int __pyx_f_3_sa_8Alphabet_setindex(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym, int __pyx_v_ind) { +static int __pyx_f_3_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym, int __pyx_v_ind) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("setindex"); + __Pyx_RefNannySetupContext("setindex", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":31 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":31 * * cdef int setindex(self, int sym, int ind): * return -(-sym & ~INDEX_MASK | ind) # <<<<<<<<<<<<<< @@ -20515,7 +22064,7 @@ static int __pyx_f_3_sa_8Alphabet_setindex(struct __pyx_obj_3_sa_Alphabet *__pyx return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":33 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":33 * return -(-sym & ~INDEX_MASK | ind) * * cdef int clearindex(self, int sym): # <<<<<<<<<<<<<< @@ -20523,12 +22072,12 @@ static int __pyx_f_3_sa_8Alphabet_setindex(struct __pyx_obj_3_sa_Alphabet *__pyx * */ -static int __pyx_f_3_sa_8Alphabet_clearindex(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +static int __pyx_f_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clearindex"); + __Pyx_RefNannySetupContext("clearindex", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":34 * * cdef int clearindex(self, int sym): * return -(-sym& ~INDEX_MASK) # <<<<<<<<<<<<<< @@ -20544,7 +22093,7 @@ static int __pyx_f_3_sa_8Alphabet_clearindex(struct __pyx_obj_3_sa_Alphabet *__p return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":36 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":36 * return -(-sym& ~INDEX_MASK) * * cdef int match(self, int sym1, int sym2): # <<<<<<<<<<<<<< @@ -20555,9 +22104,9 @@ static int __pyx_f_3_sa_8Alphabet_clearindex(struct __pyx_obj_3_sa_Alphabet *__p static int __pyx_f_3_sa_8Alphabet_match(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym1, int __pyx_v_sym2) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("match"); + __Pyx_RefNannySetupContext("match", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":37 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":37 * * cdef int match(self, int sym1, int sym2): * return self.clearindex(sym1) == self.clearindex(sym2); # <<<<<<<<<<<<<< @@ -20573,7 +22122,7 @@ static int __pyx_f_3_sa_8Alphabet_match(struct __pyx_obj_3_sa_Alphabet *__pyx_v_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":39 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":39 * return self.clearindex(sym1) == self.clearindex(sym2); * * cdef char* tocat(self, int sym): # <<<<<<<<<<<<<< @@ -20584,9 +22133,9 @@ static int __pyx_f_3_sa_8Alphabet_match(struct __pyx_obj_3_sa_Alphabet *__pyx_v_ static char *__pyx_f_3_sa_8Alphabet_tocat(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { char *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("tocat"); + __Pyx_RefNannySetupContext("tocat", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":40 * * cdef char* tocat(self, int sym): * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) # <<<<<<<<<<<<<< @@ -20602,7 +22151,7 @@ static char *__pyx_f_3_sa_8Alphabet_tocat(struct __pyx_obj_3_sa_Alphabet *__pyx_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":42 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":42 * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) * * cdef int fromcat(self, char *s): # <<<<<<<<<<<<<< @@ -20615,9 +22164,9 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("fromcat"); + __Pyx_RefNannySetupContext("fromcat", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":44 * cdef int fromcat(self, char *s): * cdef int i * i = self.nonterminals.index(s) # <<<<<<<<<<<<<< @@ -20626,7 +22175,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ */ __pyx_v_i = ((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_self->nonterminals->__pyx_vtab)->index(__pyx_v_self->nonterminals, __pyx_v_s); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":45 * cdef int i * i = self.nonterminals.index(s) * if self.first_nonterminal == -1: # <<<<<<<<<<<<<< @@ -20636,7 +22185,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ __pyx_t_1 = (__pyx_v_self->first_nonterminal == -1); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":46 * i = self.nonterminals.index(s) * if self.first_nonterminal == -1: * self.first_nonterminal = i # <<<<<<<<<<<<<< @@ -20648,7 +22197,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":47 * if self.first_nonterminal == -1: * self.first_nonterminal = i * if i > self.last_nonterminal: # <<<<<<<<<<<<<< @@ -20658,7 +22207,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ __pyx_t_1 = (__pyx_v_i > __pyx_v_self->last_nonterminal); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":48 * self.first_nonterminal = i * if i > self.last_nonterminal: * self.last_nonterminal = i # <<<<<<<<<<<<<< @@ -20670,7 +22219,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":49 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":49 * if i > self.last_nonterminal: * self.last_nonterminal = i * return -(i+1 << INDEX_SHIFT) # <<<<<<<<<<<<<< @@ -20686,7 +22235,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":51 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":51 * return -(i+1 << INDEX_SHIFT) * * cdef char* tostring(self, int sym): # <<<<<<<<<<<<<< @@ -20707,9 +22256,9 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("tostring"); + __Pyx_RefNannySetupContext("tostring", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":53 * cdef char* tostring(self, int sym): * cdef int ind * if self.isvar(sym): # <<<<<<<<<<<<<< @@ -20719,7 +22268,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->isvar(__pyx_v_self, __pyx_v_sym); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":54 * cdef int ind * if self.isvar(sym): * if sym in self.id2sym: # <<<<<<<<<<<<<< @@ -20729,19 +22278,24 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_2 = PyInt_FromLong(__pyx_v_sym); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_3 = ((PyDict_Contains(((PyObject *)__pyx_v_self->id2sym), __pyx_t_2))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__Pyx_PyDict_Contains(__pyx_t_2, ((PyObject *)__pyx_v_self->id2sym), Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":55 * if self.isvar(sym): * if sym in self.id2sym: * return self.id2sym[sym] # <<<<<<<<<<<<<< * ind = self.getindex(sym) * if ind > 0: */ + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyBytes_AsString(__pyx_t_2); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -20752,7 +22306,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":56 * if sym in self.id2sym: * return self.id2sym[sym] * ind = self.getindex(sym) # <<<<<<<<<<<<<< @@ -20761,7 +22315,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_ind = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->getindex(__pyx_v_self, __pyx_v_sym); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":57 * return self.id2sym[sym] * ind = self.getindex(sym) * if ind > 0: # <<<<<<<<<<<<<< @@ -20771,7 +22325,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_3 = (__pyx_v_ind > 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":58 * ind = self.getindex(sym) * if ind > 0: * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) # <<<<<<<<<<<<<< @@ -20783,7 +22337,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_5 = PyInt_FromLong(__pyx_v_ind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); @@ -20793,13 +22347,17 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_64), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, ((PyObject *)__pyx_t_5), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; goto __pyx_L5; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":60 * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) * else: * self.id2sym[sym] = "[%s]" % self.tocat(sym) # <<<<<<<<<<<<<< @@ -20811,18 +22369,26 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_65), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, ((PyObject *)__pyx_t_6), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":61 * else: * self.id2sym[sym] = "[%s]" % self.tocat(sym) * return self.id2sym[sym] # <<<<<<<<<<<<<< * else: * return self.terminals.word(sym) */ + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, sizeof(int), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = PyBytes_AsString(__pyx_t_6); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -20833,7 +22399,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":63 * return self.id2sym[sym] * else: * return self.terminals.word(sym) # <<<<<<<<<<<<<< @@ -20858,7 +22424,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":65 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":65 * return self.terminals.word(sym) * * cdef int fromstring(self, char *s, bint terminal): # <<<<<<<<<<<<<< @@ -20884,9 +22450,9 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fromstring"); + __Pyx_RefNannySetupContext("fromstring", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":69 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":69 * cdef char *comma * cdef int n * n = strlen(s) # <<<<<<<<<<<<<< @@ -20895,7 +22461,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_n = strlen(__pyx_v_s); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":71 * n = strlen(s) * cdef char *sep * sep = strstr(s,"_SEP_") # <<<<<<<<<<<<<< @@ -20904,7 +22470,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_sep = strstr(__pyx_v_s, __pyx_k___SEP_); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":72 * cdef char *sep * sep = strstr(s,"_SEP_") * if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL: # <<<<<<<<<<<<<< @@ -20932,7 +22498,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p } if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":73 * sep = strstr(s,"_SEP_") * if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL: * if terminal: # <<<<<<<<<<<<<< @@ -20941,7 +22507,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ if (__pyx_v_terminal) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":74 * if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL: * if terminal: * s1 = "\\"+s # <<<<<<<<<<<<<< @@ -20956,7 +22522,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_v_s1 = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":75 * if terminal: * s1 = "\\"+s * return self.terminals.index(s1) # <<<<<<<<<<<<<< @@ -20970,7 +22536,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":76 * s1 = "\\"+s * return self.terminals.index(s1) * s[n-1] = c'\0' # <<<<<<<<<<<<<< @@ -20979,7 +22545,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ (__pyx_v_s[(__pyx_v_n - 1)]) = '\x00'; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":77 * return self.terminals.index(s1) * s[n-1] = c'\0' * s = s + 1 # <<<<<<<<<<<<<< @@ -20988,7 +22554,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_s = (__pyx_v_s + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":78 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":78 * s[n-1] = c'\0' * s = s + 1 * comma = strrchr(s, c',') # <<<<<<<<<<<<<< @@ -20997,7 +22563,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_comma = strrchr(__pyx_v_s, ','); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":79 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":79 * s = s + 1 * comma = strrchr(s, c',') * if comma != NULL: # <<<<<<<<<<<<<< @@ -21007,7 +22573,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_2 = (__pyx_v_comma != NULL); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":80 * comma = strrchr(s, c',') * if comma != NULL: * comma[0] = c'\0' # <<<<<<<<<<<<<< @@ -21016,7 +22582,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ (__pyx_v_comma[0]) = '\x00'; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":81 * if comma != NULL: * comma[0] = c'\0' * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) # <<<<<<<<<<<<<< @@ -21029,7 +22595,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":83 * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) * else: * return self.fromcat(s) # <<<<<<<<<<<<<< @@ -21044,7 +22610,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":85 * return self.fromcat(s) * else: * return self.terminals.index(s) # <<<<<<<<<<<<<< @@ -21069,7 +22635,18 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":8 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_8Alphabet_9terminals___get__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":8 * * cdef class Alphabet: * cdef readonly StringMap terminals, nonterminals # <<<<<<<<<<<<<< @@ -21077,14 +22654,13 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p * cdef dict id2sym */ -static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->terminals)); - __pyx_r = ((PyObject *)((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->terminals); + __Pyx_INCREF(((PyObject *)__pyx_v_self->terminals)); + __pyx_r = ((PyObject *)__pyx_v_self->terminals); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -21094,14 +22670,24 @@ static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(PyObject *__pyx_v_se return __pyx_r; } -static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(PyObject *__pyx_v_self) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_8Alphabet_12nonterminals___get__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->nonterminals)); - __pyx_r = ((PyObject *)((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)->nonterminals); + __Pyx_INCREF(((PyObject *)__pyx_v_self->nonterminals)); + __pyx_r = ((PyObject *)__pyx_v_self->nonterminals); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -21111,7 +22697,7 @@ static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(PyObject *__pyx_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":89 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":89 * cdef Alphabet ALPHABET = Alphabet() * * cdef char* sym_tostring(int sym): # <<<<<<<<<<<<<< @@ -21122,9 +22708,9 @@ static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(PyObject *__pyx_ static char *__pyx_f_3_sa_sym_tostring(int __pyx_v_sym) { char *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_tostring"); + __Pyx_RefNannySetupContext("sym_tostring", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":90 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":90 * * cdef char* sym_tostring(int sym): * return ALPHABET.tostring(sym) # <<<<<<<<<<<<<< @@ -21140,7 +22726,7 @@ static char *__pyx_f_3_sa_sym_tostring(int __pyx_v_sym) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":92 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":92 * return ALPHABET.tostring(sym) * * cdef char* sym_tocat(int sym): # <<<<<<<<<<<<<< @@ -21151,9 +22737,9 @@ static char *__pyx_f_3_sa_sym_tostring(int __pyx_v_sym) { static char *__pyx_f_3_sa_sym_tocat(int __pyx_v_sym) { char *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_tocat"); + __Pyx_RefNannySetupContext("sym_tocat", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":93 * * cdef char* sym_tocat(int sym): * return ALPHABET.tocat(sym) # <<<<<<<<<<<<<< @@ -21169,7 +22755,7 @@ static char *__pyx_f_3_sa_sym_tocat(int __pyx_v_sym) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":95 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":95 * return ALPHABET.tocat(sym) * * cdef int sym_isvar(int sym): # <<<<<<<<<<<<<< @@ -21180,9 +22766,9 @@ static char *__pyx_f_3_sa_sym_tocat(int __pyx_v_sym) { static int __pyx_f_3_sa_sym_isvar(int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_isvar"); + __Pyx_RefNannySetupContext("sym_isvar", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":96 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":96 * * cdef int sym_isvar(int sym): * return ALPHABET.isvar(sym) # <<<<<<<<<<<<<< @@ -21198,7 +22784,7 @@ static int __pyx_f_3_sa_sym_isvar(int __pyx_v_sym) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":98 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":98 * return ALPHABET.isvar(sym) * * cdef int sym_getindex(int sym): # <<<<<<<<<<<<<< @@ -21209,9 +22795,9 @@ static int __pyx_f_3_sa_sym_isvar(int __pyx_v_sym) { static int __pyx_f_3_sa_sym_getindex(int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_getindex"); + __Pyx_RefNannySetupContext("sym_getindex", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":99 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":99 * * cdef int sym_getindex(int sym): * return ALPHABET.getindex(sym) # <<<<<<<<<<<<<< @@ -21227,7 +22813,7 @@ static int __pyx_f_3_sa_sym_getindex(int __pyx_v_sym) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":101 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":101 * return ALPHABET.getindex(sym) * * cdef int sym_setindex(int sym, int id): # <<<<<<<<<<<<<< @@ -21238,14 +22824,14 @@ static int __pyx_f_3_sa_sym_getindex(int __pyx_v_sym) { static int __pyx_f_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_setindex"); + __Pyx_RefNannySetupContext("sym_setindex", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":102 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":102 * * cdef int sym_setindex(int sym, int id): * return ALPHABET.setindex(sym, id) # <<<<<<<<<<<<<< * - * def sym_fromstring(char* string, bint terminal): + * cdef int sym_fromstring(char* string, bint terminal): */ __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->setindex(__pyx_v_3_sa_ALPHABET, __pyx_v_sym, __pyx_v_id); goto __pyx_L0; @@ -21256,79 +22842,845 @@ static int __pyx_f_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":104 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":104 * return ALPHABET.setindex(sym, id) * - * def sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<< + * cdef int sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<< * return ALPHABET.fromstring(string, terminal) + * */ -static PyObject *__pyx_pf_3_sa_1sym_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_1sym_fromstring = {__Pyx_NAMESTR("sym_fromstring"), (PyCFunction)__pyx_pf_3_sa_1sym_fromstring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_3_sa_1sym_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_string; - int __pyx_v_terminal; +static int __pyx_f_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx_v_terminal) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sym_fromstring", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":105 + * + * cdef int sym_fromstring(char* string, bint terminal): + * return ALPHABET.fromstring(string, terminal) # <<<<<<<<<<<<<< + * + * def make_lattice(words): + */ + __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->fromstring(__pyx_v_3_sa_ALPHABET, __pyx_v_string, __pyx_v_terminal); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_3make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_3make_lattice = {__Pyx_NAMESTR("make_lattice"), (PyCFunction)__pyx_pw_3_sa_3make_lattice, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_3make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_lattice (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_2make_lattice(__pyx_self, ((PyObject *)__pyx_v_words)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":108 + * + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * return tuple(((word, None, 1), ) for word in word_ids) + * + */ + +static PyObject *__pyx_pf_3_sa_12make_lattice_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_5_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *) __pyx_self; + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_12make_lattice_2generator7, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.make_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) { __Pyx_RaiseClosureNameError("words"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_words; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_5 = PyBytes_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} +static PyObject *__pyx_gb_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":109 + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) # <<<<<<<<<<<<<< + * + * def decode_lattice(lattice): + */ + +static PyObject *__pyx_pf_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__string,&__pyx_n_s__terminal,0}; - __Pyx_RefNannySetupContext("sym_fromstring"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_6_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *) __pyx_self; + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_12make_lattice_5generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.make_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids)) { __Pyx_RaiseClosureNameError("word_ids"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; } - kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__terminal); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sym_fromstring", 1, 2, 2, 1); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_word); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_word); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":107 + * return ALPHABET.fromstring(string, terminal) + * + * def make_lattice(words): # <<<<<<<<<<<<<< + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) + */ + +static PyObject *__pyx_pf_3_sa_2make_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { + struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_lattice", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)__pyx_ptype_3_sa___pyx_scope_struct_4_make_lattice->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_4_make_lattice, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_words = __pyx_v_words; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_words); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":108 + * + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * return tuple(((word, None, 1), ) for word in word_ids) + * + */ + __pyx_t_1 = __pyx_pf_3_sa_12make_lattice_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_word_ids = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":109 + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) # <<<<<<<<<<<<<< + * + * def decode_lattice(lattice): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_pf_3_sa_12make_lattice_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __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[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_sa.make_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_5decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_5decode_lattice = {__Pyx_NAMESTR("decode_lattice"), (PyCFunction)__pyx_pw_3_sa_5decode_lattice, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_5decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode_lattice (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_4decode_lattice(__pyx_self, ((PyObject *)__pyx_v_lattice)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":112 + * + * def decode_lattice(lattice): + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< + * for arc in node for node in lattice) + * + */ + +static PyObject *__pyx_pf_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_8_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_8_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *) __pyx_self; + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_14decode_lattice_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.decode_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + Py_ssize_t __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L12_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":113 + * def decode_lattice(lattice): + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc + * for arc in node for node in lattice) # <<<<<<<<<<<<<< + * + * def decode_sentence(lattice): + */ + if (unlikely(!__pyx_cur_scope->__pyx_v_arc)) { __Pyx_RaiseUnboundLocalError("arc"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_arc) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_arc)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_v_arc; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_arc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":112 + * + * def decode_lattice(lattice): + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< + * for arc in node for node in lattice) + * + */ + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + break; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sym_fromstring") < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + __pyx_t_7 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_sym = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_weight); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_weight); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_weight = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_dist); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_dist); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_cur_scope->__pyx_v_dist = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":113 + * def decode_lattice(lattice): + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc + * for arc in node for node in lattice) # <<<<<<<<<<<<<< + * + * def decode_sentence(lattice): + */ + if (unlikely(!__pyx_cur_scope->__pyx_v_node)) { __Pyx_RaiseUnboundLocalError("node"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_node) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_node)) { + __pyx_t_4 = __pyx_cur_scope->__pyx_v_node; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0; + __pyx_t_11 = NULL; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext; } - __pyx_v_string = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_string) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_terminal = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + for (;;) { + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_7 = __pyx_t_11(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_arc); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_arc); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_cur_scope->__pyx_v_arc = __pyx_t_7; + __pyx_t_7 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) { __Pyx_RaiseClosureNameError("lattice"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) { + __pyx_t_7 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice; __Pyx_INCREF(__pyx_t_7); __pyx_t_12 = 0; + __pyx_t_13 = NULL; + } else { + __pyx_t_12 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_13 = Py_TYPE(__pyx_t_7)->tp_iternext; + } + for (;;) { + if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_7)) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_6); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_7)) { + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_6); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_6 = __pyx_t_13(__pyx_t_7); + if (unlikely(!__pyx_t_6)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_node = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":112 + * + * def decode_lattice(lattice): + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< + * for arc in node for node in lattice) + * + */ + __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_14)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_weight); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_weight); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_weight); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dist); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_cur_scope->__pyx_v_dist); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_dist); + __pyx_t_6 = 0; + __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_t_3 = __pyx_t_4; + __Pyx_XGIVEREF(__pyx_t_7); + __pyx_cur_scope->__pyx_t_4 = __pyx_t_7; + __pyx_cur_scope->__pyx_t_5 = __pyx_t_10; + __pyx_cur_scope->__pyx_t_6 = __pyx_t_11; + __pyx_cur_scope->__pyx_t_7 = __pyx_t_12; + __pyx_cur_scope->__pyx_t_8 = __pyx_t_13; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L12_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_4 = __pyx_cur_scope->__pyx_t_3; + __pyx_cur_scope->__pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_t_4); + __pyx_t_7 = __pyx_cur_scope->__pyx_t_4; + __pyx_cur_scope->__pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_t_7); + __pyx_t_10 = __pyx_cur_scope->__pyx_t_5; + __pyx_t_11 = __pyx_cur_scope->__pyx_t_6; + __pyx_t_12 = __pyx_cur_scope->__pyx_t_7; + __pyx_t_13 = __pyx_cur_scope->__pyx_t_8; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sym_fromstring", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.sym_fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; - __pyx_L4_argument_unpacking_done:; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":105 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":111 + * return tuple(((word, None, 1), ) for word in word_ids) + * + * def decode_lattice(lattice): # <<<<<<<<<<<<<< + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc + * for arc in node for node in lattice) + */ + +static PyObject *__pyx_pf_3_sa_4decode_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_lattice", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)__pyx_ptype_3_sa___pyx_scope_struct_7_decode_lattice->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_7_decode_lattice, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_lattice = __pyx_v_lattice; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":112 + * + * def decode_lattice(lattice): + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< + * for arc in node for node in lattice) * - * def sym_fromstring(char* string, bint terminal): - * return ALPHABET.fromstring(string, terminal) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->fromstring(__pyx_v_3_sa_ALPHABET, __pyx_v_string, __pyx_v_terminal)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_3_sa_14decode_lattice_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __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[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; @@ -21337,58 +23689,374 @@ static PyObject *__pyx_pf_3_sa_1sym_fromstring(PyObject *__pyx_self, PyObject *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.sym_fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_sa.decode_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":6 - * cdef class Phrase: +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_7decode_sentence = {__Pyx_NAMESTR("decode_sentence"), (PyCFunction)__pyx_pw_3_sa_7decode_sentence, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_7decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode_sentence (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6decode_sentence(__pyx_self, ((PyObject *)__pyx_v_lattice)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":116 * - * def __cinit__(self, words): # <<<<<<<<<<<<<< - * cdef int i, j, n, n_vars - * n_vars = 0 + * def decode_sentence(lattice): + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< */ -static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_words = 0; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_n; - int __pyx_v_n_vars; - int __pyx_r; +static PyObject *__pyx_pf_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__words,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_10_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_10_genexpr, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *) __pyx_self; + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_15decode_sentence_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.decode_sentence.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L10_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) { __Pyx_RaiseClosureNameError("lattice"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 1)) { + if (size > 1) __Pyx_RaiseTooManyValuesError(1); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + } + __Pyx_INCREF(__pyx_t_5); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_6 = PyList_GET_ITEM(sequence, 0); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_9 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 2; __pyx_t_9 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L9_unpacking_done; + __pyx_L8_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L9_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_sym = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v__); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_v__ = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v__); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v__); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v__ = __pyx_t_9; + __pyx_t_9 = 0; + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L10_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":115 + * for arc in node for node in lattice) + * + * def decode_sentence(lattice): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) + */ + +static PyObject *__pyx_pf_3_sa_6decode_sentence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_sentence", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)__pyx_ptype_3_sa___pyx_scope_struct_9_decode_sentence->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_9_decode_sentence, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_lattice = __pyx_v_lattice; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":116 + * + * def decode_sentence(lattice): + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_pf_3_sa_15decode_sentence_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __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[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_sa.decode_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_words = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__words,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__words); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__words)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -21405,8 +24073,36 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_6Phrase___cinit__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), __pyx_v_words); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":8 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":6 + * cdef class Phrase: + * + * def __cinit__(self, words): # <<<<<<<<<<<<<< + * cdef int i, j, n, n_vars + * n_vars = 0 + */ + +static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_n; + int __pyx_v_n_vars; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":8 * def __cinit__(self, words): * cdef int i, j, n, n_vars * n_vars = 0 # <<<<<<<<<<<<<< @@ -21415,7 +24111,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p */ __pyx_v_n_vars = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":9 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":9 * cdef int i, j, n, n_vars * n_vars = 0 * n = len(words) # <<<<<<<<<<<<<< @@ -21425,16 +24121,16 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p __pyx_t_1 = PyObject_Length(__pyx_v_words); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":10 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":10 * n_vars = 0 * n = len(words) * self.syms = <int *>malloc(n*sizeof(int)) # <<<<<<<<<<<<<< * for i from 0 <= i < n: * self.syms[i] = words[i] */ - ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms = ((int *)malloc((__pyx_v_n * (sizeof(int))))); + __pyx_v_self->syms = ((int *)malloc((__pyx_v_n * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":11 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":11 * n = len(words) * self.syms = <int *>malloc(n*sizeof(int)) * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -21444,7 +24140,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":12 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":12 * self.syms = <int *>malloc(n*sizeof(int)) * for i from 0 <= i < n: * self.syms[i] = words[i] # <<<<<<<<<<<<<< @@ -21455,19 +24151,19 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - (((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i]) = __pyx_t_4; + (__pyx_v_self->syms[__pyx_v_i]) = __pyx_t_4; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":13 * for i from 0 <= i < n: * self.syms[i] = words[i] * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< * n_vars += 1 * self.n = n */ - __pyx_t_4 = __pyx_f_3_sa_sym_isvar((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i])); + __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":14 * self.syms[i] = words[i] * if sym_isvar(self.syms[i]): * n_vars += 1 # <<<<<<<<<<<<<< @@ -21475,39 +24171,39 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p * self.n_vars = n_vars */ __pyx_v_n_vars = (__pyx_v_n_vars + 1); - goto __pyx_L8; + goto __pyx_L5; } - __pyx_L8:; + __pyx_L5:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":15 * if sym_isvar(self.syms[i]): * n_vars += 1 * self.n = n # <<<<<<<<<<<<<< * self.n_vars = n_vars * self.varpos = <int *>malloc(n_vars*sizeof(int)) */ - ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n = __pyx_v_n; + __pyx_v_self->n = __pyx_v_n; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":16 * n_vars += 1 * self.n = n * self.n_vars = n_vars # <<<<<<<<<<<<<< * self.varpos = <int *>malloc(n_vars*sizeof(int)) * j = 0 */ - ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n_vars = __pyx_v_n_vars; + __pyx_v_self->n_vars = __pyx_v_n_vars; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":17 * self.n = n * self.n_vars = n_vars * self.varpos = <int *>malloc(n_vars*sizeof(int)) # <<<<<<<<<<<<<< * j = 0 * for i from 0 <= i < n: */ - ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->varpos = ((int *)malloc((__pyx_v_n_vars * (sizeof(int))))); + __pyx_v_self->varpos = ((int *)malloc((__pyx_v_n_vars * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":18 * self.n_vars = n_vars * self.varpos = <int *>malloc(n_vars*sizeof(int)) * j = 0 # <<<<<<<<<<<<<< @@ -21516,7 +24212,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p */ __pyx_v_j = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":19 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":19 * self.varpos = <int *>malloc(n_vars*sizeof(int)) * j = 0 * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -21526,26 +24222,26 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":20 * j = 0 * for i from 0 <= i < n: * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< * self.varpos[j] = i * j = j + 1 */ - __pyx_t_4 = __pyx_f_3_sa_sym_isvar((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i])); + __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":21 * for i from 0 <= i < n: * if sym_isvar(self.syms[i]): * self.varpos[j] = i # <<<<<<<<<<<<<< * j = j + 1 * */ - (((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->varpos[__pyx_v_j]) = __pyx_v_i; + (__pyx_v_self->varpos[__pyx_v_j]) = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":22 * if sym_isvar(self.syms[i]): * self.varpos[j] = i * j = j + 1 # <<<<<<<<<<<<<< @@ -21553,9 +24249,9 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p * def __dealloc__(self): */ __pyx_v_j = (__pyx_v_j + 1); - goto __pyx_L11; + goto __pyx_L8; } - __pyx_L11:; + __pyx_L8:; } __pyx_r = 0; @@ -21569,7 +24265,16 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":24 +/* Python wrapper */ +static void __pyx_pw_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_3_sa_6Phrase_2__dealloc__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":24 * j = j + 1 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -21577,33 +24282,43 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(PyObject *__pyx_v_self, PyObject *__p * free(self.varpos) */ -static void __pyx_pf_3_sa_6Phrase_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_3_sa_6Phrase_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":25 * * def __dealloc__(self): * free(self.syms) # <<<<<<<<<<<<<< * free(self.varpos) * */ - free(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms); + free(__pyx_v_self->syms); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":26 * def __dealloc__(self): * free(self.syms) * free(self.varpos) # <<<<<<<<<<<<<< * * def __str__(self): */ - free(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->varpos); + free(__pyx_v_self->varpos); __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":28 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_4__str__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":28 * free(self.varpos) * * def __str__(self): # <<<<<<<<<<<<<< @@ -21611,8 +24326,7 @@ static void __pyx_pf_3_sa_6Phrase_1__dealloc__(PyObject *__pyx_v_self) { * cdef int i, s */ -static PyObject *__pyx_pf_3_sa_6Phrase_2__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_2__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_strs = NULL; int __pyx_v_i; int __pyx_v_s; @@ -21626,9 +24340,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_2__str__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__"); + __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":29 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":29 * * def __str__(self): * strs = [] # <<<<<<<<<<<<<< @@ -21636,46 +24350,43 @@ static PyObject *__pyx_pf_3_sa_6Phrase_2__str__(PyObject *__pyx_v_self) { * for i from 0 <= i < self.n: */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_strs = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":31 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":31 * strs = [] * cdef int i, s * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< * s = self.syms[i] * strs.append(sym_tostring(s)) */ - __pyx_t_2 = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n; + __pyx_t_2 = __pyx_v_self->n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":32 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":32 * cdef int i, s * for i from 0 <= i < self.n: * s = self.syms[i] # <<<<<<<<<<<<<< * strs.append(sym_tostring(s)) * return ' '.join(strs) */ - __pyx_v_s = (((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i]); + __pyx_v_s = (__pyx_v_self->syms[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":33 * for i from 0 <= i < self.n: * s = self.syms[i] * strs.append(sym_tostring(s)) # <<<<<<<<<<<<<< * return ' '.join(strs) * */ - if (unlikely(((PyObject *)__pyx_v_strs) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = PyList_Append(__pyx_v_strs, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":34 * s = self.syms[i] * strs.append(sym_tostring(s)) * return ' '.join(strs) # <<<<<<<<<<<<<< @@ -21686,7 +24397,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_2__str__(PyObject *__pyx_v_self) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_67), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_strs)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_strs)); __Pyx_GIVEREF(((PyObject *)__pyx_v_strs)); @@ -21713,7 +24424,19 @@ static PyObject *__pyx_pf_3_sa_6Phrase_2__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":36 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3_sa_6Phrase_6handle[] = "return a hashable representation that normalizes the ordering\n of the nonterminal indices"; +static PyObject *__pyx_pw_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("handle (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_6handle(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":36 * return ' '.join(strs) * * def handle(self): # <<<<<<<<<<<<<< @@ -21721,9 +24444,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_2__str__(PyObject *__pyx_v_self) { * of the nonterminal indices""" */ -static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3_sa_6Phrase_3handle[] = "return a hashable representation that normalizes the ordering\n of the nonterminal indices"; -static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_norm = NULL; int __pyx_v_i; int __pyx_v_j; @@ -21737,9 +24458,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle"); + __Pyx_RefNannySetupContext("handle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":39 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":39 * """return a hashable representation that normalizes the ordering * of the nonterminal indices""" * norm = [] # <<<<<<<<<<<<<< @@ -21747,11 +24468,11 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN * i = 1 */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_norm = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":41 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":41 * norm = [] * cdef int i, j, s * i = 1 # <<<<<<<<<<<<<< @@ -21760,7 +24481,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN */ __pyx_v_i = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":42 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":42 * cdef int i, j, s * i = 1 * j = 0 # <<<<<<<<<<<<<< @@ -21769,26 +24490,26 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN */ __pyx_v_j = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":43 * i = 1 * j = 0 * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< * s = self.syms[j] * if sym_isvar(s): */ - __pyx_t_2 = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n; + __pyx_t_2 = __pyx_v_self->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":44 * j = 0 * for j from 0 <= j < self.n: * s = self.syms[j] # <<<<<<<<<<<<<< * if sym_isvar(s): * s = sym_setindex(s,i) */ - __pyx_v_s = (((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_j]); + __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":45 * for j from 0 <= j < self.n: * s = self.syms[j] * if sym_isvar(s): # <<<<<<<<<<<<<< @@ -21798,7 +24519,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN __pyx_t_3 = __pyx_f_3_sa_sym_isvar(__pyx_v_s); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":46 * s = self.syms[j] * if sym_isvar(s): * s = sym_setindex(s,i) # <<<<<<<<<<<<<< @@ -21807,7 +24528,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN */ __pyx_v_s = __pyx_f_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":47 * if sym_isvar(s): * s = sym_setindex(s,i) * i = i + 1 # <<<<<<<<<<<<<< @@ -21815,27 +24536,24 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN * return tuple(norm) */ __pyx_v_i = (__pyx_v_i + 1); - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":48 * s = sym_setindex(s,i) * i = i + 1 * norm.append(s) # <<<<<<<<<<<<<< * return tuple(norm) * */ - if (unlikely(((PyObject *)__pyx_v_norm) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyList_Append(__pyx_v_norm, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":49 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":49 * i = i + 1 * norm.append(s) * return tuple(norm) # <<<<<<<<<<<<<< @@ -21843,9 +24561,6 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN * def strhandle(self): */ __Pyx_XDECREF(__pyx_r); - if (unlikely(((PyObject *)__pyx_v_norm) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_norm)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); @@ -21865,7 +24580,18 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":51 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("strhandle (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_8strhandle(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":51 * return tuple(norm) * * def strhandle(self): # <<<<<<<<<<<<<< @@ -21873,9 +24599,8 @@ static PyObject *__pyx_pf_3_sa_6Phrase_3handle(PyObject *__pyx_v_self, CYTHON_UN * norm = [] */ -static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_v_strs = NULL; +static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { + CYTHON_UNUSED PyObject *__pyx_v_strs = NULL; PyObject *__pyx_v_norm = NULL; int __pyx_v_i; int __pyx_v_j; @@ -21891,9 +24616,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("strhandle"); + __Pyx_RefNannySetupContext("strhandle", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":52 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":52 * * def strhandle(self): * strs = [] # <<<<<<<<<<<<<< @@ -21901,11 +24626,11 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON * cdef int i, j, s */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_strs = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":53 * def strhandle(self): * strs = [] * norm = [] # <<<<<<<<<<<<<< @@ -21913,11 +24638,11 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON * i = 1 */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_norm = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":55 * norm = [] * cdef int i, j, s * i = 1 # <<<<<<<<<<<<<< @@ -21926,7 +24651,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON */ __pyx_v_i = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":56 * cdef int i, j, s * i = 1 * j = 0 # <<<<<<<<<<<<<< @@ -21935,26 +24660,26 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON */ __pyx_v_j = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":57 * i = 1 * j = 0 * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< * s = self.syms[j] * if sym_isvar(s): */ - __pyx_t_2 = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n; + __pyx_t_2 = __pyx_v_self->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":58 * j = 0 * for j from 0 <= j < self.n: * s = self.syms[j] # <<<<<<<<<<<<<< * if sym_isvar(s): * s = sym_setindex(s,i) */ - __pyx_v_s = (((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_j]); + __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":59 * for j from 0 <= j < self.n: * s = self.syms[j] * if sym_isvar(s): # <<<<<<<<<<<<<< @@ -21964,7 +24689,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON __pyx_t_3 = __pyx_f_3_sa_sym_isvar(__pyx_v_s); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":60 * s = self.syms[j] * if sym_isvar(s): * s = sym_setindex(s,i) # <<<<<<<<<<<<<< @@ -21973,7 +24698,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON */ __pyx_v_s = __pyx_f_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":61 * if sym_isvar(s): * s = sym_setindex(s,i) * i = i + 1 # <<<<<<<<<<<<<< @@ -21981,27 +24706,24 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON * return ' '.join(norm) */ __pyx_v_i = (__pyx_v_i + 1); - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":62 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":62 * s = sym_setindex(s,i) * i = i + 1 * norm.append(sym_tostring(s)) # <<<<<<<<<<<<<< * return ' '.join(norm) * */ - if (unlikely(((PyObject *)__pyx_v_norm) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_4 = PyList_Append(__pyx_v_norm, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":63 * i = i + 1 * norm.append(sym_tostring(s)) * return ' '.join(norm) # <<<<<<<<<<<<<< @@ -22012,7 +24734,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_67), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_norm)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_norm)); __Pyx_GIVEREF(((PyObject *)__pyx_v_norm)); @@ -22040,7 +24762,18 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":65 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arity (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_10arity(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":65 * return ' '.join(norm) * * def arity(self): # <<<<<<<<<<<<<< @@ -22048,17 +24781,16 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4strhandle(PyObject *__pyx_v_self, CYTHON * */ -static PyObject *__pyx_pf_3_sa_6Phrase_5arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_5arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("arity"); + __Pyx_RefNannySetupContext("arity", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":66 * * def arity(self): * return self.n_vars # <<<<<<<<<<<<<< @@ -22066,7 +24798,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5arity(PyObject *__pyx_v_self, CYTHON_UNU * def getvarpos(self, i): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n_vars); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -22084,7 +24816,18 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5arity(PyObject *__pyx_v_self, CYTHON_UNU return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":68 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getvarpos (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_12getvarpos(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":68 * return self.n_vars * * def getvarpos(self, i): # <<<<<<<<<<<<<< @@ -22092,8 +24835,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5arity(PyObject *__pyx_v_self, CYTHON_UNU * return self.varpos[i] */ -static PyObject *__pyx_pf_3_sa_6Phrase_6getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_6getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -22103,30 +24845,28 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6getvarpos(PyObject *__pyx_v_self, PyObje int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getvarpos"); + __Pyx_RefNannySetupContext("getvarpos", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":69 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":69 * * def getvarpos(self, i): * if 0 <= i < self.n_vars: # <<<<<<<<<<<<<< * return self.varpos[i] * else: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { __Pyx_DECREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n_vars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":70 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":70 * def getvarpos(self, i): * if 0 <= i < self.n_vars: * return self.varpos[i] # <<<<<<<<<<<<<< @@ -22135,16 +24875,16 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6getvarpos(PyObject *__pyx_v_self, PyObje */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->varpos[__pyx_t_4])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_self->varpos[__pyx_t_4])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":72 * return self.varpos[i] * else: * raise IndexError # <<<<<<<<<<<<<< @@ -22154,7 +24894,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6getvarpos(PyObject *__pyx_v_self, PyObje __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L5:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -22169,7 +24909,18 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6getvarpos(PyObject *__pyx_v_self, PyObje return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":74 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getvar (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_14getvar(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":74 * raise IndexError * * def getvar(self, i): # <<<<<<<<<<<<<< @@ -22177,8 +24928,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6getvarpos(PyObject *__pyx_v_self, PyObje * return self.syms[self.varpos[i]] */ -static PyObject *__pyx_pf_3_sa_6Phrase_7getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_7getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -22188,30 +24938,28 @@ static PyObject *__pyx_pf_3_sa_6Phrase_7getvar(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getvar"); + __Pyx_RefNannySetupContext("getvar", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":75 * * def getvar(self, i): * if 0 <= i < self.n_vars: # <<<<<<<<<<<<<< * return self.syms[self.varpos[i]] * else: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { __Pyx_DECREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n_vars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":76 * def getvar(self, i): * if 0 <= i < self.n_vars: * return self.syms[self.varpos[i]] # <<<<<<<<<<<<<< @@ -22220,16 +24968,16 @@ static PyObject *__pyx_pf_3_sa_6Phrase_7getvar(PyObject *__pyx_v_self, PyObject */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->varpos[__pyx_t_4])])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_self->syms[(__pyx_v_self->varpos[__pyx_t_4])])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":78 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":78 * return self.syms[self.varpos[i]] * else: * raise IndexError # <<<<<<<<<<<<<< @@ -22239,7 +24987,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_7getvar(PyObject *__pyx_v_self, PyObject __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L5:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -22254,7 +25002,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_7getvar(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":80 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":80 * raise IndexError * * cdef int chunkpos(self, int k): # <<<<<<<<<<<<<< @@ -22266,9 +25014,9 @@ int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("chunkpos"); + __Pyx_RefNannySetupContext("chunkpos", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":81 * * cdef int chunkpos(self, int k): * if k == 0: # <<<<<<<<<<<<<< @@ -22278,7 +25026,7 @@ int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":82 * cdef int chunkpos(self, int k): * if k == 0: * return 0 # <<<<<<<<<<<<<< @@ -22291,7 +25039,7 @@ int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":84 * return 0 * else: * return self.varpos[k-1]+1 # <<<<<<<<<<<<<< @@ -22309,7 +25057,7 @@ int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":86 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":86 * return self.varpos[k-1]+1 * * cdef int chunklen(self, int k): # <<<<<<<<<<<<<< @@ -22321,9 +25069,9 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("chunklen"); + __Pyx_RefNannySetupContext("chunklen", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":87 * * cdef int chunklen(self, int k): * if self.n_vars == 0: # <<<<<<<<<<<<<< @@ -22333,7 +25081,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in __pyx_t_1 = (__pyx_v_self->n_vars == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":88 * cdef int chunklen(self, int k): * if self.n_vars == 0: * return self.n # <<<<<<<<<<<<<< @@ -22345,7 +25093,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":89 * if self.n_vars == 0: * return self.n * elif k == 0: # <<<<<<<<<<<<<< @@ -22355,7 +25103,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":90 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":90 * return self.n * elif k == 0: * return self.varpos[0] # <<<<<<<<<<<<<< @@ -22367,7 +25115,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":91 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":91 * elif k == 0: * return self.varpos[0] * elif k == self.n_vars: # <<<<<<<<<<<<<< @@ -22377,7 +25125,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in __pyx_t_1 = (__pyx_v_k == __pyx_v_self->n_vars); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":92 * return self.varpos[0] * elif k == self.n_vars: * return self.n-self.varpos[k-1]-1 # <<<<<<<<<<<<<< @@ -22390,7 +25138,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":94 * return self.n-self.varpos[k-1]-1 * else: * return self.varpos[k]-self.varpos[k-1]-1 # <<<<<<<<<<<<<< @@ -22408,7 +25156,18 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":96 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clen (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_16clen(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_k)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":96 * return self.varpos[k]-self.varpos[k-1]-1 * * def clen(self, k): # <<<<<<<<<<<<<< @@ -22416,8 +25175,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in * */ -static PyObject *__pyx_pf_3_sa_6Phrase_8clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_8clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k) { +static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -22425,9 +25183,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8clen(PyObject *__pyx_v_self, PyObject *_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("clen"); + __Pyx_RefNannySetupContext("clen", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":97 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":97 * * def clen(self, k): * return self.chunklen(k) # <<<<<<<<<<<<<< @@ -22436,7 +25194,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8clen(PyObject *__pyx_v_self, PyObject *_ */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_k); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Phrase *)((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->__pyx_vtab)->chunklen(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunklen(__pyx_v_self, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -22454,7 +25212,18 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8clen(PyObject *__pyx_v_self, PyObject *_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":99 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getchunk (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_18getchunk(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_ci)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":99 * return self.chunklen(k) * * def getchunk(self, ci): # <<<<<<<<<<<<<< @@ -22462,8 +25231,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8clen(PyObject *__pyx_v_self, PyObject *_ * start = self.chunkpos(ci) */ -static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci) { +static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci) { int __pyx_v_start; int __pyx_v_stop; PyObject *__pyx_v_chunk = NULL; @@ -22476,9 +25244,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObjec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getchunk"); + __Pyx_RefNannySetupContext("getchunk", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":101 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":101 * def getchunk(self, ci): * cdef int start, stop * start = self.chunkpos(ci) # <<<<<<<<<<<<<< @@ -22486,9 +25254,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObjec * chunk = [] */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_ci); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_start = ((struct __pyx_vtabstruct_3_sa_Phrase *)((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->__pyx_vtab)->chunkpos(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), __pyx_t_1); + __pyx_v_start = ((struct __pyx_vtabstruct_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunkpos(__pyx_v_self, __pyx_t_1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":102 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":102 * cdef int start, stop * start = self.chunkpos(ci) * stop = start+self.chunklen(ci) # <<<<<<<<<<<<<< @@ -22496,9 +25264,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObjec * for i from start <= i < stop: */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_ci); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_stop = (__pyx_v_start + ((struct __pyx_vtabstruct_3_sa_Phrase *)((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->__pyx_vtab)->chunklen(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), __pyx_t_1)); + __pyx_v_stop = (__pyx_v_start + ((struct __pyx_vtabstruct_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunklen(__pyx_v_self, __pyx_t_1)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":103 * start = self.chunkpos(ci) * stop = start+self.chunklen(ci) * chunk = [] # <<<<<<<<<<<<<< @@ -22506,11 +25274,11 @@ static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObjec * chunk.append(self.syms[i]) */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __pyx_v_chunk = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":104 * stop = start+self.chunklen(ci) * chunk = [] * for i from start <= i < stop: # <<<<<<<<<<<<<< @@ -22520,23 +25288,20 @@ static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObjec __pyx_t_1 = __pyx_v_stop; for (__pyx_v_i = __pyx_v_start; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":105 * chunk = [] * for i from start <= i < stop: * chunk.append(self.syms[i]) # <<<<<<<<<<<<<< * return chunk * */ - if (unlikely(((PyObject *)__pyx_v_chunk) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyList_Append(__pyx_v_chunk, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":106 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":106 * for i from start <= i < stop: * chunk.append(self.syms[i]) * return chunk # <<<<<<<<<<<<<< @@ -22561,7 +25326,20 @@ static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":108 +/* Python wrapper */ +#if PY_MAJOR_VERSION < 3 +static int __pyx_pw_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static int __pyx_pw_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_20__cmp__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +#endif /*!(#if PY_MAJOR_VERSION < 3)*/ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":108 * return chunk * * def __cmp__(self, other): # <<<<<<<<<<<<<< @@ -22570,8 +25348,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_9getchunk(PyObject *__pyx_v_self, PyObjec */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other) { struct __pyx_obj_3_sa_Phrase *__pyx_v_otherp = 0; int __pyx_v_i; int __pyx_r; @@ -22583,9 +25360,9 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cmp__"); + __Pyx_RefNannySetupContext("__cmp__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":111 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":111 * cdef Phrase otherp * cdef int i * otherp = other # <<<<<<<<<<<<<< @@ -22596,7 +25373,7 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p __Pyx_INCREF(__pyx_v_other); __pyx_v_otherp = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_other); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":112 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":112 * cdef int i * otherp = other * for i from 0 <= i < min(self.n, otherp.n): # <<<<<<<<<<<<<< @@ -22604,7 +25381,7 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p * return -1 */ __pyx_t_1 = __pyx_v_otherp->n; - __pyx_t_2 = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n; + __pyx_t_2 = __pyx_v_self->n; if ((__pyx_t_1 < __pyx_t_2)) { __pyx_t_3 = __pyx_t_1; } else { @@ -22613,17 +25390,17 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p __pyx_t_1 = __pyx_t_3; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":113 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":113 * otherp = other * for i from 0 <= i < min(self.n, otherp.n): * if self.syms[i] < otherp.syms[i]: # <<<<<<<<<<<<<< * return -1 * elif self.syms[i] > otherp.syms[i]: */ - __pyx_t_4 = ((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i]) < (__pyx_v_otherp->syms[__pyx_v_i])); + __pyx_t_4 = ((__pyx_v_self->syms[__pyx_v_i]) < (__pyx_v_otherp->syms[__pyx_v_i])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":114 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":114 * for i from 0 <= i < min(self.n, otherp.n): * if self.syms[i] < otherp.syms[i]: * return -1 # <<<<<<<<<<<<<< @@ -22632,20 +25409,20 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p */ __pyx_r = -1; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L5; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":115 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":115 * if self.syms[i] < otherp.syms[i]: * return -1 * elif self.syms[i] > otherp.syms[i]: # <<<<<<<<<<<<<< * return 1 * if self.n < otherp.n: */ - __pyx_t_4 = ((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i]) > (__pyx_v_otherp->syms[__pyx_v_i])); + __pyx_t_4 = ((__pyx_v_self->syms[__pyx_v_i]) > (__pyx_v_otherp->syms[__pyx_v_i])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":116 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":116 * return -1 * elif self.syms[i] > otherp.syms[i]: * return 1 # <<<<<<<<<<<<<< @@ -22654,22 +25431,22 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p */ __pyx_r = 1; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":117 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":117 * elif self.syms[i] > otherp.syms[i]: * return 1 * if self.n < otherp.n: # <<<<<<<<<<<<<< * return -1 * elif self.n > otherp.n: */ - __pyx_t_4 = (((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n < __pyx_v_otherp->n); + __pyx_t_4 = (__pyx_v_self->n < __pyx_v_otherp->n); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":118 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":118 * return 1 * if self.n < otherp.n: * return -1 # <<<<<<<<<<<<<< @@ -22678,20 +25455,20 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p */ __pyx_r = -1; goto __pyx_L0; - goto __pyx_L8; + goto __pyx_L6; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":119 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":119 * if self.n < otherp.n: * return -1 * elif self.n > otherp.n: # <<<<<<<<<<<<<< * return 1 * else: */ - __pyx_t_4 = (((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n > __pyx_v_otherp->n); + __pyx_t_4 = (__pyx_v_self->n > __pyx_v_otherp->n); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":120 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":120 * return -1 * elif self.n > otherp.n: * return 1 # <<<<<<<<<<<<<< @@ -22700,11 +25477,11 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p */ __pyx_r = 1; goto __pyx_L0; - goto __pyx_L8; + goto __pyx_L6; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":122 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":122 * return 1 * else: * return 0 # <<<<<<<<<<<<<< @@ -22714,7 +25491,7 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p __pyx_r = 0; goto __pyx_L0; } - __pyx_L8:; + __pyx_L6:; __pyx_r = 0; goto __pyx_L0; @@ -22728,7 +25505,18 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":124 +/* Python wrapper */ +static Py_hash_t __pyx_pw_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self); /*proto*/ +static Py_hash_t __pyx_pw_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self) { + Py_hash_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_22__hash__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":124 * return 0 * * def __hash__(self): # <<<<<<<<<<<<<< @@ -22736,17 +25524,16 @@ static int __pyx_pf_3_sa_6Phrase_10__cmp__(PyObject *__pyx_v_self, PyObject *__p * cdef unsigned h */ -static Py_hash_t __pyx_pf_3_sa_6Phrase_11__hash__(PyObject *__pyx_v_self); /*proto*/ -static Py_hash_t __pyx_pf_3_sa_6Phrase_11__hash__(PyObject *__pyx_v_self) { +static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { int __pyx_v_i; unsigned int __pyx_v_h; Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("__hash__"); + __Pyx_RefNannySetupContext("__hash__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":127 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":127 * cdef int i * cdef unsigned h * h = 0 # <<<<<<<<<<<<<< @@ -22755,51 +25542,51 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_11__hash__(PyObject *__pyx_v_self) { */ __pyx_v_h = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":128 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":128 * cdef unsigned h * h = 0 * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< * if self.syms[i] > 0: * h = (h << 1) + self.syms[i] */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n; + __pyx_t_1 = __pyx_v_self->n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":129 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":129 * h = 0 * for i from 0 <= i < self.n: * if self.syms[i] > 0: # <<<<<<<<<<<<<< * h = (h << 1) + self.syms[i] * else: */ - __pyx_t_2 = ((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i]) > 0); + __pyx_t_2 = ((__pyx_v_self->syms[__pyx_v_i]) > 0); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":130 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":130 * for i from 0 <= i < self.n: * if self.syms[i] > 0: * h = (h << 1) + self.syms[i] # <<<<<<<<<<<<<< * else: * h = (h << 1) + -self.syms[i] */ - __pyx_v_h = ((__pyx_v_h << 1) + (((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i])); - goto __pyx_L7; + __pyx_v_h = ((__pyx_v_h << 1) + (__pyx_v_self->syms[__pyx_v_i])); + goto __pyx_L5; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":132 * h = (h << 1) + self.syms[i] * else: * h = (h << 1) + -self.syms[i] # <<<<<<<<<<<<<< * return h * */ - __pyx_v_h = ((__pyx_v_h << 1) + (-(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i]))); + __pyx_v_h = ((__pyx_v_h << 1) + (-(__pyx_v_self->syms[__pyx_v_i]))); } - __pyx_L7:; + __pyx_L5:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":133 * else: * h = (h << 1) + -self.syms[i] * return h # <<<<<<<<<<<<<< @@ -22816,7 +25603,18 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_11__hash__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":135 +/* Python wrapper */ +static Py_ssize_t __pyx_pw_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_24__len__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":135 * return h * * def __len__(self): # <<<<<<<<<<<<<< @@ -22824,20 +25622,19 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_11__hash__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_3_sa_6Phrase_12__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_3_sa_6Phrase_12__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pf_3_sa_6Phrase_24__len__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__"); + __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":136 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":136 * * def __len__(self): * return self.n # <<<<<<<<<<<<<< * * def __getitem__(self, i): */ - __pyx_r = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n; + __pyx_r = __pyx_v_self->n; goto __pyx_L0; __pyx_r = 0; @@ -22846,7 +25643,18 @@ static Py_ssize_t __pyx_pf_3_sa_6Phrase_12__len__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":138 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_26__getitem__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":138 * return self.n * * def __getitem__(self, i): # <<<<<<<<<<<<<< @@ -22854,8 +25662,7 @@ static Py_ssize_t __pyx_pf_3_sa_6Phrase_12__len__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_6Phrase_13__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_13__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_6Phrase_26__getitem__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -22863,9 +25670,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_13__getitem__(PyObject *__pyx_v_self, PyO int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__"); + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":139 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":139 * * def __getitem__(self, i): * return self.syms[i] # <<<<<<<<<<<<<< @@ -22874,7 +25681,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_13__getitem__(PyObject *__pyx_v_self, PyO */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -22891,9 +25698,20 @@ static PyObject *__pyx_pf_3_sa_6Phrase_13__getitem__(PyObject *__pyx_v_self, PyO __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_6Phrase_15generator2(struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":141 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_28__iter__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":141 * return self.syms[i] * * def __iter__(self): # <<<<<<<<<<<<<< @@ -22901,42 +25719,51 @@ static PyObject *__pyx_gb_3_sa_6Phrase_15generator2(struct __pyx_obj_3_sa___pyx_ * for i from 0 <= i < self.n: */ -static PyObject *__pyx_pf_3_sa_6Phrase_14__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_14__iter__(PyObject *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_6Phrase_28__iter__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__"); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *)__pyx_ptype_3_sa___pyx_scope_struct_4___iter__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_4___iter__, __pyx_empty_tuple, NULL); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *)__pyx_ptype_3_sa___pyx_scope_struct_11___iter__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_11___iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __Pyx_INCREF(__pyx_v_self); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_6Phrase_15generator2; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_6Phrase_30generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.Phrase.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_6Phrase_15generator2(struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ @@ -22946,24 +25773,24 @@ static PyObject *__pyx_gb_3_sa_6Phrase_15generator2(struct __pyx_obj_3_sa___pyx_ __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":143 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":143 * def __iter__(self): * cdef int i * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< * yield self.syms[i] * */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_Phrase *)__pyx_cur_scope->__pyx_v_self)->n; + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->n; for (__pyx_cur_scope->__pyx_v_i = 0; __pyx_cur_scope->__pyx_v_i < __pyx_t_1; __pyx_cur_scope->__pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":144 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":144 * cdef int i * for i from 0 <= i < self.n: * yield self.syms[i] # <<<<<<<<<<<<<< * * def subst(self, start, children): */ - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_Phrase *)__pyx_cur_scope->__pyx_v_self)->syms[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->syms[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -22971,74 +25798,58 @@ static PyObject *__pyx_gb_3_sa_6Phrase_15generator2(struct __pyx_obj_3_sa___pyx_ __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":146 - * yield self.syms[i] - * - * def subst(self, start, children): # <<<<<<<<<<<<<< - * cdef int i - * for i from 0 <= i < self.n: - */ - -static PyObject *__pyx_pf_3_sa_6Phrase_16subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_16subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_children = 0; - int __pyx_v_i; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - long __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__children,0}; - __Pyx_RefNannySetupContext("subst"); + __Pyx_RefNannySetupContext("subst (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__children,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__children); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__children)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "subst") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subst") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -23057,36 +25868,62 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16subst(PyObject *__pyx_v_self, PyObject __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_6Phrase_31subst(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), __pyx_v_start, __pyx_v_children); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":146 + * yield self.syms[i] + * + * def subst(self, start, children): # <<<<<<<<<<<<<< + * cdef int i + * for i from 0 <= i < self.n: + */ + +static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_children) { + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("subst", 0); __Pyx_INCREF(__pyx_v_start); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":148 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":148 * def subst(self, start, children): * cdef int i * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< * if sym_isvar(self.syms[i]): * start = start + children[sym_getindex(self.syms[i])-1] */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->n; + __pyx_t_1 = __pyx_v_self->n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":149 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":149 * cdef int i * for i from 0 <= i < self.n: * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< * start = start + children[sym_getindex(self.syms[i])-1] * else: */ - __pyx_t_2 = __pyx_f_3_sa_sym_isvar((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i])); + __pyx_t_2 = __pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":150 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":150 * for i from 0 <= i < self.n: * if sym_isvar(self.syms[i]): * start = start + children[sym_getindex(self.syms[i])-1] # <<<<<<<<<<<<<< * else: * start = start + (self.syms[i],) */ - __pyx_t_3 = (__pyx_f_3_sa_sym_getindex((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i])) - 1); + __pyx_t_3 = (__pyx_f_3_sa_sym_getindex((__pyx_v_self->syms[__pyx_v_i])) - 1); __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_children, __pyx_t_3, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -23095,21 +25932,21 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16subst(PyObject *__pyx_v_self, PyObject __Pyx_DECREF(__pyx_v_start); __pyx_v_start = __pyx_t_5; __pyx_t_5 = 0; - goto __pyx_L8; + goto __pyx_L5; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":152 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":152 * start = start + children[sym_getindex(self.syms[i])-1] * else: * start = start + (self.syms[i],) # <<<<<<<<<<<<<< * return start * */ - __pyx_t_5 = PyInt_FromLong((((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)->syms[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -23120,10 +25957,10 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16subst(PyObject *__pyx_v_self, PyObject __pyx_v_start = __pyx_t_5; __pyx_t_5 = 0; } - __pyx_L8:; + __pyx_L5:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":153 * else: * start = start + (self.syms[i],) * return start # <<<<<<<<<<<<<< @@ -23149,7 +25986,18 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16subst(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":156 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_6Phrase_5words___get__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":156 * * property words: * def __get__(self): # <<<<<<<<<<<<<< @@ -23157,8 +26005,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16subst(PyObject *__pyx_v_self, PyObject * */ -static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_w = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -23172,9 +26019,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":157 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":157 * property words: * def __get__(self): * return [sym_tostring(w) for w in self if not sym_isvar(w)] # <<<<<<<<<<<<<< @@ -23183,22 +26030,30 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(PyObject *__pyx_v_self) { */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyList_CheckExact(__pyx_v_self) || PyTuple_CheckExact(__pyx_v_self)) { - __pyx_t_2 = __pyx_v_self; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(((PyObject *)__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) { + __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_5 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_5)) { @@ -23219,11 +26074,11 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(PyObject *__pyx_v_self) { __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(((PyObject *)__pyx_t_1)); @@ -23246,16 +26101,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":161 - * cdef class Rule: - * - * def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None): # <<<<<<<<<<<<<< - * if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) - * self.lhs = lhs - */ - -static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_lhs; struct __pyx_obj_3_sa_Phrase *__pyx_v_f = 0; struct __pyx_obj_3_sa_Phrase *__pyx_v_e = 0; @@ -23263,21 +26111,24 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx PyObject *__pyx_v_word_alignments = 0; int __pyx_r; __Pyx_RefNannyDeclarations - 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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__word_alignments,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__word_alignments,0}; PyObject* values[5] = {0,0,0,0,0}; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":161 + * cdef class Rule: + * + * def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None): # <<<<<<<<<<<<<< + * if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) + * self.lhs = lhs + */ values[3] = ((PyObject *)Py_None); values[4] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -23287,20 +26138,17 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -23316,7 +26164,7 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -23345,8 +26193,27 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_3_sa_Phrase, 1, "e", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_4Rule___cinit__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_f, __pyx_v_e, __pyx_v_scores, __pyx_v_word_alignments); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, int __pyx_v_lhs, struct __pyx_obj_3_sa_Phrase *__pyx_v_f, struct __pyx_obj_3_sa_Phrase *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_word_alignments) { + int __pyx_r; + __Pyx_RefNannyDeclarations + 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("__cinit__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":162 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":162 * * def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None): * if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) # <<<<<<<<<<<<<< @@ -23361,7 +26228,7 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __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; @@ -23371,20 +26238,20 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":163 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":163 * def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None): * if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) * self.lhs = lhs # <<<<<<<<<<<<<< * self.f = f * self.e = e */ - ((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->lhs = __pyx_v_lhs; + __pyx_v_self->lhs = __pyx_v_lhs; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":164 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":164 * if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) * self.lhs = lhs * self.f = f # <<<<<<<<<<<<<< @@ -23393,11 +26260,11 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx */ __Pyx_INCREF(((PyObject *)__pyx_v_f)); __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - ((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f = __pyx_v_f; + __Pyx_GOTREF(__pyx_v_self->f); + __Pyx_DECREF(((PyObject *)__pyx_v_self->f)); + __pyx_v_self->f = __pyx_v_f; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":165 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":165 * self.lhs = lhs * self.f = f * self.e = e # <<<<<<<<<<<<<< @@ -23406,11 +26273,11 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx */ __Pyx_INCREF(((PyObject *)__pyx_v_e)); __Pyx_GIVEREF(((PyObject *)__pyx_v_e)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e)); - ((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e = __pyx_v_e; + __Pyx_GOTREF(__pyx_v_self->e); + __Pyx_DECREF(((PyObject *)__pyx_v_self->e)); + __pyx_v_self->e = __pyx_v_e; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":166 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":166 * self.f = f * self.e = e * self.word_alignments = word_alignments # <<<<<<<<<<<<<< @@ -23419,11 +26286,11 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx */ __Pyx_INCREF(__pyx_v_word_alignments); __Pyx_GIVEREF(__pyx_v_word_alignments); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments); - __Pyx_DECREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments); - ((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments = __pyx_v_word_alignments; + __Pyx_GOTREF(__pyx_v_self->word_alignments); + __Pyx_DECREF(__pyx_v_self->word_alignments); + __pyx_v_self->word_alignments = __pyx_v_word_alignments; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":167 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":167 * self.e = e * self.word_alignments = word_alignments * self.scores = scores # <<<<<<<<<<<<<< @@ -23433,9 +26300,9 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx if (!(likely(((__pyx_v_scores) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_scores, __pyx_ptype_3_sa_FeatureVector))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_scores); __Pyx_GIVEREF(__pyx_v_scores); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->scores); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->scores)); - ((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->scores = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_scores); + __Pyx_GOTREF(__pyx_v_self->scores); + __Pyx_DECREF(((PyObject *)__pyx_v_self->scores)); + __pyx_v_self->scores = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_scores); __pyx_r = 0; goto __pyx_L0; @@ -23449,7 +26316,18 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":169 +/* Python wrapper */ +static Py_hash_t __pyx_pw_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self); /*proto*/ +static Py_hash_t __pyx_pw_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self) { + Py_hash_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_4Rule_2__hash__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":169 * self.scores = scores * * def __hash__(self): # <<<<<<<<<<<<<< @@ -23457,8 +26335,7 @@ static int __pyx_pf_3_sa_4Rule___cinit__(PyObject *__pyx_v_self, PyObject *__pyx * */ -static Py_hash_t __pyx_pf_3_sa_4Rule_1__hash__(PyObject *__pyx_v_self); /*proto*/ -static Py_hash_t __pyx_pf_3_sa_4Rule_1__hash__(PyObject *__pyx_v_self) { +static Py_hash_t __pyx_pf_3_sa_4Rule_2__hash__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -23467,27 +26344,27 @@ static Py_hash_t __pyx_pf_3_sa_4Rule_1__hash__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__hash__"); + __Pyx_RefNannySetupContext("__hash__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":170 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":170 * * def __hash__(self): * return hash((self.lhs, self.f, self.e)) # <<<<<<<<<<<<<< * * def __cmp__(self, Rule other): */ - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->f)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->e)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->e)); __pyx_t_1 = 0; __pyx_t_3 = PyObject_Hash(((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -23507,7 +26384,25 @@ static Py_hash_t __pyx_pf_3_sa_4Rule_1__hash__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":172 +/* Python wrapper */ +#if PY_MAJOR_VERSION < 3 +static int __pyx_pw_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static int __pyx_pw_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_3_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_4Rule_4__cmp__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +#endif /*!(#if PY_MAJOR_VERSION < 3)*/ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":172 * return hash((self.lhs, self.f, self.e)) * * def __cmp__(self, Rule other): # <<<<<<<<<<<<<< @@ -23516,8 +26411,7 @@ static Py_hash_t __pyx_pf_3_sa_4Rule_1__hash__(PyObject *__pyx_v_self) { */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pf_3_sa_4Rule_2__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_pf_3_sa_4Rule_2__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Rule *__pyx_v_other) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -23527,58 +26421,57 @@ static int __pyx_pf_3_sa_4Rule_2__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cmp__"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_3_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("__cmp__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":173 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":173 * * def __cmp__(self, Rule other): * return cmp((self.lhs, self.f, self.e, self.word_alignments), # <<<<<<<<<<<<<< * (other.lhs, other.f, other.e, self.word_alignments)) * */ - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e)); - __Pyx_INCREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments); - PyTuple_SET_ITEM(__pyx_t_2, 3, ((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments); - __Pyx_GIVEREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments); + __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->f)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->e)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->e)); + __Pyx_INCREF(__pyx_v_self->word_alignments); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->word_alignments); + __Pyx_GIVEREF(__pyx_v_self->word_alignments); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":174 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":174 * def __cmp__(self, Rule other): * return cmp((self.lhs, self.f, self.e, self.word_alignments), * (other.lhs, other.f, other.e, self.word_alignments)) # <<<<<<<<<<<<<< * * def fmerge(self, Phrase f): */ - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_other->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)->f)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)->f)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)->f)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)->e)); - PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)->e)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)->e)); - __Pyx_INCREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments); - PyTuple_SET_ITEM(__pyx_t_3, 3, ((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments); - __Pyx_GIVEREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->word_alignments); + __Pyx_INCREF(((PyObject *)__pyx_v_other->f)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_other->f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_other->f)); + __Pyx_INCREF(((PyObject *)__pyx_v_other->e)); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_other->e)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_other->e)); + __Pyx_INCREF(__pyx_v_self->word_alignments); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_self->word_alignments); + __Pyx_GIVEREF(__pyx_v_self->word_alignments); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_3)); @@ -23607,7 +26500,23 @@ static int __pyx_pf_3_sa_4Rule_2__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_ } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":176 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fmerge (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_4Rule_6fmerge(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_f)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":176 * (other.lhs, other.f, other.e, self.word_alignments)) * * def fmerge(self, Phrase f): # <<<<<<<<<<<<<< @@ -23615,8 +26524,7 @@ static int __pyx_pf_3_sa_4Rule_2__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_ * self.f = f */ -static PyObject *__pyx_pf_3_sa_4Rule_3fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static PyObject *__pyx_pf_3_sa_4Rule_3fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { +static PyObject *__pyx_pf_3_sa_4Rule_6fmerge(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Phrase *__pyx_v_f) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -23624,37 +26532,35 @@ static PyObject *__pyx_pf_3_sa_4Rule_3fmerge(PyObject *__pyx_v_self, PyObject *_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fmerge"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("fmerge", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":177 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":177 * * def fmerge(self, Phrase f): * if self.f == f: # <<<<<<<<<<<<<< * self.f = f * */ - __pyx_t_1 = PyObject_RichCompare(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f), __pyx_v_f, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self->f), ((PyObject *)__pyx_v_f), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 177; __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[7]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":178 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":178 * def fmerge(self, Phrase f): * if self.f == f: * self.f = f # <<<<<<<<<<<<<< * * def arity(self): */ - __Pyx_INCREF(__pyx_v_f); - __Pyx_GIVEREF(__pyx_v_f); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - ((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_f); - goto __pyx_L5; + __Pyx_INCREF(((PyObject *)__pyx_v_f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); + __Pyx_GOTREF(__pyx_v_self->f); + __Pyx_DECREF(((PyObject *)__pyx_v_self->f)); + __pyx_v_self->f = __pyx_v_f; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -23668,7 +26574,18 @@ static PyObject *__pyx_pf_3_sa_4Rule_3fmerge(PyObject *__pyx_v_self, PyObject *_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":180 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arity (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_4Rule_8arity(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":180 * self.f = f * * def arity(self): # <<<<<<<<<<<<<< @@ -23676,8 +26593,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_3fmerge(PyObject *__pyx_v_self, PyObject *_ * */ -static PyObject *__pyx_pf_3_sa_4Rule_4arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_4Rule_4arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_4Rule_8arity(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -23685,9 +26601,9 @@ static PyObject *__pyx_pf_3_sa_4Rule_4arity(PyObject *__pyx_v_self, CYTHON_UNUSE int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("arity"); + __Pyx_RefNannySetupContext("arity", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":181 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":181 * * def arity(self): * return self.f.arity() # <<<<<<<<<<<<<< @@ -23695,7 +26611,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_4arity(PyObject *__pyx_v_self, CYTHON_UNUSE * def __str__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->f), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 181; __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[7]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -23716,9 +26632,20 @@ static PyObject *__pyx_pf_3_sa_4Rule_4arity(PyObject *__pyx_v_self, CYTHON_UNUSE __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":187 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_4Rule_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_11__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_4Rule_10__str__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":187 * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] * if self.word_alignments is not None: * fields.append(' '.join('%d-%d' % a for a in self.alignments())) # <<<<<<<<<<<<<< @@ -23726,45 +26653,53 @@ static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_ * */ -static PyObject *__pyx_pf_3_sa_7__str___genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_7__str___genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_4Rule_7__str___genexpr(PyObject *__pyx_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("genexpr"); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_6_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_13_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_13_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *)__pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - __pyx_self = __pyx_self; - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_7__str___1generator7; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_4Rule_7__str___2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.Rule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; PyObject *(*__pyx_t_4)(PyObject *); __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ @@ -23773,7 +26708,8 @@ static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_ } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s__alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __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[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -23788,12 +26724,20 @@ static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_2 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_2)) { @@ -23821,7 +26765,7 @@ static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_ __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; @@ -23832,7 +26776,7 @@ static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -23840,12 +26784,13 @@ static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_ __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":183 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":183 * return self.f.arity() * * def __str__(self): # <<<<<<<<<<<<<< @@ -23853,9 +26798,8 @@ static PyObject *__pyx_gb_3_sa_7__str___1generator7(struct __pyx_obj_3_sa___pyx_ * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] */ -static PyObject *__pyx_pf_3_sa_4Rule_5__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_4Rule_5__str__(PyObject *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *__pyx_cur_scope; PyObject *__pyx_v_fields = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -23869,52 +26813,52 @@ static PyObject *__pyx_pf_3_sa_4Rule_5__str__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__"); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *)__pyx_ptype_3_sa___pyx_scope_struct_5___str__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_5___str__, __pyx_empty_tuple, NULL); + __Pyx_RefNannySetupContext("__str__", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *)__pyx_ptype_3_sa___pyx_scope_struct_12___str__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_12___str__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __Pyx_INCREF(__pyx_v_self); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":185 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":185 * def __str__(self): * cdef unsigned i * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] # <<<<<<<<<<<<<< * if self.word_alignments is not None: * fields.append(' '.join('%d-%d' % a for a in self.alignments())) */ - __pyx_t_1 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_cur_scope->__pyx_v_self->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->f)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->f)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->f)); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->f)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_self->f)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->f)); __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->e)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->e)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->e)); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->e)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_self->e)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->e)); __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->scores)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->scores)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->scores)); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->scores)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_self->scores)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->scores)); __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); @@ -23930,32 +26874,29 @@ static PyObject *__pyx_pf_3_sa_4Rule_5__str__(PyObject *__pyx_v_self) { __pyx_v_fields = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":186 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":186 * cdef unsigned i * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] * if self.word_alignments is not None: # <<<<<<<<<<<<<< * fields.append(' '.join('%d-%d' % a for a in self.alignments())) * return ' ||| '.join(fields) */ - __pyx_t_6 = (((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->word_alignments != Py_None); + __pyx_t_6 = (__pyx_cur_scope->__pyx_v_self->word_alignments != Py_None); if (__pyx_t_6) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":187 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":187 * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] * if self.word_alignments is not None: * fields.append(' '.join('%d-%d' % a for a in self.alignments())) # <<<<<<<<<<<<<< * return ' ||| '.join(fields) * */ - if (unlikely(((PyObject *)__pyx_v_fields) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_67), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __pyx_pf_3_sa_7__str___genexpr(((PyObject*)__pyx_cur_scope), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_pf_3_sa_4Rule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -23965,11 +26906,11 @@ static PyObject *__pyx_pf_3_sa_4Rule_5__str__(PyObject *__pyx_v_self) { __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_7 = PyList_Append(__pyx_v_fields, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":188 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":188 * if self.word_alignments is not None: * fields.append(' '.join('%d-%d' % a for a in self.alignments())) * return ' ||| '.join(fields) # <<<<<<<<<<<<<< @@ -23980,7 +26921,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_5__str__(PyObject *__pyx_v_self) { __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_18), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_fields)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fields)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fields)); @@ -24009,9 +26950,20 @@ static PyObject *__pyx_pf_3_sa_4Rule_5__str__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("alignments (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_4Rule_12alignments(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":190 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":190 * return ' ||| '.join(fields) * * def alignments(self): # <<<<<<<<<<<<<< @@ -24019,36 +26971,45 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco * yield point/65536, point%65536 */ -static PyObject *__pyx_pf_3_sa_4Rule_6alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_4Rule_6alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_4Rule_12alignments(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("alignments"); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *)__pyx_ptype_3_sa___pyx_scope_struct_7_alignments->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_7_alignments, __pyx_empty_tuple, NULL); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("alignments", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *)__pyx_ptype_3_sa___pyx_scope_struct_14_alignments->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_14_alignments, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __Pyx_INCREF(__pyx_v_self); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_4Rule_7generator3; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_4Rule_14generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.Rule.alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -24057,8 +27018,8 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ @@ -24068,27 +27029,35 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":191 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":191 * * def alignments(self): * for point in self.word_alignments: # <<<<<<<<<<<<<< * yield point/65536, point%65536 */ - if (PyList_CheckExact(((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->word_alignments) || PyTuple_CheckExact(((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->word_alignments)) { - __pyx_t_1 = ((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->word_alignments; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_self->word_alignments) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_self->word_alignments)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->word_alignments; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((struct __pyx_obj_3_sa_Rule *)__pyx_cur_scope->__pyx_v_self)->word_alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_self->word_alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -24106,7 +27075,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco __pyx_cur_scope->__pyx_v_point = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rule.pxi":192 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":192 * def alignments(self): * for point in self.word_alignments: * yield point/65536, point%65536 # <<<<<<<<<<<<<< @@ -24116,7 +27085,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco __pyx_t_5 = PyNumber_Remainder(__pyx_cur_scope->__pyx_v_point, __pyx_int_65536); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); @@ -24132,7 +27101,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; @@ -24143,7 +27112,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -24153,11 +27122,23 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco __Pyx_AddTraceback("alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_4Rule_1f___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "_sa.pxd":37 * cdef class Rule: * cdef int lhs @@ -24166,14 +27147,13 @@ static PyObject *__pyx_gb_3_sa_4Rule_7generator3(struct __pyx_obj_3_sa___pyx_sco * cdef int n_scores */ -static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f)); - __pyx_r = ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->f); + __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); + __pyx_r = ((PyObject *)__pyx_v_self->f); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -24183,14 +27163,24 @@ static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(PyObject *__pyx_v_self) { return __pyx_r; } -static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(PyObject *__pyx_v_self) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_4Rule_1e___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e)); - __pyx_r = ((PyObject *)((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)->e); + __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); + __pyx_r = ((PyObject *)__pyx_v_self->e); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -24200,7 +27190,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":21 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":21 * int arr_len * * cdef _Trie_Node* new_trie_node(): # <<<<<<<<<<<<<< @@ -24212,9 +27202,9 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; struct __pyx_t_3_sa__Trie_Node *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("new_trie_node"); + __Pyx_RefNannySetupContext("new_trie_node", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":23 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":23 * cdef _Trie_Node* new_trie_node(): * cdef _Trie_Node* node * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) # <<<<<<<<<<<<<< @@ -24223,7 +27213,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { */ __pyx_v_node = ((struct __pyx_t_3_sa__Trie_Node *)malloc((sizeof(struct __pyx_t_3_sa__Trie_Node)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":24 * cdef _Trie_Node* node * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) * node.root = NULL # <<<<<<<<<<<<<< @@ -24232,7 +27222,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { */ __pyx_v_node->root = NULL; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":25 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":25 * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) * node.root = NULL * node.arr_len = 0 # <<<<<<<<<<<<<< @@ -24241,7 +27231,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { */ __pyx_v_node->arr_len = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":26 * node.root = NULL * node.arr_len = 0 * node.arr = <int*> malloc(sizeof(0*sizeof(int))) # <<<<<<<<<<<<<< @@ -24250,7 +27240,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { */ __pyx_v_node->arr = ((int *)malloc((sizeof((0 * (sizeof(int))))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":27 * node.arr_len = 0 * node.arr = <int*> malloc(sizeof(0*sizeof(int))) * return node # <<<<<<<<<<<<<< @@ -24266,7 +27256,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":29 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":29 * return node * * cdef _Trie_Edge* new_trie_edge(int val): # <<<<<<<<<<<<<< @@ -24278,9 +27268,9 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va struct __pyx_t_3_sa__Trie_Edge *__pyx_v_edge; struct __pyx_t_3_sa__Trie_Edge *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("new_trie_edge"); + __Pyx_RefNannySetupContext("new_trie_edge", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":31 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":31 * cdef _Trie_Edge* new_trie_edge(int val): * cdef _Trie_Edge* edge * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) # <<<<<<<<<<<<<< @@ -24289,7 +27279,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va */ __pyx_v_edge = ((struct __pyx_t_3_sa__Trie_Edge *)malloc((sizeof(struct __pyx_t_3_sa__Trie_Edge)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":32 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":32 * cdef _Trie_Edge* edge * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) * edge.node = new_trie_node() # <<<<<<<<<<<<<< @@ -24298,7 +27288,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va */ __pyx_v_edge->node = __pyx_f_3_sa_new_trie_node(); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":33 * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) * edge.node = new_trie_node() * edge.bigger = NULL # <<<<<<<<<<<<<< @@ -24307,7 +27297,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va */ __pyx_v_edge->bigger = NULL; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":34 * edge.node = new_trie_node() * edge.bigger = NULL * edge.smaller = NULL # <<<<<<<<<<<<<< @@ -24316,7 +27306,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va */ __pyx_v_edge->smaller = NULL; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":35 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":35 * edge.bigger = NULL * edge.smaller = NULL * edge.val = val # <<<<<<<<<<<<<< @@ -24325,7 +27315,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va */ __pyx_v_edge->val = __pyx_v_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":36 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":36 * edge.smaller = NULL * edge.val = val * return edge # <<<<<<<<<<<<<< @@ -24341,7 +27331,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":38 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":38 * return edge * * cdef free_trie_node(_Trie_Node* node): # <<<<<<<<<<<<<< @@ -24357,9 +27347,9 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("free_trie_node"); + __Pyx_RefNannySetupContext("free_trie_node", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":39 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":39 * * cdef free_trie_node(_Trie_Node* node): * if node != NULL: # <<<<<<<<<<<<<< @@ -24369,7 +27359,7 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p __pyx_t_1 = (__pyx_v_node != NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":40 * cdef free_trie_node(_Trie_Node* node): * if node != NULL: * free_trie_edge(node.root) # <<<<<<<<<<<<<< @@ -24380,7 +27370,7 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":41 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":41 * if node != NULL: * free_trie_edge(node.root) * free(node.arr) # <<<<<<<<<<<<<< @@ -24404,7 +27394,7 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":43 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":43 * free(node.arr) * * cdef free_trie_edge(_Trie_Edge* edge): # <<<<<<<<<<<<<< @@ -24420,9 +27410,9 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("free_trie_edge"); + __Pyx_RefNannySetupContext("free_trie_edge", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":44 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":44 * * cdef free_trie_edge(_Trie_Edge* edge): * if edge != NULL: # <<<<<<<<<<<<<< @@ -24432,7 +27422,7 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p __pyx_t_1 = (__pyx_v_edge != NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":45 * cdef free_trie_edge(_Trie_Edge* edge): * if edge != NULL: * free_trie_node(edge.node) # <<<<<<<<<<<<<< @@ -24443,7 +27433,7 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":46 * if edge != NULL: * free_trie_node(edge.node) * free_trie_edge(edge.bigger) # <<<<<<<<<<<<<< @@ -24454,7 +27444,7 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":47 * free_trie_node(edge.node) * free_trie_edge(edge.bigger) * free_trie_edge(edge.smaller) # <<<<<<<<<<<<<< @@ -24480,7 +27470,7 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":49 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":49 * free_trie_edge(edge.smaller) * * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): # <<<<<<<<<<<<<< @@ -24495,9 +27485,9 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("trie_find"); + __Pyx_RefNannySetupContext("trie_find", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":51 * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): * cdef _Trie_Edge* cur * cur = node.root # <<<<<<<<<<<<<< @@ -24506,7 +27496,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s */ __pyx_v_cur = __pyx_v_node->root; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":52 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":52 * cdef _Trie_Edge* cur * cur = node.root * while cur != NULL and cur.val != val: # <<<<<<<<<<<<<< @@ -24523,7 +27513,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s } if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":53 * cur = node.root * while cur != NULL and cur.val != val: * if val > cur.val: # <<<<<<<<<<<<<< @@ -24533,7 +27523,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_t_3 = (__pyx_v_val > __pyx_v_cur->val); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":54 * while cur != NULL and cur.val != val: * if val > cur.val: * cur = cur.bigger # <<<<<<<<<<<<<< @@ -24544,7 +27534,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s goto __pyx_L5; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":55 * if val > cur.val: * cur = cur.bigger * elif val < cur.val: # <<<<<<<<<<<<<< @@ -24554,7 +27544,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_t_3 = (__pyx_v_val < __pyx_v_cur->val); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":56 * cur = cur.bigger * elif val < cur.val: * cur = cur.smaller # <<<<<<<<<<<<<< @@ -24567,7 +27557,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_L5:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":57 * elif val < cur.val: * cur = cur.smaller * if cur == NULL: # <<<<<<<<<<<<<< @@ -24577,7 +27567,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_t_3 = (__pyx_v_cur == NULL); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":58 * cur = cur.smaller * if cur == NULL: * return NULL # <<<<<<<<<<<<<< @@ -24590,7 +27580,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":60 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":60 * return NULL * else: * return cur.node # <<<<<<<<<<<<<< @@ -24608,7 +27598,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":62 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":62 * return cur.node * * cdef trie_node_data_append(_Trie_Node* node, int val): # <<<<<<<<<<<<<< @@ -24620,9 +27610,9 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No int __pyx_v_new_len; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("trie_node_data_append"); + __Pyx_RefNannySetupContext("trie_node_data_append", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":64 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":64 * cdef trie_node_data_append(_Trie_Node* node, int val): * cdef int new_len * new_len = node.arr_len + 1 # <<<<<<<<<<<<<< @@ -24631,7 +27621,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No */ __pyx_v_new_len = (__pyx_v_node->arr_len + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":65 * cdef int new_len * new_len = node.arr_len + 1 * node.arr = <int*> realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -24640,7 +27630,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No */ __pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":66 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":66 * new_len = node.arr_len + 1 * node.arr = <int*> realloc(node.arr, new_len*sizeof(int)) * node.arr[node.arr_len] = val # <<<<<<<<<<<<<< @@ -24649,7 +27639,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No */ (__pyx_v_node->arr[__pyx_v_node->arr_len]) = __pyx_v_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":67 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":67 * node.arr = <int*> realloc(node.arr, new_len*sizeof(int)) * node.arr[node.arr_len] = val * node.arr_len = new_len # <<<<<<<<<<<<<< @@ -24664,7 +27654,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":69 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":69 * node.arr_len = new_len * * cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): # <<<<<<<<<<<<<< @@ -24676,9 +27666,9 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No int __pyx_v_new_len; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("trie_node_data_extend"); + __Pyx_RefNannySetupContext("trie_node_data_extend", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":71 * cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): * cdef int new_len * new_len = node.arr_len + num_vals # <<<<<<<<<<<<<< @@ -24687,7 +27677,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No */ __pyx_v_new_len = (__pyx_v_node->arr_len + __pyx_v_num_vals); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":72 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":72 * cdef int new_len * new_len = node.arr_len + num_vals * node.arr = <int*> realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -24696,7 +27686,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No */ __pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":73 * new_len = node.arr_len + num_vals * node.arr = <int*> realloc(node.arr, new_len*sizeof(int)) * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) # <<<<<<<<<<<<<< @@ -24705,7 +27695,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No */ memcpy((__pyx_v_node->arr + __pyx_v_node->arr_len), __pyx_v_vals, (__pyx_v_num_vals * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":74 * node.arr = <int*> realloc(node.arr, new_len*sizeof(int)) * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) * node.arr_len = new_len # <<<<<<<<<<<<<< @@ -24720,7 +27710,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":77 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":77 * * * cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): # <<<<<<<<<<<<<< @@ -24735,9 +27725,9 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("trie_insert"); + __Pyx_RefNannySetupContext("trie_insert", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":79 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":79 * cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): * cdef _Trie_Edge** cur * cur = &node.root # <<<<<<<<<<<<<< @@ -24746,7 +27736,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 */ __pyx_v_cur = (&__pyx_v_node->root); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":80 * cdef _Trie_Edge** cur * cur = &node.root * while cur[0] != NULL and cur[0].val != val: # <<<<<<<<<<<<<< @@ -24763,7 +27753,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 } if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":81 * cur = &node.root * while cur[0] != NULL and cur[0].val != val: * if val > cur[0].val: # <<<<<<<<<<<<<< @@ -24773,7 +27763,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 __pyx_t_3 = (__pyx_v_val > (__pyx_v_cur[0])->val); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":82 * while cur[0] != NULL and cur[0].val != val: * if val > cur[0].val: * cur = &cur[0].bigger # <<<<<<<<<<<<<< @@ -24784,7 +27774,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 goto __pyx_L5; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":83 * if val > cur[0].val: * cur = &cur[0].bigger * elif val < cur[0].val: # <<<<<<<<<<<<<< @@ -24794,7 +27784,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 __pyx_t_3 = (__pyx_v_val < (__pyx_v_cur[0])->val); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":84 * cur = &cur[0].bigger * elif val < cur[0].val: * cur = &cur[0].smaller # <<<<<<<<<<<<<< @@ -24807,7 +27797,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 __pyx_L5:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":85 * elif val < cur[0].val: * cur = &cur[0].smaller * if cur[0] == NULL: # <<<<<<<<<<<<<< @@ -24817,7 +27807,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 __pyx_t_3 = ((__pyx_v_cur[0]) == NULL); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":86 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":86 * cur = &cur[0].smaller * if cur[0] == NULL: * cur[0] = new_trie_edge(val) # <<<<<<<<<<<<<< @@ -24829,7 +27819,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 } __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":87 * if cur[0] == NULL: * cur[0] = new_trie_edge(val) * return cur[0].node # <<<<<<<<<<<<<< @@ -24845,7 +27835,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":89 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":89 * return cur[0].node * * cdef trie_node_to_map(_Trie_Node* node, result, prefix, int include_zeros): # <<<<<<<<<<<<<< @@ -24863,9 +27853,9 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("trie_node_to_map"); + __Pyx_RefNannySetupContext("trie_node_to_map", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":92 * cdef IntList arr * * if include_zeros or node.arr_len > 0: # <<<<<<<<<<<<<< @@ -24880,7 +27870,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ } if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":93 * * if include_zeros or node.arr_len > 0: * arr = IntList() # <<<<<<<<<<<<<< @@ -24892,7 +27882,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":94 * if include_zeros or node.arr_len > 0: * arr = IntList() * free(arr.arr) # <<<<<<<<<<<<<< @@ -24901,7 +27891,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ */ free(__pyx_v_arr->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":95 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":95 * arr = IntList() * free(arr.arr) * arr.arr = <int*> malloc(node.arr_len * sizeof(int)) # <<<<<<<<<<<<<< @@ -24910,7 +27900,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ */ __pyx_v_arr->arr = ((int *)malloc((__pyx_v_node->arr_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":96 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":96 * free(arr.arr) * arr.arr = <int*> malloc(node.arr_len * sizeof(int)) * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) # <<<<<<<<<<<<<< @@ -24919,7 +27909,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ */ memcpy(__pyx_v_arr->arr, __pyx_v_node->arr, (__pyx_v_node->arr_len * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":97 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":97 * arr.arr = <int*> malloc(node.arr_len * sizeof(int)) * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) * arr.len = node.arr_len # <<<<<<<<<<<<<< @@ -24928,7 +27918,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ */ __pyx_v_arr->len = __pyx_v_node->arr_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":98 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":98 * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) * arr.len = node.arr_len * arr.size = node.arr_len # <<<<<<<<<<<<<< @@ -24937,7 +27927,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ */ __pyx_v_arr->size = __pyx_v_node->arr_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":99 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":99 * arr.len = node.arr_len * arr.size = node.arr_len * result[prefix] = arr # <<<<<<<<<<<<<< @@ -24949,7 +27939,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":100 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":100 * arr.size = node.arr_len * result[prefix] = arr * trie_edge_to_map(node.root, result, prefix, include_zeros) # <<<<<<<<<<<<<< @@ -24973,7 +27963,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":102 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":102 * trie_edge_to_map(node.root, result, prefix, include_zeros) * * cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): # <<<<<<<<<<<<<< @@ -24990,10 +27980,10 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("trie_edge_to_map"); + __Pyx_RefNannySetupContext("trie_edge_to_map", 0); __Pyx_INCREF(__pyx_v_prefix); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":103 * * cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): * if edge != NULL: # <<<<<<<<<<<<<< @@ -25003,7 +27993,7 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __pyx_t_1 = (__pyx_v_edge != NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":104 * cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): * if edge != NULL: * trie_edge_to_map(edge.smaller, result, prefix, include_zeros) # <<<<<<<<<<<<<< @@ -25014,7 +28004,7 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":105 * if edge != NULL: * trie_edge_to_map(edge.smaller, result, prefix, include_zeros) * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) # <<<<<<<<<<<<<< @@ -25025,7 +28015,7 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":106 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":106 * trie_edge_to_map(edge.smaller, result, prefix, include_zeros) * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) * prefix = prefix + (edge.val,) # <<<<<<<<<<<<<< @@ -25035,7 +28025,7 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __pyx_t_2 = PyInt_FromLong(__pyx_v_edge->val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __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[11]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; @@ -25046,7 +28036,7 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __pyx_v_prefix = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":107 * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) * prefix = prefix + (edge.val,) * trie_node_to_map(edge.node, result, prefix, include_zeros) # <<<<<<<<<<<<<< @@ -25074,42 +28064,32 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":114 - * cdef int V - * - * def __cinit__(self, int alphabet_size): # <<<<<<<<<<<<<< - * self.V = alphabet_size - * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) - */ - -static int __pyx_pf_3_sa_7TrieMap___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_7TrieMap___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_alphabet_size; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alphabet_size,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alphabet_size,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alphabet_size); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alphabet_size)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -25126,40 +28106,66 @@ static int __pyx_pf_3_sa_7TrieMap___cinit__(PyObject *__pyx_v_self, PyObject *__ __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_7TrieMap___cinit__(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), __pyx_v_alphabet_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":115 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":114 + * cdef int V + * + * def __cinit__(self, int alphabet_size): # <<<<<<<<<<<<<< + * self.V = alphabet_size + * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) + */ + +static int __pyx_pf_3_sa_7TrieMap___cinit__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":115 * * def __cinit__(self, int alphabet_size): * self.V = alphabet_size # <<<<<<<<<<<<<< * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) */ - ((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->V = __pyx_v_alphabet_size; + __pyx_v_self->V = __pyx_v_alphabet_size; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":116 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":116 * def __cinit__(self, int alphabet_size): * self.V = alphabet_size * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) # <<<<<<<<<<<<<< * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) * */ - ((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->root = ((struct __pyx_t_3_sa__Trie_Node **)malloc((((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->V * (sizeof(struct __pyx_t_3_sa__Trie_Node *))))); + __pyx_v_self->root = ((struct __pyx_t_3_sa__Trie_Node **)malloc((__pyx_v_self->V * (sizeof(struct __pyx_t_3_sa__Trie_Node *))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":117 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":117 * self.V = alphabet_size * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) # <<<<<<<<<<<<<< * * */ - memset(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->root, 0, (((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->V * (sizeof(struct __pyx_t_3_sa__Trie_Node *)))); + memset(__pyx_v_self->root, 0, (__pyx_v_self->V * (sizeof(struct __pyx_t_3_sa__Trie_Node *)))); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":120 +/* Python wrapper */ +static void __pyx_pw_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_3_sa_7TrieMap_2__dealloc__(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":120 * * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -25167,8 +28173,7 @@ static int __pyx_pf_3_sa_7TrieMap___cinit__(PyObject *__pyx_v_self, PyObject *__ * for i from 0 <= i < self.V: */ -static void __pyx_pf_3_sa_7TrieMap_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_3_sa_7TrieMap_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self) { int __pyx_v_i; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -25177,51 +28182,51 @@ static void __pyx_pf_3_sa_7TrieMap_1__dealloc__(PyObject *__pyx_v_self) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":122 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":122 * def __dealloc__(self): * cdef int i * for i from 0 <= i < self.V: # <<<<<<<<<<<<<< * if self.root[i] != NULL: * free_trie_node(self.root[i]) */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->V; + __pyx_t_1 = __pyx_v_self->V; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":123 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":123 * cdef int i * for i from 0 <= i < self.V: * if self.root[i] != NULL: # <<<<<<<<<<<<<< * free_trie_node(self.root[i]) * free(self.root) */ - __pyx_t_2 = ((((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->root[__pyx_v_i]) != NULL); + __pyx_t_2 = ((__pyx_v_self->root[__pyx_v_i]) != NULL); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":124 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":124 * for i from 0 <= i < self.V: * if self.root[i] != NULL: * free_trie_node(self.root[i]) # <<<<<<<<<<<<<< * free(self.root) * */ - __pyx_t_3 = __pyx_f_3_sa_free_trie_node((((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->root[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_3_sa_free_trie_node((__pyx_v_self->root[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":125 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":125 * if self.root[i] != NULL: * free_trie_node(self.root[i]) * free(self.root) # <<<<<<<<<<<<<< * * */ - free(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->root); + free(__pyx_v_self->root); goto __pyx_L0; __pyx_L1_error:; @@ -25231,7 +28236,18 @@ static void __pyx_pf_3_sa_7TrieMap_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":128 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("insert (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7TrieMap_4insert(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":128 * * * def insert(self, pattern): # <<<<<<<<<<<<<< @@ -25239,8 +28255,7 @@ static void __pyx_pf_3_sa_7TrieMap_1__dealloc__(PyObject *__pyx_v_self) { * cdef int i, l */ -static PyObject *__pyx_pf_3_sa_7TrieMap_2insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pf_3_sa_7TrieMap_2insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { int *__pyx_v_p; int __pyx_v_i; int __pyx_v_l; @@ -25253,9 +28268,9 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_2insert(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("insert"); + __Pyx_RefNannySetupContext("insert", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":131 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":131 * cdef int* p * cdef int i, l * l = len(pattern) # <<<<<<<<<<<<<< @@ -25265,7 +28280,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_2insert(PyObject *__pyx_v_self, PyObject __pyx_t_1 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_l = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":132 * cdef int i, l * l = len(pattern) * p = <int*> malloc(l*sizeof(int)) # <<<<<<<<<<<<<< @@ -25274,7 +28289,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_2insert(PyObject *__pyx_v_self, PyObject */ __pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":133 * l = len(pattern) * p = <int*> malloc(l*sizeof(int)) * for i from 0 <= i < l: # <<<<<<<<<<<<<< @@ -25284,7 +28299,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_2insert(PyObject *__pyx_v_self, PyObject __pyx_t_2 = __pyx_v_l; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":134 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":134 * p = <int*> malloc(l*sizeof(int)) * for i from 0 <= i < l: * p[i] = pattern[i] # <<<<<<<<<<<<<< @@ -25298,16 +28313,16 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_2insert(PyObject *__pyx_v_self, PyObject (__pyx_v_p[__pyx_v_i]) = __pyx_t_4; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":135 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":135 * for i from 0 <= i < l: * p[i] = pattern[i] * self._insert(p,l) # <<<<<<<<<<<<<< * free(p) * */ - ((struct __pyx_vtabstruct_3_sa_TrieMap *)((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->__pyx_vtab)->_insert(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), __pyx_v_p, __pyx_v_l); + ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_insert(__pyx_v_self, __pyx_v_p, __pyx_v_l); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":136 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":136 * p[i] = pattern[i] * self._insert(p,l) * free(p) # <<<<<<<<<<<<<< @@ -25328,7 +28343,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_2insert(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":139 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":139 * * * cdef _Trie_Node* _insert(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<< @@ -25343,9 +28358,9 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("_insert"); + __Pyx_RefNannySetupContext("_insert", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":142 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":142 * cdef int i * cdef _Trie_Node* node * if self.root[pattern[0]] == NULL: # <<<<<<<<<<<<<< @@ -25355,7 +28370,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py __pyx_t_1 = ((__pyx_v_self->root[(__pyx_v_pattern[0])]) == NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":143 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":143 * cdef _Trie_Node* node * if self.root[pattern[0]] == NULL: * self.root[pattern[0]] = new_trie_node() # <<<<<<<<<<<<<< @@ -25367,7 +28382,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":144 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":144 * if self.root[pattern[0]] == NULL: * self.root[pattern[0]] = new_trie_node() * node = self.root[pattern[0]] # <<<<<<<<<<<<<< @@ -25376,7 +28391,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py */ __pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":145 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":145 * self.root[pattern[0]] = new_trie_node() * node = self.root[pattern[0]] * for i from 1 <= i < pattern_len: # <<<<<<<<<<<<<< @@ -25386,7 +28401,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py __pyx_t_2 = __pyx_v_pattern_len; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":146 * node = self.root[pattern[0]] * for i from 1 <= i < pattern_len: * node = trie_insert(node, pattern[i]) # <<<<<<<<<<<<<< @@ -25396,7 +28411,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":147 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":147 * for i from 1 <= i < pattern_len: * node = trie_insert(node, pattern[i]) * return node # <<<<<<<<<<<<<< @@ -25412,7 +28427,18 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":149 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("contains (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7TrieMap_6contains(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":149 * return node * * def contains(self, pattern): # <<<<<<<<<<<<<< @@ -25420,8 +28446,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py * cdef int i, l */ -static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { int *__pyx_v_p; int __pyx_v_i; int __pyx_v_l; @@ -25436,9 +28461,9 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("contains"); + __Pyx_RefNannySetupContext("contains", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":153 * cdef int i, l * cdef _Trie_Node* node * l = len(pattern) # <<<<<<<<<<<<<< @@ -25448,7 +28473,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje __pyx_t_1 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_l = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":154 * cdef _Trie_Node* node * l = len(pattern) * p = <int*> malloc(l*sizeof(int)) # <<<<<<<<<<<<<< @@ -25457,7 +28482,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje */ __pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":155 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":155 * l = len(pattern) * p = <int*> malloc(l*sizeof(int)) * for i from 0 <= i < l: # <<<<<<<<<<<<<< @@ -25467,7 +28492,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje __pyx_t_2 = __pyx_v_l; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":156 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":156 * p = <int*> malloc(l*sizeof(int)) * for i from 0 <= i < l: * p[i] = pattern[i] # <<<<<<<<<<<<<< @@ -25481,16 +28506,16 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje (__pyx_v_p[__pyx_v_i]) = __pyx_t_4; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":157 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":157 * for i from 0 <= i < l: * p[i] = pattern[i] * node = self._contains(p,l) # <<<<<<<<<<<<<< * free(p) * if node == NULL: */ - __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->__pyx_vtab)->_contains(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), __pyx_v_p, __pyx_v_l); + __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_contains(__pyx_v_self, __pyx_v_p, __pyx_v_l); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":158 * p[i] = pattern[i] * node = self._contains(p,l) * free(p) # <<<<<<<<<<<<<< @@ -25499,7 +28524,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje */ free(__pyx_v_p); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":159 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":159 * node = self._contains(p,l) * free(p) * if node == NULL: # <<<<<<<<<<<<<< @@ -25509,7 +28534,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje __pyx_t_5 = (__pyx_v_node == NULL); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":160 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":160 * free(p) * if node == NULL: * return False # <<<<<<<<<<<<<< @@ -25522,11 +28547,11 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L5; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":162 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":162 * return False * else: * return True # <<<<<<<<<<<<<< @@ -25540,7 +28565,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje __pyx_t_3 = 0; goto __pyx_L0; } - __pyx_L7:; + __pyx_L5:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -25554,7 +28579,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_3contains(PyObject *__pyx_v_self, PyObje return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":164 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":164 * return True * * cdef _Trie_Node* _contains(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<< @@ -25570,9 +28595,9 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("_contains"); + __Pyx_RefNannySetupContext("_contains", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":167 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":167 * cdef int i * cdef _Trie_Node* node * node = self.root[pattern[0]] # <<<<<<<<<<<<<< @@ -25581,7 +28606,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ */ __pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":168 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":168 * cdef _Trie_Node* node * node = self.root[pattern[0]] * i = 1 # <<<<<<<<<<<<<< @@ -25590,7 +28615,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ */ __pyx_v_i = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":169 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":169 * node = self.root[pattern[0]] * i = 1 * while node != NULL and i < pattern_len: # <<<<<<<<<<<<<< @@ -25607,7 +28632,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ } if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":170 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":170 * i = 1 * while node != NULL and i < pattern_len: * node = trie_find(node, pattern[i]) # <<<<<<<<<<<<<< @@ -25616,7 +28641,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ */ __pyx_v_node = __pyx_f_3_sa_trie_find(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":171 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":171 * while node != NULL and i < pattern_len: * node = trie_find(node, pattern[i]) * i = i+1 # <<<<<<<<<<<<<< @@ -25626,7 +28651,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ __pyx_v_i = (__pyx_v_i + 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":172 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":172 * node = trie_find(node, pattern[i]) * i = i+1 * return node # <<<<<<<<<<<<<< @@ -25642,7 +28667,18 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":174 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/ +static PyObject *__pyx_pw_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("toMap (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_7TrieMap_8toMap(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_flag)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":174 * return node * * def toMap(self, flag): # <<<<<<<<<<<<<< @@ -25650,8 +28686,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ * */ -static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/ -static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) { +static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag) { int __pyx_v_i; int __pyx_v_include_zeros; PyObject *__pyx_v_result = NULL; @@ -25664,9 +28699,9 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("toMap"); + __Pyx_RefNannySetupContext("toMap", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":177 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":177 * cdef int i, include_zeros * * if flag: # <<<<<<<<<<<<<< @@ -25676,7 +28711,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":178 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":178 * * if flag: * include_zeros=1 # <<<<<<<<<<<<<< @@ -25684,11 +28719,11 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject * include_zeros=0 */ __pyx_v_include_zeros = 1; - goto __pyx_L5; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":180 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":180 * include_zeros=1 * else: * include_zeros=0 # <<<<<<<<<<<<<< @@ -25697,9 +28732,9 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject */ __pyx_v_include_zeros = 0; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":181 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":181 * else: * include_zeros=0 * result = {} # <<<<<<<<<<<<<< @@ -25711,27 +28746,27 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":182 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":182 * include_zeros=0 * result = {} * for i from 0 <= i < self.V: # <<<<<<<<<<<<<< * if self.root[i] != NULL: * trie_node_to_map(self.root[i], result, (i,), include_zeros) */ - __pyx_t_3 = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->V; + __pyx_t_3 = __pyx_v_self->V; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":183 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":183 * result = {} * for i from 0 <= i < self.V: * if self.root[i] != NULL: # <<<<<<<<<<<<<< * trie_node_to_map(self.root[i], result, (i,), include_zeros) * return result */ - __pyx_t_1 = ((((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->root[__pyx_v_i]) != NULL); + __pyx_t_1 = ((__pyx_v_self->root[__pyx_v_i]) != NULL); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":184 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":184 * for i from 0 <= i < self.V: * if self.root[i] != NULL: * trie_node_to_map(self.root[i], result, (i,), include_zeros) # <<<<<<<<<<<<<< @@ -25741,20 +28776,20 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_f_3_sa_trie_node_to_map((((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)->root[__pyx_v_i]), ((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_4), __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_3_sa_trie_node_to_map((__pyx_v_self->root[__pyx_v_i]), ((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_4), __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L8; + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":185 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":185 * if self.root[i] != NULL: * trie_node_to_map(self.root[i], result, (i,), include_zeros) * return result # <<<<<<<<<<<<<< @@ -25780,16 +28815,9 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4toMap(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":200 - * cdef write_map(self, m, FILE* f) - * - * def __cinit__(self, fsarray=None, from_stats=None, from_binary=None, # <<<<<<<<<<<<<< - * precompute_rank=1000, precompute_secondary_rank=20, - * max_length=5, max_nonterminals=2, - */ - -static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fsarray = 0; PyObject *__pyx_v_from_stats = 0; PyObject *__pyx_v_from_binary = 0; @@ -25801,18 +28829,18 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb PyObject *__pyx_v_train_min_gap_size = 0; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__from_stats,&__pyx_n_s__from_binary,&__pyx_n_s__precompute_rank,&__pyx_n_s_70,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s_71,&__pyx_n_s__train_min_gap_size,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__from_stats,&__pyx_n_s__from_binary,&__pyx_n_s__precompute_rank,&__pyx_n_s_70,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s_71,&__pyx_n_s__train_min_gap_size,0}; PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":200 + * cdef write_map(self, m, FILE* f) + * + * def __cinit__(self, fsarray=None, from_stats=None, from_binary=None, # <<<<<<<<<<<<<< + * precompute_rank=1000, precompute_secondary_rank=20, + * max_length=5, max_nonterminals=2, + */ values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_None); @@ -25824,7 +28852,8 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb values[8] = ((PyObject *)__pyx_int_2); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); @@ -25838,7 +28867,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray); @@ -25886,7 +28915,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -25921,8 +28950,25 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_14Precomputation___cinit__(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_from_stats, __pyx_v_from_binary, __pyx_v_precompute_rank, __pyx_v_precompute_secondary_rank, __pyx_v_max_length, __pyx_v_max_nonterminals, __pyx_v_train_max_initial_size, __pyx_v_train_min_gap_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":204 +static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_from_stats, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_precompute_rank, PyObject *__pyx_v_precompute_secondary_rank, PyObject *__pyx_v_max_length, PyObject *__pyx_v_max_nonterminals, PyObject *__pyx_v_train_max_initial_size, PyObject *__pyx_v_train_min_gap_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":204 * max_length=5, max_nonterminals=2, * train_max_initial_size=10, train_min_gap_size=2): * self.precompute_rank = precompute_rank # <<<<<<<<<<<<<< @@ -25930,9 +28976,9 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb * self.max_length = max_length */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_precompute_rank); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precompute_rank = __pyx_t_1; + __pyx_v_self->precompute_rank = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":205 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":205 * train_max_initial_size=10, train_min_gap_size=2): * self.precompute_rank = precompute_rank * self.precompute_secondary_rank = precompute_secondary_rank # <<<<<<<<<<<<<< @@ -25940,9 +28986,9 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb * self.max_nonterminals = max_nonterminals */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_precompute_secondary_rank); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precompute_secondary_rank = __pyx_t_1; + __pyx_v_self->precompute_secondary_rank = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":206 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":206 * self.precompute_rank = precompute_rank * self.precompute_secondary_rank = precompute_secondary_rank * self.max_length = max_length # <<<<<<<<<<<<<< @@ -25950,9 +28996,9 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb * self.train_max_initial_size = train_max_initial_size */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_max_length); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_length = __pyx_t_1; + __pyx_v_self->max_length = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":207 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":207 * self.precompute_secondary_rank = precompute_secondary_rank * self.max_length = max_length * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< @@ -25960,9 +29006,9 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb * self.train_min_gap_size = train_min_gap_size */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_max_nonterminals); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_nonterminals = __pyx_t_1; + __pyx_v_self->max_nonterminals = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":208 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":208 * self.max_length = max_length * self.max_nonterminals = max_nonterminals * self.train_max_initial_size = train_max_initial_size # <<<<<<<<<<<<<< @@ -25970,9 +29016,9 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb * if from_binary: */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_train_max_initial_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_max_initial_size = __pyx_t_1; + __pyx_v_self->train_max_initial_size = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":209 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":209 * self.max_nonterminals = max_nonterminals * self.train_max_initial_size = train_max_initial_size * self.train_min_gap_size = train_min_gap_size # <<<<<<<<<<<<<< @@ -25980,9 +29026,9 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb * self.read_binary(from_binary) */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_train_min_gap_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_min_gap_size = __pyx_t_1; + __pyx_v_self->train_min_gap_size = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":210 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":210 * self.train_max_initial_size = train_max_initial_size * self.train_min_gap_size = train_min_gap_size * if from_binary: # <<<<<<<<<<<<<< @@ -25992,17 +29038,17 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":211 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":211 * self.train_min_gap_size = train_min_gap_size * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< * elif from_stats: * self.precompute(from_stats, fsarray) */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_from_binary); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_from_binary); __Pyx_GIVEREF(__pyx_v_from_binary); @@ -26011,10 +29057,10 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L6; + goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":212 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":212 * if from_binary: * self.read_binary(from_binary) * elif from_stats: # <<<<<<<<<<<<<< @@ -26024,17 +29070,17 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_stats); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":213 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":213 * self.read_binary(from_binary) * elif from_stats: * self.precompute(from_stats, fsarray) # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__precompute); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__precompute); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_from_stats); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_from_stats); __Pyx_GIVEREF(__pyx_v_from_stats); @@ -26046,9 +29092,9 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; __pyx_r = 0; goto __pyx_L0; @@ -26063,7 +29109,28 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":216 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_binary (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_14Precomputation_2read_binary(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":216 * * * def read_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -26071,9 +29138,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(PyObject *__pyx_v_self, PyOb * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_14Precomputation_1read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_14Precomputation_1read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -26081,18 +29146,9 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_1read_binary(PyObject *__pyx_v_s int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_binary"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("read_binary", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":218 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":218 * def read_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -26101,91 +29157,91 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_1read_binary(PyObject *__pyx_v_s */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":219 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":219 * cdef FILE* f * f = fopen(filename, "r") * fread(&(self.precompute_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fread(&(self.precompute_secondary_rank), sizeof(int), 1, f) * fread(&(self.max_length), sizeof(int), 1, f) */ - fread((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precompute_rank), (sizeof(int)), 1, __pyx_v_f); + fread((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":220 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":220 * f = fopen(filename, "r") * fread(&(self.precompute_rank), sizeof(int), 1, f) * fread(&(self.precompute_secondary_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fread(&(self.max_length), sizeof(int), 1, f) * fread(&(self.max_nonterminals), sizeof(int), 1, f) */ - fread((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); + fread((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":221 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":221 * fread(&(self.precompute_rank), sizeof(int), 1, f) * fread(&(self.precompute_secondary_rank), sizeof(int), 1, f) * fread(&(self.max_length), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fread(&(self.max_nonterminals), sizeof(int), 1, f) * fread(&(self.train_max_initial_size), sizeof(int), 1, f) */ - fread((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_length), (sizeof(int)), 1, __pyx_v_f); + fread((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":222 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":222 * fread(&(self.precompute_secondary_rank), sizeof(int), 1, f) * fread(&(self.max_length), sizeof(int), 1, f) * fread(&(self.max_nonterminals), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fread(&(self.train_max_initial_size), sizeof(int), 1, f) * fread(&(self.train_min_gap_size), sizeof(int), 1, f) */ - fread((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); + fread((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":223 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":223 * fread(&(self.max_length), sizeof(int), 1, f) * fread(&(self.max_nonterminals), sizeof(int), 1, f) * fread(&(self.train_max_initial_size), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fread(&(self.train_min_gap_size), sizeof(int), 1, f) * self.precomputed_index = self.read_map(f) */ - fread((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); + fread((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":224 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":224 * fread(&(self.max_nonterminals), sizeof(int), 1, f) * fread(&(self.train_max_initial_size), sizeof(int), 1, f) * fread(&(self.train_min_gap_size), sizeof(int), 1, f) # <<<<<<<<<<<<<< * self.precomputed_index = self.read_map(f) * self.precomputed_collocations = self.read_map(f) */ - fread((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); + fread((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":225 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":225 * fread(&(self.train_max_initial_size), sizeof(int), 1, f) * fread(&(self.train_min_gap_size), sizeof(int), 1, f) * self.precomputed_index = self.read_map(f) # <<<<<<<<<<<<<< * self.precomputed_collocations = self.read_map(f) * fclose(f) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->__pyx_vtab)->read_map(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_index); - __Pyx_DECREF(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_index); - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_index = __pyx_t_1; + __Pyx_GOTREF(__pyx_v_self->precomputed_index); + __Pyx_DECREF(__pyx_v_self->precomputed_index); + __pyx_v_self->precomputed_index = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":226 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":226 * fread(&(self.train_min_gap_size), sizeof(int), 1, f) * self.precomputed_index = self.read_map(f) * self.precomputed_collocations = self.read_map(f) # <<<<<<<<<<<<<< * fclose(f) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->__pyx_vtab)->read_map(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations); - __Pyx_DECREF(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations); - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations = __pyx_t_1; + __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); + __Pyx_DECREF(__pyx_v_self->precomputed_collocations); + __pyx_v_self->precomputed_collocations = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":227 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":227 * self.precomputed_index = self.read_map(f) * self.precomputed_collocations = self.read_map(f) * fclose(f) # <<<<<<<<<<<<<< @@ -26206,7 +29262,28 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_1read_binary(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":230 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_binary (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_14Precomputation_4write_binary(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":230 * * * def write_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -26214,9 +29291,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_1read_binary(PyObject *__pyx_v_s * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_14Precomputation_2write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_14Precomputation_2write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -26225,18 +29300,9 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2write_binary(PyObject *__pyx_v_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_binary"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_binary", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":232 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":232 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -26245,89 +29311,89 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2write_binary(PyObject *__pyx_v_ */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":233 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":233 * cdef FILE* f * f = fopen(filename, "w") * fwrite(&(self.precompute_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f) * fwrite(&(self.max_length), sizeof(int), 1, f) */ - fwrite((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precompute_rank), (sizeof(int)), 1, __pyx_v_f); + fwrite((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":234 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":234 * f = fopen(filename, "w") * fwrite(&(self.precompute_rank), sizeof(int), 1, f) * fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fwrite(&(self.max_length), sizeof(int), 1, f) * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) */ - fwrite((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); + fwrite((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":235 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":235 * fwrite(&(self.precompute_rank), sizeof(int), 1, f) * fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f) * fwrite(&(self.max_length), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) */ - fwrite((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_length), (sizeof(int)), 1, __pyx_v_f); + fwrite((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":236 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":236 * fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f) * fwrite(&(self.max_length), sizeof(int), 1, f) * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) */ - fwrite((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); + fwrite((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":237 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":237 * fwrite(&(self.max_length), sizeof(int), 1, f) * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) # <<<<<<<<<<<<<< * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) * self.write_map(self.precomputed_index, f) */ - fwrite((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); + fwrite((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":238 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":238 * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) # <<<<<<<<<<<<<< * self.write_map(self.precomputed_index, f) * self.write_map(self.precomputed_collocations, f) */ - fwrite((&((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); + fwrite((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":239 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":239 * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) * self.write_map(self.precomputed_index, f) # <<<<<<<<<<<<<< * self.write_map(self.precomputed_collocations, f) * fclose(f) */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_index; + __pyx_t_1 = __pyx_v_self->precomputed_index; __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->__pyx_vtab)->write_map(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":240 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":240 * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) * self.write_map(self.precomputed_index, f) * self.write_map(self.precomputed_collocations, f) # <<<<<<<<<<<<<< * fclose(f) * */ - __pyx_t_2 = ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations; + __pyx_t_2 = __pyx_v_self->precomputed_collocations; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->__pyx_vtab)->write_map(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":241 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":241 * self.write_map(self.precomputed_index, f) * self.write_map(self.precomputed_collocations, f) * fclose(f) # <<<<<<<<<<<<<< @@ -26349,7 +29415,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2write_binary(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":244 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":244 * * * cdef write_map(self, m, FILE* f): # <<<<<<<<<<<<<< @@ -26357,7 +29423,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2write_binary(PyObject *__pyx_v_ * cdef IntList arr */ -static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_m, FILE *__pyx_v_f) { +static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_m, FILE *__pyx_v_f) { int __pyx_v_i; int __pyx_v_N; struct __pyx_obj_3_sa_IntList *__pyx_v_arr = 0; @@ -26368,21 +29434,19 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *(*__pyx_t_4)(PyObject *); + Py_ssize_t __pyx_t_3; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *(*__pyx_t_8)(PyObject *); - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_t_11; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_map"); + __Pyx_RefNannySetupContext("write_map", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":248 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":248 * cdef IntList arr * * N = len(m) # <<<<<<<<<<<<<< @@ -26392,7 +29456,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P __pyx_t_1 = PyObject_Length(__pyx_v_m); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_N = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":249 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":249 * * N = len(m) * fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -26401,87 +29465,29 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P */ fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":250 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":250 * N = len(m) * fwrite(&(N), sizeof(int), 1, f) * for pattern, val in m.iteritems(): # <<<<<<<<<<<<<< * N = len(pattern) * fwrite(&(N), sizeof(int), 1, f) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_m, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __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[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_1 = 0; + if (unlikely(__pyx_v_m == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - } else { - __pyx_t_3 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L6_unpacking_done:; - } + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_m, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + while (1) { + __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_3, &__pyx_t_1, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4); + if (unlikely(__pyx_t_7 == 0)) break; + if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF(__pyx_v_pattern); __pyx_v_pattern = __pyx_t_5; __pyx_t_5 = 0; @@ -26489,17 +29495,17 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P __pyx_v_val = __pyx_t_6; __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":251 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":251 * fwrite(&(N), sizeof(int), 1, f) * for pattern, val in m.iteritems(): * N = len(pattern) # <<<<<<<<<<<<<< * fwrite(&(N), sizeof(int), 1, f) * for word_id in pattern: */ - __pyx_t_9 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_N = __pyx_t_9; + __pyx_t_8 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_N = __pyx_t_8; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":252 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":252 * for pattern, val in m.iteritems(): * N = len(pattern) * fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -26508,7 +29514,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P */ fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":253 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":253 * N = len(pattern) * fwrite(&(N), sizeof(int), 1, f) * for word_id in pattern: # <<<<<<<<<<<<<< @@ -26516,46 +29522,54 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P * fwrite(&(i), sizeof(int), 1, f) */ if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) { - __pyx_t_3 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; - __pyx_t_10 = NULL; + __pyx_t_6 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_3)) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; - } else if (PyTuple_CheckExact(__pyx_t_3)) { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_6)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_6)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { - __pyx_t_6 = __pyx_t_10(__pyx_t_3); - if (unlikely(!__pyx_t_6)) { + __pyx_t_5 = __pyx_t_9(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_5); } __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_word_id = __pyx_t_5; + __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":254 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":254 * fwrite(&(N), sizeof(int), 1, f) * for word_id in pattern: * i = word_id # <<<<<<<<<<<<<< * fwrite(&(i), sizeof(int), 1, f) * arr = val */ - __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_i = __pyx_t_11; + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_i = __pyx_t_7; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":255 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":255 * for word_id in pattern: * i = word_id * fwrite(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -26564,9 +29578,9 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P */ fwrite((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f); } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":256 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":256 * i = word_id * fwrite(&(i), sizeof(int), 1, f) * arr = val # <<<<<<<<<<<<<< @@ -26578,7 +29592,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P __Pyx_XDECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_val); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":257 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":257 * fwrite(&(i), sizeof(int), 1, f) * arr = val * arr.write_handle(f) # <<<<<<<<<<<<<< @@ -26593,10 +29607,8 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("_sa.Precomputation.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -26609,7 +29621,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":260 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":260 * * * cdef read_map(self, FILE* f): # <<<<<<<<<<<<<< @@ -26617,10 +29629,10 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(struct __pyx_obj_3_sa_P * cdef IntList arr */ -static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, FILE *__pyx_v_f) { +static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, FILE *__pyx_v_f) { int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; + CYTHON_UNUSED int __pyx_v_j; + CYTHON_UNUSED int __pyx_v_k; int __pyx_v_word_id; int __pyx_v_N; struct __pyx_obj_3_sa_IntList *__pyx_v_arr = 0; @@ -26635,9 +29647,9 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_map"); + __Pyx_RefNannySetupContext("read_map", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":264 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":264 * cdef IntList arr * * m = {} # <<<<<<<<<<<<<< @@ -26649,7 +29661,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr __pyx_v_m = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":265 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":265 * * m = {} * fread(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -26658,7 +29670,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr */ fread((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":266 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":266 * m = {} * fread(&(N), sizeof(int), 1, f) * for j from 0 <= j < N: # <<<<<<<<<<<<<< @@ -26668,7 +29680,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr __pyx_t_2 = __pyx_v_N; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":267 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":267 * fread(&(N), sizeof(int), 1, f) * for j from 0 <= j < N: * fread(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -26677,7 +29689,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr */ fread((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":268 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":268 * for j from 0 <= j < N: * fread(&(i), sizeof(int), 1, f) * key = () # <<<<<<<<<<<<<< @@ -26688,7 +29700,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr __Pyx_XDECREF(((PyObject *)__pyx_v_key)); __pyx_v_key = __pyx_empty_tuple; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":269 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":269 * fread(&(i), sizeof(int), 1, f) * key = () * for k from 0 <= k < i: # <<<<<<<<<<<<<< @@ -26698,7 +29710,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr __pyx_t_3 = __pyx_v_i; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":270 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":270 * key = () * for k from 0 <= k < i: * fread(&(word_id), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -26707,7 +29719,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr */ fread((&__pyx_v_word_id), (sizeof(int)), 1, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":271 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":271 * for k from 0 <= k < i: * fread(&(word_id), sizeof(int), 1, f) * key = key + (word_id,) # <<<<<<<<<<<<<< @@ -26717,7 +29729,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr __pyx_t_1 = PyInt_FromLong(__pyx_v_word_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -26729,7 +29741,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr __pyx_t_1 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":272 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":272 * fread(&(word_id), sizeof(int), 1, f) * key = key + (word_id,) * arr = IntList() # <<<<<<<<<<<<<< @@ -26742,7 +29754,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":273 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":273 * key = key + (word_id,) * arr = IntList() * arr.read_handle(f) # <<<<<<<<<<<<<< @@ -26751,7 +29763,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->read_handle(__pyx_v_arr, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":274 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":274 * arr = IntList() * arr.read_handle(f) * m[key] = arr # <<<<<<<<<<<<<< @@ -26761,7 +29773,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr if (PyDict_SetItem(((PyObject *)__pyx_v_m), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":275 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":275 * arr.read_handle(f) * m[key] = arr * return m # <<<<<<<<<<<<<< @@ -26789,7 +29801,68 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":278 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_stats = 0; + struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sarray = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("precompute (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__stats,&__pyx_n_s__sarray,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stats)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sarray)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "precompute") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_stats = values[0]; + __pyx_v_sarray = ((struct __pyx_obj_3_sa_SuffixArray *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sarray), __pyx_ptype_3_sa_SuffixArray, 1, "sarray", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_14Precomputation_6precompute(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), __pyx_v_stats, __pyx_v_sarray); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":278 * * * def precompute(self, stats, SuffixArray sarray): # <<<<<<<<<<<<<< @@ -26797,10 +29870,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(struct __pyx_obj_3_sa_Pr * cdef DataArray darray = sarray.darray */ -static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_stats = 0; - struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sarray = 0; +static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sarray) { int __pyx_v_i; int __pyx_v_l; int __pyx_v_N; @@ -26833,7 +29903,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se PyObject *__pyx_v_pattern_rank = NULL; float __pyx_v_start_time; PyObject *__pyx_v_rank = NULL; - PyObject *__pyx_v__ = NULL; + CYTHON_UNUSED PyObject *__pyx_v__ = NULL; PyObject *__pyx_v_phrase = NULL; int __pyx_v_sa_word_id; PyObject *__pyx_v_x = NULL; @@ -26848,7 +29918,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se PyObject *__pyx_v_arity = NULL; PyObject *__pyx_v_cumul_cost = NULL; PyObject *__pyx_v_cumul_count = NULL; - Py_ssize_t __pyx_v_num_found_patterns; + PyObject *__pyx_v_num_found_patterns = NULL; float __pyx_v_stop_time; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -26875,54 +29945,9 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__stats,&__pyx_n_s__sarray,0}; - __Pyx_RefNannySetupContext("precompute"); - { - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stats); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sarray); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "precompute") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_stats = values[0]; - __pyx_v_sarray = ((struct __pyx_obj_3_sa_SuffixArray *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sarray), __pyx_ptype_3_sa_SuffixArray, 1, "sarray", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("precompute", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":280 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":280 * def precompute(self, stats, SuffixArray sarray): * cdef int i, l, N, max_pattern_len, i1, l1, i2, l2, i3, l3, ptr1, ptr2, ptr3, is_super, sent_count, max_rank * cdef DataArray darray = sarray.darray # <<<<<<<<<<<<<< @@ -26932,7 +29957,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_INCREF(((PyObject *)__pyx_v_sarray->darray)); __pyx_v_darray = __pyx_v_sarray->darray; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":285 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":285 * cdef _Trie_Node* node * * data = darray.data # <<<<<<<<<<<<<< @@ -26942,7 +29967,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_INCREF(((PyObject *)__pyx_v_darray->data)); __pyx_v_data = __pyx_v_darray->data; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":287 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":287 * data = darray.data * * frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< @@ -26956,7 +29981,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 287; __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[11]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -26966,7 +29991,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_frequent_patterns = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":288 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":288 * * frequent_patterns = TrieMap(len(darray.id2word)) * super_frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< @@ -26980,7 +30005,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 288; __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[11]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -26990,7 +30015,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_super_frequent_patterns = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":289 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":289 * frequent_patterns = TrieMap(len(darray.id2word)) * super_frequent_patterns = TrieMap(len(darray.id2word)) * collocations = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< @@ -27004,7 +30029,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 289; __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[11]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -27014,7 +30039,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_collocations = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":291 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":291 * collocations = TrieMap(len(darray.id2word)) * * I_set = set() # <<<<<<<<<<<<<< @@ -27026,7 +30051,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_I_set = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":292 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":292 * * I_set = set() * J_set = set() # <<<<<<<<<<<<<< @@ -27038,7 +30063,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_J_set = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":293 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":293 * I_set = set() * J_set = set() * J2_set = set() # <<<<<<<<<<<<<< @@ -27050,7 +30075,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_J2_set = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":294 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":294 * J_set = set() * J2_set = set() * IJ_set = set() # <<<<<<<<<<<<<< @@ -27062,7 +30087,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_IJ_set = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":295 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":295 * J2_set = set() * IJ_set = set() * pattern_rank = {} # <<<<<<<<<<<<<< @@ -27074,7 +30099,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_pattern_rank = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":297 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":297 * pattern_rank = {} * * logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<< @@ -27091,7 +30116,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":298 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":298 * * logger.info("Precomputing frequent intersections") * cdef float start_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -27100,7 +30125,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_start_time = __pyx_f_3_sa_monitor_cpu(); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":300 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":300 * cdef float start_time = monitor_cpu() * * max_pattern_len = 0 # <<<<<<<<<<<<<< @@ -27109,7 +30134,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_max_pattern_len = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":301 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":301 * * max_pattern_len = 0 * for rank, (_, _, phrase) in enumerate(stats): # <<<<<<<<<<<<<< @@ -27127,12 +30152,20 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_3)) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_3)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_5 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_5)) { @@ -27146,21 +30179,22 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se } if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { PyObject* sequence = __pyx_t_5; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_6 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); __pyx_t_8 = PyList_GET_ITEM(sequence, 2); @@ -27168,28 +30202,35 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed; + index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); - index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed; + index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); - index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; + index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_unpacking_done; - __pyx_L8_unpacking_failed:; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L9_unpacking_done:; + __pyx_L6_unpacking_done:; } __Pyx_XDECREF(__pyx_v__); __pyx_v__ = __pyx_t_6; @@ -27209,35 +30250,34 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":302 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":302 * max_pattern_len = 0 * for rank, (_, _, phrase) in enumerate(stats): * if rank >= self.precompute_rank: # <<<<<<<<<<<<<< * break * max_pattern_len = max(max_pattern_len, len(phrase)) */ - __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precompute_rank); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->precompute_rank); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_5, Py_GE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_8 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":303 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":303 * for rank, (_, _, phrase) in enumerate(stats): * if rank >= self.precompute_rank: * break # <<<<<<<<<<<<<< * max_pattern_len = max(max_pattern_len, len(phrase)) * frequent_patterns.insert(phrase) */ - goto __pyx_L7_break; - goto __pyx_L10; + goto __pyx_L4_break; + goto __pyx_L7; } - __pyx_L10:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":304 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":304 * if rank >= self.precompute_rank: * break * max_pattern_len = max(max_pattern_len, len(phrase)) # <<<<<<<<<<<<<< @@ -27253,7 +30293,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se } __pyx_v_max_pattern_len = __pyx_t_14; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":305 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":305 * break * max_pattern_len = max(max_pattern_len, len(phrase)) * frequent_patterns.insert(phrase) # <<<<<<<<<<<<<< @@ -27263,7 +30303,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s__insert); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_phrase); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_phrase); __Pyx_GIVEREF(__pyx_v_phrase); @@ -27273,19 +30313,16 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":306 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":306 * max_pattern_len = max(max_pattern_len, len(phrase)) * frequent_patterns.insert(phrase) * I_set.add(phrase) # <<<<<<<<<<<<<< * pattern_rank[phrase] = rank * if rank < self.precompute_secondary_rank: */ - if (unlikely(((PyObject *)__pyx_v_I_set) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add"); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PySet_Add(__pyx_v_I_set, __pyx_v_phrase); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":307 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":307 * frequent_patterns.insert(phrase) * I_set.add(phrase) * pattern_rank[phrase] = rank # <<<<<<<<<<<<<< @@ -27294,23 +30331,22 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ if (PyDict_SetItem(((PyObject *)__pyx_v_pattern_rank), __pyx_v_phrase, __pyx_v_rank) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":308 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":308 * I_set.add(phrase) * pattern_rank[phrase] = rank * if rank < self.precompute_secondary_rank: # <<<<<<<<<<<<<< * super_frequent_patterns.insert(phrase) * J_set.add(phrase) */ - __pyx_t_7 = PyInt_FromLong(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precompute_secondary_rank); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromLong(__pyx_v_self->precompute_secondary_rank); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_7, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":309 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":309 * pattern_rank[phrase] = rank * if rank < self.precompute_secondary_rank: * super_frequent_patterns.insert(phrase) # <<<<<<<<<<<<<< @@ -27320,7 +30356,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_super_frequent_patterns), __pyx_n_s__insert); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_phrase); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_phrase); __Pyx_GIVEREF(__pyx_v_phrase); @@ -27330,26 +30366,23 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":310 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":310 * if rank < self.precompute_secondary_rank: * super_frequent_patterns.insert(phrase) * J_set.add(phrase) # <<<<<<<<<<<<<< * * queue = IntList(increment=1000) */ - if (unlikely(((PyObject *)__pyx_v_J_set) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add"); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PySet_Add(__pyx_v_J_set, __pyx_v_phrase); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L11; + goto __pyx_L8; } - __pyx_L11:; + __pyx_L8:; } - __pyx_L7_break:; + __pyx_L4_break:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":312 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":312 * J_set.add(phrase) * * queue = IntList(increment=1000) # <<<<<<<<<<<<<< @@ -27359,13 +30392,13 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__increment), __pyx_int_1000) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_queue = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":314 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":314 * queue = IntList(increment=1000) * * logger.info(" Computing inverted indexes...") # <<<<<<<<<<<<<< @@ -27382,7 +30415,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":315 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":315 * * logger.info(" Computing inverted indexes...") * N = len(data) # <<<<<<<<<<<<<< @@ -27392,7 +30425,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_data)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_N = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":316 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":316 * logger.info(" Computing inverted indexes...") * N = len(data) * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -27402,7 +30435,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_13 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_13; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":317 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":317 * N = len(data) * for i from 0 <= i < N: * sa_word_id = data.arr[i] # <<<<<<<<<<<<<< @@ -27411,7 +30444,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_sa_word_id = (__pyx_v_data->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":318 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":318 * for i from 0 <= i < N: * sa_word_id = data.arr[i] * if sa_word_id == 1: # <<<<<<<<<<<<<< @@ -27421,7 +30454,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_11 = (__pyx_v_sa_word_id == 1); if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":319 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":319 * sa_word_id = data.arr[i] * if sa_word_id == 1: * queue._append(-1) # <<<<<<<<<<<<<< @@ -27429,11 +30462,11 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se * for l from 1 <= l <= max_pattern_len: */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, -1); - goto __pyx_L14; + goto __pyx_L11; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":321 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":321 * queue._append(-1) * else: * for l from 1 <= l <= max_pattern_len: # <<<<<<<<<<<<<< @@ -27443,7 +30476,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_16 = __pyx_v_max_pattern_len; for (__pyx_v_l = 1; __pyx_v_l <= __pyx_t_16; __pyx_v_l++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":322 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":322 * else: * for l from 1 <= l <= max_pattern_len: * node = frequent_patterns._contains(data.arr+i, l) # <<<<<<<<<<<<<< @@ -27452,7 +30485,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i), __pyx_v_l); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":323 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":323 * for l from 1 <= l <= max_pattern_len: * node = frequent_patterns._contains(data.arr+i, l) * if node == NULL: # <<<<<<<<<<<<<< @@ -27462,19 +30495,19 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_11 = (__pyx_v_node == NULL); if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":324 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":324 * node = frequent_patterns._contains(data.arr+i, l) * if node == NULL: * break # <<<<<<<<<<<<<< * queue._append(i) * queue._append(l) */ - goto __pyx_L16_break; - goto __pyx_L17; + goto __pyx_L13_break; + goto __pyx_L14; } - __pyx_L17:; + __pyx_L14:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":325 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":325 * if node == NULL: * break * queue._append(i) # <<<<<<<<<<<<<< @@ -27483,7 +30516,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_i); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":326 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":326 * break * queue._append(i) * queue._append(l) # <<<<<<<<<<<<<< @@ -27492,7 +30525,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_l); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":327 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":327 * queue._append(i) * queue._append(l) * trie_node_data_append(node, i) # <<<<<<<<<<<<<< @@ -27503,12 +30536,12 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_L16_break:; + __pyx_L13_break:; } - __pyx_L14:; + __pyx_L11:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":329 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":329 * trie_node_data_append(node, i) * * logger.info(" Computing collocations...") # <<<<<<<<<<<<<< @@ -27525,7 +30558,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":330 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":330 * * logger.info(" Computing collocations...") * N = len(queue) # <<<<<<<<<<<<<< @@ -27535,7 +30568,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_queue)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_N = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":331 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":331 * logger.info(" Computing collocations...") * N = len(queue) * ptr1 = 0 # <<<<<<<<<<<<<< @@ -27544,7 +30577,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_ptr1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":332 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":332 * N = len(queue) * ptr1 = 0 * sent_count = 0 # <<<<<<<<<<<<<< @@ -27553,7 +30586,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_sent_count = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":333 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":333 * ptr1 = 0 * sent_count = 0 * while ptr1 < N: # main loop # <<<<<<<<<<<<<< @@ -27564,7 +30597,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_11 = (__pyx_v_ptr1 < __pyx_v_N); if (!__pyx_t_11) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":334 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":334 * sent_count = 0 * while ptr1 < N: # main loop * i1 = queue.arr[ptr1] # <<<<<<<<<<<<<< @@ -27573,7 +30606,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_i1 = (__pyx_v_queue->arr[__pyx_v_ptr1]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":335 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":335 * while ptr1 < N: # main loop * i1 = queue.arr[ptr1] * if i1 > -1: # <<<<<<<<<<<<<< @@ -27583,7 +30616,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_11 = (__pyx_v_i1 > -1); if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":336 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":336 * i1 = queue.arr[ptr1] * if i1 > -1: * l1 = queue.arr[ptr1+1] # <<<<<<<<<<<<<< @@ -27592,7 +30625,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_l1 = (__pyx_v_queue->arr[(__pyx_v_ptr1 + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":337 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":337 * if i1 > -1: * l1 = queue.arr[ptr1+1] * ptr2 = ptr1 + 2 # <<<<<<<<<<<<<< @@ -27601,7 +30634,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_ptr2 = (__pyx_v_ptr1 + 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":338 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":338 * l1 = queue.arr[ptr1+1] * ptr2 = ptr1 + 2 * while ptr2 < N: # <<<<<<<<<<<<<< @@ -27612,7 +30645,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_11 = (__pyx_v_ptr2 < __pyx_v_N); if (!__pyx_t_11) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":339 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":339 * ptr2 = ptr1 + 2 * while ptr2 < N: * i2 = queue.arr[ptr2] # <<<<<<<<<<<<<< @@ -27621,7 +30654,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_i2 = (__pyx_v_queue->arr[__pyx_v_ptr2]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":340 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":340 * while ptr2 < N: * i2 = queue.arr[ptr2] * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -27630,26 +30663,26 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_t_11 = (__pyx_v_i2 == -1); if (!__pyx_t_11) { - __pyx_t_17 = ((__pyx_v_i2 - __pyx_v_i1) >= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_max_initial_size); + __pyx_t_17 = ((__pyx_v_i2 - __pyx_v_i1) >= __pyx_v_self->train_max_initial_size); __pyx_t_18 = __pyx_t_17; } else { __pyx_t_18 = __pyx_t_11; } if (__pyx_t_18) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":341 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":341 * i2 = queue.arr[ptr2] * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: * break # <<<<<<<<<<<<<< * l2 = queue.arr[ptr2+1] * if (i2 - i1 - l1 >= self.train_min_gap_size and */ - goto __pyx_L22_break; - goto __pyx_L23; + goto __pyx_L19_break; + goto __pyx_L20; } - __pyx_L23:; + __pyx_L20:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":342 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":342 * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: * break * l2 = queue.arr[ptr2+1] # <<<<<<<<<<<<<< @@ -27658,34 +30691,34 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_l2 = (__pyx_v_queue->arr[(__pyx_v_ptr2 + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":343 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":343 * break * l2 = queue.arr[ptr2+1] * if (i2 - i1 - l1 >= self.train_min_gap_size and # <<<<<<<<<<<<<< * i2 + l2 - i1 <= self.train_max_initial_size and * l1+l2+1 <= self.max_length): */ - __pyx_t_18 = (((__pyx_v_i2 - __pyx_v_i1) - __pyx_v_l1) >= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_min_gap_size); + __pyx_t_18 = (((__pyx_v_i2 - __pyx_v_i1) - __pyx_v_l1) >= __pyx_v_self->train_min_gap_size); if (__pyx_t_18) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":344 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":344 * l2 = queue.arr[ptr2+1] * if (i2 - i1 - l1 >= self.train_min_gap_size and * i2 + l2 - i1 <= self.train_max_initial_size and # <<<<<<<<<<<<<< * l1+l2+1 <= self.max_length): * node = collocations._insert(data.arr+i1, l1) */ - __pyx_t_11 = (((__pyx_v_i2 + __pyx_v_l2) - __pyx_v_i1) <= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_max_initial_size); + __pyx_t_11 = (((__pyx_v_i2 + __pyx_v_l2) - __pyx_v_i1) <= __pyx_v_self->train_max_initial_size); if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":345 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":345 * if (i2 - i1 - l1 >= self.train_min_gap_size and * i2 + l2 - i1 <= self.train_max_initial_size and * l1+l2+1 <= self.max_length): # <<<<<<<<<<<<<< * node = collocations._insert(data.arr+i1, l1) * node = trie_insert(node, -1) */ - __pyx_t_17 = (((__pyx_v_l1 + __pyx_v_l2) + 1) <= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_length); + __pyx_t_17 = (((__pyx_v_l1 + __pyx_v_l2) + 1) <= __pyx_v_self->max_length); __pyx_t_19 = __pyx_t_17; } else { __pyx_t_19 = __pyx_t_11; @@ -27696,7 +30729,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se } if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":346 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":346 * i2 + l2 - i1 <= self.train_max_initial_size and * l1+l2+1 <= self.max_length): * node = collocations._insert(data.arr+i1, l1) # <<<<<<<<<<<<<< @@ -27705,7 +30738,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_collocations->__pyx_vtab)->_insert(__pyx_v_collocations, (__pyx_v_data->arr + __pyx_v_i1), __pyx_v_l1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":347 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":347 * l1+l2+1 <= self.max_length): * node = collocations._insert(data.arr+i1, l1) * node = trie_insert(node, -1) # <<<<<<<<<<<<<< @@ -27714,7 +30747,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":348 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":348 * node = collocations._insert(data.arr+i1, l1) * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<< @@ -27724,7 +30757,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_13 = (__pyx_v_i2 + __pyx_v_l2); for (__pyx_v_i = __pyx_v_i2; __pyx_v_i < __pyx_t_13; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":349 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":349 * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<< @@ -27734,7 +30767,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":350 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":350 * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) * trie_node_data_append(node, i1) # <<<<<<<<<<<<<< @@ -27745,7 +30778,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":351 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":351 * node = trie_insert(node, data.arr[i]) * trie_node_data_append(node, i1) * trie_node_data_append(node, i2) # <<<<<<<<<<<<<< @@ -27756,7 +30789,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":352 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":352 * trie_node_data_append(node, i1) * trie_node_data_append(node, i2) * if super_frequent_patterns._contains(data.arr+i2, l2) != NULL: # <<<<<<<<<<<<<< @@ -27766,7 +30799,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_11 = (((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_super_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_super_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i2), __pyx_v_l2) != NULL); if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":353 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":353 * trie_node_data_append(node, i2) * if super_frequent_patterns._contains(data.arr+i2, l2) != NULL: * if super_frequent_patterns._contains(data.arr+i1, l1) != NULL: # <<<<<<<<<<<<<< @@ -27776,7 +30809,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_11 = (((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_super_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_super_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i1), __pyx_v_l1) != NULL); if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":354 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":354 * if super_frequent_patterns._contains(data.arr+i2, l2) != NULL: * if super_frequent_patterns._contains(data.arr+i1, l1) != NULL: * is_super = 1 # <<<<<<<<<<<<<< @@ -27784,11 +30817,11 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se * is_super = 0 */ __pyx_v_is_super = 1; - goto __pyx_L28; + goto __pyx_L25; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":356 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":356 * is_super = 1 * else: * is_super = 0 # <<<<<<<<<<<<<< @@ -27797,9 +30830,9 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_is_super = 0; } - __pyx_L28:; + __pyx_L25:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":357 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":357 * else: * is_super = 0 * ptr3 = ptr2 + 2 # <<<<<<<<<<<<<< @@ -27808,7 +30841,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_ptr3 = (__pyx_v_ptr2 + 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":358 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":358 * is_super = 0 * ptr3 = ptr2 + 2 * while ptr3 < N: # <<<<<<<<<<<<<< @@ -27819,7 +30852,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_11 = (__pyx_v_ptr3 < __pyx_v_N); if (!__pyx_t_11) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":359 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":359 * ptr3 = ptr2 + 2 * while ptr3 < N: * i3 = queue.arr[ptr3] # <<<<<<<<<<<<<< @@ -27828,7 +30861,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_i3 = (__pyx_v_queue->arr[__pyx_v_ptr3]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":360 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":360 * while ptr3 < N: * i3 = queue.arr[ptr3] * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -27837,26 +30870,26 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_t_11 = (__pyx_v_i3 == -1); if (!__pyx_t_11) { - __pyx_t_18 = ((__pyx_v_i3 - __pyx_v_i1) >= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_max_initial_size); + __pyx_t_18 = ((__pyx_v_i3 - __pyx_v_i1) >= __pyx_v_self->train_max_initial_size); __pyx_t_19 = __pyx_t_18; } else { __pyx_t_19 = __pyx_t_11; } if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":361 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":361 * i3 = queue.arr[ptr3] * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: * break # <<<<<<<<<<<<<< * l3 = queue.arr[ptr3+1] * if (i3 - i2 - l2 >= self.train_min_gap_size and */ - goto __pyx_L30_break; - goto __pyx_L31; + goto __pyx_L27_break; + goto __pyx_L28; } - __pyx_L31:; + __pyx_L28:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":362 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":362 * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: * break * l3 = queue.arr[ptr3+1] # <<<<<<<<<<<<<< @@ -27865,34 +30898,34 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_l3 = (__pyx_v_queue->arr[(__pyx_v_ptr3 + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":363 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":363 * break * l3 = queue.arr[ptr3+1] * if (i3 - i2 - l2 >= self.train_min_gap_size and # <<<<<<<<<<<<<< * i3 + l3 - i1 <= self.train_max_initial_size and * l1+l2+l3+2 <= self.max_length): */ - __pyx_t_19 = (((__pyx_v_i3 - __pyx_v_i2) - __pyx_v_l2) >= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_min_gap_size); + __pyx_t_19 = (((__pyx_v_i3 - __pyx_v_i2) - __pyx_v_l2) >= __pyx_v_self->train_min_gap_size); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":364 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":364 * l3 = queue.arr[ptr3+1] * if (i3 - i2 - l2 >= self.train_min_gap_size and * i3 + l3 - i1 <= self.train_max_initial_size and # <<<<<<<<<<<<<< * l1+l2+l3+2 <= self.max_length): * if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL: */ - __pyx_t_11 = (((__pyx_v_i3 + __pyx_v_l3) - __pyx_v_i1) <= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->train_max_initial_size); + __pyx_t_11 = (((__pyx_v_i3 + __pyx_v_l3) - __pyx_v_i1) <= __pyx_v_self->train_max_initial_size); if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":365 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":365 * if (i3 - i2 - l2 >= self.train_min_gap_size and * i3 + l3 - i1 <= self.train_max_initial_size and * l1+l2+l3+2 <= self.max_length): # <<<<<<<<<<<<<< * if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL: * node = collocations._insert(data.arr+i1, l1) */ - __pyx_t_18 = ((((__pyx_v_l1 + __pyx_v_l2) + __pyx_v_l3) + 2) <= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_length); + __pyx_t_18 = ((((__pyx_v_l1 + __pyx_v_l2) + __pyx_v_l3) + 2) <= __pyx_v_self->max_length); __pyx_t_17 = __pyx_t_18; } else { __pyx_t_17 = __pyx_t_11; @@ -27903,7 +30936,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se } if (__pyx_t_11) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":366 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":366 * i3 + l3 - i1 <= self.train_max_initial_size and * l1+l2+l3+2 <= self.max_length): * if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL: # <<<<<<<<<<<<<< @@ -27918,7 +30951,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se } if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":367 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":367 * l1+l2+l3+2 <= self.max_length): * if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL: * node = collocations._insert(data.arr+i1, l1) # <<<<<<<<<<<<<< @@ -27927,7 +30960,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_collocations->__pyx_vtab)->_insert(__pyx_v_collocations, (__pyx_v_data->arr + __pyx_v_i1), __pyx_v_l1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":368 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":368 * if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL: * node = collocations._insert(data.arr+i1, l1) * node = trie_insert(node, -1) # <<<<<<<<<<<<<< @@ -27936,7 +30969,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":369 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":369 * node = collocations._insert(data.arr+i1, l1) * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<< @@ -27946,7 +30979,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_13 = (__pyx_v_i2 + __pyx_v_l2); for (__pyx_v_i = __pyx_v_i2; __pyx_v_i < __pyx_t_13; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":370 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":370 * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<< @@ -27956,7 +30989,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":371 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":371 * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) * node = trie_insert(node, -1) # <<<<<<<<<<<<<< @@ -27965,7 +30998,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":372 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":372 * node = trie_insert(node, data.arr[i]) * node = trie_insert(node, -1) * for i from i3 <= i < i3+l3: # <<<<<<<<<<<<<< @@ -27975,7 +31008,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_13 = (__pyx_v_i3 + __pyx_v_l3); for (__pyx_v_i = __pyx_v_i3; __pyx_v_i < __pyx_t_13; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":373 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":373 * node = trie_insert(node, -1) * for i from i3 <= i < i3+l3: * node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<< @@ -27985,7 +31018,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":374 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":374 * for i from i3 <= i < i3+l3: * node = trie_insert(node, data.arr[i]) * trie_node_data_append(node, i1) # <<<<<<<<<<<<<< @@ -27996,7 +31029,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":375 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":375 * node = trie_insert(node, data.arr[i]) * trie_node_data_append(node, i1) * trie_node_data_append(node, i2) # <<<<<<<<<<<<<< @@ -28007,7 +31040,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":376 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":376 * trie_node_data_append(node, i1) * trie_node_data_append(node, i2) * trie_node_data_append(node, i3) # <<<<<<<<<<<<<< @@ -28017,14 +31050,14 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_3 = __pyx_f_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L33; + goto __pyx_L30; } - __pyx_L33:; - goto __pyx_L32; + __pyx_L30:; + goto __pyx_L29; } - __pyx_L32:; + __pyx_L29:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":377 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":377 * trie_node_data_append(node, i2) * trie_node_data_append(node, i3) * ptr3 = ptr3 + 2 # <<<<<<<<<<<<<< @@ -28033,15 +31066,15 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_ptr3 = (__pyx_v_ptr3 + 2); } - __pyx_L30_break:; - goto __pyx_L27; + __pyx_L27_break:; + goto __pyx_L24; } - __pyx_L27:; - goto __pyx_L24; + __pyx_L24:; + goto __pyx_L21; } - __pyx_L24:; + __pyx_L21:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":378 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":378 * trie_node_data_append(node, i3) * ptr3 = ptr3 + 2 * ptr2 = ptr2 + 2 # <<<<<<<<<<<<<< @@ -28050,9 +31083,9 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_ptr2 = (__pyx_v_ptr2 + 2); } - __pyx_L22_break:; + __pyx_L19_break:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":379 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":379 * ptr3 = ptr3 + 2 * ptr2 = ptr2 + 2 * ptr1 = ptr1 + 2 # <<<<<<<<<<<<<< @@ -28060,11 +31093,11 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se * sent_count = sent_count + 1 */ __pyx_v_ptr1 = (__pyx_v_ptr1 + 2); - goto __pyx_L20; + goto __pyx_L17; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":381 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":381 * ptr1 = ptr1 + 2 * else: * sent_count = sent_count + 1 # <<<<<<<<<<<<<< @@ -28073,7 +31106,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_sent_count = (__pyx_v_sent_count + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":382 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":382 * else: * sent_count = sent_count + 1 * if sent_count % 10000 == 0: # <<<<<<<<<<<<<< @@ -28083,7 +31116,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_19 = (__Pyx_mod_long(__pyx_v_sent_count, 10000) == 0); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":383 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":383 * sent_count = sent_count + 1 * if sent_count % 10000 == 0: * logger.debug(" %d sentences", sent_count) # <<<<<<<<<<<<<< @@ -28098,7 +31131,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_3 = PyInt_FromLong(__pyx_v_sent_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_kp_s_78)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_78)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_78)); @@ -28110,11 +31143,11 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L38; + goto __pyx_L35; } - __pyx_L38:; + __pyx_L35:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":384 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":384 * if sent_count % 10000 == 0: * logger.debug(" %d sentences", sent_count) * ptr1 = ptr1 + 1 # <<<<<<<<<<<<<< @@ -28123,10 +31156,10 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_ptr1 = (__pyx_v_ptr1 + 1); } - __pyx_L20:; + __pyx_L17:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":386 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":386 * ptr1 = ptr1 + 1 * * self.precomputed_collocations = collocations.toMap(False) # <<<<<<<<<<<<<< @@ -28138,7 +31171,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; @@ -28147,12 +31180,12 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_8); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations); - __Pyx_DECREF(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations); - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations = __pyx_t_8; + __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); + __Pyx_DECREF(__pyx_v_self->precomputed_collocations); + __pyx_v_self->precomputed_collocations = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":387 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":387 * * self.precomputed_collocations = collocations.toMap(False) * self.precomputed_index = frequent_patterns.toMap(True) # <<<<<<<<<<<<<< @@ -28164,7 +31197,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 387; __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[11]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -28173,12 +31206,12 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_index); - __Pyx_DECREF(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_index); - ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_index = __pyx_t_1; + __Pyx_GOTREF(__pyx_v_self->precomputed_index); + __Pyx_DECREF(__pyx_v_self->precomputed_index); + __pyx_v_self->precomputed_index = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":389 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":389 * self.precomputed_index = frequent_patterns.toMap(True) * * x = 0 # <<<<<<<<<<<<<< @@ -28188,7 +31221,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_INCREF(__pyx_int_0); __pyx_v_x = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":390 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":390 * * x = 0 * for pattern1 in J_set: # <<<<<<<<<<<<<< @@ -28214,7 +31247,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_pattern1 = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":391 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":391 * x = 0 * for pattern1 in J_set: * for pattern2 in J_set: # <<<<<<<<<<<<<< @@ -28240,7 +31273,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_pattern2 = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":392 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":392 * for pattern1 in J_set: * for pattern2 in J_set: * if len(pattern1) + len(pattern2) + 1 < self.max_length: # <<<<<<<<<<<<<< @@ -28249,10 +31282,10 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_t_2 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_19 = (((__pyx_t_2 + __pyx_t_14) + 1) < ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_length); + __pyx_t_19 = (((__pyx_t_2 + __pyx_t_14) + 1) < __pyx_v_self->max_length); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":393 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":393 * for pattern2 in J_set: * if len(pattern1) + len(pattern2) + 1 < self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -28268,26 +31301,23 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_combined_pattern = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":394 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":394 * if len(pattern1) + len(pattern2) + 1 < self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 * J2_set.add(combined_pattern) # <<<<<<<<<<<<<< * * for pattern1 in I_set: */ - if (unlikely(((PyObject *)__pyx_v_J2_set) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add"); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PySet_Add(__pyx_v_J2_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L43; + goto __pyx_L40; } - __pyx_L43:; + __pyx_L40:; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":396 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":396 * J2_set.add(combined_pattern) * * for pattern1 in I_set: # <<<<<<<<<<<<<< @@ -28313,7 +31343,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_pattern1 = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":397 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":397 * * for pattern1 in I_set: * for pattern2 in I_set: # <<<<<<<<<<<<<< @@ -28339,7 +31369,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_pattern2 = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":398 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":398 * for pattern1 in I_set: * for pattern2 in I_set: * x = x+1 # <<<<<<<<<<<<<< @@ -28352,7 +31382,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_x = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":399 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":399 * for pattern2 in I_set: * x = x+1 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: # <<<<<<<<<<<<<< @@ -28361,10 +31391,10 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_t_14 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_19 = (((__pyx_t_14 + __pyx_t_2) + 1) <= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_length); + __pyx_t_19 = (((__pyx_t_14 + __pyx_t_2) + 1) <= __pyx_v_self->max_length); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":400 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":400 * x = x+1 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -28380,26 +31410,23 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_combined_pattern = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":401 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":401 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< * * for pattern1 in I_set: */ - if (unlikely(((PyObject *)__pyx_v_IJ_set) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add"); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L48; + goto __pyx_L45; } - __pyx_L48:; + __pyx_L45:; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":403 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":403 * IJ_set.add(combined_pattern) * * for pattern1 in I_set: # <<<<<<<<<<<<<< @@ -28425,7 +31452,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_pattern1 = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":404 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":404 * * for pattern1 in I_set: * for pattern2 in J2_set: # <<<<<<<<<<<<<< @@ -28451,7 +31478,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_pattern2 = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":405 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":405 * for pattern1 in I_set: * for pattern2 in J2_set: * x = x+2 # <<<<<<<<<<<<<< @@ -28464,7 +31491,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_x = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":406 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":406 * for pattern2 in J2_set: * x = x+2 * if len(pattern1) + len(pattern2) + 1<= self.max_length: # <<<<<<<<<<<<<< @@ -28473,10 +31500,10 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_t_2 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_19 = (((__pyx_t_2 + __pyx_t_14) + 1) <= ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->max_length); + __pyx_t_19 = (((__pyx_t_2 + __pyx_t_14) + 1) <= __pyx_v_self->max_length); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":407 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":407 * x = x+2 * if len(pattern1) + len(pattern2) + 1<= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -28492,19 +31519,16 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_combined_pattern = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":408 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":408 * if len(pattern1) + len(pattern2) + 1<= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< * combined_pattern = pattern2 + (-1,) + pattern1 * IJ_set.add(combined_pattern) */ - if (unlikely(((PyObject *)__pyx_v_IJ_set) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add"); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":409 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":409 * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) * combined_pattern = pattern2 + (-1,) + pattern1 # <<<<<<<<<<<<<< @@ -28520,39 +31544,33 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_combined_pattern = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":410 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":410 * IJ_set.add(combined_pattern) * combined_pattern = pattern2 + (-1,) + pattern1 * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< * * N = len(pattern_rank) */ - if (unlikely(((PyObject *)__pyx_v_IJ_set) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add"); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L53; + goto __pyx_L50; } - __pyx_L53:; + __pyx_L50:; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":412 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":412 * IJ_set.add(combined_pattern) * * N = len(pattern_rank) # <<<<<<<<<<<<<< * cost_by_rank = IntList(initial_len=N) * count_by_rank = IntList(initial_len=N) */ - if (unlikely(((PyObject *)__pyx_v_pattern_rank) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = PyDict_Size(((PyObject *)__pyx_v_pattern_rank)); + __pyx_t_14 = PyDict_Size(((PyObject *)__pyx_v_pattern_rank)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_N = __pyx_t_14; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":413 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":413 * * N = len(pattern_rank) * cost_by_rank = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -28565,13 +31583,13 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_cost_by_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":414 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":414 * N = len(pattern_rank) * cost_by_rank = IntList(initial_len=N) * count_by_rank = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -28584,111 +31602,53 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_count_by_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":415 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":415 * cost_by_rank = IntList(initial_len=N) * count_by_rank = IntList(initial_len=N) * for pattern, arr in self.precomputed_collocations.iteritems(): # <<<<<<<<<<<<<< * if pattern not in IJ_set: * s = "" */ - __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __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[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_14 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_14 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_14 = 0; + if (unlikely(__pyx_v_self->precomputed_collocations == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; - } else { - __pyx_t_3 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyList_GET_ITEM(sequence, 0); - __pyx_t_7 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_8 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_8)) goto __pyx_L56_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L56_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L57_unpacking_done; - __pyx_L56_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L57_unpacking_done:; - } + __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_self->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_2), (&__pyx_t_13)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + while (1) { + __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_14, &__pyx_t_3, &__pyx_t_8, NULL, __pyx_t_13); + if (unlikely(__pyx_t_16 == 0)) break; + if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_pattern = __pyx_t_3; + __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_arr = __pyx_t_8; + __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":416 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":416 * count_by_rank = IntList(initial_len=N) * for pattern, arr in self.precomputed_collocations.iteritems(): * if pattern not in IJ_set: # <<<<<<<<<<<<<< * s = "" * for word_id in pattern: */ - __pyx_t_19 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_IJ_set), __pyx_v_pattern))); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = (__Pyx_PySequence_Contains(__pyx_v_pattern, ((PyObject *)__pyx_v_IJ_set), Py_NE)); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":417 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":417 * for pattern, arr in self.precomputed_collocations.iteritems(): * if pattern not in IJ_set: * s = "" # <<<<<<<<<<<<<< @@ -28699,7 +31659,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_XDECREF(__pyx_v_s); __pyx_v_s = ((PyObject *)__pyx_kp_s_45); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":418 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":418 * if pattern not in IJ_set: * s = "" * for word_id in pattern: # <<<<<<<<<<<<<< @@ -28707,117 +31667,124 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se * s = s + "X " */ if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) { - __pyx_t_3 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_20 = NULL; + __pyx_t_8 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_8); __pyx_t_12 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_12 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = Py_TYPE(__pyx_t_8)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_3)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_3)) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_8)) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_8)) { + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { - __pyx_t_7 = __pyx_t_20(__pyx_t_3); - if (unlikely(!__pyx_t_7)) { + __pyx_t_3 = __pyx_t_4(__pyx_t_8); + if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_word_id = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":419 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":419 * s = "" * for word_id in pattern: * if word_id == -1: # <<<<<<<<<<<<<< * s = s + "X " * else: */ - __pyx_t_7 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":420 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":420 * for word_id in pattern: * if word_id == -1: * s = s + "X " # <<<<<<<<<<<<<< * else: * s = s + darray.id2word[word_id] + " " */ - __pyx_t_7 = PyNumber_Add(__pyx_v_s, ((PyObject *)__pyx_kp_s_83)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyNumber_Add(__pyx_v_s, ((PyObject *)__pyx_kp_s_83)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L61; + __pyx_v_s = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L56; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":422 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":422 * s = s + "X " * else: * s = s + darray.id2word[word_id] + " " # <<<<<<<<<<<<<< * logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) * else: */ - __pyx_t_7 = PyObject_GetItem(__pyx_v_darray->id2word, __pyx_v_word_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_darray->id2word, __pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyNumber_Add(__pyx_v_s, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_Add(__pyx_v_s, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_7, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_8, ((PyObject *)__pyx_kp_s_67)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_s = __pyx_t_3; + __pyx_t_3 = 0; } - __pyx_L61:; + __pyx_L56:; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":423 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":423 * else: * s = s + darray.id2word[word_id] + " " * logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) # <<<<<<<<<<<<<< * else: * chunk = () */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__warn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_kp_s_84)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_84)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_84)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_84)); __Pyx_INCREF(__pyx_v_s); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_s); __Pyx_GIVEREF(__pyx_v_s); - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L58; + goto __pyx_L53; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":425 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":425 * logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) * else: * chunk = () # <<<<<<<<<<<<<< @@ -28828,7 +31795,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_XDECREF(((PyObject *)__pyx_v_chunk)); __pyx_v_chunk = __pyx_empty_tuple; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":426 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":426 * else: * chunk = () * max_rank = 0 # <<<<<<<<<<<<<< @@ -28837,7 +31804,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_max_rank = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":427 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":427 * chunk = () * max_rank = 0 * arity = 0 # <<<<<<<<<<<<<< @@ -28848,7 +31815,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_XDECREF(__pyx_v_arity); __pyx_v_arity = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":428 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":428 * max_rank = 0 * arity = 0 * for word_id in pattern: # <<<<<<<<<<<<<< @@ -28856,93 +31823,99 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se * max_rank = max(max_rank, pattern_rank[chunk]) */ if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) { - __pyx_t_8 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_8); __pyx_t_2 = 0; - __pyx_t_20 = NULL; + __pyx_t_7 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_7); __pyx_t_12 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_20 = Py_TYPE(__pyx_t_8)->tp_iternext; + __pyx_t_12 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = Py_TYPE(__pyx_t_7)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_8)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_8)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_8)) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_8)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_7)) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_8); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_7)) { + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_8); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { - __pyx_t_3 = __pyx_t_20(__pyx_t_8); - if (unlikely(!__pyx_t_3)) { + __pyx_t_8 = __pyx_t_4(__pyx_t_7); + if (unlikely(!__pyx_t_8)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_8); } __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_word_id = __pyx_t_8; + __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":429 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":429 * arity = 0 * for word_id in pattern: * if word_id == -1: # <<<<<<<<<<<<<< * max_rank = max(max_rank, pattern_rank[chunk]) * arity = arity + 1 */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":430 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":430 * for word_id in pattern: * if word_id == -1: * max_rank = max(max_rank, pattern_rank[chunk]) # <<<<<<<<<<<<<< * arity = arity + 1 * chunk = () */ - __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = __pyx_v_max_rank; - __pyx_t_5 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_16 = __pyx_v_max_rank; + __pyx_t_5 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_8, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_19) { - __Pyx_INCREF(__pyx_t_3); - __pyx_t_7 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_3 = __pyx_t_8; } else { - __pyx_t_6 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_t_6; + __pyx_t_3 = __pyx_t_6; __pyx_t_6 = 0; } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_max_rank = __pyx_t_13; + __pyx_v_max_rank = __pyx_t_16; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":431 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":431 * if word_id == -1: * max_rank = max(max_rank, pattern_rank[chunk]) * arity = arity + 1 # <<<<<<<<<<<<<< * chunk = () * else: */ - __pyx_t_7 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_arity); - __pyx_v_arity = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_arity = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":432 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":432 * max_rank = max(max_rank, pattern_rank[chunk]) * arity = arity + 1 * chunk = () # <<<<<<<<<<<<<< @@ -28952,105 +31925,104 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __Pyx_DECREF(((PyObject *)__pyx_v_chunk)); __pyx_v_chunk = __pyx_empty_tuple; - goto __pyx_L64; + goto __pyx_L59; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":434 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":434 * chunk = () * else: * chunk = chunk + (word_id,) # <<<<<<<<<<<<<< * max_rank = max(max_rank, pattern_rank[chunk]) * cost_by_rank.arr[max_rank] = cost_by_rank.arr[max_rank] + (4*len(arr)) */ - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_word_id); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_word_id); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_word_id); __Pyx_GIVEREF(__pyx_v_word_id); - __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_v_chunk), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_8 = PyNumber_Add(((PyObject *)__pyx_v_chunk), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_chunk)); - __pyx_v_chunk = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_chunk = __pyx_t_8; + __pyx_t_8 = 0; } - __pyx_L64:; + __pyx_L59:; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":435 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":435 * else: * chunk = chunk + (word_id,) * max_rank = max(max_rank, pattern_rank[chunk]) # <<<<<<<<<<<<<< * cost_by_rank.arr[max_rank] = cost_by_rank.arr[max_rank] + (4*len(arr)) * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) */ - __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_13 = __pyx_v_max_rank; - __pyx_t_7 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_16 = __pyx_v_max_rank; + __pyx_t_3 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_19) { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_3 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_6 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __pyx_t_6; + __pyx_t_8 = __pyx_t_6; __pyx_t_6 = 0; } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_max_rank = __pyx_t_13; + __pyx_v_max_rank = __pyx_t_16; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":436 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":436 * chunk = chunk + (word_id,) * max_rank = max(max_rank, pattern_rank[chunk]) * cost_by_rank.arr[max_rank] = cost_by_rank.arr[max_rank] + (4*len(arr)) # <<<<<<<<<<<<<< * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) * */ - __pyx_t_2 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (__pyx_v_cost_by_rank->arr[__pyx_v_max_rank]) = ((__pyx_v_cost_by_rank->arr[__pyx_v_max_rank]) + (4 * __pyx_t_2)); + __pyx_t_12 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_cost_by_rank->arr[__pyx_v_max_rank]) = ((__pyx_v_cost_by_rank->arr[__pyx_v_max_rank]) + (4 * __pyx_t_12)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":437 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":437 * max_rank = max(max_rank, pattern_rank[chunk]) * cost_by_rank.arr[max_rank] = cost_by_rank.arr[max_rank] + (4*len(arr)) * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) # <<<<<<<<<<<<<< * * cumul_cost = 0 */ - __pyx_t_3 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_max_rank])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_max_rank])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); + __pyx_t_12 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - (__pyx_v_count_by_rank->arr[__pyx_v_max_rank]) = __pyx_t_13; + (__pyx_v_count_by_rank->arr[__pyx_v_max_rank]) = __pyx_t_16; } - __pyx_L58:; + __pyx_L53:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":439 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":439 * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) * * cumul_cost = 0 # <<<<<<<<<<<<<< @@ -29060,7 +32032,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_INCREF(__pyx_int_0); __pyx_v_cumul_cost = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":440 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":440 * * cumul_cost = 0 * cumul_count = 0 # <<<<<<<<<<<<<< @@ -29070,7 +32042,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_INCREF(__pyx_int_0); __pyx_v_cumul_count = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":441 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":441 * cumul_cost = 0 * cumul_count = 0 * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -29080,7 +32052,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_t_13 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_13; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":442 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":442 * cumul_count = 0 * for i from 0 <= i < N: * cumul_cost = cumul_cost + cost_by_rank.arr[i] # <<<<<<<<<<<<<< @@ -29096,7 +32068,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_cumul_cost = __pyx_t_6; __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":443 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":443 * for i from 0 <= i < N: * cumul_cost = cumul_cost + cost_by_rank.arr[i] * cumul_count = cumul_count + count_by_rank.arr[i] # <<<<<<<<<<<<<< @@ -29112,7 +32084,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __pyx_v_cumul_count = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":444 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":444 * cumul_cost = cumul_cost + cost_by_rank.arr[i] * cumul_count = cumul_count + count_by_rank.arr[i] * logger.debug("RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d", i, count_by_rank.arr[i], cost_by_rank.arr[i], cumul_count, cumul_cost) # <<<<<<<<<<<<<< @@ -29126,104 +32098,107 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyInt_FromLong((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = PyInt_FromLong((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_kp_s_85)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_85)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_85)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85)); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_cumul_count); - PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_cumul_count); + PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_cumul_count); __Pyx_GIVEREF(__pyx_v_cumul_count); __Pyx_INCREF(__pyx_v_cumul_cost); - PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_cumul_cost); + PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_v_cumul_cost); __Pyx_GIVEREF(__pyx_v_cumul_cost); __pyx_t_1 = 0; - __pyx_t_7 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":446 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":446 * logger.debug("RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d", i, count_by_rank.arr[i], cost_by_rank.arr[i], cumul_count, cumul_cost) * * num_found_patterns = len(self.precomputed_collocations) # <<<<<<<<<<<<<< * for pattern in IJ_set: * if pattern not in self.precomputed_collocations: */ - __pyx_t_3 = ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_14 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_num_found_patterns = __pyx_t_14; + __pyx_t_8 = __pyx_v_self->precomputed_collocations; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_2 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_v_num_found_patterns = __pyx_t_8; + __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":447 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":447 * * num_found_patterns = len(self.precomputed_collocations) * for pattern in IJ_set: # <<<<<<<<<<<<<< * if pattern not in self.precomputed_collocations: * self.precomputed_collocations[pattern] = IntList() */ - __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_IJ_set)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_8 = PyObject_GetIter(((PyObject *)__pyx_v_IJ_set)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = Py_TYPE(__pyx_t_8)->tp_iternext; for (;;) { { - __pyx_t_8 = __pyx_t_4(__pyx_t_3); - if (unlikely(!__pyx_t_8)) { + __pyx_t_7 = __pyx_t_4(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_pattern = __pyx_t_7; + __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":448 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":448 * num_found_patterns = len(self.precomputed_collocations) * for pattern in IJ_set: * if pattern not in self.precomputed_collocations: # <<<<<<<<<<<<<< * self.precomputed_collocations[pattern] = IntList() * */ - __pyx_t_19 = (__Pyx_NegateNonNeg(PySequence_Contains(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations, __pyx_v_pattern))); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = (__Pyx_PySequence_Contains(__pyx_v_pattern, __pyx_v_self->precomputed_collocations, Py_NE)); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":449 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":449 * for pattern in IJ_set: * if pattern not in self.precomputed_collocations: * self.precomputed_collocations[pattern] = IntList() # <<<<<<<<<<<<<< * * cdef float stop_time = monitor_cpu() */ - __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - if (PyObject_SetItem(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations, __pyx_v_pattern, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L69; + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_pattern, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L64; } - __pyx_L69:; + __pyx_L64:; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":451 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":451 * self.precomputed_collocations[pattern] = IntList() * * cdef float stop_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -29232,102 +32207,100 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se */ __pyx_v_stop_time = __pyx_f_3_sa_monitor_cpu(); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":452 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":452 * * cdef float stop_time = monitor_cpu() * logger.info("Precomputed collocations for %d patterns out of %d possible (upper bound %d)", num_found_patterns, len(self.precomputed_collocations), x) # <<<<<<<<<<<<<< * logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index)) * logger.info("Precomputation took %f seconds", (stop_time - start_time)) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_num_found_patterns); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_collocations; - __Pyx_INCREF(__pyx_t_6); - __pyx_t_14 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __pyx_v_self->precomputed_collocations; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_2 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_86)); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_86)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_86)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_86)); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_num_found_patterns); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_num_found_patterns); + __Pyx_GIVEREF(__pyx_v_num_found_patterns); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); - __pyx_t_3 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":453 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":453 * cdef float stop_time = monitor_cpu() * logger.info("Precomputed collocations for %d patterns out of %d possible (upper bound %d)", num_found_patterns, len(self.precomputed_collocations), x) * logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index)) # <<<<<<<<<<<<<< * logger.info("Precomputation took %f seconds", (stop_time - start_time)) */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __pyx_v_self->precomputed_index; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_2 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = ((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self)->precomputed_index; - __Pyx_INCREF(__pyx_t_6); - __pyx_t_14 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_87)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_87)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_87)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_87)); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":454 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":454 * logger.info("Precomputed collocations for %d patterns out of %d possible (upper bound %d)", num_found_patterns, len(self.precomputed_collocations), x) * logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index)) * logger.info("Precomputation took %f seconds", (stop_time - start_time)) # <<<<<<<<<<<<<< */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyFloat_FromDouble((__pyx_v_stop_time - __pyx_v_start_time)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyFloat_FromDouble((__pyx_v_stop_time - __pyx_v_start_time)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_88)); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_88)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_88)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_88)); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -29370,43 +32343,39 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_3precompute(PyObject *__pyx_v_se __Pyx_XDECREF(__pyx_v_arity); __Pyx_XDECREF(__pyx_v_cumul_cost); __Pyx_XDECREF(__pyx_v_cumul_count); + __Pyx_XDECREF(__pyx_v_num_found_patterns); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":11 - * cdef IntList ha - * - * def __cinit__(self, from_binary=None, from_text=None, side=None): # <<<<<<<<<<<<<< - * self.darray = DataArray() - * self.sa = IntList() - */ - -static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; PyObject *__pyx_v_side = 0; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,0}; PyObject* values[3] = {0,0,0}; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":11 + * cdef IntList ha + * + * def __cinit__(self, from_binary=None, from_text=None, side=None): # <<<<<<<<<<<<<< + * self.darray = DataArray() + * self.sa = IntList() + */ values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -29414,7 +32383,7 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_binary); @@ -29432,7 +32401,7 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -29455,8 +32424,24 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_11SuffixArray___cinit__(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":12 +static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":12 * * def __cinit__(self, from_binary=None, from_text=None, side=None): * self.darray = DataArray() # <<<<<<<<<<<<<< @@ -29466,12 +32451,12 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray)); - ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->darray); + __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); + __pyx_v_self->darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":13 * def __cinit__(self, from_binary=None, from_text=None, side=None): * self.darray = DataArray() * self.sa = IntList() # <<<<<<<<<<<<<< @@ -29481,12 +32466,12 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa)); - ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":14 * self.darray = DataArray() * self.sa = IntList() * self.ha = IntList() # <<<<<<<<<<<<<< @@ -29496,12 +32481,12 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha)); - ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->ha); + __Pyx_DECREF(((PyObject *)__pyx_v_self->ha)); + __pyx_v_self->ha = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":15 * self.sa = IntList() * self.ha = IntList() * if from_binary: # <<<<<<<<<<<<<< @@ -29511,17 +32496,17 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":16 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":16 * self.ha = IntList() * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< * elif from_text: * self.read_text(from_text, side) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __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[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_from_binary); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_binary); __Pyx_GIVEREF(__pyx_v_from_binary); @@ -29530,10 +32515,10 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6; + goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":17 * if from_binary: * self.read_binary(from_binary) * elif from_text: # <<<<<<<<<<<<<< @@ -29543,17 +32528,17 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":18 * self.read_binary(from_binary) * elif from_text: * self.read_text(from_text, side) # <<<<<<<<<<<<<< * * def __getitem__(self, i): */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_from_text); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_text); __Pyx_GIVEREF(__pyx_v_from_text); @@ -29565,9 +32550,9 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; __pyx_r = 0; goto __pyx_L0; @@ -29582,7 +32567,18 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":20 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_2__getitem__(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":20 * self.read_text(from_text, side) * * def __getitem__(self, i): # <<<<<<<<<<<<<< @@ -29590,8 +32586,7 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(PyObject *__pyx_v_self, PyObjec * */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -29599,9 +32594,9 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_1__getitem__(PyObject *__pyx_v_self int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__"); + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":21 * * def __getitem__(self, i): * return self.sa.arr[i] # <<<<<<<<<<<<<< @@ -29610,7 +32605,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_1__getitem__(PyObject *__pyx_v_self */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sa->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -29628,7 +32623,18 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_1__getitem__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":23 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence_id (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_4get_sentence_id(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":23 * return self.sa.arr[i] * * def get_sentence_id(self, i): # <<<<<<<<<<<<<< @@ -29636,8 +32642,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_1__getitem__(PyObject *__pyx_v_self * */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_2get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_2get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_4get_sentence_id(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -29646,9 +32651,9 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_2get_sentence_id(PyObject *__pyx_v_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sentence_id"); + __Pyx_RefNannySetupContext("get_sentence_id", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":24 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":24 * * def get_sentence_id(self, i): * return self.darray.get_sentence_id(i) # <<<<<<<<<<<<<< @@ -29656,10 +32661,10 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_2get_sentence_id(PyObject *__pyx_v_ * def get_sentence(self, i): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray), __pyx_n_s__get_sentence_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__get_sentence_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 24; __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[12]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); @@ -29685,7 +32690,18 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_2get_sentence_id(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":26 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_6get_sentence(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":26 * return self.darray.get_sentence_id(i) * * def get_sentence(self, i): # <<<<<<<<<<<<<< @@ -29693,8 +32709,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_2get_sentence_id(PyObject *__pyx_v_ * */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_3get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_3get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_6get_sentence(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -29703,9 +32718,9 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_3get_sentence(PyObject *__pyx_v_sel int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sentence"); + __Pyx_RefNannySetupContext("get_sentence", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":27 * * def get_sentence(self, i): * return self.darray.get_sentence(i) # <<<<<<<<<<<<<< @@ -29713,10 +32728,10 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_3get_sentence(PyObject *__pyx_v_sel * def get_sentence_position(self, loc): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray), __pyx_n_s__get_sentence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__get_sentence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 27; __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[12]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); @@ -29742,7 +32757,18 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_3get_sentence(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":29 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_9get_sentence_position(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_9get_sentence_position(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence_position (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_11SuffixArray_8get_sentence_position(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":29 * return self.darray.get_sentence(i) * * def get_sentence_position(self, loc): # <<<<<<<<<<<<<< @@ -29750,8 +32776,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_3get_sentence(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_4get_sentence_position(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_4get_sentence_position(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pf_3_sa_11SuffixArray_8get_sentence_position(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -29760,9 +32785,9 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4get_sentence_position(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sentence_position"); + __Pyx_RefNannySetupContext("get_sentence_position", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":30 * * def get_sentence_position(self, loc): * return self.darray.get_sentence_position(loc) # <<<<<<<<<<<<<< @@ -29770,10 +32795,10 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4get_sentence_position(PyObject *__ * def read_text(self, filename, side): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray), __pyx_n_s_89); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s_89); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 30; __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[12]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_loc); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_loc); __Pyx_GIVEREF(__pyx_v_loc); @@ -29799,75 +32824,40 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4get_sentence_position(PyObject *__ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":32 - * return self.darray.get_sentence_position(loc) - * - * def read_text(self, filename, side): # <<<<<<<<<<<<<< - * '''Constructs suffix array using the algorithm - * of Larsson & Sadahkane (1999)''' - */ - -static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3_sa_11SuffixArray_5read_text[] = "Constructs suffix array using the algorithm\n of Larsson & Sadahkane (1999)"; -static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_3_sa_11SuffixArray_10read_text[] = "Constructs suffix array using the algorithm\n of Larsson & Sadahkane (1999)"; +static PyObject *__pyx_pw_3_sa_11SuffixArray_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_filename = 0; PyObject *__pyx_v_side = 0; - int __pyx_v_V; - int __pyx_v_N; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_h; - int __pyx_v_a_i; - int __pyx_v_n; - int __pyx_v_current_run; - int __pyx_v_skip; - struct __pyx_obj_3_sa_IntList *__pyx_v_isa = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_word_count = 0; - float __pyx_v_sort_start_time; - float __pyx_v_start_time; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - long __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__side,0}; - __Pyx_RefNannySetupContext("read_text"); + __Pyx_RefNannySetupContext("read_text (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__side,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("read_text", 1, 2, 2, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_text") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_text") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -29886,8 +32876,52 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_11SuffixArray_10read_text(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":32 + * return self.darray.get_sentence_position(loc) + * + * def read_text(self, filename, side): # <<<<<<<<<<<<<< + * '''Constructs suffix array using the algorithm + * of Larsson & Sadahkane (1999)''' + */ + +static PyObject *__pyx_pf_3_sa_11SuffixArray_10read_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_side) { + int __pyx_v_V; + int __pyx_v_N; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_h; + int __pyx_v_a_i; + int __pyx_v_n; + int __pyx_v_current_run; + int __pyx_v_skip; + struct __pyx_obj_3_sa_IntList *__pyx_v_isa = 0; + struct __pyx_obj_3_sa_IntList *__pyx_v_word_count = 0; + float __pyx_v_sort_start_time; + float __pyx_v_start_time; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + long __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_text", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":38 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":38 * cdef IntList isa, word_count * * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) # <<<<<<<<<<<<<< @@ -29902,42 +32936,42 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__use_sent_id), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray)); - ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->darray); + __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); + __pyx_v_self->darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":39 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":39 * * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) * N = len(self.darray) # <<<<<<<<<<<<<< * V = len(self.darray.id2word) * */ - __pyx_t_2 = ((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray); + __pyx_t_2 = ((PyObject *)__pyx_v_self->darray); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_N = __pyx_t_3; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":40 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":40 * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) * N = len(self.darray) * V = len(self.darray.id2word) # <<<<<<<<<<<<<< * * self.sa = IntList(initial_len=N) */ - __pyx_t_2 = ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray->id2word; + __pyx_t_2 = __pyx_v_self->darray->id2word; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_V = __pyx_t_3; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":42 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":42 * V = len(self.darray.id2word) * * self.sa = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -29950,16 +32984,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa)); - ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":43 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":43 * * self.sa = IntList(initial_len=N) * self.ha = IntList(initial_len=V+1) # <<<<<<<<<<<<<< @@ -29972,16 +33006,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha)); - ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->ha); + __Pyx_DECREF(((PyObject *)__pyx_v_self->ha)); + __pyx_v_self->ha = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":45 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":45 * self.ha = IntList(initial_len=V+1) * * isa = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -29994,13 +33028,13 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_isa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":46 * * isa = IntList(initial_len=N) * word_count = IntList(initial_len=V+1) # <<<<<<<<<<<<<< @@ -30013,13 +33047,13 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_word_count = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":49 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":49 * * '''Step 1: bucket sort data''' * cdef float sort_start_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -30028,7 +33062,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_sort_start_time = __pyx_f_3_sa_monitor_cpu(); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":50 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":50 * '''Step 1: bucket sort data''' * cdef float sort_start_time = monitor_cpu() * cdef float start_time = sort_start_time # <<<<<<<<<<<<<< @@ -30037,7 +33071,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_start_time = __pyx_v_sort_start_time; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":51 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":51 * cdef float sort_start_time = monitor_cpu() * cdef float start_time = sort_start_time * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -30047,16 +33081,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_4 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":52 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":52 * cdef float start_time = sort_start_time * for i from 0 <= i < N: * a_i = self.darray.data.arr[i] # <<<<<<<<<<<<<< * word_count.arr[a_i] = word_count.arr[a_i] + 1 * */ - __pyx_v_a_i = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray->data->arr[__pyx_v_i]); + __pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":53 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":53 * for i from 0 <= i < N: * a_i = self.darray.data.arr[i] * word_count.arr[a_i] = word_count.arr[a_i] + 1 # <<<<<<<<<<<<<< @@ -30066,7 +33100,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, (__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":55 * word_count.arr[a_i] = word_count.arr[a_i] + 1 * * n = 0 # <<<<<<<<<<<<<< @@ -30075,7 +33109,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_n = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":56 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":56 * * n = 0 * for i from 0 <= i < V+1: # <<<<<<<<<<<<<< @@ -30085,16 +33119,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_5 = (__pyx_v_V + 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":57 * n = 0 * for i from 0 <= i < V+1: * self.ha.arr[i] = n # <<<<<<<<<<<<<< * n = n + word_count.arr[i] * word_count.arr[i] = 0 */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha->arr[__pyx_v_i]) = __pyx_v_n; + (__pyx_v_self->ha->arr[__pyx_v_i]) = __pyx_v_n; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":58 * for i from 0 <= i < V+1: * self.ha.arr[i] = n * n = n + word_count.arr[i] # <<<<<<<<<<<<<< @@ -30103,7 +33137,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_n = (__pyx_v_n + (__pyx_v_word_count->arr[__pyx_v_i])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":59 * self.ha.arr[i] = n * n = n + word_count.arr[i] * word_count.arr[i] = 0 # <<<<<<<<<<<<<< @@ -30113,7 +33147,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, (__pyx_v_word_count->arr[__pyx_v_i]) = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":61 * word_count.arr[i] = 0 * * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -30123,34 +33157,34 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_4 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":62 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":62 * * for i from 0 <= i < N: * a_i = self.darray.data.arr[i] # <<<<<<<<<<<<<< * self.sa.arr[self.ha.arr[a_i] + word_count.arr[a_i]] = i * isa.arr[i] = self.ha.arr[a_i + 1] - 1 # bucket pointer is last index in bucket */ - __pyx_v_a_i = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray->data->arr[__pyx_v_i]); + __pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":63 * for i from 0 <= i < N: * a_i = self.darray.data.arr[i] * self.sa.arr[self.ha.arr[a_i] + word_count.arr[a_i]] = i # <<<<<<<<<<<<<< * isa.arr[i] = self.ha.arr[a_i + 1] - 1 # bucket pointer is last index in bucket * word_count.arr[a_i] = word_count.arr[a_i] + 1 */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha->arr[__pyx_v_a_i]) + (__pyx_v_word_count->arr[__pyx_v_a_i]))]) = __pyx_v_i; + (__pyx_v_self->sa->arr[((__pyx_v_self->ha->arr[__pyx_v_a_i]) + (__pyx_v_word_count->arr[__pyx_v_a_i]))]) = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":64 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":64 * a_i = self.darray.data.arr[i] * self.sa.arr[self.ha.arr[a_i] + word_count.arr[a_i]] = i * isa.arr[i] = self.ha.arr[a_i + 1] - 1 # bucket pointer is last index in bucket # <<<<<<<<<<<<<< * word_count.arr[a_i] = word_count.arr[a_i] + 1 * */ - (__pyx_v_isa->arr[__pyx_v_i]) = ((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha->arr[(__pyx_v_a_i + 1)]) - 1); + (__pyx_v_isa->arr[__pyx_v_i]) = ((__pyx_v_self->ha->arr[(__pyx_v_a_i + 1)]) - 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":65 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":65 * self.sa.arr[self.ha.arr[a_i] + word_count.arr[a_i]] = i * isa.arr[i] = self.ha.arr[a_i + 1] - 1 # bucket pointer is last index in bucket * word_count.arr[a_i] = word_count.arr[a_i] + 1 # <<<<<<<<<<<<<< @@ -30160,7 +33194,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, (__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":68 * * '''Determine size of initial runs''' * current_run = 0 # <<<<<<<<<<<<<< @@ -30169,7 +33203,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_current_run = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":69 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":69 * '''Determine size of initial runs''' * current_run = 0 * for i from 0 <= i < V+1: # <<<<<<<<<<<<<< @@ -30179,7 +33213,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_5 = (__pyx_v_V + 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":70 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":70 * current_run = 0 * for i from 0 <= i < V+1: * if i < V and self.ha.arr[i+1] - self.ha.arr[i] == 1: # <<<<<<<<<<<<<< @@ -30188,14 +33222,14 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_t_6 = (__pyx_v_i < __pyx_v_V); if (__pyx_t_6) { - __pyx_t_7 = (((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha->arr[(__pyx_v_i + 1)]) - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha->arr[__pyx_v_i])) == 1); + __pyx_t_7 = (((__pyx_v_self->ha->arr[(__pyx_v_i + 1)]) - (__pyx_v_self->ha->arr[__pyx_v_i])) == 1); __pyx_t_8 = __pyx_t_7; } else { __pyx_t_8 = __pyx_t_6; } if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":71 * for i from 0 <= i < V+1: * if i < V and self.ha.arr[i+1] - self.ha.arr[i] == 1: * current_run = current_run + 1 # <<<<<<<<<<<<<< @@ -30203,11 +33237,11 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, * if current_run > 0: */ __pyx_v_current_run = (__pyx_v_current_run + 1); - goto __pyx_L14; + goto __pyx_L11; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":73 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":73 * current_run = current_run + 1 * else: * if current_run > 0: # <<<<<<<<<<<<<< @@ -30217,16 +33251,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_8 = (__pyx_v_current_run > 0); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":74 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":74 * else: * if current_run > 0: * self.sa.arr[self.ha.arr[i] - current_run] = -current_run # <<<<<<<<<<<<<< * current_run = 0 * */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha->arr[__pyx_v_i]) - __pyx_v_current_run)]) = (-__pyx_v_current_run); + (__pyx_v_self->sa->arr[((__pyx_v_self->ha->arr[__pyx_v_i]) - __pyx_v_current_run)]) = (-__pyx_v_current_run); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":75 * if current_run > 0: * self.sa.arr[self.ha.arr[i] - current_run] = -current_run * current_run = 0 # <<<<<<<<<<<<<< @@ -30234,14 +33268,14 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, * logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time)) */ __pyx_v_current_run = 0; - goto __pyx_L15; + goto __pyx_L12; } - __pyx_L15:; + __pyx_L12:; } - __pyx_L14:; + __pyx_L11:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":77 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":77 * current_run = 0 * * logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time)) # <<<<<<<<<<<<<< @@ -30256,7 +33290,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_2 = PyFloat_FromDouble((__pyx_f_3_sa_monitor_cpu() - __pyx_v_sort_start_time)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(((PyObject *)__pyx_kp_s_90)); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_90)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_90)); @@ -30269,7 +33303,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":80 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":80 * * '''Step 2: prefix-doubling sort''' * h = 1 # <<<<<<<<<<<<<< @@ -30278,7 +33312,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_h = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":81 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":81 * '''Step 2: prefix-doubling sort''' * h = 1 * while self.sa.arr[0] != -N: # <<<<<<<<<<<<<< @@ -30286,10 +33320,10 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, * logger.debug(" Refining, sort depth = %d", h) */ while (1) { - __pyx_t_8 = ((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[0]) != (-__pyx_v_N)); + __pyx_t_8 = ((__pyx_v_self->sa->arr[0]) != (-__pyx_v_N)); if (!__pyx_t_8) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":82 * h = 1 * while self.sa.arr[0] != -N: * sort_start_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -30298,7 +33332,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_sort_start_time = __pyx_f_3_sa_monitor_cpu(); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":83 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":83 * while self.sa.arr[0] != -N: * sort_start_time = monitor_cpu() * logger.debug(" Refining, sort depth = %d", h) # <<<<<<<<<<<<<< @@ -30313,7 +33347,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_2 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_kp_s_91)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_91)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_91)); @@ -30326,7 +33360,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":84 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":84 * sort_start_time = monitor_cpu() * logger.debug(" Refining, sort depth = %d", h) * i = 0 # <<<<<<<<<<<<<< @@ -30335,7 +33369,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_i = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":85 * logger.debug(" Refining, sort depth = %d", h) * i = 0 * skip = 0 # <<<<<<<<<<<<<< @@ -30344,7 +33378,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_skip = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":86 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":86 * i = 0 * skip = 0 * while i < N: # <<<<<<<<<<<<<< @@ -30355,38 +33389,38 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_8 = (__pyx_v_i < __pyx_v_N); if (!__pyx_t_8) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":87 * skip = 0 * while i < N: * if self.sa.arr[i] < 0: # <<<<<<<<<<<<<< * skip = skip + self.sa.arr[i] * i = i - self.sa.arr[i] */ - __pyx_t_8 = ((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_i]) < 0); + __pyx_t_8 = ((__pyx_v_self->sa->arr[__pyx_v_i]) < 0); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":88 * while i < N: * if self.sa.arr[i] < 0: * skip = skip + self.sa.arr[i] # <<<<<<<<<<<<<< * i = i - self.sa.arr[i] * else: */ - __pyx_v_skip = (__pyx_v_skip + (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_i])); + __pyx_v_skip = (__pyx_v_skip + (__pyx_v_self->sa->arr[__pyx_v_i])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":89 * if self.sa.arr[i] < 0: * skip = skip + self.sa.arr[i] * i = i - self.sa.arr[i] # <<<<<<<<<<<<<< * else: * if skip < 0: */ - __pyx_v_i = (__pyx_v_i - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_i])); - goto __pyx_L20; + __pyx_v_i = (__pyx_v_i - (__pyx_v_self->sa->arr[__pyx_v_i])); + goto __pyx_L17; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":91 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":91 * i = i - self.sa.arr[i] * else: * if skip < 0: # <<<<<<<<<<<<<< @@ -30396,16 +33430,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_8 = (__pyx_v_skip < 0); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":92 * else: * if skip < 0: * self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<< * skip = 0 * j = isa.arr[self.sa.arr[i]] */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip; + (__pyx_v_self->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":93 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":93 * if skip < 0: * self.sa.arr[i+skip] = skip * skip = 0 # <<<<<<<<<<<<<< @@ -30413,27 +33447,27 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, * self.q3sort(i, j, h, isa) */ __pyx_v_skip = 0; - goto __pyx_L21; + goto __pyx_L18; } - __pyx_L21:; + __pyx_L18:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":94 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":94 * self.sa.arr[i+skip] = skip * skip = 0 * j = isa.arr[self.sa.arr[i]] # <<<<<<<<<<<<<< * self.q3sort(i, j, h, isa) * i = j+1 */ - __pyx_v_j = (__pyx_v_isa->arr[(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_i])]); + __pyx_v_j = (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":95 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":95 * skip = 0 * j = isa.arr[self.sa.arr[i]] * self.q3sort(i, j, h, isa) # <<<<<<<<<<<<<< * i = j+1 * if skip < 0: */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__q3sort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -30442,7 +33476,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_10 = PyInt_FromLong(__pyx_v_h); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9); @@ -30461,7 +33495,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":96 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":96 * j = isa.arr[self.sa.arr[i]] * self.q3sort(i, j, h, isa) * i = j+1 # <<<<<<<<<<<<<< @@ -30470,10 +33504,10 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_i = (__pyx_v_j + 1); } - __pyx_L20:; + __pyx_L17:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":97 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":97 * self.q3sort(i, j, h, isa) * i = j+1 * if skip < 0: # <<<<<<<<<<<<<< @@ -30483,19 +33517,19 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_8 = (__pyx_v_skip < 0); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":98 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":98 * i = j+1 * if skip < 0: * self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<< * h = h * 2 * logger.debug(" Refinement took %f seconds", (monitor_cpu() - sort_start_time)) */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip; - goto __pyx_L22; + (__pyx_v_self->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip; + goto __pyx_L19; } - __pyx_L22:; + __pyx_L19:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":99 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":99 * if skip < 0: * self.sa.arr[i+skip] = skip * h = h * 2 # <<<<<<<<<<<<<< @@ -30504,7 +33538,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_h = (__pyx_v_h * 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":100 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":100 * self.sa.arr[i+skip] = skip * h = h * 2 * logger.debug(" Refinement took %f seconds", (monitor_cpu() - sort_start_time)) # <<<<<<<<<<<<<< @@ -30519,7 +33553,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_10 = PyFloat_FromDouble((__pyx_f_3_sa_monitor_cpu() - __pyx_v_sort_start_time)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_92)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_92)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92)); @@ -30533,7 +33567,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":103 * * '''Step 3: read off suffix array from inverse suffix array''' * logger.info(" Finalizing sort...") # <<<<<<<<<<<<<< @@ -30550,7 +33584,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":104 * '''Step 3: read off suffix array from inverse suffix array''' * logger.info(" Finalizing sort...") * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -30560,7 +33594,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_4 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":105 * logger.info(" Finalizing sort...") * for i from 0 <= i < N: * j = isa.arr[i] # <<<<<<<<<<<<<< @@ -30569,17 +33603,17 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, */ __pyx_v_j = (__pyx_v_isa->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":106 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":106 * for i from 0 <= i < N: * j = isa.arr[i] * self.sa.arr[j] = i # <<<<<<<<<<<<<< * logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) * */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_j]) = __pyx_v_i; + (__pyx_v_self->sa->arr[__pyx_v_j]) = __pyx_v_i; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":107 * j = isa.arr[i] * self.sa.arr[j] = i * logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) # <<<<<<<<<<<<<< @@ -30594,7 +33628,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_t_10 = PyFloat_FromDouble((__pyx_f_3_sa_monitor_cpu() - __pyx_v_start_time)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(((PyObject *)__pyx_kp_s_95)); PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_kp_s_95)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_95)); @@ -30625,49 +33659,26 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":109 - * logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) - * - * def q3sort(self, int i, int j, int h, IntList isa, pad=""): # <<<<<<<<<<<<<< - * '''This is a ternary quicksort. It divides the array into - * three partitions: items less than the pivot, items equal - */ - -static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3_sa_11SuffixArray_6q3sort[] = "This is a ternary quicksort. It divides the array into\n three partitions: items less than the pivot, items equal\n to pivot, and items greater than pivot. The first and last\n of these partitions are then recursively sorted"; -static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_3_sa_11SuffixArray_12q3sort[] = "This is a ternary quicksort. It divides the array into\n three partitions: items less than the pivot, items equal\n to pivot, and items greater than pivot. The first and last\n of these partitions are then recursively sorted"; +static PyObject *__pyx_pw_3_sa_11SuffixArray_13q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_h; struct __pyx_obj_3_sa_IntList *__pyx_v_isa = 0; PyObject *__pyx_v_pad = 0; - int __pyx_v_k; - int __pyx_v_midpoint; - int __pyx_v_pval; - int __pyx_v_phead; - int __pyx_v_ptail; - int __pyx_v_tmp; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - long __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i,&__pyx_n_s__j,&__pyx_n_s__h,&__pyx_n_s__isa,&__pyx_n_s__pad,0}; - __Pyx_RefNannySetupContext("q3sort"); + __Pyx_RefNannySetupContext("q3sort (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i,&__pyx_n_s__j,&__pyx_n_s__h,&__pyx_n_s__isa,&__pyx_n_s__pad,0}; PyObject* values[5] = {0,0,0,0,0}; values[4] = ((PyObject *)__pyx_kp_s_45); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -30677,26 +33688,22 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 2); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__isa); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__isa)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 3); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -30707,7 +33714,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "q3sort") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "q3sort") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -30735,8 +33742,46 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isa), __pyx_ptype_3_sa_IntList, 1, "isa", 0))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_11SuffixArray_12q3sort(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_i, __pyx_v_j, __pyx_v_h, __pyx_v_isa, __pyx_v_pad); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":116 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":109 + * logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) + * + * def q3sort(self, int i, int j, int h, IntList isa, pad=""): # <<<<<<<<<<<<<< + * '''This is a ternary quicksort. It divides the array into + * three partitions: items less than the pivot, items equal + */ + +static PyObject *__pyx_pf_3_sa_11SuffixArray_12q3sort(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_3_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad) { + int __pyx_v_k; + int __pyx_v_midpoint; + int __pyx_v_pval; + int __pyx_v_phead; + int __pyx_v_ptail; + int __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("q3sort", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":116 * cdef int k, midpoint, pval, phead, ptail, tmp * * if j-i < -1: # <<<<<<<<<<<<<< @@ -30746,7 +33791,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_1 = ((__pyx_v_j - __pyx_v_i) < -1); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":117 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":117 * * if j-i < -1: * raise Exception("Unexpected condition found in q3sort: sort from %d to %d" % (i,j)) # <<<<<<<<<<<<<< @@ -30758,7 +33803,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_3 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); @@ -30769,7 +33814,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -30779,11 +33824,11 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[12]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":118 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":118 * if j-i < -1: * raise Exception("Unexpected condition found in q3sort: sort from %d to %d" % (i,j)) * if j-i == -1: # recursive base case -- empty interval # <<<<<<<<<<<<<< @@ -30793,7 +33838,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_1 = ((__pyx_v_j - __pyx_v_i) == -1); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":119 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":119 * raise Exception("Unexpected condition found in q3sort: sort from %d to %d" % (i,j)) * if j-i == -1: # recursive base case -- empty interval * return # <<<<<<<<<<<<<< @@ -30803,11 +33848,11 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":120 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":120 * if j-i == -1: # recursive base case -- empty interval * return * if (j-i == 0): # recursive base case -- singleton interval # <<<<<<<<<<<<<< @@ -30817,25 +33862,25 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_1 = ((__pyx_v_j - __pyx_v_i) == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":121 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":121 * return * if (j-i == 0): # recursive base case -- singleton interval * isa.arr[self.sa.arr[i]] = i # <<<<<<<<<<<<<< * self.sa.arr[i] = -1 * return */ - (__pyx_v_isa->arr[(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_i])]) = __pyx_v_i; + (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]) = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":122 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":122 * if (j-i == 0): # recursive base case -- singleton interval * isa.arr[self.sa.arr[i]] = i * self.sa.arr[i] = -1 # <<<<<<<<<<<<<< * return * */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_i]) = -1; + (__pyx_v_self->sa->arr[__pyx_v_i]) = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":123 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":123 * isa.arr[self.sa.arr[i]] = i * self.sa.arr[i] = -1 * return # <<<<<<<<<<<<<< @@ -30845,11 +33890,11 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - goto __pyx_L8; + goto __pyx_L5; } - __pyx_L8:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":132 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":132 * # If the method of assigning word_id's is changed, this method * # may need to be reconsidered as well. * midpoint = (i+j)/2 # <<<<<<<<<<<<<< @@ -30858,16 +33903,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO */ __pyx_v_midpoint = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":133 * # may need to be reconsidered as well. * midpoint = (i+j)/2 * pval = isa.arr[self.sa.arr[midpoint] + h] # <<<<<<<<<<<<<< * if i != midpoint: * tmp = self.sa.arr[midpoint] */ - __pyx_v_pval = (__pyx_v_isa->arr[((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_midpoint]) + __pyx_v_h)]); + __pyx_v_pval = (__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_h)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":134 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":134 * midpoint = (i+j)/2 * pval = isa.arr[self.sa.arr[midpoint] + h] * if i != midpoint: # <<<<<<<<<<<<<< @@ -30877,37 +33922,37 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_1 = (__pyx_v_i != __pyx_v_midpoint); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":135 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":135 * pval = isa.arr[self.sa.arr[midpoint] + h] * if i != midpoint: * tmp = self.sa.arr[midpoint] # <<<<<<<<<<<<<< * self.sa.arr[midpoint] = self.sa.arr[i] * self.sa.arr[i] = tmp */ - __pyx_v_tmp = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_midpoint]); + __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_midpoint]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":136 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":136 * if i != midpoint: * tmp = self.sa.arr[midpoint] * self.sa.arr[midpoint] = self.sa.arr[i] # <<<<<<<<<<<<<< * self.sa.arr[i] = tmp * phead = i */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_midpoint]) = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_i]); + (__pyx_v_self->sa->arr[__pyx_v_midpoint]) = (__pyx_v_self->sa->arr[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":137 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":137 * tmp = self.sa.arr[midpoint] * self.sa.arr[midpoint] = self.sa.arr[i] * self.sa.arr[i] = tmp # <<<<<<<<<<<<<< * phead = i * ptail = i */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_i]) = __pyx_v_tmp; - goto __pyx_L9; + (__pyx_v_self->sa->arr[__pyx_v_i]) = __pyx_v_tmp; + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":138 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":138 * self.sa.arr[midpoint] = self.sa.arr[i] * self.sa.arr[i] = tmp * phead = i # <<<<<<<<<<<<<< @@ -30916,7 +33961,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO */ __pyx_v_phead = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":139 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":139 * self.sa.arr[i] = tmp * phead = i * ptail = i # <<<<<<<<<<<<<< @@ -30925,7 +33970,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO */ __pyx_v_ptail = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":143 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":143 * # find the three partitions. phead marks the first element * # of the middle partition, and ptail marks the last element * for k from i+1 <= k < j+1: # <<<<<<<<<<<<<< @@ -30935,17 +33980,17 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_5 = (__pyx_v_j + 1); for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":144 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":144 * # of the middle partition, and ptail marks the last element * for k from i+1 <= k < j+1: * if isa.arr[self.sa.arr[k] + h] < pval: # <<<<<<<<<<<<<< * if k > ptail+1: * tmp = self.sa.arr[phead] */ - __pyx_t_1 = ((__pyx_v_isa->arr[((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k]) + __pyx_v_h)]) < __pyx_v_pval); + __pyx_t_1 = ((__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_k]) + __pyx_v_h)]) < __pyx_v_pval); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":145 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":145 * for k from i+1 <= k < j+1: * if isa.arr[self.sa.arr[k] + h] < pval: * if k > ptail+1: # <<<<<<<<<<<<<< @@ -30955,75 +34000,75 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_1 = (__pyx_v_k > (__pyx_v_ptail + 1)); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":146 * if isa.arr[self.sa.arr[k] + h] < pval: * if k > ptail+1: * tmp = self.sa.arr[phead] # <<<<<<<<<<<<<< * self.sa.arr[phead] = self.sa.arr[k] * self.sa.arr[k] = self.sa.arr[ptail+1] */ - __pyx_v_tmp = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_phead]); + __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":147 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":147 * if k > ptail+1: * tmp = self.sa.arr[phead] * self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<< * self.sa.arr[k] = self.sa.arr[ptail+1] * self.sa.arr[ptail+1] = tmp */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_phead]) = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k]); + (__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":148 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":148 * tmp = self.sa.arr[phead] * self.sa.arr[phead] = self.sa.arr[k] * self.sa.arr[k] = self.sa.arr[ptail+1] # <<<<<<<<<<<<<< * self.sa.arr[ptail+1] = tmp * else: # k == ptail+1 */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k]) = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[(__pyx_v_ptail + 1)]); + (__pyx_v_self->sa->arr[__pyx_v_k]) = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":149 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":149 * self.sa.arr[phead] = self.sa.arr[k] * self.sa.arr[k] = self.sa.arr[ptail+1] * self.sa.arr[ptail+1] = tmp # <<<<<<<<<<<<<< * else: # k == ptail+1 * tmp = self.sa.arr[phead] */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[(__pyx_v_ptail + 1)]) = __pyx_v_tmp; - goto __pyx_L13; + (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]) = __pyx_v_tmp; + goto __pyx_L10; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":151 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":151 * self.sa.arr[ptail+1] = tmp * else: # k == ptail+1 * tmp = self.sa.arr[phead] # <<<<<<<<<<<<<< * self.sa.arr[phead] = self.sa.arr[k] * self.sa.arr[k] = tmp */ - __pyx_v_tmp = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_phead]); + __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":152 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":152 * else: # k == ptail+1 * tmp = self.sa.arr[phead] * self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<< * self.sa.arr[k] = tmp * phead = phead + 1 */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_phead]) = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k]); + (__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":153 * tmp = self.sa.arr[phead] * self.sa.arr[phead] = self.sa.arr[k] * self.sa.arr[k] = tmp # <<<<<<<<<<<<<< * phead = phead + 1 * ptail = ptail + 1 */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k]) = __pyx_v_tmp; + (__pyx_v_self->sa->arr[__pyx_v_k]) = __pyx_v_tmp; } - __pyx_L13:; + __pyx_L10:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":154 * self.sa.arr[phead] = self.sa.arr[k] * self.sa.arr[k] = tmp * phead = phead + 1 # <<<<<<<<<<<<<< @@ -31032,7 +34077,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO */ __pyx_v_phead = (__pyx_v_phead + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":155 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":155 * self.sa.arr[k] = tmp * phead = phead + 1 * ptail = ptail + 1 # <<<<<<<<<<<<<< @@ -31040,21 +34085,21 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO * if isa.arr[self.sa.arr[k] + h] == pval: */ __pyx_v_ptail = (__pyx_v_ptail + 1); - goto __pyx_L12; + goto __pyx_L9; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":157 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":157 * ptail = ptail + 1 * else: * if isa.arr[self.sa.arr[k] + h] == pval: # <<<<<<<<<<<<<< * if k > ptail+1: * tmp = self.sa.arr[ptail+1] */ - __pyx_t_1 = ((__pyx_v_isa->arr[((((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k]) + __pyx_v_h)]) == __pyx_v_pval); + __pyx_t_1 = ((__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_k]) + __pyx_v_h)]) == __pyx_v_pval); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":158 * else: * if isa.arr[self.sa.arr[k] + h] == pval: * if k > ptail+1: # <<<<<<<<<<<<<< @@ -31064,37 +34109,37 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_1 = (__pyx_v_k > (__pyx_v_ptail + 1)); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":159 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":159 * if isa.arr[self.sa.arr[k] + h] == pval: * if k > ptail+1: * tmp = self.sa.arr[ptail+1] # <<<<<<<<<<<<<< * self.sa.arr[ptail+1] = self.sa.arr[k] * self.sa.arr[k] = tmp */ - __pyx_v_tmp = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[(__pyx_v_ptail + 1)]); + __pyx_v_tmp = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":160 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":160 * if k > ptail+1: * tmp = self.sa.arr[ptail+1] * self.sa.arr[ptail+1] = self.sa.arr[k] # <<<<<<<<<<<<<< * self.sa.arr[k] = tmp * ptail = ptail + 1 */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[(__pyx_v_ptail + 1)]) = (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k]); + (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":161 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":161 * tmp = self.sa.arr[ptail+1] * self.sa.arr[ptail+1] = self.sa.arr[k] * self.sa.arr[k] = tmp # <<<<<<<<<<<<<< * ptail = ptail + 1 * */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k]) = __pyx_v_tmp; - goto __pyx_L15; + (__pyx_v_self->sa->arr[__pyx_v_k]) = __pyx_v_tmp; + goto __pyx_L12; } - __pyx_L15:; + __pyx_L12:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":162 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":162 * self.sa.arr[ptail+1] = self.sa.arr[k] * self.sa.arr[k] = tmp * ptail = ptail + 1 # <<<<<<<<<<<<<< @@ -31102,21 +34147,21 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO * # recursively sort smaller suffixes */ __pyx_v_ptail = (__pyx_v_ptail + 1); - goto __pyx_L14; + goto __pyx_L11; } - __pyx_L14:; + __pyx_L11:; } - __pyx_L12:; + __pyx_L9:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":165 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":165 * * # recursively sort smaller suffixes * self.q3sort(i, phead-1, h, isa, pad+" ") # <<<<<<<<<<<<<< * * # update suffixes with pivot value */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__q3sort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); @@ -31127,7 +34172,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_7 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_48)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); @@ -31149,7 +34194,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":169 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":169 * # update suffixes with pivot value * # corresponds to update_group function in Larsson & Sadakane * for k from phead <= k < ptail+1: # <<<<<<<<<<<<<< @@ -31159,17 +34204,17 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_5 = (__pyx_v_ptail + 1); for (__pyx_v_k = __pyx_v_phead; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":170 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":170 * # corresponds to update_group function in Larsson & Sadakane * for k from phead <= k < ptail+1: * isa.arr[self.sa.arr[k]] = ptail # <<<<<<<<<<<<<< * if phead == ptail: * self.sa.arr[phead] = -1 */ - (__pyx_v_isa->arr[(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_k])]) = __pyx_v_ptail; + (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_k])]) = __pyx_v_ptail; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":171 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":171 * for k from phead <= k < ptail+1: * isa.arr[self.sa.arr[k]] = ptail * if phead == ptail: # <<<<<<<<<<<<<< @@ -31179,26 +34224,26 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_1 = (__pyx_v_phead == __pyx_v_ptail); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":172 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":172 * isa.arr[self.sa.arr[k]] = ptail * if phead == ptail: * self.sa.arr[phead] = -1 # <<<<<<<<<<<<<< * * # recursively sort larger suffixes */ - (((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->arr[__pyx_v_phead]) = -1; - goto __pyx_L18; + (__pyx_v_self->sa->arr[__pyx_v_phead]) = -1; + goto __pyx_L15; } - __pyx_L18:; + __pyx_L15:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":175 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":175 * * # recursively sort larger suffixes * self.q3sort(ptail+1, j, h, isa, pad+" ") # <<<<<<<<<<<<<< * * */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__q3sort); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__q3sort); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong((__pyx_v_ptail + 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); @@ -31209,7 +34254,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO __pyx_t_2 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_48)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); @@ -31248,7 +34293,28 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":178 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_text (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_11SuffixArray_14write_text(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":178 * * * def write_text(self, char* filename): # <<<<<<<<<<<<<< @@ -31256,9 +34322,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(PyObject *__pyx_v_self, PyO * */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_7write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_7write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -31267,30 +34331,21 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_7write_text(PyObject *__pyx_v_self, int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_text"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_text", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":179 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":179 * * def write_text(self, char* filename): * self.darray.write_text(filename) # <<<<<<<<<<<<<< * * def read_binary(self, char* filename): */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray), __pyx_n_s__write_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s__write_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 179; __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[12]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -31314,24 +34369,13 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_7write_text(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":181 - * self.darray.write_text(filename) - * - * def read_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE *f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_3_sa_11SuffixArray_8read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_8read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_17read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_17read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_binary"); + __Pyx_RefNannySetupContext("read_binary (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -31341,8 +34385,26 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_8read_binary(PyObject *__pyx_v_self __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_11SuffixArray_16read_binary(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":181 + * self.darray.write_text(filename) + * + * def read_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE *f + * f = fopen(filename, "r") + */ - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":183 +static PyObject *__pyx_pf_3_sa_11SuffixArray_16read_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_binary", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":183 * def read_binary(self, char* filename): * cdef FILE *f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -31351,34 +34413,34 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_8read_binary(PyObject *__pyx_v_self */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":184 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":184 * cdef FILE *f * f = fopen(filename, "r") * self.darray.read_handle(f) # <<<<<<<<<<<<<< * self.sa.read_handle(f) * self.ha.read_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_DataArray *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->read_handle(__pyx_v_self->darray, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":185 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":185 * f = fopen(filename, "r") * self.darray.read_handle(f) * self.sa.read_handle(f) # <<<<<<<<<<<<<< * self.ha.read_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->read_handle(__pyx_v_self->sa, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":186 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":186 * self.darray.read_handle(f) * self.sa.read_handle(f) * self.ha.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha->__pyx_vtab)->read_handle(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->read_handle(__pyx_v_self->ha, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":187 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":187 * self.sa.read_handle(f) * self.ha.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -31393,24 +34455,13 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_8read_binary(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":189 - * fclose(f) - * - * def write_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_3_sa_11SuffixArray_9write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_9write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_19write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_19write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_binary"); + __Pyx_RefNannySetupContext("write_binary (wrapper)", 0); assert(__pyx_arg_filename); { __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -31420,8 +34471,26 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_9write_binary(PyObject *__pyx_v_sel __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_11SuffixArray_18write_binary(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":191 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":189 + * fclose(f) + * + * def write_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_3_sa_11SuffixArray_18write_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_binary", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":191 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -31430,34 +34499,34 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_9write_binary(PyObject *__pyx_v_sel */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":192 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":192 * cdef FILE* f * f = fopen(filename, "w") * self.darray.write_handle(f) # <<<<<<<<<<<<<< * self.sa.write_handle(f) * self.ha.write_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_DataArray *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->write_handle(__pyx_v_self->darray, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":193 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":193 * f = fopen(filename, "w") * self.darray.write_handle(f) * self.sa.write_handle(f) # <<<<<<<<<<<<<< * self.ha.write_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->write_handle(__pyx_v_self->sa, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":194 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":194 * self.darray.write_handle(f) * self.sa.write_handle(f) * self.ha.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha->__pyx_vtab)->write_handle(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha, __pyx_v_f); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->write_handle(__pyx_v_self->ha, __pyx_v_f); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":195 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":195 * self.sa.write_handle(f) * self.ha.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -31472,7 +34541,28 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_9write_binary(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":197 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_21write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_21write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_enhanced (wrapper)", 0); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_11SuffixArray_20write_enhanced(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":197 * fclose(f) * * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< @@ -31480,9 +34570,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_9write_binary(PyObject *__pyx_v_sel * self.darray.write_enhanced_handle(f) */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_10write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_10write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; +static PyObject *__pyx_pf_3_sa_11SuffixArray_20write_enhanced(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_a_i = NULL; PyObject *__pyx_v_w_i = NULL; @@ -31504,18 +34592,9 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_10write_enhanced(PyObject *__pyx_v_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced"); - assert(__pyx_arg_filename); { - __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("write_enhanced", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":198 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":198 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -31526,7 +34605,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_10write_enhanced(PyObject *__pyx_v_ __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); @@ -31538,203 +34617,220 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_10write_enhanced(PyObject *__pyx_v_ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L5_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { - __pyx_v_f = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":199 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":199 * def write_enhanced(self, char* filename): * with open(filename, "w") as f: * self.darray.write_enhanced_handle(f) # <<<<<<<<<<<<<< * for a_i in self.sa: * f.write("%d " % a_i) */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray), __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self->darray), __pyx_n_s_27); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f); __Pyx_GIVEREF(__pyx_v_f); - __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":200 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":200 * with open(filename, "w") as f: * self.darray.write_enhanced_handle(f) * for a_i in self.sa: # <<<<<<<<<<<<<< * f.write("%d " % a_i) * f.write("\n") */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa))) { - __pyx_t_7 = ((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa); __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->sa)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sa))) { + __pyx_t_2 = ((PyObject *)__pyx_v_self->sa); __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; __pyx_t_9 = NULL; } else { - __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self->sa)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_7)) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; - } else if (PyTuple_CheckExact(__pyx_t_7)) { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_2 = __pyx_t_9(__pyx_t_7); - if (unlikely(!__pyx_t_2)) { + __pyx_t_1 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF(__pyx_v_a_i); - __pyx_v_a_i = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_a_i = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":201 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":201 * self.darray.write_enhanced_handle(f) * for a_i in self.sa: * f.write("%d " % a_i) # <<<<<<<<<<<<<< * f.write("\n") * for w_i in self.ha: */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_a_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_a_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":202 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":202 * for a_i in self.sa: * f.write("%d " % a_i) * f.write("\n") # <<<<<<<<<<<<<< * for w_i in self.ha: * f.write("%d " % w_i) */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":203 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":203 * f.write("%d " % a_i) * f.write("\n") * for w_i in self.ha: # <<<<<<<<<<<<<< * f.write("%d " % w_i) * f.write("\n") */ - if (PyList_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha)) || PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha))) { - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha); __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + if (PyList_CheckExact(((PyObject *)__pyx_v_self->ha)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->ha))) { + __pyx_t_4 = ((PyObject *)__pyx_v_self->ha); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; __pyx_t_9 = NULL; } else { - __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->ha)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->ha)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif } else { - __pyx_t_7 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_7)) { + __pyx_t_2 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF(__pyx_v_w_i); - __pyx_v_w_i = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_w_i = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":204 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":204 * f.write("\n") * for w_i in self.ha: * f.write("%d " % w_i) # <<<<<<<<<<<<<< * f.write("\n") * */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_w_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_w_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_10)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_10)); __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":205 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":205 * for w_i in self.ha: * f.write("%d " % w_i) * f.write("\n") # <<<<<<<<<<<<<< * * cdef int __search_high(self, int word_id, int offset, int low, int high): */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L9_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L9_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L16_try_end; - __pyx_L9_error:; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":198 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":198 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -31743,75 +34839,75 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_10write_enhanced(PyObject *__pyx_v_ */ /*except:*/ { __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_INCREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); + __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __pyx_t_13 = (!__pyx_t_11); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_ErrRestore(__pyx_t_10, __pyx_t_1, __pyx_t_2); - __pyx_t_10 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} - goto __pyx_L23; + __Pyx_ErrRestore(__pyx_t_10, __pyx_t_4, __pyx_t_1); + __pyx_t_10 = 0; __pyx_t_4 = 0; __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; } - __pyx_L23:; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L10_exception_handled; + goto __pyx_L8_exception_handled; } - __pyx_L11_except_error:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L9_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; - __pyx_L10_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_4); + __pyx_L8_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - __pyx_L16_try_end:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L14_try_end:; } } /*finally:*/ { if (__pyx_t_3) { - __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_99, NULL); + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_99, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L24; - __pyx_L5_error:; + goto __pyx_L23; + __pyx_L3_error:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L1_error; - __pyx_L24:; + __pyx_L23:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -31819,7 +34915,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_10write_enhanced(PyObject *__pyx_v_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -31832,7 +34928,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_10write_enhanced(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":207 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":207 * f.write("\n") * * cdef int __search_high(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<< @@ -31845,9 +34941,9 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__search_high"); + __Pyx_RefNannySetupContext("__search_high", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":210 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":210 * cdef int midpoint * * if low >= high: # <<<<<<<<<<<<<< @@ -31857,7 +34953,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix __pyx_t_1 = (__pyx_v_low >= __pyx_v_high); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":211 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":211 * * if low >= high: * return high # <<<<<<<<<<<<<< @@ -31870,7 +34966,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":212 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":212 * if low >= high: * return high * midpoint = (high + low) / 2 # <<<<<<<<<<<<<< @@ -31879,7 +34975,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix */ __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":213 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":213 * return high * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<< @@ -31889,27 +34985,27 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix __pyx_t_1 = ((__pyx_v_self->darray->data->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_offset)]) == __pyx_v_word_id); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":214 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":214 * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: * return self.__search_high(word_id, offset, midpoint+1, high) # <<<<<<<<<<<<<< * else: * return self.__search_high(word_id, offset, low, midpoint) */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); + __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); goto __pyx_L0; goto __pyx_L4; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":216 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":216 * return self.__search_high(word_id, offset, midpoint+1, high) * else: * return self.__search_high(word_id, offset, low, midpoint) # <<<<<<<<<<<<<< * * cdef int __search_low(self, int word_id, int offset, int low, int high): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); + __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); goto __pyx_L0; } __pyx_L4:; @@ -31920,7 +35016,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":218 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":218 * return self.__search_high(word_id, offset, low, midpoint) * * cdef int __search_low(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<< @@ -31933,9 +35029,9 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__search_low"); + __Pyx_RefNannySetupContext("__search_low", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":221 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":221 * cdef int midpoint * * if low >= high: # <<<<<<<<<<<<<< @@ -31945,7 +35041,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA __pyx_t_1 = (__pyx_v_low >= __pyx_v_high); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":222 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":222 * * if low >= high: * return high # <<<<<<<<<<<<<< @@ -31958,7 +35054,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":223 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":223 * if low >= high: * return high * midpoint = (high + low) / 2 # <<<<<<<<<<<<<< @@ -31967,7 +35063,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA */ __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":224 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":224 * return high * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<< @@ -31977,27 +35073,27 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA __pyx_t_1 = ((__pyx_v_self->darray->data->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_offset)]) == __pyx_v_word_id); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":225 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":225 * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: * return self.__search_low(word_id, offset, low, midpoint) # <<<<<<<<<<<<<< * else: * return self.__search_low(word_id, offset, midpoint+1, high) */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__search_low(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); + __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_low(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); goto __pyx_L0; goto __pyx_L4; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":227 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":227 * return self.__search_low(word_id, offset, low, midpoint) * else: * return self.__search_low(word_id, offset, midpoint+1, high) # <<<<<<<<<<<<<< * * cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__search_low(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); + __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_low(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); goto __pyx_L0; } __pyx_L4:; @@ -32008,7 +35104,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":229 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":229 * return self.__search_low(word_id, offset, midpoint+1, high) * * cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): # <<<<<<<<<<<<<< @@ -32025,9 +35121,9 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_3_sa_Su int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get_range"); + __Pyx_RefNannySetupContext("__get_range", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":230 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":230 * * cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): * return (self.__search_low(word_id, offset, low, midpoint), # <<<<<<<<<<<<<< @@ -32035,20 +35131,20 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_3_sa_Su * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__search_low(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_low(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":231 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":231 * cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): * return (self.__search_low(word_id, offset, low, midpoint), * self.__search_high(word_id, offset, midpoint, high)) # <<<<<<<<<<<<<< * * cdef __lookup_helper(self, int word_id, int offset, int low, int high): */ - __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_midpoint, __pyx_v_high)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_midpoint, __pyx_v_high)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); @@ -32073,7 +35169,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_3_sa_Su return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":233 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":233 * self.__search_high(word_id, offset, midpoint, high)) * * cdef __lookup_helper(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<< @@ -32092,9 +35188,9 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__lookup_helper"); + __Pyx_RefNannySetupContext("__lookup_helper", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":236 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":236 * cdef int midpoint * * if offset == 0: # <<<<<<<<<<<<<< @@ -32104,7 +35200,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __pyx_t_1 = (__pyx_v_offset == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":237 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":237 * * if offset == 0: * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) # <<<<<<<<<<<<<< @@ -32117,7 +35213,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __pyx_t_3 = PyInt_FromLong((__pyx_v_self->ha->arr[(__pyx_v_word_id + 1)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); @@ -32131,7 +35227,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":238 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":238 * if offset == 0: * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) * if low >= high: # <<<<<<<<<<<<<< @@ -32141,7 +35237,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __pyx_t_1 = (__pyx_v_low >= __pyx_v_high); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":239 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":239 * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) * if low >= high: * return None # <<<<<<<<<<<<<< @@ -32156,7 +35252,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":241 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":241 * return None * * midpoint = (high + low) / 2 # <<<<<<<<<<<<<< @@ -32165,7 +35261,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s */ __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":242 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":242 * * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<< @@ -32175,7 +35271,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __pyx_t_1 = ((__pyx_v_self->darray->data->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_offset)]) == __pyx_v_word_id); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":243 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":243 * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: * return self.__get_range(word_id, offset, low, high, midpoint) # <<<<<<<<<<<<<< @@ -32183,7 +35279,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s * return self.__lookup_helper(word_id, offset, low, midpoint) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__get_range(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_high, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___get_range(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_high, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -32192,7 +35288,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":244 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":244 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: * return self.__get_range(word_id, offset, low, high, midpoint) * if self.darray.data.arr[self.sa.arr[midpoint] + offset] > word_id: # <<<<<<<<<<<<<< @@ -32202,7 +35298,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __pyx_t_1 = ((__pyx_v_self->darray->data->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_offset)]) > __pyx_v_word_id); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":245 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":245 * return self.__get_range(word_id, offset, low, high, midpoint) * if self.darray.data.arr[self.sa.arr[midpoint] + offset] > word_id: * return self.__lookup_helper(word_id, offset, low, midpoint) # <<<<<<<<<<<<<< @@ -32210,7 +35306,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s * return self.__lookup_helper(word_id, offset, midpoint+1, high) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -32219,7 +35315,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":247 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":247 * return self.__lookup_helper(word_id, offset, low, midpoint) * else: * return self.__lookup_helper(word_id, offset, midpoint+1, high) # <<<<<<<<<<<<<< @@ -32227,7 +35323,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s * def lookup(self, word, int offset, int low, int high): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -32249,37 +35345,23 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":249 - * return self.__lookup_helper(word_id, offset, midpoint+1, high) - * - * def lookup(self, word, int offset, int low, int high): # <<<<<<<<<<<<<< - * cdef int wordid - * if low == -1: - */ - -static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_11SuffixArray_23lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_11SuffixArray_23lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_word = 0; int __pyx_v_offset; int __pyx_v_low; int __pyx_v_high; - PyObject *__pyx_v_word_id = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__offset,&__pyx_n_s__low,&__pyx_n_s__high,0}; - __Pyx_RefNannySetupContext("lookup"); + __Pyx_RefNannySetupContext("lookup (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__offset,&__pyx_n_s__low,&__pyx_n_s__high,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -32288,32 +35370,28 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 2); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 3); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lookup") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookup") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -32336,8 +35414,33 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_11SuffixArray_22lookup(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_word, __pyx_v_offset, __pyx_v_low, __pyx_v_high); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":251 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":249 + * return self.__lookup_helper(word_id, offset, midpoint+1, high) + * + * def lookup(self, word, int offset, int low, int high): # <<<<<<<<<<<<<< + * cdef int wordid + * if low == -1: + */ + +static PyObject *__pyx_pf_3_sa_11SuffixArray_22lookup(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_word, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high) { + PyObject *__pyx_v_word_id = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lookup", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":251 * def lookup(self, word, int offset, int low, int high): * cdef int wordid * if low == -1: # <<<<<<<<<<<<<< @@ -32347,7 +35450,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py __pyx_t_1 = (__pyx_v_low == -1); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":252 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":252 * cdef int wordid * if low == -1: * low = 0 # <<<<<<<<<<<<<< @@ -32355,11 +35458,11 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py * high = len(self.sa) */ __pyx_v_low = 0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":253 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":253 * if low == -1: * low = 0 * if high == -1: # <<<<<<<<<<<<<< @@ -32369,45 +35472,45 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py __pyx_t_1 = (__pyx_v_high == -1); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":254 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":254 * low = 0 * if high == -1: * high = len(self.sa) # <<<<<<<<<<<<<< * if word in self.darray.word2id: * word_id = self.darray.word2id[word] */ - __pyx_t_2 = ((PyObject *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->sa); + __pyx_t_2 = ((PyObject *)__pyx_v_self->sa); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_high = __pyx_t_3; - goto __pyx_L7; + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":255 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":255 * if high == -1: * high = len(self.sa) * if word in self.darray.word2id: # <<<<<<<<<<<<<< * word_id = self.darray.word2id[word] * return self.__lookup_helper(word_id, offset, low, high) */ - __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray->word2id, __pyx_v_word))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_word, __pyx_v_self->darray->word2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":256 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":256 * high = len(self.sa) * if word in self.darray.word2id: * word_id = self.darray.word2id[word] # <<<<<<<<<<<<<< * return self.__lookup_helper(word_id, offset, low, high) * else: */ - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->darray->word2id, __pyx_v_word); if (!__pyx_t_2) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->darray->word2id, __pyx_v_word); if (!__pyx_t_2) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_word_id = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":257 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":257 * if word in self.darray.word2id: * word_id = self.darray.word2id[word] * return self.__lookup_helper(word_id, offset, low, high) # <<<<<<<<<<<<<< @@ -32416,16 +35519,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self)->__pyx_vtab)->__lookup_helper(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_t_4, __pyx_v_offset, __pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_t_4, __pyx_v_offset, __pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 257; __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_L8; + goto __pyx_L5; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":259 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":259 * return self.__lookup_helper(word_id, offset, low, high) * else: * return None # <<<<<<<<<<<<<< @@ -32435,7 +35538,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py __pyx_r = Py_None; goto __pyx_L0; } - __pyx_L8:; + __pyx_L5:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -32450,7 +35553,21 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":37 +/* Python wrapper */ +static int __pyx_pw_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_3_sa_8TrieNode___cinit__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":37 * cdef public children * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -32458,20 +35575,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_11lookup(PyObject *__pyx_v_self, Py * */ -static int __pyx_pf_3_sa_8TrieNode___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_8TrieNode___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pf_3_sa_8TrieNode___cinit__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":38 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":38 * * def __cinit__(self): * self.children = {} # <<<<<<<<<<<<<< @@ -32481,9 +35594,9 @@ static int __pyx_pf_3_sa_8TrieNode___cinit__(PyObject *__pyx_v_self, PyObject *_ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children); - __Pyx_DECREF(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children); - ((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; __pyx_r = 0; @@ -32497,7 +35610,18 @@ static int __pyx_pf_3_sa_8TrieNode___cinit__(PyObject *__pyx_v_self, PyObject *_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":35 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_8TrieNode_8children___get__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":35 * * cdef class TrieNode: * cdef public children # <<<<<<<<<<<<<< @@ -32505,14 +35629,13 @@ static int __pyx_pf_3_sa_8TrieNode___cinit__(PyObject *__pyx_v_self, PyObject *_ * def __cinit__(self): */ -static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children); - __pyx_r = ((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children; + __Pyx_INCREF(__pyx_v_self->children); + __pyx_r = __pyx_v_self->children; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -32522,66 +35645,85 @@ static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(PyObject *__pyx_v_sel return __pyx_r; } -static int __pyx_pf_3_sa_8TrieNode_8children_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_3_sa_8TrieNode_8children_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +/* Python wrapper */ +static int __pyx_pw_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__"); + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_8TrieNode_8children_2__set__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children); - __Pyx_DECREF(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children); - ((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_8TrieNode_8children_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_3_sa_8TrieNode_8children_2__del__(PyObject *__pyx_v_self) { +/* Python wrapper */ +static int __pyx_pw_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_8TrieNode_8children_4__del__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__"); + __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children); - __Pyx_DECREF(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children); - ((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)->children = Py_None; + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":45 - * cdef public suffix_link - * - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): # <<<<<<<<<<<<<< - * self.phrase = phrase - * self.phrase_location = phrase_location - */ - -static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_phrase = 0; PyObject *__pyx_v_phrase_location = 0; PyObject *__pyx_v_suffix_link = 0; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__phrase,&__pyx_n_s__phrase_location,&__pyx_n_s__suffix_link,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__phrase,&__pyx_n_s__phrase_location,&__pyx_n_s__suffix_link,0}; PyObject* values[3] = {0,0,0}; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":45 + * cdef public suffix_link + * + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): # <<<<<<<<<<<<<< + * self.phrase = phrase + * self.phrase_location = phrase_location + */ values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -32589,7 +35731,7 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, Py default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__phrase); @@ -32607,7 +35749,7 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, Py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -32630,8 +35772,17 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, Py __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), __pyx_v_phrase, __pyx_v_phrase_location, __pyx_v_suffix_link); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":46 +static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":46 * * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): * self.phrase = phrase # <<<<<<<<<<<<<< @@ -32640,11 +35791,11 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, Py */ __Pyx_INCREF(__pyx_v_phrase); __Pyx_GIVEREF(__pyx_v_phrase); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase = __pyx_v_phrase; + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = __pyx_v_phrase; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":47 * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): * self.phrase = phrase * self.phrase_location = phrase_location # <<<<<<<<<<<<<< @@ -32653,11 +35804,11 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, Py */ __Pyx_INCREF(__pyx_v_phrase_location); __Pyx_GIVEREF(__pyx_v_phrase_location); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location = __pyx_v_phrase_location; + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = __pyx_v_phrase_location; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":48 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":48 * self.phrase = phrase * self.phrase_location = phrase_location * self.suffix_link = suffix_link # <<<<<<<<<<<<<< @@ -32666,16 +35817,27 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, Py */ __Pyx_INCREF(__pyx_v_suffix_link); __Pyx_GIVEREF(__pyx_v_suffix_link); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link = __pyx_v_suffix_link; + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = __pyx_v_suffix_link; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":41 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":41 * * cdef class ExtendedTrieNode(TrieNode): * cdef public phrase # <<<<<<<<<<<<<< @@ -32683,14 +35845,13 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(PyObject *__pyx_v_self, Py * cdef public suffix_link */ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase); - __pyx_r = ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase; + __Pyx_INCREF(__pyx_v_self->phrase); + __pyx_r = __pyx_v_self->phrase; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -32700,39 +35861,70 @@ static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(PyObject *__py return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +/* Python wrapper */ +static int __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__"); + __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__del__(PyObject *__pyx_v_self) { +/* Python wrapper */ +static int __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__"); + __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase = Py_None; + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":42 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":42 * cdef class ExtendedTrieNode(TrieNode): * cdef public phrase * cdef public phrase_location # <<<<<<<<<<<<<< @@ -32740,14 +35932,13 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__del__(PyObject *__pyx_v_s * */ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location); - __pyx_r = ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location; + __Pyx_INCREF(__pyx_v_self->phrase_location); + __pyx_r = __pyx_v_self->phrase_location; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -32757,39 +35948,70 @@ static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(PyOb return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +/* Python wrapper */ +static int __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__"); + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__del__(PyObject *__pyx_v_self) { +/* Python wrapper */ +static int __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__"); + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->phrase_location = Py_None; + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":43 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":43 * cdef public phrase * cdef public phrase_location * cdef public suffix_link # <<<<<<<<<<<<<< @@ -32797,14 +36019,13 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__del__(PyObject * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): */ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link); - __pyx_r = ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link; + __Pyx_INCREF(__pyx_v_self->suffix_link); + __pyx_r = __pyx_v_self->suffix_link; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -32814,71 +36035,79 @@ static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(PyObject return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +/* Python wrapper */ +static int __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__"); + __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__del__(PyObject *__pyx_v_self) { +/* Python wrapper */ +static int __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__"); + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link); - __Pyx_DECREF(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link); - ((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)->suffix_link = Py_None; + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":55 - * cdef public int count - * cdef public root - * def __cinit__(self, extended=False): # <<<<<<<<<<<<<< - * self.count = 0 - * self.extended = extended - */ - -static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_extended = 0; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__extended,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__extended,0}; PyObject* values[1] = {0}; values[0] = __pyx_k_100; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extended); @@ -32886,7 +36115,7 @@ static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject * } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -32905,17 +36134,40 @@ static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject * __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_9TrieTable___cinit__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), __pyx_v_extended); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":56 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":55 + * cdef public int count + * cdef public root + * def __cinit__(self, extended=False): # <<<<<<<<<<<<<< + * self.count = 0 + * self.extended = extended + */ + +static int __pyx_pf_3_sa_9TrieTable___cinit__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":56 * cdef public root * def __cinit__(self, extended=False): * self.count = 0 # <<<<<<<<<<<<<< * self.extended = extended * if extended: */ - ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->count = 0; + __pyx_v_self->count = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":57 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":57 * def __cinit__(self, extended=False): * self.count = 0 * self.extended = extended # <<<<<<<<<<<<<< @@ -32923,9 +36175,9 @@ static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject * * self.root = ExtendedTrieNode() */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_extended); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->extended = __pyx_t_1; + __pyx_v_self->extended = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":58 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":58 * self.count = 0 * self.extended = extended * if extended: # <<<<<<<<<<<<<< @@ -32935,7 +36187,7 @@ static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extended); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":59 * self.extended = extended * if extended: * self.root = ExtendedTrieNode() # <<<<<<<<<<<<<< @@ -32945,15 +36197,15 @@ static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - __Pyx_DECREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root = __pyx_t_3; + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_t_3; __pyx_t_3 = 0; - goto __pyx_L6; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":61 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":61 * self.root = ExtendedTrieNode() * else: * self.root = TrieNode() # <<<<<<<<<<<<<< @@ -32963,12 +36215,12 @@ static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject * __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_TrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - __Pyx_DECREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root = __pyx_t_3; + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_t_3; __pyx_t_3 = 0; } - __pyx_L6:; + __pyx_L3:; __pyx_r = 0; goto __pyx_L0; @@ -32981,7 +36233,18 @@ static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":52 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9TrieTable_8extended___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":52 * * cdef class TrieTable: * cdef public int extended # <<<<<<<<<<<<<< @@ -32989,17 +36252,16 @@ static int __pyx_pf_3_sa_9TrieTable___cinit__(PyObject *__pyx_v_self, PyObject * * cdef public root */ -static PyObject *__pyx_pf_3_sa_9TrieTable_8extended___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_9TrieTable_8extended___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->extended); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->extended); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -33017,17 +36279,27 @@ static PyObject *__pyx_pf_3_sa_9TrieTable_8extended___get__(PyObject *__pyx_v_se return __pyx_r; } -static int __pyx_pf_3_sa_9TrieTable_8extended_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_3_sa_9TrieTable_8extended_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +/* Python wrapper */ +static int __pyx_pw_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9TrieTable_8extended_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__"); + __Pyx_RefNannySetupContext("__set__", 0); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->extended = __pyx_t_1; + __pyx_v_self->extended = __pyx_t_1; __pyx_r = 0; goto __pyx_L0; @@ -33039,7 +36311,18 @@ static int __pyx_pf_3_sa_9TrieTable_8extended_1__set__(PyObject *__pyx_v_self, P return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":53 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9TrieTable_5count___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":53 * cdef class TrieTable: * cdef public int extended * cdef public int count # <<<<<<<<<<<<<< @@ -33047,17 +36330,16 @@ static int __pyx_pf_3_sa_9TrieTable_8extended_1__set__(PyObject *__pyx_v_self, P * def __cinit__(self, extended=False): */ -static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -33075,17 +36357,27 @@ static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(PyObject *__pyx_v_self) return __pyx_r; } -static int __pyx_pf_3_sa_9TrieTable_5count_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_3_sa_9TrieTable_5count_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +/* Python wrapper */ +static int __pyx_pw_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9TrieTable_5count_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__"); + __Pyx_RefNannySetupContext("__set__", 0); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->count = __pyx_t_1; + __pyx_v_self->count = __pyx_t_1; __pyx_r = 0; goto __pyx_L0; @@ -33097,7 +36389,18 @@ static int __pyx_pf_3_sa_9TrieTable_5count_1__set__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":54 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9TrieTable_4root___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":54 * cdef public int extended * cdef public int count * cdef public root # <<<<<<<<<<<<<< @@ -33105,14 +36408,13 @@ static int __pyx_pf_3_sa_9TrieTable_5count_1__set__(PyObject *__pyx_v_self, PyOb * self.count = 0 */ -static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - __pyx_r = ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root; + __Pyx_INCREF(__pyx_v_self->root); + __pyx_r = __pyx_v_self->root; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -33122,39 +36424,59 @@ static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(PyObject *__pyx_v_self) return __pyx_r; } -static int __pyx_pf_3_sa_9TrieTable_4root_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_3_sa_9TrieTable_4root_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +/* Python wrapper */ +static int __pyx_pw_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9TrieTable_4root_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__"); + __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - __Pyx_DECREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9TrieTable_4root_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_3_sa_9TrieTable_4root_2__del__(PyObject *__pyx_v_self) { +/* Python wrapper */ +static int __pyx_pw_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__"); + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_9TrieTable_4root_4__del__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - __Pyx_DECREF(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root); - ((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)->root = Py_None; + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":81 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":81 * * # returns true if sent_id is contained * cdef int contains(self, int sent_id): # <<<<<<<<<<<<<< @@ -33162,12 +36484,12 @@ static int __pyx_pf_3_sa_9TrieTable_4root_2__del__(PyObject *__pyx_v_self) { * */ -static int __pyx_f_3_sa_14PhraseLocation_contains(struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sent_id) { +static int __pyx_f_3_sa_14PhraseLocation_contains(CYTHON_UNUSED struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_self, CYTHON_UNUSED int __pyx_v_sent_id) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("contains"); + __Pyx_RefNannySetupContext("contains", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":82 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":82 * # returns true if sent_id is contained * cdef int contains(self, int sent_id): * return 1 # <<<<<<<<<<<<<< @@ -33183,16 +36505,9 @@ static int __pyx_f_3_sa_14PhraseLocation_contains(struct __pyx_obj_3_sa_PhraseLo return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":84 - * return 1 - * - * def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, # <<<<<<<<<<<<<< - * arr=None, int num_subpatterns=1): - * self.sa_low = sa_low - */ - -static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_sa_low; int __pyx_v_sa_high; int __pyx_v_arr_low; @@ -33201,15 +36516,12 @@ static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyOb int __pyx_v_num_subpatterns; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sa_low,&__pyx_n_s__sa_high,&__pyx_n_s__arr_low,&__pyx_n_s__arr_high,&__pyx_n_s__arr,&__pyx_n_s__num_subpatterns,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sa_low,&__pyx_n_s__sa_high,&__pyx_n_s__arr_low,&__pyx_n_s__arr_high,&__pyx_n_s__arr,&__pyx_n_s__num_subpatterns,0}; PyObject* values[6] = {0,0,0,0,0,0}; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":85 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":85 * * def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, * arr=None, int num_subpatterns=1): # <<<<<<<<<<<<<< @@ -33219,7 +36531,8 @@ static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyOb values[4] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -33230,7 +36543,7 @@ static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyOb default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa_low); @@ -33263,7 +36576,7 @@ static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyOb } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -33312,44 +36625,64 @@ static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyOb __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_14PhraseLocation___cinit__(((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self), __pyx_v_sa_low, __pyx_v_sa_high, __pyx_v_arr_low, __pyx_v_arr_high, __pyx_v_arr, __pyx_v_num_subpatterns); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":86 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":84 + * return 1 + * + * def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, # <<<<<<<<<<<<<< + * arr=None, int num_subpatterns=1): + * self.sa_low = sa_low + */ + +static int __pyx_pf_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sa_low, int __pyx_v_sa_high, int __pyx_v_arr_low, int __pyx_v_arr_high, PyObject *__pyx_v_arr, int __pyx_v_num_subpatterns) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":86 * def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, * arr=None, int num_subpatterns=1): * self.sa_low = sa_low # <<<<<<<<<<<<<< * self.sa_high = sa_high * self.arr_low = arr_low */ - ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self)->sa_low = __pyx_v_sa_low; + __pyx_v_self->sa_low = __pyx_v_sa_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":87 * arr=None, int num_subpatterns=1): * self.sa_low = sa_low * self.sa_high = sa_high # <<<<<<<<<<<<<< * self.arr_low = arr_low * self.arr_high = arr_high */ - ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self)->sa_high = __pyx_v_sa_high; + __pyx_v_self->sa_high = __pyx_v_sa_high; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":88 * self.sa_low = sa_low * self.sa_high = sa_high * self.arr_low = arr_low # <<<<<<<<<<<<<< * self.arr_high = arr_high * self.arr = arr */ - ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self)->arr_low = __pyx_v_arr_low; + __pyx_v_self->arr_low = __pyx_v_arr_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":89 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":89 * self.sa_high = sa_high * self.arr_low = arr_low * self.arr_high = arr_high # <<<<<<<<<<<<<< * self.arr = arr * self.num_subpatterns = num_subpatterns */ - ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self)->arr_high = __pyx_v_arr_high; + __pyx_v_self->arr_high = __pyx_v_arr_high; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":90 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":90 * self.arr_low = arr_low * self.arr_high = arr_high * self.arr = arr # <<<<<<<<<<<<<< @@ -33359,18 +36692,18 @@ static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyOb if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self)->arr); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self)->arr)); - ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self)->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_arr); + __Pyx_GOTREF(__pyx_v_self->arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->arr)); + __pyx_v_self->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":91 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":91 * self.arr_high = arr_high * self.arr = arr * self.num_subpatterns = num_subpatterns # <<<<<<<<<<<<<< * * */ - ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_self)->num_subpatterns = __pyx_v_num_subpatterns; + __pyx_v_self->num_subpatterns = __pyx_v_num_subpatterns; __pyx_r = 0; goto __pyx_L0; @@ -33382,54 +36715,39 @@ static int __pyx_pf_3_sa_14PhraseLocation___cinit__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":101 - * cdef IntList sa - * - * def __cinit__(self, int sample_size, SuffixArray fsarray): # <<<<<<<<<<<<<< - * self.sample_size = sample_size - * self.sa = fsarray.sa - */ - -static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_sample_size; struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray = 0; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sample_size,&__pyx_n_s__fsarray,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sample_size,&__pyx_n_s__fsarray,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_size); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_size)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -33449,17 +36767,45 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__ return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_7Sampler___cinit__(((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self), __pyx_v_sample_size, __pyx_v_fsarray); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":102 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":101 + * cdef IntList sa + * + * def __cinit__(self, int sample_size, SuffixArray fsarray): # <<<<<<<<<<<<<< + * self.sample_size = sample_size + * self.sa = fsarray.sa + */ + +static int __pyx_pf_3_sa_7Sampler___cinit__(struct __pyx_obj_3_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":102 * * def __cinit__(self, int sample_size, SuffixArray fsarray): * self.sample_size = sample_size # <<<<<<<<<<<<<< * self.sa = fsarray.sa * if sample_size > 0: */ - ((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size = __pyx_v_sample_size; + __pyx_v_self->sample_size = __pyx_v_sample_size; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":103 * def __cinit__(self, int sample_size, SuffixArray fsarray): * self.sample_size = sample_size * self.sa = fsarray.sa # <<<<<<<<<<<<<< @@ -33468,11 +36814,11 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__ */ __Pyx_INCREF(((PyObject *)__pyx_v_fsarray->sa)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fsarray->sa)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sa); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sa)); - ((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sa = __pyx_v_fsarray->sa; + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = __pyx_v_fsarray->sa; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":104 * self.sample_size = sample_size * self.sa = fsarray.sa * if sample_size > 0: # <<<<<<<<<<<<<< @@ -33482,7 +36828,7 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__ __pyx_t_1 = (__pyx_v_sample_size > 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":105 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":105 * self.sa = fsarray.sa * if sample_size > 0: * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) # <<<<<<<<<<<<<< @@ -33497,7 +36843,7 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__ __pyx_t_2 = PyInt_FromLong(__pyx_v_sample_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_101)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_101)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_101)); @@ -33509,11 +36855,11 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L6; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":107 * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) * else: * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< @@ -33530,7 +36876,7 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __pyx_L6:; + __pyx_L3:; __pyx_r = 0; goto __pyx_L0; @@ -33545,7 +36891,24 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":109 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location); /*proto*/ +static char __pyx_doc_3_sa_7Sampler_2sample[] = "Returns a sample of the locations for\n the phrase. If there are less than self.sample_size\n locations, return all of them; otherwise, return\n up to self.sample_size locations. In the latter case,\n we choose to sample UNIFORMLY -- that is, the locations\n are chosen at uniform intervals over the entire set, rather\n than randomly. This makes the algorithm deterministic, which\n is good for things like MERT"; +static PyObject *__pyx_pw_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sample (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_phrase_location), __pyx_ptype_3_sa_PhraseLocation, 1, "phrase_location", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_7Sampler_2sample(((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self), ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":109 * logger.info("Sampling strategy: no sampling") * * def sample(self, PhraseLocation phrase_location): # <<<<<<<<<<<<<< @@ -33553,9 +36916,7 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(PyObject *__pyx_v_self, PyObject *__ * the phrase. If there are less than self.sample_size */ -static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location); /*proto*/ -static char __pyx_doc_3_sa_7Sampler_1sample[] = "Returns a sample of the locations for\n the phrase. If there are less than self.sample_size\n locations, return all of them; otherwise, return\n up to self.sample_size locations. In the latter case,\n we choose to sample UNIFORMLY -- that is, the locations\n are chosen at uniform intervals over the entire set, rather\n than randomly. This makes the algorithm deterministic, which\n is good for things like MERT"; -static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location) { +static PyObject *__pyx_pf_3_sa_7Sampler_2sample(struct __pyx_obj_3_sa_Sampler *__pyx_v_self, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_phrase_location) { struct __pyx_obj_3_sa_IntList *__pyx_v_sample = 0; double __pyx_v_i; double __pyx_v_stepsize; @@ -33572,10 +36933,9 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sample"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_phrase_location), __pyx_ptype_3_sa_PhraseLocation, 1, "phrase_location", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("sample", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":122 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":122 * cdef int num_locations, val, j * * sample = IntList() # <<<<<<<<<<<<<< @@ -33587,76 +36947,76 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject __pyx_v_sample = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":123 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":123 * * sample = IntList() * if phrase_location.arr is None: # <<<<<<<<<<<<<< * num_locations = phrase_location.sa_high - phrase_location.sa_low * if self.sample_size == -1 or num_locations <= self.sample_size: */ - __pyx_t_2 = (((PyObject *)((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->arr) == Py_None); + __pyx_t_2 = (((PyObject *)__pyx_v_phrase_location->arr) == Py_None); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":124 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":124 * sample = IntList() * if phrase_location.arr is None: * num_locations = phrase_location.sa_high - phrase_location.sa_low # <<<<<<<<<<<<<< * if self.sample_size == -1 or num_locations <= self.sample_size: * sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) */ - __pyx_v_num_locations = (((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->sa_high - ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->sa_low); + __pyx_v_num_locations = (__pyx_v_phrase_location->sa_high - __pyx_v_phrase_location->sa_low); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":125 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":125 * if phrase_location.arr is None: * num_locations = phrase_location.sa_high - phrase_location.sa_low * if self.sample_size == -1 or num_locations <= self.sample_size: # <<<<<<<<<<<<<< * sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) * else: */ - __pyx_t_2 = (((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size == -1); + __pyx_t_2 = (__pyx_v_self->sample_size == -1); if (!__pyx_t_2) { - __pyx_t_3 = (__pyx_v_num_locations <= ((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size); + __pyx_t_3 = (__pyx_v_num_locations <= __pyx_v_self->sample_size); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":126 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":126 * num_locations = phrase_location.sa_high - phrase_location.sa_low * if self.sample_size == -1 or num_locations <= self.sample_size: * sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) # <<<<<<<<<<<<<< * else: * stepsize = float(num_locations)/float(self.sample_size) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sa->arr + ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->sa_low), __pyx_v_num_locations); - goto __pyx_L6; + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (__pyx_v_self->sa->arr + __pyx_v_phrase_location->sa_low), __pyx_v_num_locations); + goto __pyx_L4; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":128 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":128 * sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) * else: * stepsize = float(num_locations)/float(self.sample_size) # <<<<<<<<<<<<<< * i = phrase_location.sa_low * while i < phrase_location.sa_high and sample.len < self.sample_size: */ - if (unlikely(((double)((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size) == 0)) { + if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size)); + __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":129 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":129 * else: * stepsize = float(num_locations)/float(self.sample_size) * i = phrase_location.sa_low # <<<<<<<<<<<<<< * while i < phrase_location.sa_high and sample.len < self.sample_size: * '''Note: int(i) not guaranteed to have the desired */ - __pyx_v_i = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->sa_low; + __pyx_v_i = __pyx_v_phrase_location->sa_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":130 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":130 * stepsize = float(num_locations)/float(self.sample_size) * i = phrase_location.sa_low * while i < phrase_location.sa_high and sample.len < self.sample_size: # <<<<<<<<<<<<<< @@ -33664,16 +37024,16 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject * effect, according to the python documentation''' */ while (1) { - __pyx_t_4 = (__pyx_v_i < ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->sa_high); + __pyx_t_4 = (__pyx_v_i < __pyx_v_phrase_location->sa_high); if (__pyx_t_4) { - __pyx_t_2 = (__pyx_v_sample->len < ((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size); + __pyx_t_2 = (__pyx_v_sample->len < __pyx_v_self->sample_size); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_4; } if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":133 * '''Note: int(i) not guaranteed to have the desired * effect, according to the python documentation''' * if fmod(i,1.0) > 0.5: # <<<<<<<<<<<<<< @@ -33683,7 +37043,7 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject __pyx_t_3 = (fmod(__pyx_v_i, 1.0) > 0.5); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":134 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":134 * effect, according to the python documentation''' * if fmod(i,1.0) > 0.5: * val = int(ceil(i)) # <<<<<<<<<<<<<< @@ -33691,11 +37051,11 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject * val = int(floor(i)) */ __pyx_v_val = ((int)ceil(__pyx_v_i)); - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":136 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":136 * val = int(ceil(i)) * else: * val = int(floor(i)) # <<<<<<<<<<<<<< @@ -33704,18 +37064,18 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject */ __pyx_v_val = ((int)floor(__pyx_v_i)); } - __pyx_L9:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":137 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":137 * else: * val = int(floor(i)) * sample._append(self.sa.arr[val]) # <<<<<<<<<<<<<< * i = i + stepsize * else: */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_append(__pyx_v_sample, (((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sa->arr[__pyx_v_val])); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_append(__pyx_v_sample, (__pyx_v_self->sa->arr[__pyx_v_val])); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":138 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":138 * val = int(floor(i)) * sample._append(self.sa.arr[val]) * i = i + stepsize # <<<<<<<<<<<<<< @@ -33725,82 +37085,82 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); } } - __pyx_L6:; - goto __pyx_L5; + __pyx_L4:; + goto __pyx_L3; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":140 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":140 * i = i + stepsize * else: * num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns # <<<<<<<<<<<<<< * if self.sample_size == -1 or num_locations <= self.sample_size: * sample = phrase_location.arr */ - __pyx_t_5 = (((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->arr_high - ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->arr_low); - if (unlikely(((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->num_subpatterns == 0)) { + __pyx_t_5 = (__pyx_v_phrase_location->arr_high - __pyx_v_phrase_location->arr_low); + if (unlikely(__pyx_v_phrase_location->num_subpatterns == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - else if (sizeof(int) == sizeof(long) && unlikely(((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_phrase_location->num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { PyErr_Format(PyExc_OverflowError, "value too large to perform division"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_num_locations = __Pyx_div_int(__pyx_t_5, ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->num_subpatterns); + __pyx_v_num_locations = __Pyx_div_int(__pyx_t_5, __pyx_v_phrase_location->num_subpatterns); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":141 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":141 * else: * num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns * if self.sample_size == -1 or num_locations <= self.sample_size: # <<<<<<<<<<<<<< * sample = phrase_location.arr * else: */ - __pyx_t_3 = (((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size == -1); + __pyx_t_3 = (__pyx_v_self->sample_size == -1); if (!__pyx_t_3) { - __pyx_t_4 = (__pyx_v_num_locations <= ((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size); + __pyx_t_4 = (__pyx_v_num_locations <= __pyx_v_self->sample_size); __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":142 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":142 * num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns * if self.sample_size == -1 or num_locations <= self.sample_size: * sample = phrase_location.arr # <<<<<<<<<<<<<< * else: * stepsize = float(num_locations)/float(self.sample_size) */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->arr)); + __Pyx_INCREF(((PyObject *)__pyx_v_phrase_location->arr)); __Pyx_DECREF(((PyObject *)__pyx_v_sample)); - __pyx_v_sample = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->arr; - goto __pyx_L10; + __pyx_v_sample = __pyx_v_phrase_location->arr; + goto __pyx_L8; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":144 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":144 * sample = phrase_location.arr * else: * stepsize = float(num_locations)/float(self.sample_size) # <<<<<<<<<<<<<< * i = phrase_location.arr_low * while i < num_locations and sample.len < self.sample_size * phrase_location.num_subpatterns: */ - if (unlikely(((double)((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size) == 0)) { + if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size)); + __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":145 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":145 * else: * stepsize = float(num_locations)/float(self.sample_size) * i = phrase_location.arr_low # <<<<<<<<<<<<<< * while i < num_locations and sample.len < self.sample_size * phrase_location.num_subpatterns: * '''Note: int(i) not guaranteed to have the desired */ - __pyx_v_i = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->arr_low; + __pyx_v_i = __pyx_v_phrase_location->arr_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":146 * stepsize = float(num_locations)/float(self.sample_size) * i = phrase_location.arr_low * while i < num_locations and sample.len < self.sample_size * phrase_location.num_subpatterns: # <<<<<<<<<<<<<< @@ -33810,14 +37170,14 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject while (1) { __pyx_t_2 = (__pyx_v_i < __pyx_v_num_locations); if (__pyx_t_2) { - __pyx_t_3 = (__pyx_v_sample->len < (((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self)->sample_size * ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->num_subpatterns)); + __pyx_t_3 = (__pyx_v_sample->len < (__pyx_v_self->sample_size * __pyx_v_phrase_location->num_subpatterns)); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } if (!__pyx_t_4) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":149 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":149 * '''Note: int(i) not guaranteed to have the desired * effect, according to the python documentation''' * if fmod(i,1.0) > 0.5: # <<<<<<<<<<<<<< @@ -33827,7 +37187,7 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject __pyx_t_4 = (fmod(__pyx_v_i, 1.0) > 0.5); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":150 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":150 * effect, according to the python documentation''' * if fmod(i,1.0) > 0.5: * val = int(ceil(i)) # <<<<<<<<<<<<<< @@ -33835,11 +37195,11 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject * val = int(floor(i)) */ __pyx_v_val = ((int)ceil(__pyx_v_i)); - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":152 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":152 * val = int(ceil(i)) * else: * val = int(floor(i)) # <<<<<<<<<<<<<< @@ -33848,27 +37208,27 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject */ __pyx_v_val = ((int)floor(__pyx_v_i)); } - __pyx_L13:; + __pyx_L11:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":153 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":153 * else: * val = int(floor(i)) * j = phrase_location.arr_low + (val*phrase_location.num_subpatterns) # <<<<<<<<<<<<<< * sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) * i = i + stepsize */ - __pyx_v_j = (((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->arr_low + (__pyx_v_val * ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->num_subpatterns)); + __pyx_v_j = (__pyx_v_phrase_location->arr_low + (__pyx_v_val * __pyx_v_phrase_location->num_subpatterns)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":154 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":154 * val = int(floor(i)) * j = phrase_location.arr_low + (val*phrase_location.num_subpatterns) * sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) # <<<<<<<<<<<<<< * i = i + stepsize * return sample */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->arr->arr + __pyx_v_j), ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)->num_subpatterns); + ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (__pyx_v_phrase_location->arr->arr + __pyx_v_j), __pyx_v_phrase_location->num_subpatterns); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":155 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":155 * j = phrase_location.arr_low + (val*phrase_location.num_subpatterns) * sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) * i = i + stepsize # <<<<<<<<<<<<<< @@ -33878,11 +37238,11 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); } } - __pyx_L10:; + __pyx_L8:; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":156 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":156 * sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) * i = i + stepsize * return sample # <<<<<<<<<<<<<< @@ -33907,7 +37267,7 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":168 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":168 * * * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): # <<<<<<<<<<<<<< @@ -33917,9 +37277,9 @@ static PyObject *__pyx_pf_3_sa_7Sampler_1sample(PyObject *__pyx_v_self, PyObject static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *__pyx_v_m, int *__pyx_v_arr, int __pyx_v_start, int __pyx_v_step, int *__pyx_v_sent_id_arr) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("assign_matching"); + __Pyx_RefNannySetupContext("assign_matching", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":169 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":169 * * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): * m.arr = arr # <<<<<<<<<<<<<< @@ -33928,7 +37288,7 @@ static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *__pyx_v_m */ __pyx_v_m->arr = __pyx_v_arr; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":170 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":170 * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): * m.arr = arr * m.start = start # <<<<<<<<<<<<<< @@ -33937,7 +37297,7 @@ static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *__pyx_v_m */ __pyx_v_m->start = __pyx_v_start; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":171 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":171 * m.arr = arr * m.start = start * m.end = start + step # <<<<<<<<<<<<<< @@ -33946,7 +37306,7 @@ static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *__pyx_v_m */ __pyx_v_m->end = (__pyx_v_start + __pyx_v_step); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":172 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":172 * m.start = start * m.end = start + step * m.sent_id = sent_id_arr[arr[start]] # <<<<<<<<<<<<<< @@ -33955,7 +37315,7 @@ static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *__pyx_v_m */ __pyx_v_m->sent_id = (__pyx_v_sent_id_arr[(__pyx_v_arr[__pyx_v_start])]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":173 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":173 * m.end = start + step * m.sent_id = sent_id_arr[arr[start]] * m.size = step # <<<<<<<<<<<<<< @@ -33967,7 +37327,7 @@ static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *__pyx_v_m __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":176 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":176 * * * cdef int* append_combined_matching(int* arr, Matching* loc1, Matching* loc2, # <<<<<<<<<<<<<< @@ -33975,16 +37335,16 @@ static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *__pyx_v_m * cdef int i, new_len */ -static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx_t_3_sa_Matching *__pyx_v_loc1, struct __pyx_t_3_sa_Matching *__pyx_v_loc2, int __pyx_v_offset_by_one, int __pyx_v_num_subpatterns, int *__pyx_v_result_len) { +static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx_t_3_sa_Matching *__pyx_v_loc1, struct __pyx_t_3_sa_Matching *__pyx_v_loc2, CYTHON_UNUSED int __pyx_v_offset_by_one, int __pyx_v_num_subpatterns, int *__pyx_v_result_len) { int __pyx_v_i; int __pyx_v_new_len; int *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("append_combined_matching"); + __Pyx_RefNannySetupContext("append_combined_matching", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":180 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":180 * cdef int i, new_len * * new_len = result_len[0] + num_subpatterns # <<<<<<<<<<<<<< @@ -33993,7 +37353,7 @@ static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx */ __pyx_v_new_len = ((__pyx_v_result_len[0]) + __pyx_v_num_subpatterns); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":181 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":181 * * new_len = result_len[0] + num_subpatterns * arr = <int*> realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -34002,7 +37362,7 @@ static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx */ __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":183 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":183 * arr = <int*> realloc(arr, new_len*sizeof(int)) * * for i from 0 <= i < loc1.size: # <<<<<<<<<<<<<< @@ -34012,7 +37372,7 @@ static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx __pyx_t_1 = __pyx_v_loc1->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":184 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":184 * * for i from 0 <= i < loc1.size: * arr[result_len[0]+i] = loc1.arr[loc1.start+i] # <<<<<<<<<<<<<< @@ -34022,7 +37382,7 @@ static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx (__pyx_v_arr[((__pyx_v_result_len[0]) + __pyx_v_i)]) = (__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":185 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":185 * for i from 0 <= i < loc1.size: * arr[result_len[0]+i] = loc1.arr[loc1.start+i] * if num_subpatterns > loc1.size: # <<<<<<<<<<<<<< @@ -34032,7 +37392,7 @@ static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx __pyx_t_2 = (__pyx_v_num_subpatterns > __pyx_v_loc1->size); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":186 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":186 * arr[result_len[0]+i] = loc1.arr[loc1.start+i] * if num_subpatterns > loc1.size: * arr[new_len-1] = loc2.arr[loc2.end-1] # <<<<<<<<<<<<<< @@ -34044,7 +37404,7 @@ static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":187 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":187 * if num_subpatterns > loc1.size: * arr[new_len-1] = loc2.arr[loc2.end-1] * result_len[0] = new_len # <<<<<<<<<<<<<< @@ -34053,7 +37413,7 @@ static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx */ (__pyx_v_result_len[0]) = __pyx_v_new_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":188 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":188 * arr[new_len-1] = loc2.arr[loc2.end-1] * result_len[0] = new_len * return arr # <<<<<<<<<<<<<< @@ -34069,7 +37429,7 @@ static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":191 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":191 * * * cdef int* extend_arr(int* arr, int* arr_len, int* appendix, int appendix_len): # <<<<<<<<<<<<<< @@ -34081,9 +37441,9 @@ static int *__pyx_f_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int int __pyx_v_new_len; int *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("extend_arr"); + __Pyx_RefNannySetupContext("extend_arr", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":194 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":194 * cdef int new_len * * new_len = arr_len[0] + appendix_len # <<<<<<<<<<<<<< @@ -34092,7 +37452,7 @@ static int *__pyx_f_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int */ __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_appendix_len); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":195 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":195 * * new_len = arr_len[0] + appendix_len * arr = <int*> realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -34101,7 +37461,7 @@ static int *__pyx_f_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int */ __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":196 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":196 * new_len = arr_len[0] + appendix_len * arr = <int*> realloc(arr, new_len*sizeof(int)) * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -34110,7 +37470,7 @@ static int *__pyx_f_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int */ memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_appendix, (__pyx_v_appendix_len * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":197 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":197 * arr = <int*> realloc(arr, new_len*sizeof(int)) * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) * arr_len[0] = new_len # <<<<<<<<<<<<<< @@ -34119,7 +37479,7 @@ static int *__pyx_f_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int */ (__pyx_v_arr_len[0]) = __pyx_v_new_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":198 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":198 * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) * arr_len[0] = new_len * return arr # <<<<<<<<<<<<<< @@ -34135,7 +37495,7 @@ static int *__pyx_f_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":200 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":200 * return arr * * cdef int median(int low, int high, int step): # <<<<<<<<<<<<<< @@ -34150,9 +37510,9 @@ static int __pyx_f_3_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx_v_st int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("median"); + __Pyx_RefNannySetupContext("median", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":201 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":201 * * cdef int median(int low, int high, int step): * return low + (((high - low)/step)/2)*step # <<<<<<<<<<<<<< @@ -34181,7 +37541,7 @@ static int __pyx_f_3_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx_v_st return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":204 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":204 * * * cdef void find_comparable_matchings(int low, int high, int* arr, int step, int loc, int* loc_minus, int* loc_plus): # <<<<<<<<<<<<<< @@ -34194,9 +37554,9 @@ static void __pyx_f_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_ int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("find_comparable_matchings"); + __Pyx_RefNannySetupContext("find_comparable_matchings", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":208 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":208 * # in which all matchings have the same first index as the one * # starting at loc * loc_plus[0] = loc + step # <<<<<<<<<<<<<< @@ -34205,7 +37565,7 @@ static void __pyx_f_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_ */ (__pyx_v_loc_plus[0]) = (__pyx_v_loc + __pyx_v_step); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":209 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":209 * # starting at loc * loc_plus[0] = loc + step * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: # <<<<<<<<<<<<<< @@ -34222,7 +37582,7 @@ static void __pyx_f_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_ } if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":210 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":210 * loc_plus[0] = loc + step * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: * loc_plus[0] = loc_plus[0] + step # <<<<<<<<<<<<<< @@ -34232,7 +37592,7 @@ static void __pyx_f_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_ (__pyx_v_loc_plus[0]) = ((__pyx_v_loc_plus[0]) + __pyx_v_step); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":211 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":211 * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: * loc_plus[0] = loc_plus[0] + step * loc_minus[0] = loc # <<<<<<<<<<<<<< @@ -34241,7 +37601,7 @@ static void __pyx_f_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_ */ (__pyx_v_loc_minus[0]) = __pyx_v_loc; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":212 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":212 * loc_plus[0] = loc_plus[0] + step * loc_minus[0] = loc * while loc_minus[0]-step >= low and arr[loc_minus[0]-step] == arr[loc]: # <<<<<<<<<<<<<< @@ -34258,7 +37618,7 @@ static void __pyx_f_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_ } if (!__pyx_t_2) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":213 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":213 * loc_minus[0] = loc * while loc_minus[0]-step >= low and arr[loc_minus[0]-step] == arr[loc]: * loc_minus[0] = loc_minus[0] - step # <<<<<<<<<<<<<< @@ -34271,16 +37631,9 @@ static void __pyx_f_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_ __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":265 - * cdef IntList findexes1 - * - * def __cinit__(self, # <<<<<<<<<<<<<< - * # compiled alignment object (REQUIRED) - * Alignment alignment, - */ - -static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_3_sa_Alignment *__pyx_v_alignment = 0; float __pyx_v_by_slack_factor; char *__pyx_v_category; @@ -34304,21 +37657,12 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s int __pyx_v_use_index; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alignment,&__pyx_n_s__by_slack_factor,&__pyx_n_s__category,&__pyx_n_s__max_chunks,&__pyx_n_s__max_initial_size,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s__max_target_chunks,&__pyx_n_s__max_target_length,&__pyx_n_s__min_gap_size,&__pyx_n_s__precompute_file,&__pyx_n_s_70,&__pyx_n_s__precompute_rank,&__pyx_n_s_104,&__pyx_n_s_105,&__pyx_n_s_71,&__pyx_n_s__train_min_gap_size,&__pyx_n_s__tight_phrases,&__pyx_n_s__use_baeza_yates,&__pyx_n_s__use_collocations,&__pyx_n_s__use_index,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alignment,&__pyx_n_s__by_slack_factor,&__pyx_n_s__category,&__pyx_n_s__max_chunks,&__pyx_n_s__max_initial_size,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s__max_target_chunks,&__pyx_n_s__max_target_length,&__pyx_n_s__min_gap_size,&__pyx_n_s__precompute_file,&__pyx_n_s_70,&__pyx_n_s__precompute_rank,&__pyx_n_s_104,&__pyx_n_s_105,&__pyx_n_s_71,&__pyx_n_s__train_min_gap_size,&__pyx_n_s__tight_phrases,&__pyx_n_s__use_baeza_yates,&__pyx_n_s__use_collocations,&__pyx_n_s__use_index,0}; PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":273 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":273 * char* category="[X]", * # maximum number of contiguous chunks of terminal symbols in RHS of a rule. If None, defaults to max_nonterminals+1 * max_chunks=None, # <<<<<<<<<<<<<< @@ -34327,7 +37671,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ values[3] = ((PyObject *)Py_None); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":281 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":281 * unsigned max_nonterminals=2, * # maximum number of contiguous chunks of terminal symbols in target-side RHS of a rule. If None, defaults to max_nonterminals+1 * max_target_chunks=None, # <<<<<<<<<<<<<< @@ -34336,7 +37680,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ values[7] = ((PyObject *)Py_None); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":283 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":283 * max_target_chunks=None, * # maximum number of target side symbols (both T and NT) allowed in a rule. If None, defaults to max_initial_size * max_target_length=None, # <<<<<<<<<<<<<< @@ -34345,7 +37689,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ values[8] = ((PyObject *)Py_None); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":287 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":287 * unsigned min_gap_size=2, * # filename of file containing precomputed collocations * precompute_file=None, # <<<<<<<<<<<<<< @@ -34355,7 +37699,8 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s values[10] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); @@ -34381,10 +37726,9 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alignment); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alignment)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -34488,7 +37832,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -34519,10 +37863,10 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s } __pyx_v_alignment = ((struct __pyx_obj_3_sa_Alignment *)values[0]); if (values[1]) { - __pyx_v_by_slack_factor = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_by_slack_factor == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_by_slack_factor = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_by_slack_factor == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":269 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":269 * Alignment alignment, * # parameter for double-binary search; doesn't seem to matter much * float by_slack_factor=1.0, # <<<<<<<<<<<<<< @@ -34574,7 +37918,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_v_require_aligned_terminal = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_require_aligned_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":293 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":293 * unsigned precompute_rank=100, * # require extracted rules to have at least one aligned word * bint require_aligned_terminal=True, # <<<<<<<<<<<<<< @@ -34587,7 +37931,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_v_require_aligned_chunks = __Pyx_PyObject_IsTrue(values[14]); if (unlikely((__pyx_v_require_aligned_chunks == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":295 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":295 * bint require_aligned_terminal=True, * # require each contiguous chunk of extracted rules to have at least one aligned word * bint require_aligned_chunks=False, # <<<<<<<<<<<<<< @@ -34610,7 +37954,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_v_tight_phrases = __Pyx_PyObject_IsTrue(values[17]); if (unlikely((__pyx_v_tight_phrases == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":301 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":301 * unsigned train_min_gap_size=2, * # True if phrases should be tight, False otherwise (False == slower but better results) * bint tight_phrases=False, # <<<<<<<<<<<<<< @@ -34623,7 +37967,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_v_use_baeza_yates = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_use_baeza_yates == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":303 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":303 * bint tight_phrases=False, * # True to require use of double-binary alg, false otherwise * bint use_baeza_yates=True, # <<<<<<<<<<<<<< @@ -34636,7 +37980,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_v_use_collocations = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_use_collocations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":305 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":305 * bint use_baeza_yates=True, * # True to enable used of precomputed collocations * bint use_collocations=True, # <<<<<<<<<<<<<< @@ -34649,7 +37993,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_v_use_index = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_use_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":307 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":307 * bint use_collocations=True, * # True to enable use of precomputed inverted indices * bint use_index=True): # <<<<<<<<<<<<<< @@ -34668,8 +38012,36 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alignment), __pyx_ptype_3_sa_Alignment, 1, "alignment", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_alignment, __pyx_v_by_slack_factor, __pyx_v_category, __pyx_v_max_chunks, __pyx_v_max_initial_size, __pyx_v_max_length, __pyx_v_max_nonterminals, __pyx_v_max_target_chunks, __pyx_v_max_target_length, __pyx_v_min_gap_size, __pyx_v_precompute_file, __pyx_v_precompute_secondary_rank, __pyx_v_precompute_rank, __pyx_v_require_aligned_terminal, __pyx_v_require_aligned_chunks, __pyx_v_train_max_initial_size, __pyx_v_train_min_gap_size, __pyx_v_tight_phrases, __pyx_v_use_baeza_yates, __pyx_v_use_collocations, __pyx_v_use_index); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":313 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":265 + * cdef IntList findexes1 + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * # compiled alignment object (REQUIRED) + * Alignment alignment, + */ + +static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_Alignment *__pyx_v_alignment, float __pyx_v_by_slack_factor, char *__pyx_v_category, PyObject *__pyx_v_max_chunks, unsigned int __pyx_v_max_initial_size, unsigned int __pyx_v_max_length, unsigned int __pyx_v_max_nonterminals, PyObject *__pyx_v_max_target_chunks, PyObject *__pyx_v_max_target_length, unsigned int __pyx_v_min_gap_size, PyObject *__pyx_v_precompute_file, unsigned int __pyx_v_precompute_secondary_rank, unsigned int __pyx_v_precompute_rank, int __pyx_v_require_aligned_terminal, int __pyx_v_require_aligned_chunks, unsigned int __pyx_v_train_max_initial_size, unsigned int __pyx_v_train_min_gap_size, int __pyx_v_tight_phrases, int __pyx_v_use_baeza_yates, int __pyx_v_use_collocations, int __pyx_v_use_index) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":313 * respectively. This is because Chiang's model does not require * them to be the same, therefore we don't either.''' * self.rules = TrieTable(True) # cache # <<<<<<<<<<<<<< @@ -34679,7 +38051,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 313; __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[8]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -34687,12 +38059,12 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->rules); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->rules)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->rules = ((struct __pyx_obj_3_sa_TrieTable *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->rules); + __Pyx_DECREF(((PyObject *)__pyx_v_self->rules)); + __pyx_v_self->rules = ((struct __pyx_obj_3_sa_TrieTable *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":314 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":314 * them to be the same, therefore we don't either.''' * self.rules = TrieTable(True) # cache * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< @@ -34705,16 +38077,16 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->rules->root); - __Pyx_DECREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->rules->root); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->rules->root = __pyx_t_2; + __Pyx_GOTREF(__pyx_v_self->rules->root); + __Pyx_DECREF(__pyx_v_self->rules->root); + __pyx_v_self->rules->root = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":315 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":315 * self.rules = TrieTable(True) # cache * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) * if alignment is None: # <<<<<<<<<<<<<< @@ -34724,7 +38096,7 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_t_3 = (((PyObject *)__pyx_v_alignment) == Py_None); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":316 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":316 * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) * if alignment is None: * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< @@ -34736,11 +38108,11 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[8]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":317 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":317 * if alignment is None: * raise Exception("Must specify an alignment object") * self.alignment = alignment # <<<<<<<<<<<<<< @@ -34749,94 +38121,74 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ __Pyx_INCREF(((PyObject *)__pyx_v_alignment)); __Pyx_GIVEREF(((PyObject *)__pyx_v_alignment)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->alignment); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->alignment)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->alignment = __pyx_v_alignment; + __Pyx_GOTREF(__pyx_v_self->alignment); + __Pyx_DECREF(((PyObject *)__pyx_v_self->alignment)); + __pyx_v_self->alignment = __pyx_v_alignment; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":321 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":321 * # grammar parameters and settings * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero * self.max_length = max_length # <<<<<<<<<<<<<< * self.max_nonterminals = max_nonterminals * self.max_initial_size = max_initial_size */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_length = __pyx_v_max_length; + __pyx_v_self->max_length = __pyx_v_max_length; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":322 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":322 * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero * self.max_length = max_length * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< * self.max_initial_size = max_initial_size * self.train_max_initial_size = train_max_initial_size */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_nonterminals = __pyx_v_max_nonterminals; + __pyx_v_self->max_nonterminals = __pyx_v_max_nonterminals; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":323 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":323 * self.max_length = max_length * self.max_nonterminals = max_nonterminals * self.max_initial_size = max_initial_size # <<<<<<<<<<<<<< * self.train_max_initial_size = train_max_initial_size * self.min_gap_size = min_gap_size */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_initial_size = __pyx_v_max_initial_size; + __pyx_v_self->max_initial_size = __pyx_v_max_initial_size; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":324 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":324 * self.max_nonterminals = max_nonterminals * self.max_initial_size = max_initial_size * self.train_max_initial_size = train_max_initial_size # <<<<<<<<<<<<<< * self.min_gap_size = min_gap_size * self.train_min_gap_size = train_min_gap_size */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->train_max_initial_size = __pyx_v_train_max_initial_size; + __pyx_v_self->train_max_initial_size = __pyx_v_train_max_initial_size; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":325 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":325 * self.max_initial_size = max_initial_size * self.train_max_initial_size = train_max_initial_size * self.min_gap_size = min_gap_size # <<<<<<<<<<<<<< * self.train_min_gap_size = train_min_gap_size * self.category = sym_fromstring(category, False) */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->min_gap_size = __pyx_v_min_gap_size; + __pyx_v_self->min_gap_size = __pyx_v_min_gap_size; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":326 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":326 * self.train_max_initial_size = train_max_initial_size * self.min_gap_size = min_gap_size * self.train_min_gap_size = train_min_gap_size # <<<<<<<<<<<<<< * self.category = sym_fromstring(category, False) * */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->train_min_gap_size = __pyx_v_train_min_gap_size; + __pyx_v_self->train_min_gap_size = __pyx_v_train_min_gap_size; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":327 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":327 * self.min_gap_size = min_gap_size * self.train_min_gap_size = train_min_gap_size * self.category = sym_fromstring(category, False) # <<<<<<<<<<<<<< * * if max_chunks is None: */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_fromstring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyBytes_FromString(__pyx_v_category); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_1 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->category = __pyx_t_6; + __pyx_v_self->category = __pyx_f_3_sa_sym_fromstring(__pyx_v_category, 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":329 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":329 * self.category = sym_fromstring(category, False) * * if max_chunks is None: # <<<<<<<<<<<<<< @@ -34846,31 +38198,31 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_t_3 = (__pyx_v_max_chunks == Py_None); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":330 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":330 * * if max_chunks is None: * self.max_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< * else: * self.max_chunks = max_chunks */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_chunks = (((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_nonterminals + 1); - goto __pyx_L7; + __pyx_v_self->max_chunks = (__pyx_v_self->max_nonterminals + 1); + goto __pyx_L4; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":332 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":332 * self.max_chunks = self.max_nonterminals + 1 * else: * self.max_chunks = max_chunks # <<<<<<<<<<<<<< * * if max_target_chunks is None: */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_max_chunks); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_chunks = __pyx_t_6; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_max_chunks); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_chunks = __pyx_t_4; } - __pyx_L7:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":334 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":334 * self.max_chunks = max_chunks * * if max_target_chunks is None: # <<<<<<<<<<<<<< @@ -34880,31 +38232,31 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_t_3 = (__pyx_v_max_target_chunks == Py_None); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":335 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":335 * * if max_target_chunks is None: * self.max_target_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< * else: * self.max_target_chunks = max_target_chunks */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_target_chunks = (((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_nonterminals + 1); - goto __pyx_L8; + __pyx_v_self->max_target_chunks = (__pyx_v_self->max_nonterminals + 1); + goto __pyx_L5; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":337 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":337 * self.max_target_chunks = self.max_nonterminals + 1 * else: * self.max_target_chunks = max_target_chunks # <<<<<<<<<<<<<< * * if max_target_length is None: */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_max_target_chunks); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_target_chunks = __pyx_t_6; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_max_target_chunks); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_target_chunks = __pyx_t_4; } - __pyx_L8:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":339 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":339 * self.max_target_chunks = max_target_chunks * * if max_target_length is None: # <<<<<<<<<<<<<< @@ -34914,94 +38266,94 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s __pyx_t_3 = (__pyx_v_max_target_length == Py_None); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":340 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":340 * * if max_target_length is None: * self.max_target_length = max_initial_size # <<<<<<<<<<<<<< * else: * self.max_target_length = max_target_length */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_target_length = __pyx_v_max_initial_size; - goto __pyx_L9; + __pyx_v_self->max_target_length = __pyx_v_max_initial_size; + goto __pyx_L6; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":342 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":342 * self.max_target_length = max_initial_size * else: * self.max_target_length = max_target_length # <<<<<<<<<<<<<< * * # algorithmic parameters and settings */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_max_target_length); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_target_length = __pyx_t_6; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_max_target_length); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_target_length = __pyx_t_4; } - __pyx_L9:; + __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":345 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":345 * * # algorithmic parameters and settings * self.precomputed_collocations = {} # <<<<<<<<<<<<<< * self.precomputed_index = {} * self.use_index = use_index */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_collocations); - __Pyx_DECREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_collocations); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_collocations = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); + __Pyx_DECREF(__pyx_v_self->precomputed_collocations); + __pyx_v_self->precomputed_collocations = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":346 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":346 * # algorithmic parameters and settings * self.precomputed_collocations = {} * self.precomputed_index = {} # <<<<<<<<<<<<<< * self.use_index = use_index * self.use_collocations = use_collocations */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_index); - __Pyx_DECREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_index); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_index = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->precomputed_index); + __Pyx_DECREF(__pyx_v_self->precomputed_index); + __pyx_v_self->precomputed_index = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":347 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":347 * self.precomputed_collocations = {} * self.precomputed_index = {} * self.use_index = use_index # <<<<<<<<<<<<<< * self.use_collocations = use_collocations * self.max_rank = {} */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->use_index = __pyx_v_use_index; + __pyx_v_self->use_index = __pyx_v_use_index; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":348 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":348 * self.precomputed_index = {} * self.use_index = use_index * self.use_collocations = use_collocations # <<<<<<<<<<<<<< * self.max_rank = {} * self.precompute_file = precompute_file */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->use_collocations = __pyx_v_use_collocations; + __pyx_v_self->use_collocations = __pyx_v_use_collocations; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":349 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":349 * self.use_index = use_index * self.use_collocations = use_collocations * self.max_rank = {} # <<<<<<<<<<<<<< * self.precompute_file = precompute_file * self.precompute_rank = precompute_rank */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_rank); - __Pyx_DECREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_rank); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_rank = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->max_rank); + __Pyx_DECREF(__pyx_v_self->max_rank); + __pyx_v_self->max_rank = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":350 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":350 * self.use_collocations = use_collocations * self.max_rank = {} * self.precompute_file = precompute_file # <<<<<<<<<<<<<< @@ -35010,47 +38362,47 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ __Pyx_INCREF(__pyx_v_precompute_file); __Pyx_GIVEREF(__pyx_v_precompute_file); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_file); - __Pyx_DECREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_file); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_file = __pyx_v_precompute_file; + __Pyx_GOTREF(__pyx_v_self->precompute_file); + __Pyx_DECREF(__pyx_v_self->precompute_file); + __pyx_v_self->precompute_file = __pyx_v_precompute_file; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":351 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":351 * self.max_rank = {} * self.precompute_file = precompute_file * self.precompute_rank = precompute_rank # <<<<<<<<<<<<<< * self.precompute_secondary_rank = precompute_secondary_rank * self.use_baeza_yates = use_baeza_yates */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_rank = __pyx_v_precompute_rank; + __pyx_v_self->precompute_rank = __pyx_v_precompute_rank; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":352 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":352 * self.precompute_file = precompute_file * self.precompute_rank = precompute_rank * self.precompute_secondary_rank = precompute_secondary_rank # <<<<<<<<<<<<<< * self.use_baeza_yates = use_baeza_yates * self.by_slack_factor = by_slack_factor */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_secondary_rank = __pyx_v_precompute_secondary_rank; + __pyx_v_self->precompute_secondary_rank = __pyx_v_precompute_secondary_rank; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":353 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":353 * self.precompute_rank = precompute_rank * self.precompute_secondary_rank = precompute_secondary_rank * self.use_baeza_yates = use_baeza_yates # <<<<<<<<<<<<<< * self.by_slack_factor = by_slack_factor * if tight_phrases: */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->use_baeza_yates = __pyx_v_use_baeza_yates; + __pyx_v_self->use_baeza_yates = __pyx_v_use_baeza_yates; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":354 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":354 * self.precompute_secondary_rank = precompute_secondary_rank * self.use_baeza_yates = use_baeza_yates * self.by_slack_factor = by_slack_factor # <<<<<<<<<<<<<< * if tight_phrases: * self.tight_phrases = 1 */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->by_slack_factor = __pyx_v_by_slack_factor; + __pyx_v_self->by_slack_factor = __pyx_v_by_slack_factor; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":355 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":355 * self.use_baeza_yates = use_baeza_yates * self.by_slack_factor = by_slack_factor * if tight_phrases: # <<<<<<<<<<<<<< @@ -35059,30 +38411,30 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ if (__pyx_v_tight_phrases) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":356 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":356 * self.by_slack_factor = by_slack_factor * if tight_phrases: * self.tight_phrases = 1 # <<<<<<<<<<<<<< * else: * self.tight_phrases = 0 */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->tight_phrases = 1; - goto __pyx_L10; + __pyx_v_self->tight_phrases = 1; + goto __pyx_L7; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":358 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":358 * self.tight_phrases = 1 * else: * self.tight_phrases = 0 # <<<<<<<<<<<<<< * * if require_aligned_chunks: */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->tight_phrases = 0; + __pyx_v_self->tight_phrases = 0; } - __pyx_L10:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":360 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":360 * self.tight_phrases = 0 * * if require_aligned_chunks: # <<<<<<<<<<<<<< @@ -35091,27 +38443,27 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ if (__pyx_v_require_aligned_chunks) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":362 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":362 * if require_aligned_chunks: * # one condition is a stronger version of the other. * self.require_aligned_chunks = 1 # <<<<<<<<<<<<<< * self.require_aligned_terminal = 1 * elif require_aligned_terminal: */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->require_aligned_chunks = 1; + __pyx_v_self->require_aligned_chunks = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":363 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":363 * # one condition is a stronger version of the other. * self.require_aligned_chunks = 1 * self.require_aligned_terminal = 1 # <<<<<<<<<<<<<< * elif require_aligned_terminal: * self.require_aligned_chunks = 0 */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->require_aligned_terminal = 1; - goto __pyx_L11; + __pyx_v_self->require_aligned_terminal = 1; + goto __pyx_L8; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":364 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":364 * self.require_aligned_chunks = 1 * self.require_aligned_terminal = 1 * elif require_aligned_terminal: # <<<<<<<<<<<<<< @@ -35120,48 +38472,48 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ if (__pyx_v_require_aligned_terminal) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":365 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":365 * self.require_aligned_terminal = 1 * elif require_aligned_terminal: * self.require_aligned_chunks = 0 # <<<<<<<<<<<<<< * self.require_aligned_terminal = 1 * else: */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->require_aligned_chunks = 0; + __pyx_v_self->require_aligned_chunks = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":366 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":366 * elif require_aligned_terminal: * self.require_aligned_chunks = 0 * self.require_aligned_terminal = 1 # <<<<<<<<<<<<<< * else: * self.require_aligned_chunks = 0 */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->require_aligned_terminal = 1; - goto __pyx_L11; + __pyx_v_self->require_aligned_terminal = 1; + goto __pyx_L8; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":368 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":368 * self.require_aligned_terminal = 1 * else: * self.require_aligned_chunks = 0 # <<<<<<<<<<<<<< * self.require_aligned_terminal = 0 * */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->require_aligned_chunks = 0; + __pyx_v_self->require_aligned_chunks = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":369 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":369 * else: * self.require_aligned_chunks = 0 * self.require_aligned_terminal = 0 # <<<<<<<<<<<<<< * * */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->require_aligned_terminal = 0; + __pyx_v_self->require_aligned_terminal = 0; } - __pyx_L11:; + __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":373 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":373 * * # diagnostics * self.prev_norm_prefix = () # <<<<<<<<<<<<<< @@ -35170,55 +38522,53 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s */ __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->prev_norm_prefix); - __Pyx_DECREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->prev_norm_prefix); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->prev_norm_prefix = ((PyObject *)__pyx_empty_tuple); + __Pyx_GOTREF(__pyx_v_self->prev_norm_prefix); + __Pyx_DECREF(__pyx_v_self->prev_norm_prefix); + __pyx_v_self->prev_norm_prefix = ((PyObject *)__pyx_empty_tuple); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":375 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":375 * self.prev_norm_prefix = () * * self.findexes = IntList(initial_len=10) # <<<<<<<<<<<<<< * self.findexes1 = IntList(initial_len=10) * */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->findexes); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->findexes)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->findexes = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->findexes); + __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes)); + __pyx_v_self->findexes = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":376 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":376 * * self.findexes = IntList(initial_len=10) * self.findexes1 = IntList(initial_len=10) # <<<<<<<<<<<<<< * * def configure(self, SuffixArray fsarray, DataArray edarray, */ - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->findexes1); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->findexes1)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->findexes1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->findexes1); + __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes1)); + __pyx_v_self->findexes1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -35226,35 +38576,24 @@ static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":378 - * self.findexes1 = IntList(initial_len=10) - * - * def configure(self, SuffixArray fsarray, DataArray edarray, # <<<<<<<<<<<<<< - * Sampler sampler, Scorer scorer): - * '''This gives the RuleFactory access to the Context object. - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3_sa_23HieroCachingRuleFactory_1configure[] = "This gives the RuleFactory access to the Context object.\n Here we also use it to precompute the most expensive intersections\n in the corpus quickly."; -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_3_sa_23HieroCachingRuleFactory_2configure[] = "This gives the RuleFactory access to the Context object.\n Here we also use it to precompute the most expensive intersections\n in the corpus quickly."; +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray = 0; struct __pyx_obj_3_sa_DataArray *__pyx_v_edarray = 0; struct __pyx_obj_3_sa_Sampler *__pyx_v_sampler = 0; struct __pyx_obj_3_sa_Scorer *__pyx_v_scorer = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__edarray,&__pyx_n_s__sampler,&__pyx_n_s__scorer,0}; - __Pyx_RefNannySetupContext("configure"); + __Pyx_RefNannySetupContext("configure (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__edarray,&__pyx_n_s__sampler,&__pyx_n_s__scorer,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -35263,32 +38602,28 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edarray); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edarray)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sampler); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sampler)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scorer); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scorer)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "configure") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "configure") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -35315,8 +38650,34 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edarray), __pyx_ptype_3_sa_DataArray, 1, "edarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sampler), __pyx_ptype_3_sa_Sampler, 1, "sampler", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scorer), __pyx_ptype_3_sa_Scorer, 1, "scorer", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_2configure(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_edarray, __pyx_v_sampler, __pyx_v_scorer); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":383 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":378 + * self.findexes1 = IntList(initial_len=10) + * + * def configure(self, SuffixArray fsarray, DataArray edarray, # <<<<<<<<<<<<<< + * Sampler sampler, Scorer scorer): + * '''This gives the RuleFactory access to the Context object. + */ + +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_3_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_3_sa_Sampler *__pyx_v_sampler, struct __pyx_obj_3_sa_Scorer *__pyx_v_scorer) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("configure", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":383 * Here we also use it to precompute the most expensive intersections * in the corpus quickly.''' * self.fsa = fsarray # <<<<<<<<<<<<<< @@ -35325,11 +38686,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ */ __Pyx_INCREF(((PyObject *)__pyx_v_fsarray)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fsarray)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fsa); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fsa)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fsa = __pyx_v_fsarray; + __Pyx_GOTREF(__pyx_v_self->fsa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fsa)); + __pyx_v_self->fsa = __pyx_v_fsarray; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":384 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":384 * in the corpus quickly.''' * self.fsa = fsarray * self.fda = fsarray.darray # <<<<<<<<<<<<<< @@ -35338,11 +38699,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ */ __Pyx_INCREF(((PyObject *)__pyx_v_fsarray->darray)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fsarray->darray)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fda); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fda)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fda = __pyx_v_fsarray->darray; + __Pyx_GOTREF(__pyx_v_self->fda); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fda)); + __pyx_v_self->fda = __pyx_v_fsarray->darray; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":385 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":385 * self.fsa = fsarray * self.fda = fsarray.darray * self.eda = edarray # <<<<<<<<<<<<<< @@ -35351,63 +38712,63 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ */ __Pyx_INCREF(((PyObject *)__pyx_v_edarray)); __Pyx_GIVEREF(((PyObject *)__pyx_v_edarray)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->eda); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->eda)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->eda = __pyx_v_edarray; + __Pyx_GOTREF(__pyx_v_self->eda); + __Pyx_DECREF(((PyObject *)__pyx_v_self->eda)); + __pyx_v_self->eda = __pyx_v_edarray; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":386 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":386 * self.fda = fsarray.darray * self.eda = edarray * self.fid2symid = self.set_idmap(self.fda) # <<<<<<<<<<<<<< * self.eid2symid = self.set_idmap(self.eda) * self.precompute() */ - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fda); + __pyx_t_1 = ((PyObject *)__pyx_v_self->fda); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->__pyx_vtab)->set_idmap(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fid2symid); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fid2symid)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fid2symid = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->fid2symid); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fid2symid)); + __pyx_v_self->fid2symid = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":387 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":387 * self.eda = edarray * self.fid2symid = self.set_idmap(self.fda) * self.eid2symid = self.set_idmap(self.eda) # <<<<<<<<<<<<<< * self.precompute() * self.sampler = sampler */ - __pyx_t_2 = ((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->eda); + __pyx_t_2 = ((PyObject *)__pyx_v_self->eda); __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->__pyx_vtab)->set_idmap(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->eid2symid); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->eid2symid)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->eid2symid = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->eid2symid); + __Pyx_DECREF(((PyObject *)__pyx_v_self->eid2symid)); + __pyx_v_self->eid2symid = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":388 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":388 * self.fid2symid = self.set_idmap(self.fda) * self.eid2symid = self.set_idmap(self.eda) * self.precompute() # <<<<<<<<<<<<<< * self.sampler = sampler * self.scorer = scorer */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__precompute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__precompute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 388; __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[8]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":389 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":389 * self.eid2symid = self.set_idmap(self.eda) * self.precompute() * self.sampler = sampler # <<<<<<<<<<<<<< @@ -35416,11 +38777,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ */ __Pyx_INCREF(((PyObject *)__pyx_v_sampler)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sampler)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->sampler); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->sampler)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->sampler = __pyx_v_sampler; + __Pyx_GOTREF(__pyx_v_self->sampler); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sampler)); + __pyx_v_self->sampler = __pyx_v_sampler; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":390 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":390 * self.precompute() * self.sampler = sampler * self.scorer = scorer # <<<<<<<<<<<<<< @@ -35429,9 +38790,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ */ __Pyx_INCREF(((PyObject *)__pyx_v_scorer)); __Pyx_GIVEREF(((PyObject *)__pyx_v_scorer)); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->scorer); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->scorer)); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->scorer = __pyx_v_scorer; + __Pyx_GOTREF(__pyx_v_self->scorer); + __Pyx_DECREF(((PyObject *)__pyx_v_self->scorer)); + __pyx_v_self->scorer = __pyx_v_scorer; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -35446,7 +38807,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":392 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":392 * self.scorer = scorer * * cdef set_idmap(self, DataArray darray): # <<<<<<<<<<<<<< @@ -35454,7 +38815,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure(PyObject *__ * cdef IntList idmap */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_DataArray *__pyx_v_darray) { +static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_DataArray *__pyx_v_darray) { int __pyx_v_word_id; int __pyx_v_new_word_id; int __pyx_v_N; @@ -35465,15 +38826,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_o Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set_idmap"); + __Pyx_RefNannySetupContext("set_idmap", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":396 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":396 * cdef IntList idmap * * N = len(darray.id2word) # <<<<<<<<<<<<<< @@ -35486,7 +38845,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_N = __pyx_t_2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":397 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":397 * * N = len(darray.id2word) * idmap = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -35499,13 +38858,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_o __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_idmap = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":398 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":398 * N = len(darray.id2word) * idmap = IntList(initial_len=N) * for word_id from 0 <= word_id < N: # <<<<<<<<<<<<<< @@ -35515,36 +38874,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_o __pyx_t_4 = __pyx_v_N; for (__pyx_v_word_id = 0; __pyx_v_word_id < __pyx_t_4; __pyx_v_word_id++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":399 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":399 * idmap = IntList(initial_len=N) * for word_id from 0 <= word_id < N: * new_word_id = sym_fromstring(darray.id2word[word_id], True) # <<<<<<<<<<<<<< * idmap.arr[word_id] = new_word_id * return idmap */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_fromstring); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_darray->id2word, __pyx_v_word_id, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_darray->id2word, __pyx_v_word_id, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_1 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_new_word_id = __pyx_t_7; + __pyx_v_new_word_id = __pyx_f_3_sa_sym_fromstring(__pyx_t_5, 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":400 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":400 * for word_id from 0 <= word_id < N: * new_word_id = sym_fromstring(darray.id2word[word_id], True) * idmap.arr[word_id] = new_word_id # <<<<<<<<<<<<<< @@ -35554,7 +38897,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_o (__pyx_v_idmap->arr[__pyx_v_word_id]) = __pyx_v_new_word_id; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":401 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":401 * new_word_id = sym_fromstring(darray.id2word[word_id], True) * idmap.arr[word_id] = new_word_id * return idmap # <<<<<<<<<<<<<< @@ -35571,8 +38914,6 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_o __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.set_idmap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -35582,7 +38923,18 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_o return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":404 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pattern2phrase (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":404 * * * def pattern2phrase(self, pattern): # <<<<<<<<<<<<<< @@ -35590,12 +38942,11 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(struct __pyx_o * result = () */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_arity = NULL; PyObject *__pyx_v_word_id = NULL; - PyObject *__pyx_v_new_id = NULL; + int __pyx_v_new_id; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -35604,15 +38955,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + char *__pyx_t_7; PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pattern2phrase"); + __Pyx_RefNannySetupContext("pattern2phrase", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":406 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":406 * def pattern2phrase(self, pattern): * # pattern is a tuple, which we must convert to a hiero Phrase * result = () # <<<<<<<<<<<<<< @@ -35622,7 +38972,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __pyx_v_result = __pyx_empty_tuple; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":407 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":407 * # pattern is a tuple, which we must convert to a hiero Phrase * result = () * arity = 0 # <<<<<<<<<<<<<< @@ -35632,7 +38982,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec __Pyx_INCREF(__pyx_int_0); __pyx_v_arity = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":408 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":408 * result = () * arity = 0 * for word_id in pattern: # <<<<<<<<<<<<<< @@ -35648,12 +38998,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -35669,20 +39027,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec __pyx_v_word_id = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":409 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":409 * arity = 0 * for word_id in pattern: * if word_id == -1: # <<<<<<<<<<<<<< * arity = arity + 1 * new_id = sym_setindex(self.category, arity) */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":410 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":410 * for word_id in pattern: * if word_id == -1: * arity = arity + 1 # <<<<<<<<<<<<<< @@ -35695,7 +39052,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec __pyx_v_arity = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":411 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":411 * if word_id == -1: * arity = arity + 1 * new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<< @@ -35703,68 +39060,50 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec * new_id = sym_fromstring(self.fda.id2word[word_id], True) */ __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->category, __pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_v_new_id); - __pyx_v_new_id = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L7; + __pyx_v_new_id = __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); + goto __pyx_L5; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":413 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":413 * new_id = sym_setindex(self.category, arity) * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<< * result = result + (new_id,) * return Phrase(result) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_fromstring); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetItem(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fda->id2word, __pyx_v_word_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_v_new_id); - __pyx_v_new_id = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_new_id = __pyx_f_3_sa_sym_fromstring(__pyx_t_7, 1); } - __pyx_L7:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":414 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":414 * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) * result = result + (new_id,) # <<<<<<<<<<<<<< * return Phrase(result) * */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_INCREF(__pyx_v_new_id); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_new_id); - __Pyx_GIVEREF(__pyx_v_new_id); - __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":415 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":415 * new_id = sym_fromstring(self.fda.id2word[word_id], True) * result = result + (new_id,) * return Phrase(result) # <<<<<<<<<<<<<< @@ -35773,15 +39112,15 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_result)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -35789,22 +39128,30 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.pattern2phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_arity); __Pyx_XDECREF(__pyx_v_word_id); - __Pyx_XDECREF(__pyx_v_new_id); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":417 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pattern2phrase_plus (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":417 * return Phrase(result) * * def pattern2phrase_plus(self, pattern): # <<<<<<<<<<<<<< @@ -35812,13 +39159,12 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase(PyObjec * # suffixed/prefixed with the NT category. */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { PyObject *__pyx_v_patterns = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_arity = NULL; PyObject *__pyx_v_word_id = NULL; - PyObject *__pyx_v_new_id = NULL; + int __pyx_v_new_id; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -35827,16 +39173,15 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + char *__pyx_t_7; PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pattern2phrase_plus"); + __Pyx_RefNannySetupContext("pattern2phrase_plus", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":420 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":420 * # returns a list containing both the pattern, and pattern * # suffixed/prefixed with the NT category. * patterns = [] # <<<<<<<<<<<<<< @@ -35844,11 +39189,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py * arity = 0 */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_patterns = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":421 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":421 * # suffixed/prefixed with the NT category. * patterns = [] * result = () # <<<<<<<<<<<<<< @@ -35858,7 +39203,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __pyx_v_result = __pyx_empty_tuple; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":422 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":422 * patterns = [] * result = () * arity = 0 # <<<<<<<<<<<<<< @@ -35868,7 +39213,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py __Pyx_INCREF(__pyx_int_0); __pyx_v_arity = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":423 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":423 * result = () * arity = 0 * for word_id in pattern: # <<<<<<<<<<<<<< @@ -35884,12 +39229,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -35905,20 +39258,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py __pyx_v_word_id = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":424 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":424 * arity = 0 * for word_id in pattern: * if word_id == -1: # <<<<<<<<<<<<<< * arity = arity + 1 * new_id = sym_setindex(self.category, arity) */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":425 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":425 * for word_id in pattern: * if word_id == -1: * arity = arity + 1 # <<<<<<<<<<<<<< @@ -35931,7 +39283,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py __pyx_v_arity = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":426 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":426 * if word_id == -1: * arity = arity + 1 * new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<< @@ -35939,151 +39291,124 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py * new_id = sym_fromstring(self.fda.id2word[word_id], True) */ __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->category, __pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_v_new_id); - __pyx_v_new_id = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L7; + __pyx_v_new_id = __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); + goto __pyx_L5; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":428 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":428 * new_id = sym_setindex(self.category, arity) * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<< * result = result + (new_id,) * patterns.append(Phrase(result)) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_fromstring); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetItem(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->fda->id2word, __pyx_v_word_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_v_new_id); - __pyx_v_new_id = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_new_id = __pyx_f_3_sa_sym_fromstring(__pyx_t_7, 1); } - __pyx_L7:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":429 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":429 * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) * result = result + (new_id,) # <<<<<<<<<<<<<< * patterns.append(Phrase(result)) * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_INCREF(__pyx_v_new_id); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_new_id); - __Pyx_GIVEREF(__pyx_v_new_id); - __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":430 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":430 * new_id = sym_fromstring(self.fda.id2word[word_id], True) * result = result + (new_id,) * patterns.append(Phrase(result)) # <<<<<<<<<<<<<< * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) */ - if (unlikely(((PyObject *)__pyx_v_patterns) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_result)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_10 = PyList_Append(__pyx_v_patterns, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyList_Append(__pyx_v_patterns, __pyx_t_4); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":431 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":431 * result = result + (new_id,) * patterns.append(Phrase(result)) * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) # <<<<<<<<<<<<<< * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) * return patterns */ - if (unlikely(((PyObject *)__pyx_v_patterns) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->category, 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_10 = PyList_Append(__pyx_v_patterns, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyList_Append(__pyx_v_patterns, __pyx_t_4); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":432 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":432 * patterns.append(Phrase(result)) * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) # <<<<<<<<<<<<<< * return patterns * */ - if (unlikely(((PyObject *)__pyx_v_patterns) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->category, 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_10 = PyList_Append(__pyx_v_patterns, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyList_Append(__pyx_v_patterns, __pyx_t_4); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":433 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":433 * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) * return patterns # <<<<<<<<<<<<<< @@ -36100,9 +39425,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.pattern2phrase_plus", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -36110,13 +39433,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_arity); __Pyx_XDECREF(__pyx_v_word_id); - __Pyx_XDECREF(__pyx_v_new_id); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":435 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("precompute (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":435 * return patterns * * def precompute(self): # <<<<<<<<<<<<<< @@ -36124,8 +39457,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus(Py * */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self) { struct __pyx_obj_3_sa_Precomputation *__pyx_v_pre = 0; PyObject *__pyx_v_start_time = NULL; PyObject *__pyx_v_pattern = NULL; @@ -36141,27 +39473,27 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - PyObject *(*__pyx_t_9)(PyObject *); + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; Py_ssize_t __pyx_t_10; PyObject *(*__pyx_t_11)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("precompute"); + __Pyx_RefNannySetupContext("precompute", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":438 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":438 * cdef Precomputation pre * * if self.precompute_file is not None: # <<<<<<<<<<<<<< * start_time = monitor_cpu() * logger.info("Reading precomputed data from file %s... ", self.precompute_file) */ - __pyx_t_1 = (((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_file != Py_None); + __pyx_t_1 = (__pyx_v_self->precompute_file != Py_None); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":439 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":439 * * if self.precompute_file is not None: * start_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -36173,7 +39505,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __pyx_v_start_time = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":440 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":440 * if self.precompute_file is not None: * start_time = monitor_cpu() * logger.info("Reading precomputed data from file %s... ", self.precompute_file) # <<<<<<<<<<<<<< @@ -36186,20 +39518,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_109)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_109)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_109)); - __Pyx_INCREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_file); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_file); - __Pyx_GIVEREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_file); + __Pyx_INCREF(__pyx_v_self->precompute_file); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->precompute_file); + __Pyx_GIVEREF(__pyx_v_self->precompute_file); __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":441 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":441 * start_time = monitor_cpu() * logger.info("Reading precomputed data from file %s... ", self.precompute_file) * pre = Precomputation(from_binary=self.precompute_file) # <<<<<<<<<<<<<< @@ -36208,24 +39540,24 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ */ __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__from_binary), ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Precomputation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__from_binary), __pyx_v_self->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Precomputation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_v_pre = ((struct __pyx_obj_3_sa_Precomputation *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":443 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":443 * pre = Precomputation(from_binary=self.precompute_file) * # check parameters of precomputation -- some are critical and some are not * if pre.max_nonterminals != self.max_nonterminals: # <<<<<<<<<<<<<< * logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals) * if pre.max_length != self.max_length: */ - __pyx_t_1 = (__pyx_v_pre->max_nonterminals != ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_nonterminals); + __pyx_t_1 = (__pyx_v_pre->max_nonterminals != __pyx_v_self->max_nonterminals); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":444 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":444 * # check parameters of precomputation -- some are critical and some are not * if pre.max_nonterminals != self.max_nonterminals: * logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals) # <<<<<<<<<<<<<< @@ -36239,10 +39571,10 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_pre->max_nonterminals); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_nonterminals); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_110)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_110)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110)); @@ -36257,21 +39589,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":445 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":445 * if pre.max_nonterminals != self.max_nonterminals: * logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals) * if pre.max_length != self.max_length: # <<<<<<<<<<<<<< * logger.warn("Precomputation done with max terminals %d, decoder uses %d", pre.max_length, self.max_length) * if pre.train_max_initial_size != self.train_max_initial_size: */ - __pyx_t_1 = (__pyx_v_pre->max_length != ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_length); + __pyx_t_1 = (__pyx_v_pre->max_length != __pyx_v_self->max_length); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":446 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":446 * logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals) * if pre.max_length != self.max_length: * logger.warn("Precomputation done with max terminals %d, decoder uses %d", pre.max_length, self.max_length) # <<<<<<<<<<<<<< @@ -36285,10 +39617,10 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyInt_FromLong(__pyx_v_pre->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_self->max_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_111)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_111)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_111)); @@ -36303,21 +39635,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L7; + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":447 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":447 * if pre.max_length != self.max_length: * logger.warn("Precomputation done with max terminals %d, decoder uses %d", pre.max_length, self.max_length) * if pre.train_max_initial_size != self.train_max_initial_size: # <<<<<<<<<<<<<< * raise Exception("Precomputation done with max initial size %d, decoder uses %d" % (pre.train_max_initial_size, self.train_max_initial_size)) * if pre.train_min_gap_size != self.train_min_gap_size: */ - __pyx_t_1 = (__pyx_v_pre->train_max_initial_size != ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->train_max_initial_size); + __pyx_t_1 = (__pyx_v_pre->train_max_initial_size != __pyx_v_self->train_max_initial_size); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":448 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":448 * logger.warn("Precomputation done with max terminals %d, decoder uses %d", pre.max_length, self.max_length) * if pre.train_max_initial_size != self.train_max_initial_size: * raise Exception("Precomputation done with max initial size %d, decoder uses %d" % (pre.train_max_initial_size, self.train_max_initial_size)) # <<<<<<<<<<<<<< @@ -36326,10 +39658,10 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ */ __pyx_t_4 = PyInt_FromLong(__pyx_v_pre->train_max_initial_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->train_max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->train_max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); @@ -36340,7 +39672,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -36350,21 +39682,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[8]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":449 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":449 * if pre.train_max_initial_size != self.train_max_initial_size: * raise Exception("Precomputation done with max initial size %d, decoder uses %d" % (pre.train_max_initial_size, self.train_max_initial_size)) * if pre.train_min_gap_size != self.train_min_gap_size: # <<<<<<<<<<<<<< * raise Exception("Precomputation done with min gap size %d, decoder uses %d" % (pre.train_min_gap_size, self.train_min_gap_size)) * if self.use_index: */ - __pyx_t_1 = (__pyx_v_pre->train_min_gap_size != ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->train_min_gap_size); + __pyx_t_1 = (__pyx_v_pre->train_min_gap_size != __pyx_v_self->train_min_gap_size); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":450 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":450 * raise Exception("Precomputation done with max initial size %d, decoder uses %d" % (pre.train_max_initial_size, self.train_max_initial_size)) * if pre.train_min_gap_size != self.train_min_gap_size: * raise Exception("Precomputation done with min gap size %d, decoder uses %d" % (pre.train_min_gap_size, self.train_min_gap_size)) # <<<<<<<<<<<<<< @@ -36373,10 +39705,10 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ */ __pyx_t_2 = PyInt_FromLong(__pyx_v_pre->train_min_gap_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->train_min_gap_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->train_min_gap_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); @@ -36387,7 +39719,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -36397,20 +39729,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L9; + goto __pyx_L7; } - __pyx_L9:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":451 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":451 * if pre.train_min_gap_size != self.train_min_gap_size: * raise Exception("Precomputation done with min gap size %d, decoder uses %d" % (pre.train_min_gap_size, self.train_min_gap_size)) * if self.use_index: # <<<<<<<<<<<<<< * logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index)) * for pattern, arr in pre.precomputed_index.iteritems(): */ - if (((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->use_index) { + if (__pyx_v_self->use_index) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":452 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":452 * raise Exception("Precomputation done with min gap size %d, decoder uses %d" % (pre.train_min_gap_size, self.train_min_gap_size)) * if self.use_index: * logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index)) # <<<<<<<<<<<<<< @@ -36429,7 +39761,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_114)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_114)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114)); @@ -36442,117 +39774,59 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":453 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":453 * if self.use_index: * logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index)) * for pattern, arr in pre.precomputed_index.iteritems(): # <<<<<<<<<<<<<< * phrases = self.pattern2phrase_plus(pattern) * for phrase in phrases: */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_pre->precomputed_index, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_6 = 0; + if (unlikely(__pyx_v_pre->precomputed_index == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (PyList_CheckExact(__pyx_t_5)) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; - } else if (PyTuple_CheckExact(__pyx_t_5)) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; - } else { - __pyx_t_2 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { - PyObject* sequence = __pyx_t_2; - if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L13_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L13_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L14_unpacking_done; - __pyx_L13_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L14_unpacking_done:; - } + __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_index, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_2; + __pyx_t_2 = 0; + while (1) { + __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_7, &__pyx_t_6, &__pyx_t_2, &__pyx_t_4, NULL, __pyx_t_8); + if (unlikely(__pyx_t_9 == 0)) break; + if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_pattern = __pyx_t_2; + __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_arr = __pyx_t_4; + __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":454 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":454 * logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index)) * for pattern, arr in pre.precomputed_index.iteritems(): * phrases = self.pattern2phrase_plus(pattern) # <<<<<<<<<<<<<< * for phrase in phrases: * self.precomputed_index[phrase] = arr */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pattern2phrase_plus); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pattern2phrase_plus); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __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[8]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_pattern); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pattern); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pattern); __Pyx_GIVEREF(__pyx_v_pattern); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_phrases); - __pyx_v_phrases = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_phrases = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":455 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":455 * for pattern, arr in pre.precomputed_index.iteritems(): * phrases = self.pattern2phrase_plus(pattern) * for phrase in phrases: # <<<<<<<<<<<<<< @@ -36560,61 +39834,69 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ * if self.use_collocations: */ if (PyList_CheckExact(__pyx_v_phrases) || PyTuple_CheckExact(__pyx_v_phrases)) { - __pyx_t_4 = __pyx_v_phrases; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0; + __pyx_t_3 = __pyx_v_phrases; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_phrases); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext; + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_phrases); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_4)) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; - } else if (PyTuple_CheckExact(__pyx_t_4)) { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { - __pyx_t_3 = __pyx_t_11(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { + __pyx_t_2 = __pyx_t_11(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF(__pyx_v_phrase); - __pyx_v_phrase = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_phrase = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":456 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":456 * phrases = self.pattern2phrase_plus(pattern) * for phrase in phrases: * self.precomputed_index[phrase] = arr # <<<<<<<<<<<<<< * if self.use_collocations: * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) */ - if (PyObject_SetItem(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_index, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_self->precomputed_index, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L10; + goto __pyx_L8; } - __pyx_L10:; + __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":457 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":457 * for phrase in phrases: * self.precomputed_index[phrase] = arr * if self.use_collocations: # <<<<<<<<<<<<<< * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) * for pattern, arr in pre.precomputed_collocations.iteritems(): */ - if (((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->use_collocations) { + if (__pyx_v_self->use_collocations) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":458 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":458 * self.precomputed_index[phrase] = arr * if self.use_collocations: * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) # <<<<<<<<<<<<<< @@ -36623,128 +39905,70 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ */ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_v_pre->precomputed_collocations; __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_115)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_115)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_115)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_115)); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_t_5); __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":459 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":459 * if self.use_collocations: * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) * for pattern, arr in pre.precomputed_collocations.iteritems(): # <<<<<<<<<<<<<< * phrase = self.pattern2phrase(pattern) * self.precomputed_collocations[phrase] = arr */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_pre->precomputed_collocations, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_7 = 0; + if (unlikely(__pyx_v_pre->precomputed_collocations == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (PyList_CheckExact(__pyx_t_5)) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; - } else if (PyTuple_CheckExact(__pyx_t_5)) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; - } else { - __pyx_t_3 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L20_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L20_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L21_unpacking_done; - __pyx_L20_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L21_unpacking_done:; - } + __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_6), (&__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_2; + __pyx_t_2 = 0; + while (1) { + __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_6, &__pyx_t_7, &__pyx_t_2, &__pyx_t_3, NULL, __pyx_t_8); + if (unlikely(__pyx_t_9 == 0)) break; + if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_2; + __pyx_v_pattern = __pyx_t_2; __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":460 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":460 * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) * for pattern, arr in pre.precomputed_collocations.iteritems(): * phrase = self.pattern2phrase(pattern) # <<<<<<<<<<<<<< * self.precomputed_collocations[phrase] = arr * stop_time = monitor_cpu() */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pattern2phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pattern2phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_pattern); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pattern); __Pyx_GIVEREF(__pyx_v_pattern); @@ -36756,21 +39980,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __pyx_v_phrase = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":461 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":461 * for pattern, arr in pre.precomputed_collocations.iteritems(): * phrase = self.pattern2phrase(pattern) * self.precomputed_collocations[phrase] = arr # <<<<<<<<<<<<<< * stop_time = monitor_cpu() * logger.info("Processing precomputations took %f seconds", stop_time - start_time) */ - if (PyObject_SetItem(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_collocations, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L17; + goto __pyx_L13; } - __pyx_L17:; + __pyx_L13:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":462 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":462 * phrase = self.pattern2phrase(pattern) * self.precomputed_collocations[phrase] = arr * stop_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -36782,7 +40006,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __pyx_v_stop_time = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":463 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":463 * self.precomputed_collocations[phrase] = arr * stop_time = monitor_cpu() * logger.info("Processing precomputations took %f seconds", stop_time - start_time) # <<<<<<<<<<<<<< @@ -36797,7 +40021,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __pyx_t_5 = PyNumber_Subtract(__pyx_v_stop_time, __pyx_v_start_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_116)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_116)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116)); @@ -36809,9 +40033,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -36820,7 +40044,6 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -36836,7 +40059,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":466 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_precomputed_collocation (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_phrase)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":466 * * * def get_precomputed_collocation(self, phrase): # <<<<<<<<<<<<<< @@ -36844,8 +40078,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute(PyObject *_ * arr = self.precomputed_collocations[phrase] */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_5get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_5get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase) { +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase) { PyObject *__pyx_v_arr = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -36857,31 +40090,31 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_5get_precomputed_colloc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_precomputed_collocation"); + __Pyx_RefNannySetupContext("get_precomputed_collocation", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":467 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":467 * * def get_precomputed_collocation(self, phrase): * if phrase in self.precomputed_collocations: # <<<<<<<<<<<<<< * arr = self.precomputed_collocations[phrase] * return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1) */ - __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_collocations, __pyx_v_phrase))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_phrase, __pyx_v_self->precomputed_collocations, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":468 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":468 * def get_precomputed_collocation(self, phrase): * if phrase in self.precomputed_collocations: * arr = self.precomputed_collocations[phrase] # <<<<<<<<<<<<<< * return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1) * return None */ - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->precomputed_collocations, __pyx_v_phrase); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_arr = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":469 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":469 * if phrase in self.precomputed_collocations: * arr = self.precomputed_collocations[phrase] * return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1) # <<<<<<<<<<<<<< @@ -36908,17 +40141,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_5get_precomputed_colloc __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":470 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":470 * arr = self.precomputed_collocations[phrase] * return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1) * return None # <<<<<<<<<<<<<< @@ -36945,7 +40178,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_5get_precomputed_colloc return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":473 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":473 * * * cdef int* baeza_yates_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<< @@ -36989,9 +40222,9 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("baeza_yates_helper"); + __Pyx_RefNannySetupContext("baeza_yates_helper", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":486 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":486 * cdef Matching loc1, loc2 * * result = <int*> malloc(0*sizeof(int*)) # <<<<<<<<<<<<<< @@ -37000,7 +40233,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_result = ((int *)malloc((0 * (sizeof(int *))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":488 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":488 * result = <int*> malloc(0*sizeof(int*)) * * d_first = 0 # <<<<<<<<<<<<<< @@ -37009,7 +40242,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_d_first = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":489 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":489 * * d_first = 0 * if high1 - low1 > high2 - low2: # <<<<<<<<<<<<<< @@ -37019,7 +40252,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_1 = ((__pyx_v_high1 - __pyx_v_low1) > (__pyx_v_high2 - __pyx_v_low2)); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":490 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":490 * d_first = 0 * if high1 - low1 > high2 - low2: * d_first = 1 # <<<<<<<<<<<<<< @@ -37031,7 +40264,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":494 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":494 * # First, check to see if we are at any of the recursive base cases * # Case 1: one of the sets is empty * if low1 >= high1 or low2 >= high2: # <<<<<<<<<<<<<< @@ -37047,7 +40280,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":495 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":495 * # Case 1: one of the sets is empty * if low1 >= high1 or low2 >= high2: * return result # <<<<<<<<<<<<<< @@ -37060,7 +40293,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":498 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":498 * * # Case 2: sets are non-overlapping * assign_matching(&loc1, arr1, high1-step1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37069,7 +40302,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, (__pyx_v_high1 - __pyx_v_step1), __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":499 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":499 * # Case 2: sets are non-overlapping * assign_matching(&loc1, arr1, high1-step1, step1, self.fda.sent_id.arr) * assign_matching(&loc2, arr2, low2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37078,7 +40311,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_low2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":500 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":500 * assign_matching(&loc1, arr1, high1-step1, step1, self.fda.sent_id.arr) * assign_matching(&loc2, arr2, low2, step2, self.fda.sent_id.arr) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: # <<<<<<<<<<<<<< @@ -37088,7 +40321,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == -1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":501 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":501 * assign_matching(&loc2, arr2, low2, step2, self.fda.sent_id.arr) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: * return result # <<<<<<<<<<<<<< @@ -37101,7 +40334,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":503 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":503 * return result * * assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37110,7 +40343,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_low1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":504 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":504 * * assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr) * assign_matching(&loc2, arr2, high2-step2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37119,7 +40352,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, (__pyx_v_high2 - __pyx_v_step2), __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":505 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":505 * assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr) * assign_matching(&loc2, arr2, high2-step2, step2, self.fda.sent_id.arr) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: # <<<<<<<<<<<<<< @@ -37129,7 +40362,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == 1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":506 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":506 * assign_matching(&loc2, arr2, high2-step2, step2, self.fda.sent_id.arr) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: * return result # <<<<<<<<<<<<<< @@ -37142,7 +40375,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":510 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":510 * # Case 3: query set and data set do not meet size mismatch constraints; * # We use mergesort instead in this case * qsetsize = (high1-low1) / step1 # <<<<<<<<<<<<<< @@ -37160,7 +40393,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_v_qsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":511 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":511 * # We use mergesort instead in this case * qsetsize = (high1-low1) / step1 * dsetsize = (high2-low2) / step2 # <<<<<<<<<<<<<< @@ -37178,7 +40411,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_v_dsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":512 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":512 * qsetsize = (high1-low1) / step1 * dsetsize = (high2-low2) / step2 * if d_first: # <<<<<<<<<<<<<< @@ -37187,7 +40420,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ if (__pyx_v_d_first) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":513 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":513 * dsetsize = (high2-low2) / step2 * if d_first: * tmp = qsetsize # <<<<<<<<<<<<<< @@ -37196,7 +40429,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_tmp = __pyx_v_qsetsize; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":514 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":514 * if d_first: * tmp = qsetsize * qsetsize = dsetsize # <<<<<<<<<<<<<< @@ -37205,7 +40438,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_qsetsize = __pyx_v_dsetsize; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":515 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":515 * tmp = qsetsize * qsetsize = dsetsize * dsetsize = tmp # <<<<<<<<<<<<<< @@ -37217,7 +40450,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":517 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":517 * dsetsize = tmp * * if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize: # <<<<<<<<<<<<<< @@ -37233,7 +40466,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_t_5 / __pyx_t_6) > __pyx_v_dsetsize); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":518 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":518 * * if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize: * free(result) # <<<<<<<<<<<<<< @@ -37242,7 +40475,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ free(__pyx_v_result); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":519 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":519 * if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize: * free(result) * return self.merge_helper(low1, high1, arr1, step1, low2, high2, arr2, step2, offset_by_one, len_last, num_subpatterns, result_len) # <<<<<<<<<<<<<< @@ -37255,7 +40488,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":523 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":523 * # binary search. There are two flavors, depending on * # whether the queryset or dataset is first * if d_first: # <<<<<<<<<<<<<< @@ -37264,7 +40497,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ if (__pyx_v_d_first) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":524 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":524 * # whether the queryset or dataset is first * if d_first: * med2 = median(low2, high2, step2) # <<<<<<<<<<<<<< @@ -37273,7 +40506,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2 = __pyx_f_3_sa_median(__pyx_v_low2, __pyx_v_high2, __pyx_v_step2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":525 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":525 * if d_first: * med2 = median(low2, high2, step2) * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37282,7 +40515,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_med2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":527 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":527 * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) * * search_low = low1 # <<<<<<<<<<<<<< @@ -37291,7 +40524,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_search_low = __pyx_v_low1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":528 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":528 * * search_low = low1 * search_high = high1 # <<<<<<<<<<<<<< @@ -37300,7 +40533,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_search_high = __pyx_v_high1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":529 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":529 * search_low = low1 * search_high = high1 * while search_low < search_high: # <<<<<<<<<<<<<< @@ -37311,7 +40544,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_search_low < __pyx_v_search_high); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":530 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":530 * search_high = high1 * while search_low < search_high: * med1 = median(search_low, search_high, step1) # <<<<<<<<<<<<<< @@ -37320,7 +40553,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med1 = __pyx_f_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":531 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":531 * while search_low < search_high: * med1 = median(search_low, search_high, step1) * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) # <<<<<<<<<<<<<< @@ -37329,7 +40562,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_find_comparable_matchings(__pyx_v_low1, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_med1, (&__pyx_v_med1_minus), (&__pyx_v_med1_plus)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":532 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":532 * med1 = median(search_low, search_high, step1) * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) # <<<<<<<<<<<<<< @@ -37338,7 +40571,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_comparison = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings_set(__pyx_v_self, __pyx_v_med1_minus, __pyx_v_med1_plus, __pyx_v_arr1, __pyx_v_step1, (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":535 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":535 * if comparison == -1: * search_low = med1_plus * elif comparison == 1: # <<<<<<<<<<<<<< @@ -37347,7 +40580,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ switch (__pyx_v_comparison) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":533 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":533 * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) * if comparison == -1: # <<<<<<<<<<<<<< @@ -37356,7 +40589,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ case -1: - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":534 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":534 * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) * if comparison == -1: * search_low = med1_plus # <<<<<<<<<<<<<< @@ -37366,7 +40599,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_v_search_low = __pyx_v_med1_plus; break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":535 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":535 * if comparison == -1: * search_low = med1_plus * elif comparison == 1: # <<<<<<<<<<<<<< @@ -37375,7 +40608,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ case 1: - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":536 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":536 * search_low = med1_plus * elif comparison == 1: * search_high = med1_minus # <<<<<<<<<<<<<< @@ -37386,7 +40619,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p break; default: - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":538 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":538 * search_high = med1_minus * else: * break # <<<<<<<<<<<<<< @@ -37402,7 +40635,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":540 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":540 * break * else: * med1 = median(low1, high1, step1) # <<<<<<<<<<<<<< @@ -37411,7 +40644,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med1 = __pyx_f_3_sa_median(__pyx_v_low1, __pyx_v_high1, __pyx_v_step1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":541 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":541 * else: * med1 = median(low1, high1, step1) * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) # <<<<<<<<<<<<<< @@ -37420,7 +40653,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_find_comparable_matchings(__pyx_v_low1, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_med1, (&__pyx_v_med1_minus), (&__pyx_v_med1_plus)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":543 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":543 * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) * * search_low = low2 # <<<<<<<<<<<<<< @@ -37429,7 +40662,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_search_low = __pyx_v_low2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":544 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":544 * * search_low = low2 * search_high = high2 # <<<<<<<<<<<<<< @@ -37438,7 +40671,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_search_high = __pyx_v_high2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":545 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":545 * search_low = low2 * search_high = high2 * while search_low < search_high: # <<<<<<<<<<<<<< @@ -37449,7 +40682,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_search_low < __pyx_v_search_high); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":546 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":546 * search_high = high2 * while search_low < search_high: * med2 = median(search_low, search_high, step2) # <<<<<<<<<<<<<< @@ -37458,7 +40691,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2 = __pyx_f_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":547 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":547 * while search_low < search_high: * med2 = median(search_low, search_high, step2) * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37467,7 +40700,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_med2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":548 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":548 * med2 = median(search_low, search_high, step2) * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) # <<<<<<<<<<<<<< @@ -37476,7 +40709,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_comparison = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings_set(__pyx_v_self, __pyx_v_med1_minus, __pyx_v_med1_plus, __pyx_v_arr1, __pyx_v_step1, (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":551 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":551 * if comparison == -1: * search_high = med2 * elif comparison == 1: # <<<<<<<<<<<<<< @@ -37485,7 +40718,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ switch (__pyx_v_comparison) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":549 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":549 * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) * if comparison == -1: # <<<<<<<<<<<<<< @@ -37494,7 +40727,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ case -1: - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":550 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":550 * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) * if comparison == -1: * search_high = med2 # <<<<<<<<<<<<<< @@ -37504,7 +40737,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_v_search_high = __pyx_v_med2; break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":551 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":551 * if comparison == -1: * search_high = med2 * elif comparison == 1: # <<<<<<<<<<<<<< @@ -37513,7 +40746,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ case 1: - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":552 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":552 * search_high = med2 * elif comparison == 1: * search_low = med2 + step2 # <<<<<<<<<<<<<< @@ -37524,7 +40757,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p break; default: - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":554 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":554 * search_low = med2 + step2 * else: * break # <<<<<<<<<<<<<< @@ -37539,7 +40772,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L9:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":556 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":556 * break * * med_result_len = 0 # <<<<<<<<<<<<<< @@ -37548,7 +40781,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med_result_len = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":557 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":557 * * med_result_len = 0 * med_result = <int*> malloc(0*sizeof(int*)) # <<<<<<<<<<<<<< @@ -37557,7 +40790,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med_result = ((int *)malloc((0 * (sizeof(int *))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":558 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":558 * med_result_len = 0 * med_result = <int*> malloc(0*sizeof(int*)) * if search_high > search_low: # <<<<<<<<<<<<<< @@ -37567,7 +40800,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_search_high > __pyx_v_search_low); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":564 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":564 * # want to store the bindings for all of those elements. We can * # subsequently throw all of them away. * med2_minus = med2 # <<<<<<<<<<<<<< @@ -37576,7 +40809,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_minus = __pyx_v_med2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":565 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":565 * # subsequently throw all of them away. * med2_minus = med2 * med2_plus = med2 + step2 # <<<<<<<<<<<<<< @@ -37585,7 +40818,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_plus = (__pyx_v_med2 + __pyx_v_step2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":566 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":566 * med2_minus = med2 * med2_plus = med2 + step2 * i1 = med1_minus # <<<<<<<<<<<<<< @@ -37594,7 +40827,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_i1 = __pyx_v_med1_minus; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":567 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":567 * med2_plus = med2 + step2 * i1 = med1_minus * while i1 < med1_plus: # <<<<<<<<<<<<<< @@ -37605,7 +40838,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_i1 < __pyx_v_med1_plus); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":568 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":568 * i1 = med1_minus * while i1 < med1_plus: * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37614,7 +40847,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":569 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":569 * while i1 < med1_plus: * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * while med2_minus-step2 >= low2: # <<<<<<<<<<<<<< @@ -37625,7 +40858,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_med2_minus - __pyx_v_step2) >= __pyx_v_low2); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":570 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":570 * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * while med2_minus-step2 >= low2: * assign_matching(&loc2, arr2, med2_minus-step2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37634,7 +40867,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, (__pyx_v_med2_minus - __pyx_v_step2), __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":571 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":571 * while med2_minus-step2 >= low2: * assign_matching(&loc2, arr2, med2_minus-step2, step2, self.fda.sent_id.arr) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1: # <<<<<<<<<<<<<< @@ -37644,7 +40877,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) < 1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":572 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":572 * assign_matching(&loc2, arr2, med2_minus-step2, step2, self.fda.sent_id.arr) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1: * med2_minus = med2_minus - step2 # <<<<<<<<<<<<<< @@ -37656,7 +40889,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":574 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":574 * med2_minus = med2_minus - step2 * else: * break # <<<<<<<<<<<<<< @@ -37669,7 +40902,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L18_break:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":575 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":575 * else: * break * i2 = med2_minus # <<<<<<<<<<<<<< @@ -37678,7 +40911,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_i2 = __pyx_v_med2_minus; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":576 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":576 * break * i2 = med2_minus * while i2 < high2: # <<<<<<<<<<<<<< @@ -37689,7 +40922,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_i2 < __pyx_v_high2); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":577 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":577 * i2 = med2_minus * while i2 < high2: * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -37698,7 +40931,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_i2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":578 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":578 * while i2 < high2: * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) * comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) # <<<<<<<<<<<<<< @@ -37707,7 +40940,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_comparison = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":579 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":579 * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) * comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) * if comparison == 0: # <<<<<<<<<<<<<< @@ -37717,7 +40950,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_comparison == 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":581 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":581 * if comparison == 0: * pass * med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) # <<<<<<<<<<<<<< @@ -37729,7 +40962,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L22:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":582 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":582 * pass * med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) * if comparison == -1: # <<<<<<<<<<<<<< @@ -37739,7 +40972,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_comparison == -1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":583 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":583 * med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) * if comparison == -1: * break # <<<<<<<<<<<<<< @@ -37751,7 +40984,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L23:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":584 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":584 * if comparison == -1: * break * i2 = i2 + step2 # <<<<<<<<<<<<<< @@ -37762,7 +40995,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L21_break:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":585 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":585 * break * i2 = i2 + step2 * if i2 > med2_plus: # <<<<<<<<<<<<<< @@ -37772,7 +41005,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_i2 > __pyx_v_med2_plus); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":586 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":586 * i2 = i2 + step2 * if i2 > med2_plus: * med2_plus = i2 # <<<<<<<<<<<<<< @@ -37784,7 +41017,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L24:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":587 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":587 * if i2 > med2_plus: * med2_plus = i2 * i1 = i1 + step1 # <<<<<<<<<<<<<< @@ -37794,7 +41027,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":589 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":589 * i1 = i1 + step1 * * tmp = med1_minus # <<<<<<<<<<<<<< @@ -37803,7 +41036,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_tmp = __pyx_v_med1_minus; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":590 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":590 * * tmp = med1_minus * med1_minus = med1_plus # <<<<<<<<<<<<<< @@ -37812,7 +41045,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med1_minus = __pyx_v_med1_plus; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":591 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":591 * tmp = med1_minus * med1_minus = med1_plus * med1_plus = tmp # <<<<<<<<<<<<<< @@ -37824,7 +41057,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":594 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":594 * else: * # No match; need to figure out the point of division in D and Q * med2_minus = med2 # <<<<<<<<<<<<<< @@ -37833,7 +41066,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_minus = __pyx_v_med2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":595 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":595 * # No match; need to figure out the point of division in D and Q * med2_minus = med2 * med2_plus = med2 # <<<<<<<<<<<<<< @@ -37842,7 +41075,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_plus = __pyx_v_med2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":596 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":596 * med2_minus = med2 * med2_plus = med2 * if d_first: # <<<<<<<<<<<<<< @@ -37851,7 +41084,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ if (__pyx_v_d_first) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":597 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":597 * med2_plus = med2 * if d_first: * med2_minus = med2_minus + step2 # <<<<<<<<<<<<<< @@ -37860,7 +41093,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":598 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":598 * if d_first: * med2_minus = med2_minus + step2 * if comparison == -1: # <<<<<<<<<<<<<< @@ -37870,7 +41103,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_comparison == -1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":599 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":599 * med2_minus = med2_minus + step2 * if comparison == -1: * med1_minus = med1_plus # <<<<<<<<<<<<<< @@ -37882,7 +41115,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L26:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":600 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":600 * if comparison == -1: * med1_minus = med1_plus * if comparison == 1: # <<<<<<<<<<<<<< @@ -37892,7 +41125,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_comparison == 1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":601 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":601 * med1_minus = med1_plus * if comparison == 1: * med1_plus = med1_minus # <<<<<<<<<<<<<< @@ -37907,7 +41140,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":603 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":603 * med1_plus = med1_minus * else: * tmp = med1_minus # <<<<<<<<<<<<<< @@ -37916,7 +41149,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_tmp = __pyx_v_med1_minus; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":604 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":604 * else: * tmp = med1_minus * med1_minus = med1_plus # <<<<<<<<<<<<<< @@ -37925,7 +41158,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med1_minus = __pyx_v_med1_plus; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":605 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":605 * tmp = med1_minus * med1_minus = med1_plus * med1_plus = tmp # <<<<<<<<<<<<<< @@ -37934,7 +41167,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med1_plus = __pyx_v_tmp; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":606 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":606 * med1_minus = med1_plus * med1_plus = tmp * if comparison == 1: # <<<<<<<<<<<<<< @@ -37944,7 +41177,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_comparison == 1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":607 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":607 * med1_plus = tmp * if comparison == 1: * med2_minus = med2_minus + step2 # <<<<<<<<<<<<<< @@ -37953,7 +41186,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":608 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":608 * if comparison == 1: * med2_minus = med2_minus + step2 * med2_plus = med2_plus + step2 # <<<<<<<<<<<<<< @@ -37969,7 +41202,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L14:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":610 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":610 * med2_plus = med2_plus + step2 * * low_result_len = 0 # <<<<<<<<<<<<<< @@ -37978,7 +41211,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_low_result_len = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":611 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":611 * * low_result_len = 0 * low_result = self.baeza_yates_helper(low1, med1_plus, arr1, step1, low2, med2_plus, arr2, step2, offset_by_one, len_last, num_subpatterns, &low_result_len) # <<<<<<<<<<<<<< @@ -37987,7 +41220,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_low_result = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->baeza_yates_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_med1_plus, __pyx_v_arr1, __pyx_v_step1, __pyx_v_low2, __pyx_v_med2_plus, __pyx_v_arr2, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_low_result_len)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":612 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":612 * low_result_len = 0 * low_result = self.baeza_yates_helper(low1, med1_plus, arr1, step1, low2, med2_plus, arr2, step2, offset_by_one, len_last, num_subpatterns, &low_result_len) * high_result_len = 0 # <<<<<<<<<<<<<< @@ -37996,7 +41229,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_high_result_len = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":613 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":613 * low_result = self.baeza_yates_helper(low1, med1_plus, arr1, step1, low2, med2_plus, arr2, step2, offset_by_one, len_last, num_subpatterns, &low_result_len) * high_result_len = 0 * high_result = self.baeza_yates_helper(med1_minus, high1, arr1, step1, med2_minus, high2, arr2, step2, offset_by_one, len_last, num_subpatterns, &high_result_len) # <<<<<<<<<<<<<< @@ -38005,7 +41238,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_high_result = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->baeza_yates_helper(__pyx_v_self, __pyx_v_med1_minus, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_med2_minus, __pyx_v_high2, __pyx_v_arr2, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_high_result_len)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":615 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":615 * high_result = self.baeza_yates_helper(med1_minus, high1, arr1, step1, med2_minus, high2, arr2, step2, offset_by_one, len_last, num_subpatterns, &high_result_len) * * result = extend_arr(result, result_len, low_result, low_result_len) # <<<<<<<<<<<<<< @@ -38014,7 +41247,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_result = __pyx_f_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_low_result, __pyx_v_low_result_len); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":616 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":616 * * result = extend_arr(result, result_len, low_result, low_result_len) * result = extend_arr(result, result_len, med_result, med_result_len) # <<<<<<<<<<<<<< @@ -38023,7 +41256,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_result = __pyx_f_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_med_result, __pyx_v_med_result_len); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":617 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":617 * result = extend_arr(result, result_len, low_result, low_result_len) * result = extend_arr(result, result_len, med_result, med_result_len) * result = extend_arr(result, result_len, high_result, high_result_len) # <<<<<<<<<<<<<< @@ -38032,7 +41265,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_result = __pyx_f_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_high_result, __pyx_v_high_result_len); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":618 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":618 * result = extend_arr(result, result_len, med_result, med_result_len) * result = extend_arr(result, result_len, high_result, high_result_len) * free(low_result) # <<<<<<<<<<<<<< @@ -38041,7 +41274,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ free(__pyx_v_low_result); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":619 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":619 * result = extend_arr(result, result_len, high_result, high_result_len) * free(low_result) * free(med_result) # <<<<<<<<<<<<<< @@ -38050,7 +41283,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ free(__pyx_v_med_result); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":620 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":620 * free(low_result) * free(med_result) * free(high_result) # <<<<<<<<<<<<<< @@ -38059,7 +41292,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ free(__pyx_v_high_result); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":622 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":622 * free(high_result) * * return result # <<<<<<<<<<<<<< @@ -38079,7 +41312,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":626 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":626 * * * cdef long compare_matchings_set(self, int i1_minus, int i1_plus, int* arr1, int step1, # <<<<<<<<<<<<<< @@ -38096,9 +41329,9 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct long __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("compare_matchings_set"); + __Pyx_RefNannySetupContext("compare_matchings_set", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":637 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":637 * cdef Matching* loc1 * * loc1 = &l1_stack # <<<<<<<<<<<<<< @@ -38107,7 +41340,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_loc1 = (&__pyx_v_l1_stack); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":639 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":639 * loc1 = &l1_stack * * i1 = i1_minus # <<<<<<<<<<<<<< @@ -38116,7 +41349,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_i1 = __pyx_v_i1_minus; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":640 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":640 * * i1 = i1_minus * while i1 < i1_plus: # <<<<<<<<<<<<<< @@ -38127,7 +41360,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_t_1 = (__pyx_v_i1 < __pyx_v_i1_plus); if (!__pyx_t_1) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":641 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":641 * i1 = i1_minus * while i1 < i1_plus: * assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -38136,7 +41369,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_f_3_sa_assign_matching(__pyx_v_loc1, __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":642 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":642 * while i1 < i1_plus: * assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr) * comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last) # <<<<<<<<<<<<<< @@ -38145,7 +41378,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_comparison = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, __pyx_v_loc1, __pyx_v_loc2, __pyx_v_offset_by_one, __pyx_v_len_last); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":643 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":643 * assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr) * comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last) * if comparison == 0: # <<<<<<<<<<<<<< @@ -38155,7 +41388,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_t_1 = (__pyx_v_comparison == 0); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":644 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":644 * comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last) * if comparison == 0: * prev_comparison = 0 # <<<<<<<<<<<<<< @@ -38164,7 +41397,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_prev_comparison = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":645 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":645 * if comparison == 0: * prev_comparison = 0 * break # <<<<<<<<<<<<<< @@ -38175,7 +41408,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct goto __pyx_L5; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":646 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":646 * prev_comparison = 0 * break * elif i1 == i1_minus: # <<<<<<<<<<<<<< @@ -38185,7 +41418,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_t_1 = (__pyx_v_i1 == __pyx_v_i1_minus); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":647 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":647 * break * elif i1 == i1_minus: * prev_comparison = comparison # <<<<<<<<<<<<<< @@ -38197,7 +41430,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":649 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":649 * prev_comparison = comparison * else: * if comparison != prev_comparison: # <<<<<<<<<<<<<< @@ -38207,7 +41440,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_t_1 = (__pyx_v_comparison != __pyx_v_prev_comparison); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":650 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":650 * else: * if comparison != prev_comparison: * prev_comparison = 0 # <<<<<<<<<<<<<< @@ -38216,7 +41449,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_prev_comparison = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":651 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":651 * if comparison != prev_comparison: * prev_comparison = 0 * break # <<<<<<<<<<<<<< @@ -38230,7 +41463,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":652 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":652 * prev_comparison = 0 * break * i1 = i1 + step1 # <<<<<<<<<<<<<< @@ -38241,7 +41474,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct } __pyx_L4_break:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":653 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":653 * break * i1 = i1 + step1 * return prev_comparison # <<<<<<<<<<<<<< @@ -38257,7 +41490,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":656 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":656 * * * cdef long compare_matchings(self, Matching* loc1, Matching* loc2, int offset_by_one, int len_last): # <<<<<<<<<<<<<< @@ -38273,9 +41506,9 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - __Pyx_RefNannySetupContext("compare_matchings"); + __Pyx_RefNannySetupContext("compare_matchings", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":659 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":659 * cdef int i * * if loc1.sent_id > loc2.sent_id: # <<<<<<<<<<<<<< @@ -38285,7 +41518,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_1 = (__pyx_v_loc1->sent_id > __pyx_v_loc2->sent_id); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":660 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":660 * * if loc1.sent_id > loc2.sent_id: * return 1 # <<<<<<<<<<<<<< @@ -38298,7 +41531,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":661 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":661 * if loc1.sent_id > loc2.sent_id: * return 1 * if loc2.sent_id > loc1.sent_id: # <<<<<<<<<<<<<< @@ -38308,7 +41541,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_1 = (__pyx_v_loc2->sent_id > __pyx_v_loc1->sent_id); if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":662 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":662 * return 1 * if loc2.sent_id > loc1.sent_id: * return -1 # <<<<<<<<<<<<<< @@ -38321,7 +41554,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":664 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":664 * return -1 * * if loc1.size == 1 and loc2.size == 1: # <<<<<<<<<<<<<< @@ -38337,7 +41570,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":665 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":665 * * if loc1.size == 1 and loc2.size == 1: * if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size: # <<<<<<<<<<<<<< @@ -38347,7 +41580,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = (((__pyx_v_loc2->arr[__pyx_v_loc2->start]) - (__pyx_v_loc1->arr[__pyx_v_loc1->start])) <= __pyx_v_self->train_min_gap_size); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":666 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":666 * if loc1.size == 1 and loc2.size == 1: * if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size: * return 1 # <<<<<<<<<<<<<< @@ -38362,7 +41595,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py goto __pyx_L5; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":668 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":668 * return 1 * * elif offset_by_one: # <<<<<<<<<<<<<< @@ -38371,7 +41604,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py */ if (__pyx_v_offset_by_one) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":669 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":669 * * elif offset_by_one: * for i from 1 <= i < loc1.size: # <<<<<<<<<<<<<< @@ -38381,7 +41614,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_4 = __pyx_v_loc1->size; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":670 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":670 * elif offset_by_one: * for i from 1 <= i < loc1.size: * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]: # <<<<<<<<<<<<<< @@ -38391,7 +41624,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = ((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) > (__pyx_v_loc2->arr[((__pyx_v_loc2->start + __pyx_v_i) - 1)])); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":671 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":671 * for i from 1 <= i < loc1.size: * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]: * return 1 # <<<<<<<<<<<<<< @@ -38404,7 +41637,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L9:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":672 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":672 * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]: * return 1 * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i-1]: # <<<<<<<<<<<<<< @@ -38414,7 +41647,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = ((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) < (__pyx_v_loc2->arr[((__pyx_v_loc2->start + __pyx_v_i) - 1)])); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":673 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":673 * return 1 * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i-1]: * return -1 # <<<<<<<<<<<<<< @@ -38431,7 +41664,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":676 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":676 * * else: * if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]: # <<<<<<<<<<<<<< @@ -38441,7 +41674,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = (((__pyx_v_loc1->arr[__pyx_v_loc1->start]) + 1) > (__pyx_v_loc2->arr[__pyx_v_loc2->start])); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":677 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":677 * else: * if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]: * return 1 # <<<<<<<<<<<<<< @@ -38454,7 +41687,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L11:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":678 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":678 * if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]: * return 1 * if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]: # <<<<<<<<<<<<<< @@ -38464,7 +41697,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = (((__pyx_v_loc1->arr[__pyx_v_loc1->start]) + 1) < (__pyx_v_loc2->arr[__pyx_v_loc2->start])); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":679 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":679 * return 1 * if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]: * return -1 # <<<<<<<<<<<<<< @@ -38477,7 +41710,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L12:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":681 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":681 * return -1 * * for i from 1 <= i < loc1.size: # <<<<<<<<<<<<<< @@ -38487,7 +41720,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_4 = __pyx_v_loc1->size; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":682 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":682 * * for i from 1 <= i < loc1.size: * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]: # <<<<<<<<<<<<<< @@ -38497,7 +41730,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = ((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) > (__pyx_v_loc2->arr[(__pyx_v_loc2->start + __pyx_v_i)])); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":683 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":683 * for i from 1 <= i < loc1.size: * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]: * return 1 # <<<<<<<<<<<<<< @@ -38510,7 +41743,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L15:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":684 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":684 * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]: * return 1 * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]: # <<<<<<<<<<<<<< @@ -38520,7 +41753,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = ((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) < (__pyx_v_loc2->arr[(__pyx_v_loc2->start + __pyx_v_i)])); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":685 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":685 * return 1 * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]: * return -1 # <<<<<<<<<<<<<< @@ -38536,7 +41769,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":687 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":687 * return -1 * * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -38546,7 +41779,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = ((((__pyx_v_loc2->arr[(__pyx_v_loc2->end - 1)]) + __pyx_v_len_last) - (__pyx_v_loc1->arr[__pyx_v_loc1->start])) > __pyx_v_self->train_max_initial_size); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":688 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":688 * * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: * return -1 # <<<<<<<<<<<<<< @@ -38559,7 +41792,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L17:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":689 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":689 * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: * return -1 * return 0 # <<<<<<<<<<<<<< @@ -38575,7 +41808,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":692 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":692 * * * cdef int* merge_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<< @@ -38597,9 +41830,9 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("merge_helper"); + __Pyx_RefNannySetupContext("merge_helper", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":700 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":700 * cdef Matching loc1, loc2 * * result_len[0] = 0 # <<<<<<<<<<<<<< @@ -38608,7 +41841,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ (__pyx_v_result_len[0]) = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":701 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":701 * * result_len[0] = 0 * result = <int*> malloc(0*sizeof(int)) # <<<<<<<<<<<<<< @@ -38617,7 +41850,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_result = ((int *)malloc((0 * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":703 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":703 * result = <int*> malloc(0*sizeof(int)) * * i1 = low1 # <<<<<<<<<<<<<< @@ -38626,7 +41859,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_i1 = __pyx_v_low1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":704 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":704 * * i1 = low1 * i2 = low2 # <<<<<<<<<<<<<< @@ -38635,7 +41868,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_i2 = __pyx_v_low2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":705 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":705 * i1 = low1 * i2 = low2 * while i1 < high1 and i2 < high2: # <<<<<<<<<<<<<< @@ -38652,7 +41885,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":708 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":708 * * # First, pop all unneeded loc2's off the stack * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -38661,7 +41894,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":709 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":709 * # First, pop all unneeded loc2's off the stack * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * while i2 < high2: # <<<<<<<<<<<<<< @@ -38672,7 +41905,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_3 = (__pyx_v_i2 < __pyx_v_high2); if (!__pyx_t_3) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":710 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":710 * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * while i2 < high2: * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -38681,7 +41914,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_i2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":711 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":711 * while i2 < high2: * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: # <<<<<<<<<<<<<< @@ -38691,7 +41924,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_3 = (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == 1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":712 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":712 * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: * i2 = i2 + step2 # <<<<<<<<<<<<<< @@ -38703,7 +41936,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":714 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":714 * i2 = i2 + step2 * else: * break # <<<<<<<<<<<<<< @@ -38716,7 +41949,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } __pyx_L6_break:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":717 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":717 * * # Next: process all loc1's with the same starting val * j1 = i1 # <<<<<<<<<<<<<< @@ -38725,7 +41958,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_j1 = __pyx_v_i1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":718 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":718 * # Next: process all loc1's with the same starting val * j1 = i1 * while i1 < high1 and arr1[j1] == arr1[i1]: # <<<<<<<<<<<<<< @@ -38742,7 +41975,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } if (!__pyx_t_2) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":719 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":719 * j1 = i1 * while i1 < high1 and arr1[j1] == arr1[i1]: * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -38751,7 +41984,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":720 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":720 * while i1 < high1 and arr1[j1] == arr1[i1]: * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * j2 = i2 # <<<<<<<<<<<<<< @@ -38760,7 +41993,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_j2 = __pyx_v_i2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":721 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":721 * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * j2 = i2 * while j2 < high2: # <<<<<<<<<<<<<< @@ -38771,7 +42004,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_2 = (__pyx_v_j2 < __pyx_v_high2); if (!__pyx_t_2) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":722 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":722 * j2 = i2 * while j2 < high2: * assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< @@ -38780,7 +42013,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_j2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":723 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":723 * while j2 < high2: * assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr) * comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) # <<<<<<<<<<<<<< @@ -38789,7 +42022,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_comparison = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":724 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":724 * assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr) * comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) * if comparison == 0: # <<<<<<<<<<<<<< @@ -38799,7 +42032,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_2 = (__pyx_v_comparison == 0); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":725 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":725 * comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) * if comparison == 0: * result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len) # <<<<<<<<<<<<<< @@ -38811,7 +42044,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } __pyx_L12:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":726 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":726 * if comparison == 0: * result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len) * if comparison == 1: # <<<<<<<<<<<<<< @@ -38824,7 +42057,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } __pyx_L13:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":728 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":728 * if comparison == 1: * pass * if comparison == -1: # <<<<<<<<<<<<<< @@ -38834,7 +42067,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_2 = (__pyx_v_comparison == -1); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":729 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":729 * pass * if comparison == -1: * break # <<<<<<<<<<<<<< @@ -38846,7 +42079,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":731 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":731 * break * else: * j2 = j2 + step2 # <<<<<<<<<<<<<< @@ -38859,7 +42092,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } __pyx_L11_break:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":732 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":732 * else: * j2 = j2 + step2 * i1 = i1 + step1 # <<<<<<<<<<<<<< @@ -38870,7 +42103,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":733 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":733 * j2 = j2 + step2 * i1 = i1 + step1 * return result # <<<<<<<<<<<<<< @@ -38886,7 +42119,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":736 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":736 * * * cdef void sort_phrase_loc(self, IntList arr, PhraseLocation loc, Phrase phrase): # <<<<<<<<<<<<<< @@ -38906,19 +42139,19 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sort_phrase_loc"); + __Pyx_RefNannySetupContext("sort_phrase_loc", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":741 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":741 * cdef IntList result * * if phrase in self.precomputed_index: # <<<<<<<<<<<<<< * loc.arr = self.precomputed_index[phrase] * else: */ - __pyx_t_1 = ((PySequence_Contains(__pyx_v_self->precomputed_index, ((PyObject *)__pyx_v_phrase)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_phrase), __pyx_v_self->precomputed_index, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":742 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":742 * * if phrase in self.precomputed_index: * loc.arr = self.precomputed_index[phrase] # <<<<<<<<<<<<<< @@ -38937,7 +42170,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":744 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":744 * loc.arr = self.precomputed_index[phrase] * else: * loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low) # <<<<<<<<<<<<<< @@ -38950,7 +42183,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_3); @@ -38959,7 +42192,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __pyx_v_loc->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":745 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":745 * else: * loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low) * veb = VEB(arr.len) # <<<<<<<<<<<<<< @@ -38969,7 +42202,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __pyx_t_3 = PyInt_FromLong(__pyx_v_arr->len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -38979,7 +42212,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":746 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":746 * loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low) * veb = VEB(arr.len) * for i from loc.sa_low <= i < loc.sa_high: # <<<<<<<<<<<<<< @@ -38989,7 +42222,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __pyx_t_4 = __pyx_v_loc->sa_high; for (__pyx_v_i = __pyx_v_loc->sa_low; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":747 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":747 * veb = VEB(arr.len) * for i from loc.sa_low <= i < loc.sa_high: * veb._insert(arr.arr[i]) # <<<<<<<<<<<<<< @@ -38999,7 +42232,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ ((struct __pyx_vtabstruct_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_insert(__pyx_v_veb, (__pyx_v_arr->arr[__pyx_v_i])); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":748 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":748 * for i from loc.sa_low <= i < loc.sa_high: * veb._insert(arr.arr[i]) * i = veb.veb.min_val # <<<<<<<<<<<<<< @@ -39008,7 +42241,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ */ __pyx_v_i = __pyx_v_veb->veb->min_val; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":749 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":749 * veb._insert(arr.arr[i]) * i = veb.veb.min_val * for j from 0 <= j < loc.sa_high-loc.sa_low: # <<<<<<<<<<<<<< @@ -39018,7 +42251,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __pyx_t_4 = (__pyx_v_loc->sa_high - __pyx_v_loc->sa_low); for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":750 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":750 * i = veb.veb.min_val * for j from 0 <= j < loc.sa_high-loc.sa_low: * loc.arr.arr[j] = i # <<<<<<<<<<<<<< @@ -39027,7 +42260,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ */ (__pyx_v_loc->arr->arr[__pyx_v_j]) = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":751 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":751 * for j from 0 <= j < loc.sa_high-loc.sa_low: * loc.arr.arr[j] = i * i = veb._findsucc(i) # <<<<<<<<<<<<<< @@ -39039,7 +42272,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":752 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":752 * loc.arr.arr[j] = i * i = veb._findsucc(i) * loc.arr_low = 0 # <<<<<<<<<<<<<< @@ -39048,7 +42281,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ */ __pyx_v_loc->arr_low = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":753 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":753 * i = veb._findsucc(i) * loc.arr_low = 0 * loc.arr_high = loc.arr.len # <<<<<<<<<<<<<< @@ -39067,7 +42300,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __Pyx_RefNannyFinishContext(); } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":756 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":756 * * * cdef intersect_helper(self, Phrase prefix, Phrase suffix, # <<<<<<<<<<<<<< @@ -39102,9 +42335,9 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("intersect_helper"); + __Pyx_RefNannySetupContext("intersect_helper", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":763 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":763 * cdef int* result_ptr * * result_len = 0 # <<<<<<<<<<<<<< @@ -39113,7 +42346,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_result_len = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":765 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":765 * result_len = 0 * * if sym_isvar(suffix[0]): # <<<<<<<<<<<<<< @@ -39127,7 +42360,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_3 = __pyx_f_3_sa_sym_isvar(__pyx_t_2); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":766 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":766 * * if sym_isvar(suffix[0]): * offset_by_one = 1 # <<<<<<<<<<<<<< @@ -39139,7 +42372,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":768 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":768 * offset_by_one = 1 * else: * offset_by_one = 0 # <<<<<<<<<<<<<< @@ -39150,7 +42383,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":770 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":770 * offset_by_one = 0 * * len_last = len(suffix.getchunk(suffix.arity())) # <<<<<<<<<<<<<< @@ -39165,7 +42398,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -39177,7 +42410,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_len_last = __pyx_t_6; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":772 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":772 * len_last = len(suffix.getchunk(suffix.arity())) * * if prefix_loc.arr is None: # <<<<<<<<<<<<<< @@ -39187,7 +42420,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_7 = (((PyObject *)__pyx_v_prefix_loc->arr) == Py_None); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":773 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":773 * * if prefix_loc.arr is None: * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) # <<<<<<<<<<<<<< @@ -39202,7 +42435,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":774 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":774 * if prefix_loc.arr is None: * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) * arr1 = prefix_loc.arr # <<<<<<<<<<<<<< @@ -39212,7 +42445,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __Pyx_INCREF(((PyObject *)__pyx_v_prefix_loc->arr)); __pyx_v_arr1 = __pyx_v_prefix_loc->arr; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":775 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":775 * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) * arr1 = prefix_loc.arr * low1 = prefix_loc.arr_low # <<<<<<<<<<<<<< @@ -39221,7 +42454,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_low1 = __pyx_v_prefix_loc->arr_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":776 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":776 * arr1 = prefix_loc.arr * low1 = prefix_loc.arr_low * high1 = prefix_loc.arr_high # <<<<<<<<<<<<<< @@ -39230,7 +42463,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_high1 = __pyx_v_prefix_loc->arr_high; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":777 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":777 * low1 = prefix_loc.arr_low * high1 = prefix_loc.arr_high * step1 = prefix_loc.num_subpatterns # <<<<<<<<<<<<<< @@ -39239,7 +42472,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_step1 = __pyx_v_prefix_loc->num_subpatterns; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":779 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":779 * step1 = prefix_loc.num_subpatterns * * if suffix_loc.arr is None: # <<<<<<<<<<<<<< @@ -39249,7 +42482,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_7 = (((PyObject *)__pyx_v_suffix_loc->arr) == Py_None); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":780 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":780 * * if suffix_loc.arr is None: * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) # <<<<<<<<<<<<<< @@ -39264,7 +42497,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":781 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":781 * if suffix_loc.arr is None: * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) * arr2 = suffix_loc.arr # <<<<<<<<<<<<<< @@ -39274,7 +42507,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __Pyx_INCREF(((PyObject *)__pyx_v_suffix_loc->arr)); __pyx_v_arr2 = __pyx_v_suffix_loc->arr; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":782 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":782 * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) * arr2 = suffix_loc.arr * low2 = suffix_loc.arr_low # <<<<<<<<<<<<<< @@ -39283,7 +42516,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_low2 = __pyx_v_suffix_loc->arr_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":783 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":783 * arr2 = suffix_loc.arr * low2 = suffix_loc.arr_low * high2 = suffix_loc.arr_high # <<<<<<<<<<<<<< @@ -39292,7 +42525,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_high2 = __pyx_v_suffix_loc->arr_high; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":784 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":784 * low2 = suffix_loc.arr_low * high2 = suffix_loc.arr_high * step2 = suffix_loc.num_subpatterns # <<<<<<<<<<<<<< @@ -39301,7 +42534,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_step2 = __pyx_v_suffix_loc->num_subpatterns; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":786 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":786 * step2 = suffix_loc.num_subpatterns * * num_subpatterns = prefix.arity()+1 # <<<<<<<<<<<<<< @@ -39320,7 +42553,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_num_subpatterns = __pyx_t_3; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":788 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":788 * num_subpatterns = prefix.arity()+1 * * if algorithm == MERGE: # <<<<<<<<<<<<<< @@ -39330,7 +42563,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_7 = (__pyx_v_algorithm == __pyx_v_3_sa_MERGE); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":791 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":791 * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, * low2, high2, arr2.arr, step2, * offset_by_one, len_last, num_subpatterns, &result_len) # <<<<<<<<<<<<<< @@ -39342,7 +42575,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":795 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":795 * result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, * low2, high2, arr2.arr, step2, * offset_by_one, len_last, num_subpatterns, &result_len) # <<<<<<<<<<<<<< @@ -39353,7 +42586,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":797 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":797 * offset_by_one, len_last, num_subpatterns, &result_len) * * if result_len == 0: # <<<<<<<<<<<<<< @@ -39363,7 +42596,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_7 = (__pyx_v_result_len == 0); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":798 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":798 * * if result_len == 0: * free(result_ptr) # <<<<<<<<<<<<<< @@ -39372,7 +42605,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ free(__pyx_v_result_ptr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":799 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":799 * if result_len == 0: * free(result_ptr) * return None # <<<<<<<<<<<<<< @@ -39387,7 +42620,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":801 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":801 * return None * else: * result = IntList() # <<<<<<<<<<<<<< @@ -39399,7 +42632,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_v_result = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_5); __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":802 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":802 * else: * result = IntList() * free(result.arr) # <<<<<<<<<<<<<< @@ -39408,7 +42641,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ free(__pyx_v_result->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":803 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":803 * result = IntList() * free(result.arr) * result.arr = result_ptr # <<<<<<<<<<<<<< @@ -39417,7 +42650,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_result->arr = __pyx_v_result_ptr; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":804 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":804 * free(result.arr) * result.arr = result_ptr * result.len = result_len # <<<<<<<<<<<<<< @@ -39426,7 +42659,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_result->len = __pyx_v_result_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":805 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":805 * result.arr = result_ptr * result.len = result_len * result.size = result_len # <<<<<<<<<<<<<< @@ -39435,7 +42668,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_result->size = __pyx_v_result_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":806 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":806 * result.len = result_len * result.size = result_len * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) # <<<<<<<<<<<<<< @@ -39455,7 +42688,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_r = __pyx_t_4; @@ -39481,7 +42714,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":808 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":808 * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) * * cdef loc2str(self, PhraseLocation loc): # <<<<<<<<<<<<<< @@ -39489,7 +42722,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct * result = "{" */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_loc) { +static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_loc) { int __pyx_v_i; int __pyx_v_j; PyObject *__pyx_v_result = NULL; @@ -39502,9 +42735,9 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loc2str"); + __Pyx_RefNannySetupContext("loc2str", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":810 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":810 * cdef loc2str(self, PhraseLocation loc): * cdef int i, j * result = "{" # <<<<<<<<<<<<<< @@ -39514,7 +42747,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj __Pyx_INCREF(((PyObject *)__pyx_kp_s_117)); __pyx_v_result = ((PyObject *)__pyx_kp_s_117); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":811 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":811 * cdef int i, j * result = "{" * i = 0 # <<<<<<<<<<<<<< @@ -39523,7 +42756,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj */ __pyx_v_i = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":812 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":812 * result = "{" * i = 0 * while i < loc.arr_high: # <<<<<<<<<<<<<< @@ -39534,7 +42767,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj __pyx_t_1 = (__pyx_v_i < __pyx_v_loc->arr_high); if (!__pyx_t_1) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":813 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":813 * i = 0 * while i < loc.arr_high: * result = result + "(" # <<<<<<<<<<<<<< @@ -39547,7 +42780,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":814 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":814 * while i < loc.arr_high: * result = result + "(" * for j from i <= j < i + loc.num_subpatterns: # <<<<<<<<<<<<<< @@ -39557,7 +42790,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj __pyx_t_3 = (__pyx_v_i + __pyx_v_loc->num_subpatterns); for (__pyx_v_j = __pyx_v_i; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":815 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":815 * result = result + "(" * for j from i <= j < i + loc.num_subpatterns: * result = result + ("%d " %loc.arr[j]) # <<<<<<<<<<<<<< @@ -39577,7 +42810,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj __pyx_t_2 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":816 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":816 * for j from i <= j < i + loc.num_subpatterns: * result = result + ("%d " %loc.arr[j]) * result = result + ")" # <<<<<<<<<<<<<< @@ -39590,7 +42823,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":817 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":817 * result = result + ("%d " %loc.arr[j]) * result = result + ")" * i = i + loc.num_subpatterns # <<<<<<<<<<<<<< @@ -39600,7 +42833,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj __pyx_v_i = (__pyx_v_i + __pyx_v_loc->num_subpatterns); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":818 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":818 * result = result + ")" * i = i + loc.num_subpatterns * result = result + "}" # <<<<<<<<<<<<<< @@ -39613,7 +42846,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":819 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":819 * i = i + loc.num_subpatterns * result = result + "}" * return result # <<<<<<<<<<<<<< @@ -39639,7 +42872,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(struct __pyx_obj return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":821 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":821 * return result * * cdef PhraseLocation intersect(self, prefix_node, suffix_node, Phrase phrase): # <<<<<<<<<<<<<< @@ -39653,7 +42886,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_prefix_loc = 0; struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_suffix_loc = 0; struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_result = 0; - PyObject *__pyx_v_intersect_method = NULL; + CYTHON_UNUSED PyObject *__pyx_v_intersect_method = NULL; struct __pyx_obj_3_sa_PhraseLocation *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -39663,9 +42896,9 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("intersect"); + __Pyx_RefNannySetupContext("intersect", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":825 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":825 * cdef PhraseLocation prefix_loc, suffix_loc, result * * prefix = prefix_node.phrase # <<<<<<<<<<<<<< @@ -39678,7 +42911,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_v_prefix = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":826 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":826 * * prefix = prefix_node.phrase * suffix = suffix_node.phrase # <<<<<<<<<<<<<< @@ -39691,7 +42924,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_v_suffix = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":827 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":827 * prefix = prefix_node.phrase * suffix = suffix_node.phrase * prefix_loc = prefix_node.phrase_location # <<<<<<<<<<<<<< @@ -39704,7 +42937,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_v_prefix_loc = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":828 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":828 * suffix = suffix_node.phrase * prefix_loc = prefix_node.phrase_location * suffix_loc = suffix_node.phrase_location # <<<<<<<<<<<<<< @@ -39717,7 +42950,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_v_suffix_loc = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":830 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":830 * suffix_loc = suffix_node.phrase_location * * result = self.get_precomputed_collocation(phrase) # <<<<<<<<<<<<<< @@ -39727,7 +42960,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_120); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __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[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_phrase)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_phrase)); __Pyx_GIVEREF(((PyObject *)__pyx_v_phrase)); @@ -39739,7 +42972,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":831 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":831 * * result = self.get_precomputed_collocation(phrase) * if result is not None: # <<<<<<<<<<<<<< @@ -39749,7 +42982,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_t_4 = (((PyObject *)__pyx_v_result) != Py_None); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":832 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":832 * result = self.get_precomputed_collocation(phrase) * if result is not None: * intersect_method = "precomputed" # <<<<<<<<<<<<<< @@ -39762,7 +42995,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":834 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":834 * intersect_method = "precomputed" * * if result is None: # <<<<<<<<<<<<<< @@ -39772,7 +43005,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_t_4 = (((PyObject *)__pyx_v_result) == Py_None); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":835 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":835 * * if result is None: * if self.use_baeza_yates: # <<<<<<<<<<<<<< @@ -39781,7 +43014,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact */ if (__pyx_v_self->use_baeza_yates) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":836 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":836 * if result is None: * if self.use_baeza_yates: * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES) # <<<<<<<<<<<<<< @@ -39795,7 +43028,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":837 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":837 * if self.use_baeza_yates: * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES) * intersect_method="double binary" # <<<<<<<<<<<<<< @@ -39809,7 +43042,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":839 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":839 * intersect_method="double binary" * else: * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) # <<<<<<<<<<<<<< @@ -39823,7 +43056,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":840 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":840 * else: * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) * intersect_method="merge" # <<<<<<<<<<<<<< @@ -39839,7 +43072,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact } __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":841 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":841 * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) * intersect_method="merge" * return result # <<<<<<<<<<<<<< @@ -39871,56 +43104,22 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":843 - * return result - * - * def advance(self, frontier, res, fwords): # <<<<<<<<<<<<<< - * cdef unsigned na - * nf = [] - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_frontier = 0; PyObject *__pyx_v_res = 0; PyObject *__pyx_v_fwords = 0; - unsigned int __pyx_v_na; - PyObject *__pyx_v_nf = NULL; - PyObject *__pyx_v_toskip = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_alt = NULL; - PyObject *__pyx_v_pathlen = NULL; - PyObject *__pyx_v_spanlen = NULL; - PyObject *__pyx_v_ni = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - unsigned int __pyx_t_16; - int __pyx_t_17; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__frontier,&__pyx_n_s__res,&__pyx_n_s__fwords,0}; - __Pyx_RefNannySetupContext("advance"); + __Pyx_RefNannySetupContext("advance (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__frontier,&__pyx_n_s__res,&__pyx_n_s__fwords,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -39928,26 +43127,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frontier); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frontier)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "advance") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "advance") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -39968,8 +43164,53 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_frontier, __pyx_v_res, __pyx_v_fwords); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":843 + * return result + * + * def advance(self, frontier, res, fwords): # <<<<<<<<<<<<<< + * cdef unsigned na + * nf = [] + */ - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":845 +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords) { + unsigned int __pyx_v_na; + PyObject *__pyx_v_nf = NULL; + PyObject *__pyx_v_toskip = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_alt = NULL; + PyObject *__pyx_v_pathlen = NULL; + PyObject *__pyx_v_spanlen = NULL; + PyObject *__pyx_v_ni = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + Py_ssize_t __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + unsigned int __pyx_t_16; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("advance", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":845 * def advance(self, frontier, res, fwords): * cdef unsigned na * nf = [] # <<<<<<<<<<<<<< @@ -39977,11 +43218,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py * spanlen = fwords[i][alt][2] */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_nf = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":846 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":846 * cdef unsigned na * nf = [] * for (toskip, (i, alt, pathlen)) in frontier: # <<<<<<<<<<<<<< @@ -39997,12 +43238,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -40016,66 +43265,74 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py } if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed; + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed; + index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L9_unpacking_done; - __pyx_L8_unpacking_failed:; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L9_unpacking_done:; + __pyx_L6_unpacking_done:; } __Pyx_XDECREF(__pyx_v_toskip); __pyx_v_toskip = __pyx_t_5; __pyx_t_5 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { PyObject* sequence = __pyx_t_6; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_7 = PyList_GET_ITEM(sequence, 0); __pyx_t_9 = PyList_GET_ITEM(sequence, 1); __pyx_t_10 = PyList_GET_ITEM(sequence, 2); @@ -40083,28 +43340,35 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); + #else + __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L10_unpacking_failed; + index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); - index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed; + index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); - index = 2; __pyx_t_10 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; + index = 2; __pyx_t_10 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L11_unpacking_done; - __pyx_L10_unpacking_failed:; + goto __pyx_L8_unpacking_done; + __pyx_L7_unpacking_failed:; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L11_unpacking_done:; + __pyx_L8_unpacking_done:; } __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_7; @@ -40116,7 +43380,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_v_pathlen = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":847 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":847 * nf = [] * for (toskip, (i, alt, pathlen)) in frontier: * spanlen = fwords[i][alt][2] # <<<<<<<<<<<<<< @@ -40135,20 +43399,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_v_spanlen = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":848 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":848 * for (toskip, (i, alt, pathlen)) in frontier: * spanlen = fwords[i][alt][2] * if (toskip == 0): # <<<<<<<<<<<<<< * res.append((i, alt, pathlen)) * ni = i + spanlen */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_toskip, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_toskip, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_12) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":849 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":849 * spanlen = fwords[i][alt][2] * if (toskip == 0): * res.append((i, alt, pathlen)) # <<<<<<<<<<<<<< @@ -40156,7 +43419,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py * if (ni < len(fwords) and (pathlen + 1) < self.max_initial_size): */ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); @@ -40170,11 +43433,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L12; + goto __pyx_L9; } - __pyx_L12:; + __pyx_L9:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":850 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":850 * if (toskip == 0): * res.append((i, alt, pathlen)) * ni = i + spanlen # <<<<<<<<<<<<<< @@ -40187,7 +43450,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_v_ni = __pyx_t_6; __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":851 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":851 * res.append((i, alt, pathlen)) * ni = i + spanlen * if (ni < len(fwords) and (pathlen + 1) < self.max_initial_size): # <<<<<<<<<<<<<< @@ -40197,18 +43460,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_t_13 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_ni, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_ni, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_12) { __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_initial_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -40219,7 +43480,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py } if (__pyx_t_15) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":852 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":852 * ni = i + spanlen * if (ni < len(fwords) and (pathlen + 1) < self.max_initial_size): * for na in range(len(fwords[ni])): # <<<<<<<<<<<<<< @@ -40233,16 +43494,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_13; __pyx_t_16+=1) { __pyx_v_na = __pyx_t_16; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":853 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":853 * if (ni < len(fwords) and (pathlen + 1) < self.max_initial_size): * for na in range(len(fwords[ni])): * nf.append((toskip - 1, (ni, na, pathlen + 1))) # <<<<<<<<<<<<<< * if (len(nf) > 0): * return self.advance(nf, res, fwords) */ - if (unlikely(((PyObject *)__pyx_v_nf) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyNumber_Subtract(__pyx_v_toskip, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_na); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -40250,7 +43508,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_v_ni); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ni); __Pyx_GIVEREF(__pyx_v_ni); @@ -40261,7 +43519,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_10)); @@ -40271,27 +43529,24 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_t_17 = PyList_Append(__pyx_v_nf, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; } - goto __pyx_L13; + goto __pyx_L10; } - __pyx_L13:; + __pyx_L10:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":854 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":854 * for na in range(len(fwords[ni])): * nf.append((toskip - 1, (ni, na, pathlen + 1))) * if (len(nf) > 0): # <<<<<<<<<<<<<< * return self.advance(nf, res, fwords) * else: */ - if (unlikely(((PyObject *)__pyx_v_nf) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_nf)); + __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_nf)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = (__pyx_t_2 > 0); if (__pyx_t_15) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":855 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":855 * nf.append((toskip - 1, (ni, na, pathlen + 1))) * if (len(nf) > 0): * return self.advance(nf, res, fwords) # <<<<<<<<<<<<<< @@ -40299,10 +43554,10 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py * return res */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__advance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__advance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_nf)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_nf)); __Pyx_GIVEREF(((PyObject *)__pyx_v_nf)); @@ -40319,11 +43574,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_r = __pyx_t_10; __pyx_t_10 = 0; goto __pyx_L0; - goto __pyx_L16; + goto __pyx_L13; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":857 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":857 * return self.advance(nf, res, fwords) * else: * return res # <<<<<<<<<<<<<< @@ -40335,7 +43590,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py __pyx_r = __pyx_v_res; goto __pyx_L0; } - __pyx_L16:; + __pyx_L13:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -40363,16 +43618,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance(PyObject *__py return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":859 - * return res - * - * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): # <<<<<<<<<<<<<< - * cdef unsigned alt_it - * frontier = [] - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_skip = 0; PyObject *__pyx_v_i = 0; PyObject *__pyx_v_spanlen = 0; @@ -40380,39 +43628,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_next_states = 0; PyObject *__pyx_v_reachable_buffer = 0; - PyObject *__pyx_v_frontier = NULL; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_reachable = NULL; - PyObject *__pyx_v_nextreachable = NULL; - PyObject *__pyx_v_next_id = NULL; - PyObject *__pyx_v_jump = NULL; - Py_ssize_t __pyx_v_alt_id; - PyObject *__pyx_v_newel = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__skip,&__pyx_n_s__i,&__pyx_n_s__spanlen,&__pyx_n_s__pathlen,&__pyx_n_s__fwords,&__pyx_n_s__next_states,&__pyx_n_s__reachable_buffer,0}; - __Pyx_RefNannySetupContext("get_all_nodes_isteps_away"); + __Pyx_RefNannySetupContext("get_all_nodes_isteps_away (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__skip,&__pyx_n_s__i,&__pyx_n_s__spanlen,&__pyx_n_s__pathlen,&__pyx_n_s__fwords,&__pyx_n_s__next_states,&__pyx_n_s__reachable_buffer,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); @@ -40424,50 +43649,43 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__skip); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__skip)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__spanlen); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__spanlen)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pathlen); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pathlen)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__next_states); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__next_states)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reachable_buffer); - if (likely(values[6])) kw_args--; + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reachable_buffer)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_all_nodes_isteps_away") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_all_nodes_isteps_away") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -40496,8 +43714,50 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_skip, __pyx_v_i, __pyx_v_spanlen, __pyx_v_pathlen, __pyx_v_fwords, __pyx_v_next_states, __pyx_v_reachable_buffer); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":859 + * return res + * + * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): # <<<<<<<<<<<<<< + * cdef unsigned alt_it + * frontier = [] + */ - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":861 +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_skip, PyObject *__pyx_v_i, PyObject *__pyx_v_spanlen, PyObject *__pyx_v_pathlen, PyObject *__pyx_v_fwords, PyObject *__pyx_v_next_states, PyObject *__pyx_v_reachable_buffer) { + PyObject *__pyx_v_frontier = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_reachable = NULL; + PyObject *__pyx_v_nextreachable = NULL; + PyObject *__pyx_v_next_id = NULL; + PyObject *__pyx_v_jump = NULL; + PyObject *__pyx_v_alt_id = NULL; + PyObject *__pyx_v_newel = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_all_nodes_isteps_away", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":861 * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): * cdef unsigned alt_it * frontier = [] # <<<<<<<<<<<<<< @@ -40505,11 +43765,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a * return frontier */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_frontier = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":862 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":862 * cdef unsigned alt_it * frontier = [] * if (i+spanlen+skip >= len(next_states)): # <<<<<<<<<<<<<< @@ -40524,15 +43784,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __pyx_t_3 = PyObject_Length(__pyx_v_next_states); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":863 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":863 * frontier = [] * if (i+spanlen+skip >= len(next_states)): * return frontier # <<<<<<<<<<<<<< @@ -40543,11 +43802,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __Pyx_INCREF(((PyObject *)__pyx_v_frontier)); __pyx_r = ((PyObject *)__pyx_v_frontier); goto __pyx_L0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":864 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":864 * if (i+spanlen+skip >= len(next_states)): * return frontier * key = tuple([i,spanlen]) # <<<<<<<<<<<<<< @@ -40555,7 +43814,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a * if (key in reachable_buffer): */ __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); @@ -40568,7 +43827,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __pyx_v_key = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":865 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":865 * return frontier * key = tuple([i,spanlen]) * reachable = [] # <<<<<<<<<<<<<< @@ -40576,21 +43835,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a * reachable = reachable_buffer[key] */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_reachable = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":866 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":866 * key = tuple([i,spanlen]) * reachable = [] * if (key in reachable_buffer): # <<<<<<<<<<<<<< * reachable = reachable_buffer[key] * else: */ - __pyx_t_5 = ((PySequence_Contains(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_key), __pyx_v_reachable_buffer, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":867 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":867 * reachable = [] * if (key in reachable_buffer): * reachable = reachable_buffer[key] # <<<<<<<<<<<<<< @@ -40602,21 +43861,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __Pyx_DECREF(__pyx_v_reachable); __pyx_v_reachable = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L7; + goto __pyx_L4; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":869 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":869 * reachable = reachable_buffer[key] * else: * reachable = self.reachable(fwords, i, spanlen) # <<<<<<<<<<<<<< * reachable_buffer[key] = reachable * for nextreachable in reachable: */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reachable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reachable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fwords); __Pyx_GIVEREF(__pyx_v_fwords); @@ -40634,7 +43893,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __pyx_v_reachable = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":870 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":870 * else: * reachable = self.reachable(fwords, i, spanlen) * reachable_buffer[key] = reachable # <<<<<<<<<<<<<< @@ -40643,9 +43902,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a */ if (PyObject_SetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key), __pyx_v_reachable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L7:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":871 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":871 * reachable = self.reachable(fwords, i, spanlen) * reachable_buffer[key] = reachable * for nextreachable in reachable: # <<<<<<<<<<<<<< @@ -40661,12 +43920,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { + if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_4)) { @@ -40682,7 +43949,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __pyx_v_nextreachable = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":872 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":872 * reachable_buffer[key] = reachable * for nextreachable in reachable: * for next_id in next_states[nextreachable]: # <<<<<<<<<<<<<< @@ -40701,12 +43968,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_8(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -40722,17 +43997,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __pyx_v_next_id = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":873 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":873 * for nextreachable in reachable: * for next_id in next_states[nextreachable]: * jump = self.shortest(fwords,i,next_id) # <<<<<<<<<<<<<< * if jump < skip: * continue */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shortest); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shortest); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_fwords); __Pyx_GIVEREF(__pyx_v_fwords); @@ -40750,32 +44025,31 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __pyx_v_jump = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":874 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":874 * for next_id in next_states[nextreachable]: * jump = self.shortest(fwords,i,next_id) * if jump < skip: # <<<<<<<<<<<<<< * continue * if pathlen+jump <= self.max_initial_size: */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_jump, __pyx_v_skip, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_10 = PyObject_RichCompare(__pyx_v_jump, __pyx_v_skip, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":875 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":875 * jump = self.shortest(fwords,i,next_id) * if jump < skip: * continue # <<<<<<<<<<<<<< * if pathlen+jump <= self.max_initial_size: * for alt_id in range(len(fwords[next_id])): */ - goto __pyx_L10_continue; - goto __pyx_L12; + goto __pyx_L7_continue; + goto __pyx_L9; } - __pyx_L12:; + __pyx_L9:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":876 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":876 * if jump < skip: * continue * if pathlen+jump <= self.max_initial_size: # <<<<<<<<<<<<<< @@ -40784,17 +44058,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a */ __pyx_t_10 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_initial_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_10, __pyx_t_9, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_10, __pyx_t_9, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":877 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":877 * continue * if pathlen+jump <= self.max_initial_size: * for alt_id in range(len(fwords[next_id])): # <<<<<<<<<<<<<< @@ -40805,10 +44078,56 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __Pyx_GOTREF(__pyx_t_4); __pyx_t_11 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_alt_id = __pyx_t_12; + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_9 = __pyx_t_4; __Pyx_INCREF(__pyx_t_9); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = Py_TYPE(__pyx_t_9)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_9)) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_9, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_9)) { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_9, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_12(__pyx_t_9); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_alt_id); + __pyx_v_alt_id = __pyx_t_4; + __pyx_t_4 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":878 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":878 * if pathlen+jump <= self.max_initial_size: * for alt_id in range(len(fwords[next_id])): * if (fwords[next_id][alt_id][0] != EPSILON): # <<<<<<<<<<<<<< @@ -40817,102 +44136,95 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a */ __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_next_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_alt_id, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt_id); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_9, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_RichCompare(__pyx_t_4, __pyx_t_9, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = PyObject_RichCompare(__pyx_t_4, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":879 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":879 * for alt_id in range(len(fwords[next_id])): * if (fwords[next_id][alt_id][0] != EPSILON): * newel = (next_id,alt_id,pathlen+jump) # <<<<<<<<<<<<<< * if newel not in frontier: * frontier.append((next_id,alt_id,pathlen+jump)) */ - __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_alt_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(__pyx_v_next_id); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_next_id); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_next_id); __Pyx_GIVEREF(__pyx_v_next_id); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_10 = 0; - __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_v_alt_id); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_alt_id); + __Pyx_GIVEREF(__pyx_v_alt_id); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_newel)); - __pyx_v_newel = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_newel = __pyx_t_10; + __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":880 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":880 * if (fwords[next_id][alt_id][0] != EPSILON): * newel = (next_id,alt_id,pathlen+jump) * if newel not in frontier: # <<<<<<<<<<<<<< * frontier.append((next_id,alt_id,pathlen+jump)) * return frontier */ - __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_frontier), ((PyObject *)__pyx_v_newel)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_newel), ((PyObject *)__pyx_v_frontier), Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":881 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":881 * newel = (next_id,alt_id,pathlen+jump) * if newel not in frontier: * frontier.append((next_id,alt_id,pathlen+jump)) # <<<<<<<<<<<<<< * return frontier * */ - if (unlikely(((PyObject *)__pyx_v_frontier) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_alt_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __pyx_t_10 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); __Pyx_INCREF(__pyx_v_next_id); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_next_id); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_next_id); __Pyx_GIVEREF(__pyx_v_next_id); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_4 = 0; - __pyx_t_9 = 0; - __pyx_t_13 = PyList_Append(__pyx_v_frontier, ((PyObject *)__pyx_t_10)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - goto __pyx_L17; + __Pyx_INCREF(__pyx_v_alt_id); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_alt_id); + __Pyx_GIVEREF(__pyx_v_alt_id); + PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_14 = PyList_Append(__pyx_v_frontier, ((PyObject *)__pyx_t_13)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + goto __pyx_L14; } - __pyx_L17:; - goto __pyx_L16; + __pyx_L14:; + goto __pyx_L13; } - __pyx_L16:; + __pyx_L13:; } - goto __pyx_L13; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L10; } - __pyx_L13:; - __pyx_L10_continue:; + __pyx_L10:; + __pyx_L7_continue:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":882 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":882 * if newel not in frontier: * frontier.append((next_id,alt_id,pathlen+jump)) * return frontier # <<<<<<<<<<<<<< @@ -40932,6 +44244,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -40941,50 +44254,29 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_a __Pyx_XDECREF(__pyx_v_nextreachable); __Pyx_XDECREF(__pyx_v_next_id); __Pyx_XDECREF(__pyx_v_jump); + __Pyx_XDECREF(__pyx_v_alt_id); __Pyx_XDECREF(__pyx_v_newel); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":884 - * return frontier - * - * def reachable(self, fwords, ifrom, dist): # <<<<<<<<<<<<<< - * ret = [] - * if (ifrom >= len(fwords)): - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_ifrom = 0; PyObject *__pyx_v_dist = 0; - PyObject *__pyx_v_ret = NULL; - Py_ssize_t __pyx_v_alt_id; - PyObject *__pyx_v_ifromchild = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__dist,0}; - __Pyx_RefNannySetupContext("reachable"); + __Pyx_RefNannySetupContext("reachable (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__dist,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -40992,26 +44284,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dist); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dist)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reachable") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reachable") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -41032,8 +44321,42 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_dist); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":884 + * return frontier + * + * def reachable(self, fwords, ifrom, dist): # <<<<<<<<<<<<<< + * ret = [] + * if (ifrom >= len(fwords)): + */ + +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_dist) { + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_alt_id = NULL; + PyObject *__pyx_v_ifromchild = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("reachable", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":885 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":885 * * def reachable(self, fwords, ifrom, dist): * ret = [] # <<<<<<<<<<<<<< @@ -41041,11 +44364,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ * return ret */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_ret = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":886 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":886 * def reachable(self, fwords, ifrom, dist): * ret = [] * if (ifrom >= len(fwords)): # <<<<<<<<<<<<<< @@ -41055,14 +44378,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ __pyx_t_2 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":887 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":887 * ret = [] * if (ifrom >= len(fwords)): * return ret # <<<<<<<<<<<<<< @@ -41073,11 +44395,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ __Pyx_INCREF(((PyObject *)__pyx_v_ret)); __pyx_r = ((PyObject *)__pyx_v_ret); goto __pyx_L0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":888 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":888 * if (ifrom >= len(fwords)): * return ret * for alt_id in range(len(fwords[ifrom])): # <<<<<<<<<<<<<< @@ -41088,10 +44410,56 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) { - __pyx_v_alt_id = __pyx_t_5; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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_2 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_3 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF(__pyx_v_alt_id); + __pyx_v_alt_id = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":889 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":889 * return ret * for alt_id in range(len(fwords[ifrom])): * if (fwords[ifrom][alt_id][0] == EPSILON): # <<<<<<<<<<<<<< @@ -41100,169 +44468,172 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ */ __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_alt_id, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":890 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":890 * for alt_id in range(len(fwords[ifrom])): * if (fwords[ifrom][alt_id][0] == EPSILON): * ret.extend(self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist)) # <<<<<<<<<<<<<< * else: * if (dist==0): */ - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_ret), __pyx_n_s__extend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_ret), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reachable); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reachable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_alt_id, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fwords); __Pyx_GIVEREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_dist); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_dist); __Pyx_GIVEREF(__pyx_v_dist); - __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L9; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L6; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":892 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":892 * ret.extend(self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist)) * else: * if (dist==0): # <<<<<<<<<<<<<< * if (ifrom not in ret): * ret.append(ifrom) */ - __pyx_t_7 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":893 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":893 * else: * if (dist==0): * if (ifrom not in ret): # <<<<<<<<<<<<<< * ret.append(ifrom) * else: */ - __pyx_t_4 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_ret), __pyx_v_ifrom))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_ifrom, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":894 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":894 * if (dist==0): * if (ifrom not in ret): * ret.append(ifrom) # <<<<<<<<<<<<<< * else: * for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1): */ - if (unlikely(((PyObject *)__pyx_v_ret) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyList_Append(__pyx_v_ret, __pyx_v_ifrom); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L11; + __pyx_t_9 = PyList_Append(__pyx_v_ret, __pyx_v_ifrom); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L11:; - goto __pyx_L10; + __pyx_L8:; + goto __pyx_L7; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":896 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":896 * ret.append(ifrom) * else: * for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1): # <<<<<<<<<<<<<< * if (ifromchild not in ret): * ret.append(ifromchild) */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reachable); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reachable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_alt_id, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_v_dist, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fwords); __Pyx_GIVEREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_6 = 0; + __pyx_t_7 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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_9 = 0; - __pyx_t_10 = NULL; + __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0; + __pyx_t_11 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_6)) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_6)) { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { - __pyx_t_3 = __pyx_t_10(__pyx_t_1); + __pyx_t_3 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); @@ -41276,39 +44647,37 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ __pyx_v_ifromchild = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":897 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":897 * else: * for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1): * if (ifromchild not in ret): # <<<<<<<<<<<<<< * ret.append(ifromchild) * */ - __pyx_t_4 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_ret), __pyx_v_ifromchild))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_ifromchild, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":898 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":898 * for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1): * if (ifromchild not in ret): * ret.append(ifromchild) # <<<<<<<<<<<<<< * * return ret */ - if (unlikely(((PyObject *)__pyx_v_ret) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyList_Append(__pyx_v_ret, __pyx_v_ifromchild); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + __pyx_t_9 = PyList_Append(__pyx_v_ret, __pyx_v_ifromchild); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; } - __pyx_L14:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_L10:; + __pyx_L7:; } - __pyx_L9:; + __pyx_L6:; } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":900 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":900 * ret.append(ifromchild) * * return ret # <<<<<<<<<<<<<< @@ -41327,50 +44696,34 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable(PyObject *__ __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_alt_id); __Pyx_XDECREF(__pyx_v_ifromchild); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":902 - * return ret - * - * def shortest(self, fwords, ifrom, ito): # <<<<<<<<<<<<<< - * cdef unsigned alt_id - * min = 1000 - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_ifrom = 0; PyObject *__pyx_v_ito = 0; - unsigned int __pyx_v_alt_id; - PyObject *__pyx_v_min = NULL; - PyObject *__pyx_v_currmin = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - unsigned int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__ito,0}; - __Pyx_RefNannySetupContext("shortest"); + __Pyx_RefNannySetupContext("shortest (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__ito,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -41378,26 +44731,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ito); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ito)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "shortest") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shortest") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -41418,8 +44768,37 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_ito); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":902 + * return ret + * + * def shortest(self, fwords, ifrom, ito): # <<<<<<<<<<<<<< + * cdef unsigned alt_id + * min = 1000 + */ - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":904 +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_ito) { + unsigned int __pyx_v_alt_id; + PyObject *__pyx_v_min = NULL; + PyObject *__pyx_v_currmin = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + unsigned int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("shortest", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":904 * def shortest(self, fwords, ifrom, ito): * cdef unsigned alt_id * min = 1000 # <<<<<<<<<<<<<< @@ -41429,20 +44808,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __Pyx_INCREF(__pyx_int_1000); __pyx_v_min = __pyx_int_1000; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":905 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":905 * cdef unsigned alt_id * min = 1000 * if (ifrom > ito): # <<<<<<<<<<<<<< * return min * if (ifrom == ito): */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 905; __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[8]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":906 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":906 * min = 1000 * if (ifrom > ito): * return min # <<<<<<<<<<<<<< @@ -41453,24 +44831,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __Pyx_INCREF(__pyx_v_min); __pyx_r = __pyx_v_min; goto __pyx_L0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":907 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":907 * if (ifrom > ito): * return min * if (ifrom == ito): # <<<<<<<<<<<<<< * return 0 * for alt_id in range(len(fwords[ifrom])): */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 907; __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[8]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":908 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":908 * return min * if (ifrom == ito): * return 0 # <<<<<<<<<<<<<< @@ -41481,11 +44858,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __Pyx_INCREF(__pyx_int_0); __pyx_r = __pyx_int_0; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":909 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":909 * if (ifrom == ito): * return 0 * for alt_id in range(len(fwords[ifrom])): # <<<<<<<<<<<<<< @@ -41499,14 +44876,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_alt_id = __pyx_t_4; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":910 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":910 * return 0 * for alt_id in range(len(fwords[ifrom])): * currmin = self.shortest(fwords,ifrom+fwords[ifrom][alt_id][2],ito) # <<<<<<<<<<<<<< * if (fwords[ifrom][alt_id][0] != EPSILON): * currmin += 1 */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shortest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shortest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); @@ -41520,7 +44897,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fwords); __Pyx_GIVEREF(__pyx_v_fwords); @@ -41538,7 +44915,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __pyx_v_currmin = __pyx_t_6; __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":911 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":911 * for alt_id in range(len(fwords[ifrom])): * currmin = self.shortest(fwords,ifrom+fwords[ifrom][alt_id][2],ito) * if (fwords[ifrom][alt_id][0] != EPSILON): # <<<<<<<<<<<<<< @@ -41555,15 +44932,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":912 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":912 * currmin = self.shortest(fwords,ifrom+fwords[ifrom][alt_id][2],ito) * if (fwords[ifrom][alt_id][0] != EPSILON): * currmin += 1 # <<<<<<<<<<<<<< @@ -41575,24 +44951,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __Pyx_DECREF(__pyx_v_currmin); __pyx_v_currmin = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L10; + goto __pyx_L7; } - __pyx_L10:; + __pyx_L7:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":913 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":913 * if (fwords[ifrom][alt_id][0] != EPSILON): * currmin += 1 * if (currmin<min): # <<<<<<<<<<<<<< * min = currmin * return min */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_currmin, __pyx_v_min, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_currmin, __pyx_v_min, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __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[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":914 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":914 * currmin += 1 * if (currmin<min): * min = currmin # <<<<<<<<<<<<<< @@ -41602,12 +44977,12 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p __Pyx_INCREF(__pyx_v_currmin); __Pyx_DECREF(__pyx_v_min); __pyx_v_min = __pyx_v_currmin; - goto __pyx_L11; + goto __pyx_L8; } - __pyx_L11:; + __pyx_L8:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":915 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":915 * if (currmin<min): * min = currmin * return min # <<<<<<<<<<<<<< @@ -41635,49 +45010,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest(PyObject *__p return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":917 - * return min - * - * def get_next_states(self, _columns, curr_idx, min_dist=2): # <<<<<<<<<<<<<< - * result = [] - * candidate = [[curr_idx,0]] - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v__columns = 0; PyObject *__pyx_v_curr_idx = 0; PyObject *__pyx_v_min_dist = 0; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_candidate = NULL; - PyObject *__pyx_v_curr = NULL; - PyObject *__pyx_v_curr_col = NULL; - PyObject *__pyx_v_alt = NULL; - PyObject *__pyx_v_next_id = NULL; - PyObject *__pyx_v_jump = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - PyObject *__pyx_t_10 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___columns,&__pyx_n_s__curr_idx,&__pyx_n_s__min_dist,0}; - __Pyx_RefNannySetupContext("get_next_states"); + __Pyx_RefNannySetupContext("get_next_states (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___columns,&__pyx_n_s__curr_idx,&__pyx_n_s__min_dist,0}; PyObject* values[3] = {0,0,0}; values[2] = ((PyObject *)__pyx_int_2); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -41685,14 +45034,12 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___columns); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___columns)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curr_idx); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curr_idx)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -41703,7 +45050,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_next_states") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_next_states") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -41726,8 +45073,45 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v__columns, __pyx_v_curr_idx, __pyx_v_min_dist); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":918 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":917 + * return min + * + * def get_next_states(self, _columns, curr_idx, min_dist=2): # <<<<<<<<<<<<<< + * result = [] + * candidate = [[curr_idx,0]] + */ + +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v__columns, PyObject *__pyx_v_curr_idx, PyObject *__pyx_v_min_dist) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_candidate = NULL; + PyObject *__pyx_v_curr = NULL; + PyObject *__pyx_v_curr_col = NULL; + PyObject *__pyx_v_alt = NULL; + PyObject *__pyx_v_next_id = NULL; + PyObject *__pyx_v_jump = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_next_states", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":918 * * def get_next_states(self, _columns, curr_idx, min_dist=2): * result = [] # <<<<<<<<<<<<<< @@ -41735,11 +45119,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj * */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":919 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":919 * def get_next_states(self, _columns, curr_idx, min_dist=2): * result = [] * candidate = [[curr_idx,0]] # <<<<<<<<<<<<<< @@ -41747,7 +45131,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj * while len(candidate) > 0: */ __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_curr_idx); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_curr_idx); __Pyx_GIVEREF(__pyx_v_curr_idx); @@ -41755,14 +45139,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_candidate = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":921 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":921 * candidate = [[curr_idx,0]] * * while len(candidate) > 0: # <<<<<<<<<<<<<< @@ -41770,14 +45154,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj * if curr[0] >= len(_columns): */ while (1) { - if (unlikely(((PyObject *)__pyx_v_candidate) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidate)); + __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidate)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = (__pyx_t_3 > 0); if (!__pyx_t_4) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":922 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":922 * * while len(candidate) > 0: * curr = candidate.pop() # <<<<<<<<<<<<<< @@ -41790,7 +45171,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __pyx_v_curr = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":923 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":923 * while len(candidate) > 0: * curr = candidate.pop() * if curr[0] >= len(_columns): # <<<<<<<<<<<<<< @@ -41802,27 +45183,26 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __pyx_t_3 = PyObject_Length(__pyx_v__columns); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":924 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":924 * curr = candidate.pop() * if curr[0] >= len(_columns): * continue # <<<<<<<<<<<<<< * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: * result.append(curr[0]); */ - goto __pyx_L6_continue; - goto __pyx_L8; + goto __pyx_L3_continue; + goto __pyx_L5; } - __pyx_L8:; + __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":925 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":925 * if curr[0] >= len(_columns): * continue * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: # <<<<<<<<<<<<<< @@ -41831,19 +45211,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj */ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_result), __pyx_t_5))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_5, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_min_dist, __pyx_t_5, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_min_dist, __pyx_t_5, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { __Pyx_DECREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -41855,25 +45233,22 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":926 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":926 * continue * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: * result.append(curr[0]); # <<<<<<<<<<<<<< * curr_col = _columns[curr[0]] * for alt in curr_col: */ - if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L9; + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":927 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":927 * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: * result.append(curr[0]); * curr_col = _columns[curr[0]] # <<<<<<<<<<<<<< @@ -41889,7 +45264,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __pyx_v_curr_col = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":928 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":928 * result.append(curr[0]); * curr_col = _columns[curr[0]] * for alt in curr_col: # <<<<<<<<<<<<<< @@ -41905,12 +45280,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_5)) { + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_5)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; - } else if (PyTuple_CheckExact(__pyx_t_5)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_5)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_1 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_1)) { @@ -41926,7 +45309,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __pyx_v_alt = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":929 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":929 * curr_col = _columns[curr[0]] * for alt in curr_col: * next_id = curr[0]+alt[2] # <<<<<<<<<<<<<< @@ -41945,7 +45328,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __pyx_v_next_id = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":930 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":930 * for alt in curr_col: * next_id = curr[0]+alt[2] * jump = 1 # <<<<<<<<<<<<<< @@ -41956,7 +45339,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __Pyx_XDECREF(__pyx_v_jump); __pyx_v_jump = __pyx_int_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":931 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":931 * next_id = curr[0]+alt[2] * jump = 1 * if (alt[0] == EPSILON): # <<<<<<<<<<<<<< @@ -41967,15 +45350,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __Pyx_GOTREF(__pyx_t_10); __pyx_t_2 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_10, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_10, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":932 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":932 * jump = 1 * if (alt[0] == EPSILON): * jump = 0 # <<<<<<<<<<<<<< @@ -41985,32 +45367,30 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __Pyx_INCREF(__pyx_int_0); __Pyx_DECREF(__pyx_v_jump); __pyx_v_jump = __pyx_int_0; - goto __pyx_L12; + goto __pyx_L9; } - __pyx_L12:; + __pyx_L9:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":933 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":933 * if (alt[0] == EPSILON): * jump = 0 * if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1: # <<<<<<<<<<<<<< * candidate.append([next_id,curr[1]+jump]) * return sorted(result); */ - __pyx_t_7 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_v_result), __pyx_v_next_id))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_next_id, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_7) { __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_jump); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_min_dist, __pyx_t_2, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_min_dist, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { __Pyx_DECREF(__pyx_t_1); - __pyx_t_10 = PyInt_FromLong((((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)->max_initial_size + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong((__pyx_v_self->max_initial_size + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_10, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -42022,23 +45402,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj } if (__pyx_t_6) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":934 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":934 * jump = 0 * if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1: * candidate.append([next_id,curr[1]+jump]) # <<<<<<<<<<<<<< * return sorted(result); * */ - if (unlikely(((PyObject *)__pyx_v_candidate) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_jump); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_next_id); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_next_id); __Pyx_GIVEREF(__pyx_v_next_id); @@ -42047,15 +45424,15 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __pyx_t_2 = 0; __pyx_t_8 = PyList_Append(__pyx_v_candidate, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - goto __pyx_L13; + goto __pyx_L10; } - __pyx_L13:; + __pyx_L10:; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_L6_continue:; + __pyx_L3_continue:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":935 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":935 * if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1: * candidate.append([next_id,curr[1]+jump]) * return sorted(result); # <<<<<<<<<<<<<< @@ -42064,7 +45441,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj */ __Pyx_XDECREF(__pyx_r); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_result)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_result)); __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); @@ -42096,9 +45473,45 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states(PyObj __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __pyx_obj_3_sa___pyx_scope_struct_8_input *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_v_fwords); /*proto*/ +static char __pyx_doc_3_sa_23HieroCachingRuleFactory_22input[] = "When this function is called on the RuleFactory,\n it looks up all of the rules that can be used to translate\n the input sentence"; +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_v_fwords) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("input (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_22input(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_fwords)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_lambda1 = {__Pyx_NAMESTR("lambda1"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_lambda1, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1097 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_7lambda1_lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_7lambda1_lambda2 = {__Pyx_NAMESTR("lambda2"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_7lambda1_lambda2, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_7lambda1_lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1097 * if len(extracts) > 0: * fcount = Counter() * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) # <<<<<<<<<<<<<< @@ -42106,9 +45519,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * fcount[f] += count */ -static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_lambda_methdef_lambda2 = {__Pyx_NAMESTR("lambda2"), (PyCFunction)__pyx_lambda_funcdef_lambda2, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -42117,13 +45528,12 @@ static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, CYTHON_UNUSE int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lambda2"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("lambda2", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __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[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)((PyObject*)(&PyList_Type)))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyList_Type)))); __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyList_Type)))); @@ -42141,7 +45551,7 @@ static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, CYTHON_UNUSE __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.input.lambda1.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input.lambda1.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -42149,9 +45559,7 @@ static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, CYTHON_UNUSE return __pyx_r; } -static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_lambda_methdef_lambda1 = {__Pyx_NAMESTR("lambda1"), (PyCFunction)__pyx_lambda_funcdef_lambda1, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -42160,15 +45568,14 @@ static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, CYTHON_UNUSE int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lambda1"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("lambda1", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_lambda_methdef_lambda2, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_7lambda1_lambda2, 0, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __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[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; @@ -42186,7 +45593,7 @@ static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, CYTHON_UNUSE __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.input.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -42194,7 +45601,19 @@ static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, CYTHON_UNUSE return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1103 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_1lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ +static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_1lambda3 = {__Pyx_NAMESTR("lambda3"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_1lambda3, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_1lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self, ((PyObject *)__pyx_v_x)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1103 * for f, elist in fphrases.iteritems(): * for e, alslist in elist.iteritems(): * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) # <<<<<<<<<<<<<< @@ -42202,9 +45621,7 @@ static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, CYTHON_UNUSE * # count = len(locs) # Should be? */ -static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static PyMethodDef __pyx_lambda_methdef_lambda3 = {__Pyx_NAMESTR("lambda3"), (PyCFunction)__pyx_lambda_funcdef_lambda3, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x) { +static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -42212,8 +45629,7 @@ static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lambda3"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("lambda3", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -42229,7 +45645,7 @@ static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.input.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -42237,7 +45653,7 @@ static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":937 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":937 * return sorted(result); * * def input(self, fwords): # <<<<<<<<<<<<<< @@ -42245,40 +45661,48 @@ static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__ * it looks up all of the rules that can be used to translate */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_11input(PyObject *__pyx_v_self, PyObject *__pyx_v_fwords); /*proto*/ -static char __pyx_doc_3_sa_23HieroCachingRuleFactory_11input[] = "When this function is called on the RuleFactory,\n it looks up all of the rules that can be used to translate\n the input sentence"; -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_11input(PyObject *__pyx_v_self, PyObject *__pyx_v_fwords) { - struct __pyx_obj_3_sa___pyx_scope_struct_8_input *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords) { + struct __pyx_obj_3_sa___pyx_scope_struct_15_input *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("input"); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_8_input *)__pyx_ptype_3_sa___pyx_scope_struct_8_input->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_8_input, __pyx_empty_tuple, NULL); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("input", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_15_input *)__pyx_ptype_3_sa___pyx_scope_struct_15_input->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_15_input, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __Pyx_INCREF(__pyx_v_self); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF(__pyx_v_fwords); - __pyx_cur_scope->__pyx_v_fwords = __pyx_v_fwords; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_fwords = __pyx_v_fwords; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __pyx_obj_3_sa___pyx_scope_struct_8_input *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct_15_input *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_15_input *)__pyx_generator->closure); PyObject *__pyx_r = NULL; Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -42302,15 +45726,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p PyObject *(*__pyx_t_20)(PyObject *); float __pyx_t_21; Py_ssize_t __pyx_t_22; - PyObject *(*__pyx_t_23)(PyObject *); + Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - int __pyx_t_25; + Py_ssize_t __pyx_t_25; int __pyx_t_26; + int __pyx_t_27; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L64_resume_from_yield; + case 1: goto __pyx_L60_resume_from_yield; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; @@ -42318,7 +45743,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":948 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":948 * cdef Phrase hiero_phrase * * flen = len(fwords) # <<<<<<<<<<<<<< @@ -42328,7 +45753,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_1 = PyObject_Length(__pyx_cur_scope->__pyx_v_fwords); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_flen = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":949 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":949 * * flen = len(fwords) * start_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -42337,16 +45762,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_cur_scope->__pyx_v_start_time = __pyx_f_3_sa_monitor_cpu(); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":950 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":950 * flen = len(fwords) * start_time = monitor_cpu() * self.extract_time = 0.0 # <<<<<<<<<<<<<< * nodes_isteps_away_buffer = {} * hit = 0 */ - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->extract_time = 0.0; + __pyx_cur_scope->__pyx_v_self->extract_time = 0.0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":951 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":951 * start_time = monitor_cpu() * self.extract_time = 0.0 * nodes_isteps_away_buffer = {} # <<<<<<<<<<<<<< @@ -42359,7 +45784,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":952 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":952 * self.extract_time = 0.0 * nodes_isteps_away_buffer = {} * hit = 0 # <<<<<<<<<<<<<< @@ -42368,7 +45793,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_cur_scope->__pyx_v_hit = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":953 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":953 * nodes_isteps_away_buffer = {} * hit = 0 * reachable_buffer = {} # <<<<<<<<<<<<<< @@ -42381,7 +45806,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_reachable_buffer = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":956 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":956 * * # Do not cache between sentences * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< @@ -42394,16 +45819,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root); - __Pyx_DECREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root); - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root = __pyx_t_3; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->rules->root); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->rules->root); + __pyx_cur_scope->__pyx_v_self->rules->root = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":958 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":958 * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) * * frontier = [] # <<<<<<<<<<<<<< @@ -42411,12 +45836,12 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * for alt in range(0, len(fwords[i])): */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_cur_scope->__pyx_v_frontier = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":959 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":959 * * frontier = [] * for i in range(len(fwords)): # <<<<<<<<<<<<<< @@ -42427,7 +45852,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_4; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":960 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":960 * frontier = [] * for i in range(len(fwords)): * for alt in range(0, len(fwords[i])): # <<<<<<<<<<<<<< @@ -42441,7 +45866,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_cur_scope->__pyx_v_alt = __pyx_t_6; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":961 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":961 * for i in range(len(fwords)): * for alt in range(0, len(fwords[i])): * if fwords[i][alt][0] != EPSILON: # <<<<<<<<<<<<<< @@ -42458,24 +45883,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":962 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":962 * for alt in range(0, len(fwords[i])): * if fwords[i][alt][0] != EPSILON: * frontier.append((i, i, alt, 0, self.rules.root, (), False)) # <<<<<<<<<<<<<< * * xroot = None */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_frontier) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_7 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -42485,7 +45906,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_9 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); @@ -42495,9 +45916,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root); - PyTuple_SET_ITEM(__pyx_t_10, 4, ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root); - __Pyx_GIVEREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->rules->root); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_cur_scope->__pyx_v_self->rules->root); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->rules->root); __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); PyTuple_SET_ITEM(__pyx_t_10, 5, ((PyObject *)__pyx_empty_tuple)); __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); @@ -42515,7 +45936,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":964 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":964 * frontier.append((i, i, alt, 0, self.rules.root, (), False)) * * xroot = None # <<<<<<<<<<<<<< @@ -42526,16 +45947,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GIVEREF(Py_None); __pyx_cur_scope->__pyx_v_xroot = Py_None; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":965 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":965 * * xroot = None * x1 = sym_setindex(self.category, 1) # <<<<<<<<<<<<<< * if x1 in self.rules.root.children: * xroot = self.rules.root.children[x1] */ - __pyx_cur_scope->__pyx_v_x1 = __pyx_f_3_sa_sym_setindex(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->category, 1); + __pyx_cur_scope->__pyx_v_x1 = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":966 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":966 * xroot = None * x1 = sym_setindex(self.category, 1) * if x1 in self.rules.root.children: # <<<<<<<<<<<<<< @@ -42544,21 +45965,21 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyObject_GetAttr(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = ((PySequence_Contains(__pyx_t_9, __pyx_t_10))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = (__Pyx_PySequence_Contains(__pyx_t_10, __pyx_t_9, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":967 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":967 * x1 = sym_setindex(self.category, 1) * if x1 in self.rules.root.children: * xroot = self.rules.root.children[x1] # <<<<<<<<<<<<<< * else: * xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation()) */ - __pyx_t_9 = PyObject_GetAttr(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_9, __pyx_cur_scope->__pyx_v_x1, sizeof(int), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); @@ -42572,7 +45993,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":969 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":969 * xroot = self.rules.root.children[x1] * else: * xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< @@ -42581,12 +46002,12 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__suffix_link), ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_self->rules->root) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot); @@ -42595,21 +46016,21 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_xroot = __pyx_t_9; __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":970 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":970 * else: * xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation()) * self.rules.root.children[x1] = xroot # <<<<<<<<<<<<<< * * for i in range(self.min_gap_size, len(fwords)): */ - __pyx_t_9 = PyObject_GetAttr(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); if (__Pyx_SetItemInt(__pyx_t_9, __pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_xroot, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __pyx_L9:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":972 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":972 * self.rules.root.children[x1] = xroot * * for i in range(self.min_gap_size, len(fwords)): # <<<<<<<<<<<<<< @@ -42617,10 +46038,10 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * if fwords[i][alt][0] != EPSILON: */ __pyx_t_1 = PyObject_Length(__pyx_cur_scope->__pyx_v_fwords); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_t_4 = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->min_gap_size; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) { + for (__pyx_t_4 = __pyx_cur_scope->__pyx_v_self->min_gap_size; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_4; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":973 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":973 * * for i in range(self.min_gap_size, len(fwords)): * for alt in range(0, len(fwords[i])): # <<<<<<<<<<<<<< @@ -42634,7 +46055,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_cur_scope->__pyx_v_alt = __pyx_t_6; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":974 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":974 * for i in range(self.min_gap_size, len(fwords)): * for alt in range(0, len(fwords[i])): * if fwords[i][alt][0] != EPSILON: # <<<<<<<<<<<<<< @@ -42651,43 +46072,39 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":975 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":975 * for alt in range(0, len(fwords[i])): * if fwords[i][alt][0] != EPSILON: * frontier.append((i-self.min_gap_size, i, alt, self.min_gap_size, xroot, (x1,), True)) # <<<<<<<<<<<<<< * * next_states = [] */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_frontier) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_i - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->min_gap_size)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_self->min_gap_size)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->min_gap_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_GOTREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_13 = PyTuple_New(7); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10); @@ -42717,7 +46134,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":977 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":977 * frontier.append((i-self.min_gap_size, i, alt, self.min_gap_size, xroot, (x1,), True)) * * next_states = [] # <<<<<<<<<<<<<< @@ -42725,12 +46142,12 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) */ __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(((PyObject *)__pyx_t_13)); __pyx_cur_scope->__pyx_v_next_states = __pyx_t_13; __pyx_t_13 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":978 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":978 * * next_states = [] * for i in range(len(fwords)): # <<<<<<<<<<<<<< @@ -42741,24 +46158,21 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_4; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":979 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":979 * next_states = [] * for i in range(len(fwords)): * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) # <<<<<<<<<<<<<< * * while len(frontier) > 0: */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_next_states) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s__get_next_states); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_next_states); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_7 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->min_gap_size); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_fwords); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); @@ -42776,7 +46190,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":981 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":981 * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) * * while len(frontier) > 0: # <<<<<<<<<<<<<< @@ -42784,14 +46198,11 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * for k, i, alt, pathlen, node, prefix, is_shadow_path in frontier: */ while (1) { - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_frontier) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); + __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = (__pyx_t_1 > 0); if (!__pyx_t_8) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":982 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":982 * * while len(frontier) > 0: * new_frontier = [] # <<<<<<<<<<<<<< @@ -42799,35 +46210,42 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * word_id = fwords[i][alt][0] */ __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_GOTREF(__pyx_t_12); __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); __pyx_cur_scope->__pyx_v_new_frontier = __pyx_t_12; __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":983 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":983 * while len(frontier) > 0: * new_frontier = [] * for k, i, alt, pathlen, node, prefix, is_shadow_path in frontier: # <<<<<<<<<<<<<< * word_id = fwords[i][alt][0] * spanlen = fwords[i][alt][2] */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_frontier) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_12 = ((PyObject *)__pyx_cur_scope->__pyx_v_frontier); __Pyx_INCREF(__pyx_t_12); __pyx_t_1 = 0; for (;;) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_12)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_12, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 7)) { + if (size > 7) __Pyx_RaiseTooManyValuesError(7); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 7)) { - if (PyTuple_GET_SIZE(sequence) > 7) __Pyx_RaiseTooManyValuesError(7); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); @@ -42836,11 +46254,6 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_14 = PyTuple_GET_ITEM(sequence, 5); __pyx_t_15 = PyTuple_GET_ITEM(sequence, 6); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 7)) { - if (PyList_GET_SIZE(sequence) > 7) __Pyx_RaiseTooManyValuesError(7); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_13 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); __pyx_t_9 = PyList_GET_ITEM(sequence, 2); @@ -42856,34 +46269,36 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(__pyx_t_15); + #else + Py_ssize_t i; + PyObject** temps[7] = {&__pyx_t_13,&__pyx_t_7,&__pyx_t_9,&__pyx_t_10,&__pyx_t_3,&__pyx_t_14,&__pyx_t_15}; + for (i=0; i < 7; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + *(temps[i]) = item; + } + #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { + } else + { Py_ssize_t index = -1; + PyObject** temps[7] = {&__pyx_t_13,&__pyx_t_7,&__pyx_t_9,&__pyx_t_10,&__pyx_t_3,&__pyx_t_14,&__pyx_t_15}; __pyx_t_16 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext; - index = 0; __pyx_t_13 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_13)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_13); - index = 1; __pyx_t_7 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_7)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - index = 2; __pyx_t_9 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_9)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 3; __pyx_t_10 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_10)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 4; __pyx_t_3 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_3)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 5; __pyx_t_14 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_14)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - index = 6; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); + for (index=0; index < 7; index++) { + PyObject* item = __pyx_t_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L21_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 7) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; goto __pyx_L22_unpacking_done; __pyx_L21_unpacking_failed:; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L22_unpacking_done:; } @@ -42917,7 +46332,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_is_shadow_path = __pyx_t_15; __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":984 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":984 * new_frontier = [] * for k, i, alt, pathlen, node, prefix, is_shadow_path in frontier: * word_id = fwords[i][alt][0] # <<<<<<<<<<<<<< @@ -42938,7 +46353,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_word_id = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":985 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":985 * for k, i, alt, pathlen, node, prefix, is_shadow_path in frontier: * word_id = fwords[i][alt][0] * spanlen = fwords[i][alt][2] # <<<<<<<<<<<<<< @@ -42959,7 +46374,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":987 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":987 * spanlen = fwords[i][alt][2] * # TODO get rid of k -- pathlen is replacing it * if word_id == EPSILON: # <<<<<<<<<<<<<< @@ -42968,14 +46383,13 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_t_2 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); + __pyx_t_15 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":989 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":989 * if word_id == EPSILON: * # skipping because word_id is epsilon * if i+spanlen >= len(fwords): # <<<<<<<<<<<<<< @@ -42990,15 +46404,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_fwords); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_14 = PyObject_RichCompare(__pyx_t_2, __pyx_t_15, Py_GE); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_14 = PyObject_RichCompare(__pyx_t_2, __pyx_t_15, Py_GE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":990 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":990 * # skipping because word_id is epsilon * if i+spanlen >= len(fwords): * continue # <<<<<<<<<<<<<< @@ -43010,7 +46423,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L24:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":991 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":991 * if i+spanlen >= len(fwords): * continue * for nualt in range(0,len(fwords[i+spanlen])): # <<<<<<<<<<<<<< @@ -43030,16 +46443,13 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_5; __pyx_t_18+=1) { __pyx_cur_scope->__pyx_v_nualt = __pyx_t_18; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":992 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":992 * continue * for nualt in range(0,len(fwords[i+spanlen])): * frontier.append((k, i+spanlen, nualt, pathlen, node, prefix, is_shadow_path)) # <<<<<<<<<<<<<< * continue * */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_frontier) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_14 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -43050,7 +46460,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_nualt); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); @@ -43076,7 +46486,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":993 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":993 * for nualt in range(0,len(fwords[i+spanlen])): * frontier.append((k, i+spanlen, nualt, pathlen, node, prefix, is_shadow_path)) * continue # <<<<<<<<<<<<<< @@ -43088,7 +46498,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L23:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":995 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":995 * continue * * phrase = prefix + (word_id,) # <<<<<<<<<<<<<< @@ -43096,7 +46506,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * arity = hiero_phrase.arity() */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_word_id); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_word_id); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_word_id); @@ -43109,7 +46519,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_phrase = __pyx_t_15; __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":996 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":996 * * phrase = prefix + (word_id,) * hiero_phrase = Phrase(phrase) # <<<<<<<<<<<<<< @@ -43117,7 +46527,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * */ __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_phrase); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); @@ -43130,7 +46540,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_hiero_phrase = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":997 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":997 * phrase = prefix + (word_id,) * hiero_phrase = Phrase(phrase) * arity = hiero_phrase.arity() # <<<<<<<<<<<<<< @@ -43146,7 +46556,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_cur_scope->__pyx_v_arity = __pyx_t_18; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":999 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":999 * arity = hiero_phrase.arity() * * lookup_required = False # <<<<<<<<<<<<<< @@ -43155,7 +46565,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_cur_scope->__pyx_v_lookup_required = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1000 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1000 * * lookup_required = False * if word_id in node.children: # <<<<<<<<<<<<<< @@ -43164,11 +46574,11 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_t_15 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_8 = ((PySequence_Contains(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_15, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1001 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1001 * lookup_required = False * if word_id in node.children: * if node.children[word_id] is None: # <<<<<<<<<<<<<< @@ -43184,7 +46594,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1003 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1003 * if node.children[word_id] is None: * # Path dead-ends at this node * continue # <<<<<<<<<<<<<< @@ -43196,7 +46606,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1006 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1006 * else: * # Path continues at this node * node = node.children[word_id] # <<<<<<<<<<<<<< @@ -43219,7 +46629,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1008 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1008 * node = node.children[word_id] * else: * if node.suffix_link is None: # <<<<<<<<<<<<<< @@ -43232,7 +46642,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1010 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1010 * if node.suffix_link is None: * # Current node is root; lookup required * lookup_required = True # <<<<<<<<<<<<<< @@ -43244,7 +46654,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1012 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1012 * lookup_required = True * else: * if word_id in node.suffix_link.children: # <<<<<<<<<<<<<< @@ -43256,11 +46666,11 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_3 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_8 = ((PySequence_Contains(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1013 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1013 * else: * if word_id in node.suffix_link.children: * if node.suffix_link.children[word_id] is None: # <<<<<<<<<<<<<< @@ -43279,7 +46689,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1015 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1015 * if node.suffix_link.children[word_id] is None: * # Suffix link reports path is dead end * node.children[word_id] = None # <<<<<<<<<<<<<< @@ -43291,7 +46701,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p if (PyObject_SetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1016 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1016 * # Suffix link reports path is dead end * node.children[word_id] = None * continue # <<<<<<<<<<<<<< @@ -43303,7 +46713,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1019 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1019 * else: * # Suffix link indicates lookup is reqired * lookup_required = True # <<<<<<<<<<<<<< @@ -43317,7 +46727,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1022 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1022 * else: * #ERROR: We never get here * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< @@ -43336,7 +46746,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L27:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1024 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1024 * raise Exception("Keyword trie error") * # checking whether lookup_required * if lookup_required: # <<<<<<<<<<<<<< @@ -43345,7 +46755,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ if (__pyx_cur_scope->__pyx_v_lookup_required) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1025 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1025 * # checking whether lookup_required * if lookup_required: * new_node = None # <<<<<<<<<<<<<< @@ -43358,7 +46768,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GIVEREF(Py_None); __pyx_cur_scope->__pyx_v_new_node = Py_None; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1026 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1026 * if lookup_required: * new_node = None * if is_shadow_path: # <<<<<<<<<<<<<< @@ -43368,7 +46778,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1029 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1029 * # Extending shadow path * # on the shadow path we don't do any search, we just use info from suffix link * new_node = ExtendedTrieNode(phrase_location=node.suffix_link.children[word_id].phrase_location, # <<<<<<<<<<<<<< @@ -43391,7 +46801,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1030 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1030 * # on the shadow path we don't do any search, we just use info from suffix link * new_node = ExtendedTrieNode(phrase_location=node.suffix_link.children[word_id].phrase_location, * suffix_link=node.suffix_link.children[word_id], # <<<<<<<<<<<<<< @@ -43409,7 +46819,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1031 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1031 * new_node = ExtendedTrieNode(phrase_location=node.suffix_link.children[word_id].phrase_location, * suffix_link=node.suffix_link.children[word_id], * phrase=hiero_phrase) # <<<<<<<<<<<<<< @@ -43417,7 +46827,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * if arity > 0: */ if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); @@ -43429,7 +46839,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1033 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1033 * phrase=hiero_phrase) * else: * if arity > 0: # <<<<<<<<<<<<<< @@ -43439,7 +46849,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_8 = (__pyx_cur_scope->__pyx_v_arity > 0); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1035 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1035 * if arity > 0: * # Intersecting because of arity > 0 * phrase_location = self.intersect(node, node.suffix_link.children[word_id], hiero_phrase) # <<<<<<<<<<<<<< @@ -43454,7 +46864,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_2 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->__pyx_vtab)->intersect(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_node, __pyx_t_2, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->intersect(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_node, __pyx_t_2, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); @@ -43466,7 +46876,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1038 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1038 * else: * # Suffix array search * phrase_location = node.phrase_location # <<<<<<<<<<<<<< @@ -43482,14 +46892,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1039 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1039 * # Suffix array search * phrase_location = node.phrase_location * sa_range = self.fsa.lookup(sym_tostring(phrase[-1]), len(phrase)-1, phrase_location.sa_low, phrase_location.sa_high) # <<<<<<<<<<<<<< * if sa_range is not None: * phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->fsa), __pyx_n_s__lookup); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self->fsa), __pyx_n_s__lookup); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_phrase, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -43505,7 +46915,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_15); @@ -43528,7 +46938,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_sa_range = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1040 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1040 * phrase_location = node.phrase_location * sa_range = self.fsa.lookup(sym_tostring(phrase[-1]), len(phrase)-1, phrase_location.sa_low, phrase_location.sa_high) * if sa_range is not None: # <<<<<<<<<<<<<< @@ -43538,7 +46948,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_8 = (__pyx_cur_scope->__pyx_v_sa_range != Py_None); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1041 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1041 * sa_range = self.fsa.lookup(sym_tostring(phrase[-1]), len(phrase)-1, phrase_location.sa_low, phrase_location.sa_high) * if sa_range is not None: * phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) # <<<<<<<<<<<<<< @@ -43555,7 +46965,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GOTREF(__pyx_t_9); if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__sa_high), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); @@ -43567,7 +46977,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1043 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1043 * phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) * else: * phrase_location = None # <<<<<<<<<<<<<< @@ -43584,7 +46994,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L34:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1045 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1045 * phrase_location = None * * if phrase_location is None: # <<<<<<<<<<<<<< @@ -43594,7 +47004,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_8 = (((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location) == Py_None); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1046 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1046 * * if phrase_location is None: * node.children[word_id] = None # <<<<<<<<<<<<<< @@ -43606,7 +47016,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p if (PyObject_SetItem(__pyx_t_9, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1048 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1048 * node.children[word_id] = None * # Search failed * continue # <<<<<<<<<<<<<< @@ -43618,20 +47028,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L36:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1050 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1050 * continue * # Search succeeded * suffix_link = self.rules.root # <<<<<<<<<<<<<< * if node.suffix_link is not None: * suffix_link = node.suffix_link.children[word_id] */ - __Pyx_INCREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->rules->root); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_suffix_link); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_suffix_link); - __Pyx_GIVEREF(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root); - __pyx_cur_scope->__pyx_v_suffix_link = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->rules->root; + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->rules->root); + __pyx_cur_scope->__pyx_v_suffix_link = __pyx_cur_scope->__pyx_v_self->rules->root; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1051 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1051 * # Search succeeded * suffix_link = self.rules.root * if node.suffix_link is not None: # <<<<<<<<<<<<<< @@ -43644,7 +47054,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1052 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1052 * suffix_link = self.rules.root * if node.suffix_link is not None: * suffix_link = node.suffix_link.children[word_id] # <<<<<<<<<<<<<< @@ -43668,7 +47078,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L37:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1053 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1053 * if node.suffix_link is not None: * suffix_link = node.suffix_link.children[word_id] * new_node = ExtendedTrieNode(phrase_location=phrase_location, # <<<<<<<<<<<<<< @@ -43679,7 +47089,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GOTREF(((PyObject *)__pyx_t_9)); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__phrase_location), ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1054 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1054 * suffix_link = node.suffix_link.children[word_id] * new_node = ExtendedTrieNode(phrase_location=phrase_location, * suffix_link=suffix_link, # <<<<<<<<<<<<<< @@ -43688,7 +47098,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1055 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1055 * new_node = ExtendedTrieNode(phrase_location=phrase_location, * suffix_link=suffix_link, * phrase=hiero_phrase) # <<<<<<<<<<<<<< @@ -43696,7 +47106,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * node = new_node */ if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); @@ -43707,7 +47117,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L33:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1056 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1056 * suffix_link=suffix_link, * phrase=hiero_phrase) * node.children[word_id] = new_node # <<<<<<<<<<<<<< @@ -43719,7 +47129,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p if (PyObject_SetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id, __pyx_cur_scope->__pyx_v_new_node) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1057 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1057 * phrase=hiero_phrase) * node.children[word_id] = new_node * node = new_node # <<<<<<<<<<<<<< @@ -43732,17 +47142,17 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_node); __pyx_cur_scope->__pyx_v_node = __pyx_cur_scope->__pyx_v_new_node; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1062 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1062 * This should happen before we get to extraction (so that * the node will exist if needed)''' * if arity < self.max_nonterminals: # <<<<<<<<<<<<<< * xcat_index = arity+1 * xcat = sym_setindex(self.category, xcat_index) */ - __pyx_t_8 = (__pyx_cur_scope->__pyx_v_arity < ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->max_nonterminals); + __pyx_t_8 = (__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1063 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1063 * the node will exist if needed)''' * if arity < self.max_nonterminals: * xcat_index = arity+1 # <<<<<<<<<<<<<< @@ -43757,7 +47167,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_xcat_index = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1064 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1064 * if arity < self.max_nonterminals: * xcat_index = arity+1 * xcat = sym_setindex(self.category, xcat_index) # <<<<<<<<<<<<<< @@ -43765,9 +47175,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * if is_shadow_path: */ __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_xcat_index); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_cur_scope->__pyx_v_xcat = __pyx_f_3_sa_sym_setindex(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->category, __pyx_t_18); + __pyx_cur_scope->__pyx_v_xcat = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_18); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1065 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1065 * xcat_index = arity+1 * xcat = sym_setindex(self.category, xcat_index) * suffix_link_xcat_index = xcat_index # <<<<<<<<<<<<<< @@ -43780,7 +47190,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xcat_index); __pyx_cur_scope->__pyx_v_suffix_link_xcat_index = __pyx_cur_scope->__pyx_v_xcat_index; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1066 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1066 * xcat = sym_setindex(self.category, xcat_index) * suffix_link_xcat_index = xcat_index * if is_shadow_path: # <<<<<<<<<<<<<< @@ -43790,7 +47200,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1067 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1067 * suffix_link_xcat_index = xcat_index * if is_shadow_path: * suffix_link_xcat_index = xcat_index-1 # <<<<<<<<<<<<<< @@ -43808,7 +47218,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L39:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1068 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1068 * if is_shadow_path: * suffix_link_xcat_index = xcat_index-1 * suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index) # <<<<<<<<<<<<<< @@ -43816,9 +47226,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * suffix_link=node.suffix_link.children[suffix_link_xcat], */ __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_cur_scope->__pyx_v_suffix_link_xcat = __pyx_f_3_sa_sym_setindex(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->category, __pyx_t_18); + __pyx_cur_scope->__pyx_v_suffix_link_xcat = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_18); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1069 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1069 * suffix_link_xcat_index = xcat_index-1 * suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index) * node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, # <<<<<<<<<<<<<< @@ -43832,7 +47242,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1070 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1070 * suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index) * node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, * suffix_link=node.suffix_link.children[suffix_link_xcat], # <<<<<<<<<<<<<< @@ -43850,7 +47260,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1071 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1071 * node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, * suffix_link=node.suffix_link.children[suffix_link_xcat], * phrase= Phrase(phrase + (xcat,))) # <<<<<<<<<<<<<< @@ -43860,7 +47270,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; @@ -43868,7 +47278,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GOTREF(__pyx_t_9); __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[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; @@ -43877,11 +47287,11 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1069 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1069 * suffix_link_xcat_index = xcat_index-1 * suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index) * node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, # <<<<<<<<<<<<<< @@ -43897,7 +47307,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L38:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1074 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1074 * * # sample from range * if not is_shadow_path: # <<<<<<<<<<<<<< @@ -43908,19 +47318,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_19 = (!__pyx_t_8); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1075 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1075 * # sample from range * if not is_shadow_path: * sample = self.sampler.sample(node.phrase_location) # <<<<<<<<<<<<<< * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns * chunklen = IntList(initial_len=num_subpatterns) */ - __pyx_t_9 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->sampler), __pyx_n_s__sample); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s__sample); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; @@ -43935,7 +47345,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_sample = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1076 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1076 * if not is_shadow_path: * sample = self.sampler.sample(node.phrase_location) * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns # <<<<<<<<<<<<<< @@ -43947,7 +47357,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_num_subpatterns = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_10)->num_subpatterns; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1077 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1077 * sample = self.sampler.sample(node.phrase_location) * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns * chunklen = IntList(initial_len=num_subpatterns) # <<<<<<<<<<<<<< @@ -43960,7 +47370,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); @@ -43969,7 +47379,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_chunklen = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1078 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1078 * num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns * chunklen = IntList(initial_len=num_subpatterns) * for j from 0 <= j < num_subpatterns: # <<<<<<<<<<<<<< @@ -43979,7 +47389,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_18 = __pyx_cur_scope->__pyx_v_num_subpatterns; for (__pyx_cur_scope->__pyx_v_j = 0; __pyx_cur_scope->__pyx_v_j < __pyx_t_18; __pyx_cur_scope->__pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1079 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1079 * chunklen = IntList(initial_len=num_subpatterns) * for j from 0 <= j < num_subpatterns: * chunklen.arr[j] = hiero_phrase.chunklen(j) # <<<<<<<<<<<<<< @@ -43989,7 +47399,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p (__pyx_cur_scope->__pyx_v_chunklen->arr[__pyx_cur_scope->__pyx_v_j]) = ((struct __pyx_vtabstruct_3_sa_Phrase *)__pyx_cur_scope->__pyx_v_hiero_phrase->__pyx_vtab)->chunklen(__pyx_cur_scope->__pyx_v_hiero_phrase, __pyx_cur_scope->__pyx_v_j); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1080 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1080 * for j from 0 <= j < num_subpatterns: * chunklen.arr[j] = hiero_phrase.chunklen(j) * extracts = [] # <<<<<<<<<<<<<< @@ -43997,14 +47407,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * extract_start = monitor_cpu() */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_cur_scope->__pyx_v_extracts = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1081 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1081 * chunklen.arr[j] = hiero_phrase.chunklen(j) * extracts = [] * j = 0 # <<<<<<<<<<<<<< @@ -44013,7 +47423,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_cur_scope->__pyx_v_j = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1082 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1082 * extracts = [] * j = 0 * extract_start = monitor_cpu() # <<<<<<<<<<<<<< @@ -44028,7 +47438,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_extract_start = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1083 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1083 * j = 0 * extract_start = monitor_cpu() * while j < sample.len: # <<<<<<<<<<<<<< @@ -44039,7 +47449,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_19 = (__pyx_cur_scope->__pyx_v_j < __pyx_cur_scope->__pyx_v_sample->len); if (!__pyx_t_19) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1084 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1084 * extract_start = monitor_cpu() * while j < sample.len: * extract = [] # <<<<<<<<<<<<<< @@ -44047,23 +47457,23 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_cur_scope->__pyx_v_extract = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1086 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1086 * extract = [] * * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) # <<<<<<<<<<<<<< * loc = tuple(sample[j:j+num_subpatterns]) * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) */ - __pyx_f_3_sa_assign_matching((&__pyx_cur_scope->__pyx_v_matching), __pyx_cur_scope->__pyx_v_sample->arr, __pyx_cur_scope->__pyx_v_j, __pyx_cur_scope->__pyx_v_num_subpatterns, ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->fda->sent_id->arr); + __pyx_f_3_sa_assign_matching((&__pyx_cur_scope->__pyx_v_matching), __pyx_cur_scope->__pyx_v_sample->arr, __pyx_cur_scope->__pyx_v_j, __pyx_cur_scope->__pyx_v_num_subpatterns, __pyx_cur_scope->__pyx_v_self->fda->sent_id->arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1087 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1087 * * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) * loc = tuple(sample[j:j+num_subpatterns]) # <<<<<<<<<<<<<< @@ -44073,7 +47483,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_cur_scope->__pyx_v_sample), __pyx_cur_scope->__pyx_v_j, (__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_num_subpatterns)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -44086,14 +47496,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_loc = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1088 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1088 * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) * loc = tuple(sample[j:j+num_subpatterns]) * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) # <<<<<<<<<<<<<< * extracts.extend([(e, loc) for e in extract]) * j = j + num_subpatterns */ - __pyx_t_3 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->__pyx_vtab)->extract(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_hiero_phrase, (&__pyx_cur_scope->__pyx_v_matching), __pyx_cur_scope->__pyx_v_chunklen->arr, __pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->extract(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_hiero_phrase, (&__pyx_cur_scope->__pyx_v_matching), __pyx_cur_scope->__pyx_v_chunklen->arr, __pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_extract); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_extract); @@ -44101,7 +47511,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_extract = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1089 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1089 * loc = tuple(sample[j:j+num_subpatterns]) * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) * extracts.extend([(e, loc) for e in extract]) # <<<<<<<<<<<<<< @@ -44111,7 +47521,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_extracts), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_extract) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_extract)) { __pyx_t_9 = __pyx_cur_scope->__pyx_v_extract; __Pyx_INCREF(__pyx_t_9); __pyx_t_5 = 0; __pyx_t_20 = NULL; @@ -44121,12 +47531,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_20 = Py_TYPE(__pyx_t_9)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_9)) { + if (!__pyx_t_20 && PyList_CheckExact(__pyx_t_9)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_9)) break; - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_5); __Pyx_INCREF(__pyx_t_14); __pyx_t_5++; - } else if (PyTuple_CheckExact(__pyx_t_9)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_14 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_5); __Pyx_INCREF(__pyx_t_14); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_14 = PySequence_ITEM(__pyx_t_9, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_20 && PyTuple_CheckExact(__pyx_t_9)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_5); __Pyx_INCREF(__pyx_t_14); __pyx_t_5++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_5); __Pyx_INCREF(__pyx_t_14); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_14 = PySequence_ITEM(__pyx_t_9, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_14 = __pyx_t_20(__pyx_t_9); if (unlikely(!__pyx_t_14)) { @@ -44144,19 +47562,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_e = __pyx_t_14; __pyx_t_14 = 0; __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_cur_scope->__pyx_v_e); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_loc); PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_cur_scope->__pyx_v_loc); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_loc); - if (unlikely(PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_14))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_14))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(((PyObject *)__pyx_t_10)); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_10)); __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); @@ -44167,7 +47585,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1090 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1090 * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) * extracts.extend([(e, loc) for e in extract]) * j = j + num_subpatterns # <<<<<<<<<<<<<< @@ -44177,7 +47595,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_num_subpatterns); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1092 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1092 * j = j + num_subpatterns * * num_samples = sample.len/num_subpatterns # <<<<<<<<<<<<<< @@ -44194,7 +47612,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_cur_scope->__pyx_v_num_samples = __Pyx_div_int(__pyx_cur_scope->__pyx_v_sample->len, __pyx_cur_scope->__pyx_v_num_subpatterns); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1093 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1093 * * num_samples = sample.len/num_subpatterns * extract_stop = monitor_cpu() # <<<<<<<<<<<<<< @@ -44209,14 +47627,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_extract_stop = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1094 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1094 * num_samples = sample.len/num_subpatterns * extract_stop = monitor_cpu() * self.extract_time = self.extract_time + extract_stop - extract_start # <<<<<<<<<<<<<< * if len(extracts) > 0: * fcount = Counter() */ - __pyx_t_10 = PyFloat_FromDouble(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->extract_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_extract_stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); @@ -44224,25 +47642,22 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_10 = PyNumber_Subtract(__pyx_t_9, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_21 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __pyx_PyFloat_AsFloat(__pyx_t_10); if (unlikely((__pyx_t_21 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->extract_time = __pyx_t_21; + __pyx_cur_scope->__pyx_v_self->extract_time = __pyx_t_21; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1095 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1095 * extract_stop = monitor_cpu() * self.extract_time = self.extract_time + extract_stop - extract_start * if len(extracts) > 0: # <<<<<<<<<<<<<< * fcount = Counter() * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_extracts) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); + __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = (__pyx_t_5 > 0); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1096 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1096 * self.extract_time = self.extract_time + extract_stop - extract_start * if len(extracts) > 0: * fcount = Counter() # <<<<<<<<<<<<<< @@ -44260,7 +47675,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_fcount = __pyx_t_9; __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1097 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1097 * if len(extracts) > 0: * fcount = Counter() * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) # <<<<<<<<<<<<<< @@ -44269,10 +47684,10 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_lambda_methdef_lambda1, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_lambda1, 0, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; @@ -44286,43 +47701,50 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_fphrases = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1098 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1098 * fcount = Counter() * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) * for (f, e, count, als), loc in extracts: # <<<<<<<<<<<<<< * fcount[f] += count * fphrases[f][e][als].append(loc) */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_extracts) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_10 = ((PyObject *)__pyx_cur_scope->__pyx_v_extracts); __Pyx_INCREF(__pyx_t_10); __pyx_t_5 = 0; for (;;) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_10)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_10, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_9 = PyList_GET_ITEM(sequence, 0); __pyx_t_14 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_14); + #else + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_15 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); @@ -44333,33 +47755,35 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p index = 1; __pyx_t_14 = __pyx_t_17(__pyx_t_15); if (unlikely(!__pyx_t_14)) goto __pyx_L50_unpacking_failed; __Pyx_GOTREF(__pyx_t_14); if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; goto __pyx_L51_unpacking_done; __pyx_L50_unpacking_failed:; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L51_unpacking_done:; } if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { PyObject* sequence = __pyx_t_9; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) { - if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_13 = PyTuple_GET_ITEM(sequence, 3); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 4)) { - if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); __pyx_t_7 = PyList_GET_ITEM(sequence, 2); @@ -44369,28 +47793,36 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_13); + #else + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_15,&__pyx_t_2,&__pyx_t_7,&__pyx_t_13}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + *(temps[i]) = item; + } + #endif __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { + } else + { Py_ssize_t index = -1; + PyObject** temps[4] = {&__pyx_t_15,&__pyx_t_2,&__pyx_t_7,&__pyx_t_13}; __pyx_t_16 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext; - index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L52_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); - index = 1; __pyx_t_2 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_2)) goto __pyx_L52_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 2; __pyx_t_7 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_7)) goto __pyx_L52_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - index = 3; __pyx_t_13 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_13)) goto __pyx_L52_unpacking_failed; - __Pyx_GOTREF(__pyx_t_13); + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L52_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; goto __pyx_L53_unpacking_done; __pyx_L52_unpacking_failed:; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L53_unpacking_done:; } @@ -44420,7 +47852,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_loc = __pyx_t_14; __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1099 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1099 * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) * for (f, e, count, als), loc in extracts: * fcount[f] += count # <<<<<<<<<<<<<< @@ -44438,7 +47870,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1100 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1100 * for (f, e, count, als), loc in extracts: * fcount[f] += count * fphrases[f][e][als].append(loc) # <<<<<<<<<<<<<< @@ -44460,191 +47892,75 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1101 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1101 * fcount[f] += count * fphrases[f][e][als].append(loc) * for f, elist in fphrases.iteritems(): # <<<<<<<<<<<<<< * for e, alslist in elist.iteritems(): * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) */ - __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_fphrases, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) { - __pyx_t_10 = __pyx_t_9; __Pyx_INCREF(__pyx_t_10); __pyx_t_5 = 0; - __pyx_t_20 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_20 = Py_TYPE(__pyx_t_10)->tp_iternext; + __pyx_t_5 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_fphrases == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - for (;;) { - if (PyList_CheckExact(__pyx_t_10)) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_10)) break; - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++; - } else if (PyTuple_CheckExact(__pyx_t_10)) { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++; - } else { - __pyx_t_9 = __pyx_t_20(__pyx_t_10); - if (unlikely(!__pyx_t_9)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { - PyObject* sequence = __pyx_t_9; - if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_14 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_13)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_17(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L56_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_14 = __pyx_t_17(__pyx_t_13); if (unlikely(!__pyx_t_14)) goto __pyx_L56_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L57_unpacking_done; - __pyx_L56_unpacking_failed:; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L57_unpacking_done:; - } + __pyx_t_9 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_fphrases, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_22), (&__pyx_t_18)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __pyx_t_10 = __pyx_t_9; + __pyx_t_9 = 0; + while (1) { + __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_10, __pyx_t_22, &__pyx_t_5, &__pyx_t_9, &__pyx_t_3, NULL, __pyx_t_18); + if (unlikely(__pyx_t_6 == 0)) break; + if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_f = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_f = __pyx_t_9; + __pyx_t_9 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elist); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_elist); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_cur_scope->__pyx_v_elist = __pyx_t_14; - __pyx_t_14 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_elist = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1102 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1102 * fphrases[f][e][als].append(loc) * for f, elist in fphrases.iteritems(): * for e, alslist in elist.iteritems(): # <<<<<<<<<<<<<< * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) * locs = tuple(itertools.chain(alslist.itervalues())) */ - __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_elist, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_elist == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_9 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_elist, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_24), (&__pyx_t_6)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyList_CheckExact(__pyx_t_14) || PyTuple_CheckExact(__pyx_t_14)) { - __pyx_t_9 = __pyx_t_14; __Pyx_INCREF(__pyx_t_9); __pyx_t_22 = 0; - __pyx_t_23 = NULL; - } else { - __pyx_t_22 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_9; + __pyx_t_9 = 0; + while (1) { + __pyx_t_4 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_24, &__pyx_t_23, &__pyx_t_9, &__pyx_t_14, NULL, __pyx_t_6); + if (unlikely(__pyx_t_4 == 0)) break; + if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_23 = Py_TYPE(__pyx_t_9)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - for (;;) { - if (PyList_CheckExact(__pyx_t_9)) { - if (__pyx_t_22 >= PyList_GET_SIZE(__pyx_t_9)) break; - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_22); __Pyx_INCREF(__pyx_t_14); __pyx_t_22++; - } else if (PyTuple_CheckExact(__pyx_t_9)) { - if (__pyx_t_22 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_22); __Pyx_INCREF(__pyx_t_14); __pyx_t_22++; - } else { - __pyx_t_14 = __pyx_t_23(__pyx_t_9); - if (unlikely(!__pyx_t_14)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_14); - } - if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) { - PyObject* sequence = __pyx_t_14; - if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); - } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_13 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_7)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L60_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_13 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_13)) goto __pyx_L60_unpacking_failed; - __Pyx_GOTREF(__pyx_t_13); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L61_unpacking_done; - __pyx_L60_unpacking_failed:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L61_unpacking_done:; - } + __Pyx_GOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_e = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_e = __pyx_t_9; + __pyx_t_9 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alslist); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alslist); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_cur_scope->__pyx_v_alslist = __pyx_t_13; - __pyx_t_13 = 0; + __Pyx_GIVEREF(__pyx_t_14); + __pyx_cur_scope->__pyx_v_alslist = __pyx_t_14; + __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1103 * for f, elist in fphrases.iteritems(): * for e, alslist in elist.iteritems(): * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) # <<<<<<<<<<<<<< @@ -44653,156 +47969,163 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_t_14 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_alslist, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_9 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_13 = 0; - __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); - __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_lambda_methdef_lambda3, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__key), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_builtin_max, ((PyObject *)__pyx_t_14), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __pyx_t_13 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_1lambda3, 0, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__key), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_14), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_13))) || (PyList_CheckExact(__pyx_t_13))) { + PyObject* sequence = __pyx_t_13; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = PyList_GET_ITEM(sequence, 0); + __pyx_t_9 = PyList_GET_ITEM(sequence, 0); __pyx_t_14 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { + #else + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_7)->tp_iternext; - index = 0; __pyx_t_13 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_13)) goto __pyx_L62_unpacking_failed; - __Pyx_GOTREF(__pyx_t_13); - index = 1; __pyx_t_14 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_14)) goto __pyx_L62_unpacking_failed; + index = 0; __pyx_t_9 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_9)) goto __pyx_L58_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_14 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_14)) goto __pyx_L58_unpacking_failed; __Pyx_GOTREF(__pyx_t_14); if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L63_unpacking_done; - __pyx_L62_unpacking_failed:; + goto __pyx_L59_unpacking_done; + __pyx_L58_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L63_unpacking_done:; + __pyx_L59_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alignment); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_cur_scope->__pyx_v_alignment = __pyx_t_13; - __pyx_t_13 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_alignment = __pyx_t_9; + __pyx_t_9 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_max_locs); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_max_locs); __Pyx_GIVEREF(__pyx_t_14); __pyx_cur_scope->__pyx_v_max_locs = __pyx_t_14; __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1104 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1104 * for e, alslist in elist.iteritems(): * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) * locs = tuple(itertools.chain(alslist.itervalues())) # <<<<<<<<<<<<<< * # count = len(locs) # Should be? * count = len(max_locs) # Was */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__itertools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_14 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__chain); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__itertools); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__chain); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_alslist, __pyx_n_s__itervalues); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_alslist, __pyx_n_s__itervalues); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_cur_scope->__pyx_v_locs = ((PyObject*)__pyx_t_13); - __pyx_t_13 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_locs = ((PyObject*)__pyx_t_9); + __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1106 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1106 * locs = tuple(itertools.chain(alslist.itervalues())) * # count = len(locs) # Should be? * count = len(max_locs) # Was # <<<<<<<<<<<<<< * scores = self.scorer.score(FeatureContext( * f, e, count, fcount[f], num_samples, */ - __pyx_t_24 = PyObject_Length(__pyx_cur_scope->__pyx_v_max_locs); if (unlikely(__pyx_t_24 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_24); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_25 = PyObject_Length(__pyx_cur_scope->__pyx_v_max_locs); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_25); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_count); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_cur_scope->__pyx_v_count = __pyx_t_13; - __pyx_t_13 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_count = __pyx_t_9; + __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1107 * # count = len(locs) # Should be? * count = len(max_locs) # Was * scores = self.scorer.score(FeatureContext( # <<<<<<<<<<<<<< * f, e, count, fcount[f], num_samples, * (k,i+spanlen), locs, fwords, self.fda, self.eda */ - __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__FeatureContext); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__FeatureContext); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1108 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1108 * count = len(max_locs) # Was * scores = self.scorer.score(FeatureContext( * f, e, count, fcount[f], num_samples, # <<<<<<<<<<<<<< * (k,i+spanlen), locs, fwords, self.fda, self.eda * )) */ - __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); __pyx_t_14 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1109 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1109 * scores = self.scorer.score(FeatureContext( * f, e, count, fcount[f], num_samples, * (k,i+spanlen), locs, fwords, self.fda, self.eda # <<<<<<<<<<<<<< @@ -44817,7 +48140,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_15); @@ -44825,7 +48148,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_7 = 0; __pyx_t_15 = 0; __pyx_t_15 = PyTuple_New(10); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_f); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f); @@ -44835,8 +48158,8 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_INCREF(__pyx_cur_scope->__pyx_v_count); PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_cur_scope->__pyx_v_count); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_count); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 5, ((PyObject *)__pyx_t_2)); @@ -44847,20 +48170,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_15, 7, __pyx_cur_scope->__pyx_v_fwords); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->fda)); - PyTuple_SET_ITEM(__pyx_t_15, 8, ((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->fda)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->fda)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->eda)); - PyTuple_SET_ITEM(__pyx_t_15, 9, ((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->eda)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->eda)); - __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->fda)); + PyTuple_SET_ITEM(__pyx_t_15, 8, ((PyObject *)__pyx_cur_scope->__pyx_v_self->fda)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->fda)); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->eda)); + PyTuple_SET_ITEM(__pyx_t_15, 9, ((PyObject *)__pyx_cur_scope->__pyx_v_self->eda)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->eda)); + __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_Scorer *)((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->scorer->__pyx_vtab)->score(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->scorer, __pyx_t_2)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_Scorer *)__pyx_cur_scope->__pyx_v_self->scorer->__pyx_vtab)->score(__pyx_cur_scope->__pyx_v_self->scorer, __pyx_t_2)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); @@ -44869,17 +48192,17 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_t_15); __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1111 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1111 * (k,i+spanlen), locs, fwords, self.fda, self.eda * )) * yield Rule(self.category, f, e, scores, alignment) # <<<<<<<<<<<<<< * * if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size: */ - __pyx_t_15 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->category); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); @@ -44901,39 +48224,43 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_r = __pyx_t_15; __pyx_t_15 = 0; __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_5; - __Pyx_XGIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_9; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; + __pyx_cur_scope->__pyx_t_3 = __pyx_t_6; __Pyx_XGIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_t_3 = __pyx_t_10; + __pyx_cur_scope->__pyx_t_4 = __pyx_t_10; __Pyx_XGIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_t_4 = __pyx_t_12; - __pyx_cur_scope->__pyx_t_5 = __pyx_t_20; - __pyx_cur_scope->__pyx_t_6 = __pyx_t_22; - __pyx_cur_scope->__pyx_t_7 = __pyx_t_23; + __pyx_cur_scope->__pyx_t_5 = __pyx_t_12; + __pyx_cur_scope->__pyx_t_6 = __pyx_t_18; + __pyx_cur_scope->__pyx_t_7 = __pyx_t_22; + __pyx_cur_scope->__pyx_t_8 = __pyx_t_23; + __pyx_cur_scope->__pyx_t_9 = __pyx_t_24; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; - __pyx_L64_resume_from_yield:; + __pyx_L60_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_t_5 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_9 = __pyx_cur_scope->__pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = 0; - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_10 = __pyx_cur_scope->__pyx_t_3; - __pyx_cur_scope->__pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_t_10); - __pyx_t_12 = __pyx_cur_scope->__pyx_t_4; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_3); + __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_6 = __pyx_cur_scope->__pyx_t_3; + __pyx_t_10 = __pyx_cur_scope->__pyx_t_4; __pyx_cur_scope->__pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_t_10); + __pyx_t_12 = __pyx_cur_scope->__pyx_t_5; + __pyx_cur_scope->__pyx_t_5 = 0; __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_20 = __pyx_cur_scope->__pyx_t_5; - __pyx_t_22 = __pyx_cur_scope->__pyx_t_6; - __pyx_t_23 = __pyx_cur_scope->__pyx_t_7; + __pyx_t_18 = __pyx_cur_scope->__pyx_t_6; + __pyx_t_22 = __pyx_cur_scope->__pyx_t_7; + __pyx_t_23 = __pyx_cur_scope->__pyx_t_8; + __pyx_t_24 = __pyx_cur_scope->__pyx_t_9; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L47; @@ -44946,83 +48273,78 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } __pyx_L32:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1113 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1113 * yield Rule(self.category, f, e, scores, alignment) * * if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size: # <<<<<<<<<<<<<< * for alt_id in range(len(fwords[i+spanlen])): * new_frontier.append((k, i+spanlen, alt_id, pathlen + 1, node, phrase, is_shadow_path)) */ - __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_19 = (__pyx_t_5 < ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->max_length); + __pyx_t_22 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_22 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = (__pyx_t_22 < __pyx_cur_scope->__pyx_v_self->max_length); if (__pyx_t_19) { __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_fwords); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_22 = PyObject_Length(__pyx_cur_scope->__pyx_v_fwords); if (unlikely(__pyx_t_22 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_22); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_15 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_LT); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_15 = PyObject_RichCompare(__pyx_t_3, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_8) { __pyx_t_15 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->max_initial_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyObject_RichCompare(__pyx_t_15, __pyx_t_10, Py_LE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_15, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_25 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_25 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_26 = __pyx_t_25; + __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_27 = __pyx_t_26; } else { - __pyx_t_26 = __pyx_t_8; + __pyx_t_27 = __pyx_t_8; } - __pyx_t_8 = __pyx_t_26; + __pyx_t_8 = __pyx_t_27; } else { __pyx_t_8 = __pyx_t_19; } if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1114 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1114 * * if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size: * for alt_id in range(len(fwords[i+spanlen])): # <<<<<<<<<<<<<< * new_frontier.append((k, i+spanlen, alt_id, pathlen + 1, node, phrase, is_shadow_path)) * num_subpatterns = arity */ - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = PyNumber_Add(__pyx_t_3, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_10); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_10); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_5 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_5; __pyx_t_18+=1) { + __pyx_t_22 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_22 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_22; __pyx_t_18+=1) { __pyx_cur_scope->__pyx_v_alt_id = __pyx_t_18; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1115 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1115 * if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size: * for alt_id in range(len(fwords[i+spanlen])): * new_frontier.append((k, i+spanlen, alt_id, pathlen + 1, node, phrase, is_shadow_path)) # <<<<<<<<<<<<<< * num_subpatterns = arity * if not is_shadow_path: */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_15 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -45032,34 +48354,34 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GOTREF(__pyx_t_10); __pyx_t_2 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = PyTuple_New(7); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_15); + __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_node); - PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_cur_scope->__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_cur_scope->__pyx_v_node); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_node); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); - PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_cur_scope->__pyx_v_phrase); + PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_cur_scope->__pyx_v_phrase); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - PyTuple_SET_ITEM(__pyx_t_13, 6, __pyx_cur_scope->__pyx_v_is_shadow_path); + PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_cur_scope->__pyx_v_is_shadow_path); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - __pyx_t_9 = 0; + __pyx_t_3 = 0; __pyx_t_15 = 0; __pyx_t_10 = 0; __pyx_t_2 = 0; - __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_13)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1116 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1116 * for alt_id in range(len(fwords[i+spanlen])): * new_frontier.append((k, i+spanlen, alt_id, pathlen + 1, node, phrase, is_shadow_path)) * num_subpatterns = arity # <<<<<<<<<<<<<< @@ -45068,7 +48390,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ __pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_cur_scope->__pyx_v_arity; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1117 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1117 * new_frontier.append((k, i+spanlen, alt_id, pathlen + 1, node, phrase, is_shadow_path)) * num_subpatterns = arity * if not is_shadow_path: # <<<<<<<<<<<<<< @@ -45079,7 +48401,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_19 = (!__pyx_t_8); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1118 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1118 * num_subpatterns = arity * if not is_shadow_path: * num_subpatterns = num_subpatterns + 1 # <<<<<<<<<<<<<< @@ -45087,77 +48409,77 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * xcat = sym_setindex(self.category, arity+1) */ __pyx_cur_scope->__pyx_v_num_subpatterns = (__pyx_cur_scope->__pyx_v_num_subpatterns + 1); - goto __pyx_L68; + goto __pyx_L64; } - __pyx_L68:; + __pyx_L64:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1119 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1119 * if not is_shadow_path: * num_subpatterns = num_subpatterns + 1 * if len(phrase)+1 < self.max_length and arity < self.max_nonterminals and num_subpatterns < self.max_chunks: # <<<<<<<<<<<<<< * xcat = sym_setindex(self.category, arity+1) * xnode = node.children[xcat] */ - __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_19 = ((__pyx_t_5 + 1) < ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->max_length); + __pyx_t_22 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_22 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = ((__pyx_t_22 + 1) < __pyx_cur_scope->__pyx_v_self->max_length); if (__pyx_t_19) { - __pyx_t_8 = (__pyx_cur_scope->__pyx_v_arity < ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->max_nonterminals); + __pyx_t_8 = (__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals); if (__pyx_t_8) { - __pyx_t_26 = (__pyx_cur_scope->__pyx_v_num_subpatterns < ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->max_chunks); - __pyx_t_25 = __pyx_t_26; + __pyx_t_27 = (__pyx_cur_scope->__pyx_v_num_subpatterns < __pyx_cur_scope->__pyx_v_self->max_chunks); + __pyx_t_26 = __pyx_t_27; } else { - __pyx_t_25 = __pyx_t_8; + __pyx_t_26 = __pyx_t_8; } - __pyx_t_8 = __pyx_t_25; + __pyx_t_8 = __pyx_t_26; } else { __pyx_t_8 = __pyx_t_19; } if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1120 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1120 * num_subpatterns = num_subpatterns + 1 * if len(phrase)+1 < self.max_length and arity < self.max_nonterminals and num_subpatterns < self.max_chunks: * xcat = sym_setindex(self.category, arity+1) # <<<<<<<<<<<<<< * xnode = node.children[xcat] * # I put spanlen=1 below */ - __pyx_cur_scope->__pyx_v_xcat = __pyx_f_3_sa_sym_setindex(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->category, (__pyx_cur_scope->__pyx_v_arity + 1)); + __pyx_cur_scope->__pyx_v_xcat = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, (__pyx_cur_scope->__pyx_v_arity + 1)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1121 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1121 * if len(phrase)+1 < self.max_length and arity < self.max_nonterminals and num_subpatterns < self.max_chunks: * xcat = sym_setindex(self.category, arity+1) * xnode = node.children[xcat] # <<<<<<<<<<<<<< * # I put spanlen=1 below * key = tuple([self.min_gap_size, i, 1, pathlen]) */ - __pyx_t_13 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_13, __pyx_cur_scope->__pyx_v_xcat, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, __pyx_cur_scope->__pyx_v_xcat, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xnode); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xnode); __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_xnode = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1123 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1123 * xnode = node.children[xcat] * # I put spanlen=1 below * key = tuple([self.min_gap_size, i, 1, pathlen]) # <<<<<<<<<<<<<< * frontier_nodes = [] * if (key in nodes_isteps_away_buffer): */ - __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->min_gap_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyList_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); + PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); __Pyx_INCREF(__pyx_int_1); PyList_SET_ITEM(__pyx_t_10, 2, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -45165,77 +48487,74 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p PyList_SET_ITEM(__pyx_t_10, 3, __pyx_cur_scope->__pyx_v_pathlen); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen); __pyx_t_2 = 0; - __pyx_t_13 = 0; - __pyx_t_13 = ((PyObject *)PyList_AsTuple(__pyx_t_10)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __pyx_t_9 = 0; + __pyx_t_9 = ((PyObject *)PyList_AsTuple(__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_13)); - __pyx_cur_scope->__pyx_v_key = __pyx_t_13; - __pyx_t_13 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_cur_scope->__pyx_v_key = __pyx_t_9; + __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1124 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1124 * # I put spanlen=1 below * key = tuple([self.min_gap_size, i, 1, pathlen]) * frontier_nodes = [] # <<<<<<<<<<<<<< * if (key in nodes_isteps_away_buffer): * frontier_nodes = nodes_isteps_away_buffer[key] */ - __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_GIVEREF(((PyObject *)__pyx_t_13)); - __pyx_cur_scope->__pyx_v_frontier_nodes = ((PyObject *)__pyx_t_13); - __pyx_t_13 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_cur_scope->__pyx_v_frontier_nodes = ((PyObject *)__pyx_t_9); + __pyx_t_9 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1125 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1125 * key = tuple([self.min_gap_size, i, 1, pathlen]) * frontier_nodes = [] * if (key in nodes_isteps_away_buffer): # <<<<<<<<<<<<<< * frontier_nodes = nodes_isteps_away_buffer[key] * else: */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = ((PyDict_Contains(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_cur_scope->__pyx_v_key), ((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), Py_EQ)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1126 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1126 * frontier_nodes = [] * if (key in nodes_isteps_away_buffer): * frontier_nodes = nodes_isteps_away_buffer[key] # <<<<<<<<<<<<<< * else: * frontier_nodes = self.get_all_nodes_isteps_away(self.min_gap_size, i, 1, pathlen, fwords, next_states, reachable_buffer) */ - __pyx_t_13 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_13; - __pyx_t_13 = 0; - goto __pyx_L70; + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L66; } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1128 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1128 * frontier_nodes = nodes_isteps_away_buffer[key] * else: * frontier_nodes = self.get_all_nodes_isteps_away(self.min_gap_size, i, 1, pathlen, fwords, next_states, reachable_buffer) # <<<<<<<<<<<<<< * nodes_isteps_away_buffer[key] = frontier_nodes * */ - __pyx_t_13 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_124); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_10 = PyInt_FromLong(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->min_gap_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_124); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_15 = PyTuple_New(7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2); @@ -45257,9 +48576,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); __pyx_t_10 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); @@ -45267,7 +48586,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1129 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1129 * else: * frontier_nodes = self.get_all_nodes_isteps_away(self.min_gap_size, i, 1, pathlen, fwords, next_states, reachable_buffer) * nodes_isteps_away_buffer[key] = frontier_nodes # <<<<<<<<<<<<<< @@ -45276,9 +48595,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p */ if (PyDict_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key), __pyx_cur_scope->__pyx_v_frontier_nodes) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L70:; + __pyx_L66:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1131 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1131 * nodes_isteps_away_buffer[key] = frontier_nodes * * for (i, alt, pathlen) in frontier_nodes: # <<<<<<<<<<<<<< @@ -45286,20 +48605,28 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * frontier = new_frontier */ if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_frontier_nodes) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_frontier_nodes)) { - __pyx_t_2 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; + __pyx_t_2 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_2); __pyx_t_22 = 0; __pyx_t_20 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_22 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_20 = Py_TYPE(__pyx_t_2)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_15 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_15); __pyx_t_5++; - } else if (PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_15); __pyx_t_5++; + if (!__pyx_t_20 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_22 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_15 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_22); __Pyx_INCREF(__pyx_t_15); __pyx_t_22++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_15 = PySequence_ITEM(__pyx_t_2, __pyx_t_22); __pyx_t_22++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_20 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_22 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_22); __Pyx_INCREF(__pyx_t_15); __pyx_t_22++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_15 = PySequence_ITEM(__pyx_t_2, __pyx_t_22); __pyx_t_22++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_15 = __pyx_t_20(__pyx_t_2); if (unlikely(!__pyx_t_15)) { @@ -45313,95 +48640,100 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p } if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) { PyObject* sequence = __pyx_t_15; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = PyList_GET_ITEM(sequence, 0); + __pyx_t_9 = PyList_GET_ITEM(sequence, 0); __pyx_t_10 = PyList_GET_ITEM(sequence, 1); - __pyx_t_9 = PyList_GET_ITEM(sequence, 2); + __pyx_t_3 = PyList_GET_ITEM(sequence, 2); } - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_14)->tp_iternext; - index = 0; __pyx_t_13 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L73_unpacking_failed; - __Pyx_GOTREF(__pyx_t_13); - index = 1; __pyx_t_10 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_10)) goto __pyx_L73_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 2; __pyx_t_9 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_9)) goto __pyx_L73_unpacking_failed; + index = 0; __pyx_t_9 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_9)) goto __pyx_L69_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_10 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_10)) goto __pyx_L69_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + index = 2; __pyx_t_3 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L69_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_14), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L74_unpacking_done; - __pyx_L73_unpacking_failed:; + goto __pyx_L70_unpacking_done; + __pyx_L69_unpacking_failed:; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L74_unpacking_done:; + __pyx_L70_unpacking_done:; } - __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_t_13); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_cur_scope->__pyx_v_i = __pyx_t_18; __pyx_cur_scope->__pyx_v_alt = __pyx_t_6; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pathlen); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_pathlen); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_9; - __pyx_t_9 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1132 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1132 * * for (i, alt, pathlen) in frontier_nodes: * new_frontier.append((k, i, alt, pathlen, xnode, phrase +(xcat,), is_shadow_path)) # <<<<<<<<<<<<<< * frontier = new_frontier * */ - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_9 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_13 = 0; - __pyx_t_13 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __pyx_t_14 = PyTuple_New(7); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_GOTREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); @@ -45410,30 +48742,30 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_INCREF(__pyx_cur_scope->__pyx_v_xnode); PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_cur_scope->__pyx_v_xnode); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xnode); - PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path); PyTuple_SET_ITEM(__pyx_t_14, 6, __pyx_cur_scope->__pyx_v_is_shadow_path); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path); __pyx_t_15 = 0; - __pyx_t_9 = 0; + __pyx_t_3 = 0; __pyx_t_10 = 0; - __pyx_t_13 = 0; + __pyx_t_9 = 0; __pyx_t_11 = PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_14)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L69; + goto __pyx_L65; } - __pyx_L69:; - goto __pyx_L65; + __pyx_L65:; + goto __pyx_L61; } - __pyx_L65:; + __pyx_L61:; __pyx_L19_continue:; } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1133 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1133 * for (i, alt, pathlen) in frontier_nodes: * new_frontier.append((k, i, alt, pathlen, xnode, phrase +(xcat,), is_shadow_path)) * frontier = new_frontier # <<<<<<<<<<<<<< @@ -45447,7 +48779,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_frontier = __pyx_cur_scope->__pyx_v_new_frontier; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1135 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1135 * frontier = new_frontier * * stop_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -45460,7 +48792,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_cur_scope->__pyx_v_stop_time = __pyx_t_12; __pyx_t_12 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1136 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1136 * * stop_time = monitor_cpu() * logger.info("Total time for rule lookup, extraction, and scoring = %f seconds", (stop_time - start_time)) # <<<<<<<<<<<<<< @@ -45478,7 +48810,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(((PyObject *)__pyx_kp_s_125)); PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_kp_s_125)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_125)); @@ -45491,7 +48823,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1137 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1137 * stop_time = monitor_cpu() * logger.info("Total time for rule lookup, extraction, and scoring = %f seconds", (stop_time - start_time)) * gc.collect() # <<<<<<<<<<<<<< @@ -45508,7 +48840,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1138 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1138 * logger.info("Total time for rule lookup, extraction, and scoring = %f seconds", (stop_time - start_time)) * gc.collect() * logger.info(" Extract time = %f seconds", self.extract_time) # <<<<<<<<<<<<<< @@ -45520,10 +48852,10 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __pyx_t_12 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyFloat_FromDouble(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self)->extract_time); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_126)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_126)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_126)); @@ -45535,7 +48867,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); @@ -45551,12 +48883,13 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p __Pyx_AddTraceback("input", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1141 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1141 * * * cdef int find_fixpoint(self, # <<<<<<<<<<<<<< @@ -45564,7 +48897,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_12generator4(struct __p * int* f_links_low, int* f_links_high, */ -static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_f_low, PyObject *__pyx_v_f_high, int *__pyx_v_f_links_low, int *__pyx_v_f_links_high, int *__pyx_v_e_links_low, int *__pyx_v_e_links_high, int __pyx_v_e_in_low, int __pyx_v_e_in_high, int *__pyx_v_e_low, int *__pyx_v_e_high, int *__pyx_v_f_back_low, int *__pyx_v_f_back_high, int __pyx_v_f_sent_len, int __pyx_v_e_sent_len, int __pyx_v_max_f_len, int __pyx_v_max_e_len, int __pyx_v_min_fx_size, int __pyx_v_min_ex_size, int __pyx_v_max_new_x, int __pyx_v_allow_low_x, int __pyx_v_allow_high_x, int __pyx_v_allow_arbitrary_x, int __pyx_v_write_log) { +static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_f_low, PyObject *__pyx_v_f_high, int *__pyx_v_f_links_low, int *__pyx_v_f_links_high, int *__pyx_v_e_links_low, int *__pyx_v_e_links_high, int __pyx_v_e_in_low, int __pyx_v_e_in_high, int *__pyx_v_e_low, int *__pyx_v_e_high, int *__pyx_v_f_back_low, int *__pyx_v_f_back_high, int __pyx_v_f_sent_len, int __pyx_v_e_sent_len, int __pyx_v_max_f_len, int __pyx_v_max_e_len, int __pyx_v_min_fx_size, int __pyx_v_min_ex_size, int __pyx_v_max_new_x, int __pyx_v_allow_low_x, int __pyx_v_allow_high_x, int __pyx_v_allow_arbitrary_x, CYTHON_UNUSED int __pyx_v_write_log) { int __pyx_v_e_low_prev; int __pyx_v_e_high_prev; int __pyx_v_f_low_prev; @@ -45584,9 +48917,9 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("find_fixpoint"); + __Pyx_RefNannySetupContext("find_fixpoint", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1156 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1156 * cdef int e_low_prev, e_high_prev, f_low_prev, f_high_prev, new_x, new_low_x, new_high_x * * e_low[0] = e_in_low # <<<<<<<<<<<<<< @@ -45595,7 +48928,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_e_low[0]) = __pyx_v_e_in_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1157 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1157 * * e_low[0] = e_in_low * e_high[0] = e_in_high # <<<<<<<<<<<<<< @@ -45604,7 +48937,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_e_high[0]) = __pyx_v_e_in_high; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1158 * e_low[0] = e_in_low * e_high[0] = e_in_high * self.find_projection(f_low, f_high, f_links_low, f_links_high, e_low, e_high) # <<<<<<<<<<<<<< @@ -45616,7 +48949,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1159 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1159 * e_high[0] = e_in_high * self.find_projection(f_low, f_high, f_links_low, f_links_high, e_low, e_high) * if e_low[0] == -1: # <<<<<<<<<<<<<< @@ -45626,7 +48959,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_3 = ((__pyx_v_e_low[0]) == -1); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1165 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1165 * # rule X -> X_1 w X_2 / X_1 X_2. This is probably * # not worth the bother, though. * return 0 # <<<<<<<<<<<<<< @@ -45638,7 +48971,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj goto __pyx_L3; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1166 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1166 * # not worth the bother, though. * return 0 * elif e_in_low != -1 and e_low[0] != e_in_low: # <<<<<<<<<<<<<< @@ -45654,7 +48987,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1167 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1167 * return 0 * elif e_in_low != -1 and e_low[0] != e_in_low: * if e_in_low - e_low[0] < min_ex_size: # <<<<<<<<<<<<<< @@ -45664,7 +48997,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_5 = ((__pyx_v_e_in_low - (__pyx_v_e_low[0])) < __pyx_v_min_ex_size); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1168 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1168 * elif e_in_low != -1 and e_low[0] != e_in_low: * if e_in_low - e_low[0] < min_ex_size: * e_low[0] = e_in_low - min_ex_size # <<<<<<<<<<<<<< @@ -45673,7 +49006,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_e_low[0]) = (__pyx_v_e_in_low - __pyx_v_min_ex_size); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1169 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1169 * if e_in_low - e_low[0] < min_ex_size: * e_low[0] = e_in_low - min_ex_size * if e_low[0] < 0: # <<<<<<<<<<<<<< @@ -45683,7 +49016,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_5 = ((__pyx_v_e_low[0]) < 0); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1170 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1170 * e_low[0] = e_in_low - min_ex_size * if e_low[0] < 0: * return 0 # <<<<<<<<<<<<<< @@ -45702,7 +49035,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1172 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1172 * return 0 * * if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<< @@ -45712,7 +49045,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_5 = (((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1173 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1173 * * if e_high[0] - e_low[0] > max_e_len: * return 0 # <<<<<<<<<<<<<< @@ -45724,7 +49057,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj goto __pyx_L6; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1174 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1174 * if e_high[0] - e_low[0] > max_e_len: * return 0 * elif e_in_high != -1 and e_high[0] != e_in_high: # <<<<<<<<<<<<<< @@ -45740,7 +49073,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1175 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1175 * return 0 * elif e_in_high != -1 and e_high[0] != e_in_high: * if e_high[0] - e_in_high < min_ex_size: # <<<<<<<<<<<<<< @@ -45750,7 +49083,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_e_high[0]) - __pyx_v_e_in_high) < __pyx_v_min_ex_size); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1176 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1176 * elif e_in_high != -1 and e_high[0] != e_in_high: * if e_high[0] - e_in_high < min_ex_size: * e_high[0] = e_in_high + min_ex_size # <<<<<<<<<<<<<< @@ -45759,7 +49092,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_e_high[0]) = (__pyx_v_e_in_high + __pyx_v_min_ex_size); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1177 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1177 * if e_high[0] - e_in_high < min_ex_size: * e_high[0] = e_in_high + min_ex_size * if e_high[0] > e_sent_len: # <<<<<<<<<<<<<< @@ -45769,7 +49102,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_e_high[0]) > __pyx_v_e_sent_len); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1178 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1178 * e_high[0] = e_in_high + min_ex_size * if e_high[0] > e_sent_len: * return 0 # <<<<<<<<<<<<<< @@ -45788,7 +49121,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1180 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1180 * return 0 * * f_back_low[0] = -1 # <<<<<<<<<<<<<< @@ -45797,7 +49130,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_f_back_low[0]) = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1181 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1181 * * f_back_low[0] = -1 * f_back_high[0] = -1 # <<<<<<<<<<<<<< @@ -45806,7 +49139,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_f_back_high[0]) = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1182 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1182 * f_back_low[0] = -1 * f_back_high[0] = -1 * f_low_prev = f_low # <<<<<<<<<<<<<< @@ -45815,7 +49148,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_f_low_prev = __pyx_v_f_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1183 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1183 * f_back_high[0] = -1 * f_low_prev = f_low * f_high_prev = f_high # <<<<<<<<<<<<<< @@ -45825,7 +49158,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f_high_prev = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1184 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1184 * f_low_prev = f_low * f_high_prev = f_high * new_x = 0 # <<<<<<<<<<<<<< @@ -45834,7 +49167,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_x = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1185 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1185 * f_high_prev = f_high * new_x = 0 * new_low_x = 0 # <<<<<<<<<<<<<< @@ -45843,7 +49176,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_low_x = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1186 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1186 * new_x = 0 * new_low_x = 0 * new_high_x = 0 # <<<<<<<<<<<<<< @@ -45852,7 +49185,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_high_x = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1188 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1188 * new_high_x = 0 * * while True: # <<<<<<<<<<<<<< @@ -45862,7 +49195,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj while (1) { if (!1) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1190 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1190 * while True: * * if f_back_low[0] == -1: # <<<<<<<<<<<<<< @@ -45872,7 +49205,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_f_back_low[0]) == -1); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1191 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1191 * * if f_back_low[0] == -1: * self.find_projection(e_low[0], e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) # <<<<<<<<<<<<<< @@ -45886,7 +49219,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1193 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1193 * self.find_projection(e_low[0], e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) * else: * self.find_projection(e_low[0], e_low_prev, e_links_low, e_links_high, f_back_low, f_back_high) # <<<<<<<<<<<<<< @@ -45897,7 +49230,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1194 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1194 * else: * self.find_projection(e_low[0], e_low_prev, e_links_low, e_links_high, f_back_low, f_back_high) * self.find_projection(e_high_prev, e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) # <<<<<<<<<<<<<< @@ -45910,7 +49243,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L11:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1196 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1196 * self.find_projection(e_high_prev, e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) * * if f_back_low[0] > f_low: # <<<<<<<<<<<<<< @@ -45920,7 +49253,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_f_back_low[0]) > __pyx_v_f_low); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1197 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1197 * * if f_back_low[0] > f_low: * f_back_low[0] = f_low # <<<<<<<<<<<<<< @@ -45932,7 +49265,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L12:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1199 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1199 * f_back_low[0] = f_low * * if f_back_high[0] < f_high: # <<<<<<<<<<<<<< @@ -45941,14 +49274,13 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_high, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_high, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1200 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1200 * * if f_back_high[0] < f_high: * f_back_high[0] = f_high # <<<<<<<<<<<<<< @@ -45961,7 +49293,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L13:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1202 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1202 * f_back_high[0] = f_high * * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: # <<<<<<<<<<<<<< @@ -45977,7 +49309,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1203 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1203 * * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: * return 1 # <<<<<<<<<<<<<< @@ -45990,7 +49322,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L14:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1205 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1205 * return 1 * * if allow_low_x == 0 and f_back_low[0] < f_low: # <<<<<<<<<<<<<< @@ -46006,7 +49338,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1207 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1207 * if allow_low_x == 0 and f_back_low[0] < f_low: * # FAIL: f phrase is not tight * return 0 # <<<<<<<<<<<<<< @@ -46019,7 +49351,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L15:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1209 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1209 * return 0 * * if f_back_high[0] - f_back_low[0] > max_f_len: # <<<<<<<<<<<<<< @@ -46029,7 +49361,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_5 = (((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len); if (__pyx_t_5) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1211 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1211 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: f back projection is too wide * return 0 # <<<<<<<<<<<<<< @@ -46042,7 +49374,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L16:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1213 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1213 * return 0 * * if allow_high_x == 0 and f_back_high[0] > f_high: # <<<<<<<<<<<<<< @@ -46053,8 +49385,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj if (__pyx_t_5) { __pyx_t_6 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_v_f_high, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_v_f_high, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -46064,7 +49395,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1215 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1215 * if allow_high_x == 0 and f_back_high[0] > f_high: * # FAIL: extension on high side not allowed * return 0 # <<<<<<<<<<<<<< @@ -46077,7 +49408,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L17:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1217 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1217 * return 0 * * if f_low != f_back_low[0]: # <<<<<<<<<<<<<< @@ -46087,7 +49418,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (__pyx_v_f_low != (__pyx_v_f_back_low[0])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1218 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1218 * * if f_low != f_back_low[0]: * if new_low_x == 0: # <<<<<<<<<<<<<< @@ -46097,7 +49428,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (__pyx_v_new_low_x == 0); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1219 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1219 * if f_low != f_back_low[0]: * if new_low_x == 0: * if new_x >= max_new_x: # <<<<<<<<<<<<<< @@ -46107,7 +49438,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (__pyx_v_new_x >= __pyx_v_max_new_x); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1221 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1221 * if new_x >= max_new_x: * # FAIL: extension required on low side violates max # of gaps * return 0 # <<<<<<<<<<<<<< @@ -46120,7 +49451,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1223 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1223 * return 0 * else: * new_x = new_x + 1 # <<<<<<<<<<<<<< @@ -46129,7 +49460,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_x = (__pyx_v_new_x + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1224 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1224 * else: * new_x = new_x + 1 * new_low_x = 1 # <<<<<<<<<<<<<< @@ -46143,7 +49474,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L19:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1225 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1225 * new_x = new_x + 1 * new_low_x = 1 * if f_low - f_back_low[0] < min_fx_size: # <<<<<<<<<<<<<< @@ -46153,7 +49484,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_f_low - (__pyx_v_f_back_low[0])) < __pyx_v_min_fx_size); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1226 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1226 * new_low_x = 1 * if f_low - f_back_low[0] < min_fx_size: * f_back_low[0] = f_low - min_fx_size # <<<<<<<<<<<<<< @@ -46162,7 +49493,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_f_back_low[0]) = (__pyx_v_f_low - __pyx_v_min_fx_size); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1227 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1227 * if f_low - f_back_low[0] < min_fx_size: * f_back_low[0] = f_low - min_fx_size * if f_back_high[0] - f_back_low[0] > max_f_len: # <<<<<<<<<<<<<< @@ -46172,7 +49503,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1229 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1229 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: extension required on low side violates max initial length * return 0 # <<<<<<<<<<<<<< @@ -46185,7 +49516,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L22:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1230 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1230 * # FAIL: extension required on low side violates max initial length * return 0 * if f_back_low[0] < 0: # <<<<<<<<<<<<<< @@ -46195,7 +49526,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_f_back_low[0]) < 0); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1232 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1232 * if f_back_low[0] < 0: * # FAIL: extension required on low side violates sentence boundary * return 0 # <<<<<<<<<<<<<< @@ -46214,7 +49545,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L18:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1234 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1234 * return 0 * * if f_high != f_back_high[0]: # <<<<<<<<<<<<<< @@ -46223,14 +49554,13 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_RichCompare(__pyx_v_f_high, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_6 = PyObject_RichCompare(__pyx_v_f_high, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1235 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1235 * * if f_high != f_back_high[0]: * if new_high_x == 0: # <<<<<<<<<<<<<< @@ -46240,7 +49570,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (__pyx_v_new_high_x == 0); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1236 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1236 * if f_high != f_back_high[0]: * if new_high_x == 0: * if new_x >= max_new_x: # <<<<<<<<<<<<<< @@ -46250,7 +49580,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (__pyx_v_new_x >= __pyx_v_max_new_x); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1238 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1238 * if new_x >= max_new_x: * # FAIL: extension required on high side violates max # of gaps * return 0 # <<<<<<<<<<<<<< @@ -46263,7 +49593,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1240 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1240 * return 0 * else: * new_x = new_x + 1 # <<<<<<<<<<<<<< @@ -46272,7 +49602,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_x = (__pyx_v_new_x + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1241 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1241 * else: * new_x = new_x + 1 * new_high_x = 1 # <<<<<<<<<<<<<< @@ -46286,7 +49616,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L25:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1242 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1242 * new_x = new_x + 1 * new_high_x = 1 * if f_back_high[0] - f_high < min_fx_size: # <<<<<<<<<<<<<< @@ -46300,15 +49630,14 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1243 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1243 * new_high_x = 1 * if f_back_high[0] - f_high < min_fx_size: * f_back_high[0] = f_high + min_fx_size # <<<<<<<<<<<<<< @@ -46324,7 +49653,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; (__pyx_v_f_back_high[0]) = __pyx_t_1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1244 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1244 * if f_back_high[0] - f_high < min_fx_size: * f_back_high[0] = f_high + min_fx_size * if f_back_high[0] - f_back_low[0] > max_f_len: # <<<<<<<<<<<<<< @@ -46334,7 +49663,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1246 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1246 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: extension required on high side violates max initial length * return 0 # <<<<<<<<<<<<<< @@ -46347,7 +49676,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L28:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1247 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1247 * # FAIL: extension required on high side violates max initial length * return 0 * if f_back_high[0] > f_sent_len: # <<<<<<<<<<<<<< @@ -46357,7 +49686,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_f_back_high[0]) > __pyx_v_f_sent_len); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1249 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1249 * if f_back_high[0] > f_sent_len: * # FAIL: extension required on high side violates sentence boundary * return 0 # <<<<<<<<<<<<<< @@ -46376,7 +49705,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L24:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1251 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1251 * return 0 * * e_low_prev = e_low[0] # <<<<<<<<<<<<<< @@ -46385,7 +49714,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_e_low_prev = (__pyx_v_e_low[0]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1252 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1252 * * e_low_prev = e_low[0] * e_high_prev = e_high[0] # <<<<<<<<<<<<<< @@ -46394,7 +49723,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_e_high_prev = (__pyx_v_e_high[0]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1254 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1254 * e_high_prev = e_high[0] * * self.find_projection(f_back_low[0], f_low_prev, f_links_low, f_links_high, e_low, e_high) # <<<<<<<<<<<<<< @@ -46405,7 +49734,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1255 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1255 * * self.find_projection(f_back_low[0], f_low_prev, f_links_low, f_links_high, e_low, e_high) * self.find_projection(f_high_prev, f_back_high[0], f_links_low, f_links_high, e_low, e_high) # <<<<<<<<<<<<<< @@ -46416,7 +49745,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1256 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1256 * self.find_projection(f_back_low[0], f_low_prev, f_links_low, f_links_high, e_low, e_high) * self.find_projection(f_high_prev, f_back_high[0], f_links_low, f_links_high, e_low, e_high) * if e_low[0] == e_low_prev and e_high[0] == e_high_prev: # <<<<<<<<<<<<<< @@ -46432,7 +49761,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1257 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1257 * self.find_projection(f_high_prev, f_back_high[0], f_links_low, f_links_high, e_low, e_high) * if e_low[0] == e_low_prev and e_high[0] == e_high_prev: * return 1 # <<<<<<<<<<<<<< @@ -46445,7 +49774,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L30:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1258 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1258 * if e_low[0] == e_low_prev and e_high[0] == e_high_prev: * return 1 * if allow_arbitrary_x == 0: # <<<<<<<<<<<<<< @@ -46455,7 +49784,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_3 = (__pyx_v_allow_arbitrary_x == 0); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1260 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1260 * if allow_arbitrary_x == 0: * # FAIL: arbitrary expansion not permitted * return 0 # <<<<<<<<<<<<<< @@ -46468,7 +49797,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L31:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1261 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1261 * # FAIL: arbitrary expansion not permitted * return 0 * if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<< @@ -46478,7 +49807,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_3 = (((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len); if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1263 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1263 * if e_high[0] - e_low[0] > max_e_len: * # FAIL: re-projection violates sentence max phrase length * return 0 # <<<<<<<<<<<<<< @@ -46491,7 +49820,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L32:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1264 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1264 * # FAIL: re-projection violates sentence max phrase length * return 0 * f_low_prev = f_back_low[0] # <<<<<<<<<<<<<< @@ -46500,7 +49829,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_f_low_prev = (__pyx_v_f_back_low[0]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1265 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1265 * return 0 * f_low_prev = f_back_low[0] * f_high_prev = f_back_high[0] # <<<<<<<<<<<<<< @@ -46523,7 +49852,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1268 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1268 * * * cdef find_projection(self, int in_low, int in_high, int* in_links_low, int* in_links_high, # <<<<<<<<<<<<<< @@ -46531,7 +49860,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj * cdef int i */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_in_low, int __pyx_v_in_high, int *__pyx_v_in_links_low, int *__pyx_v_in_links_high, int *__pyx_v_out_low, int *__pyx_v_out_high) { +static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_in_low, int __pyx_v_in_high, int *__pyx_v_in_links_low, int *__pyx_v_in_links_high, int *__pyx_v_out_low, int *__pyx_v_out_high) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -46539,9 +49868,9 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct _ int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - __Pyx_RefNannySetupContext("find_projection"); + __Pyx_RefNannySetupContext("find_projection", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1271 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1271 * int* out_low, int* out_high): * cdef int i * for i from in_low <= i < in_high: # <<<<<<<<<<<<<< @@ -46551,7 +49880,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct _ __pyx_t_1 = __pyx_v_in_high; for (__pyx_v_i = __pyx_v_in_low; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1272 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1272 * cdef int i * for i from in_low <= i < in_high: * if in_links_low[i] != -1: # <<<<<<<<<<<<<< @@ -46561,7 +49890,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct _ __pyx_t_2 = ((__pyx_v_in_links_low[__pyx_v_i]) != -1); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1273 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1273 * for i from in_low <= i < in_high: * if in_links_low[i] != -1: * if out_low[0] == -1 or in_links_low[i] < out_low[0]: # <<<<<<<<<<<<<< @@ -46577,7 +49906,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct _ } if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1274 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1274 * if in_links_low[i] != -1: * if out_low[0] == -1 or in_links_low[i] < out_low[0]: * out_low[0] = in_links_low[i] # <<<<<<<<<<<<<< @@ -46589,7 +49918,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct _ } __pyx_L6:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1275 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1275 * if out_low[0] == -1 or in_links_low[i] < out_low[0]: * out_low[0] = in_links_low[i] * if out_high[0] == -1 or in_links_high[i] > out_high[0]: # <<<<<<<<<<<<<< @@ -46605,7 +49934,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct _ } if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1276 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1276 * out_low[0] = in_links_low[i] * if out_high[0] == -1 or in_links_high[i] > out_high[0]: * out_high[0] = in_links_high[i] # <<<<<<<<<<<<<< @@ -46627,7 +49956,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct _ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1279 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1279 * * * cdef int* int_arr_extend(self, int* arr, int* arr_len, int* data, int data_len): # <<<<<<<<<<<<<< @@ -46635,13 +49964,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(struct _ * new_len = arr_len[0] + data_len */ -static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_data, int __pyx_v_data_len) { +static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_data, int __pyx_v_data_len) { int __pyx_v_new_len; int *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("int_arr_extend"); + __Pyx_RefNannySetupContext("int_arr_extend", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1281 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1281 * cdef int* int_arr_extend(self, int* arr, int* arr_len, int* data, int data_len): * cdef int new_len * new_len = arr_len[0] + data_len # <<<<<<<<<<<<<< @@ -46650,7 +49979,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(struct __pyx_o */ __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_data_len); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1282 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1282 * cdef int new_len * new_len = arr_len[0] + data_len * arr = <int*> realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -46659,7 +49988,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(struct __pyx_o */ __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1283 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1283 * new_len = arr_len[0] + data_len * arr = <int*> realloc(arr, new_len*sizeof(int)) * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -46668,7 +49997,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(struct __pyx_o */ memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_data, (__pyx_v_data_len * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1284 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1284 * arr = <int*> realloc(arr, new_len*sizeof(int)) * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) * arr_len[0] = new_len # <<<<<<<<<<<<<< @@ -46677,7 +50006,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(struct __pyx_o */ (__pyx_v_arr_len[0]) = __pyx_v_new_len; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1285 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1285 * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) * arr_len[0] = new_len * return arr # <<<<<<<<<<<<<< @@ -46693,7 +50022,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(struct __pyx_o return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1288 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1288 * * * cdef extract_phrases(self, int e_low, int e_high, int* e_gap_low, int* e_gap_high, int* e_links_low, int num_gaps, # <<<<<<<<<<<<<< @@ -46701,7 +50030,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(struct __pyx_o * int sent_id, int e_sent_len, int e_sent_start): */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_e_low, int __pyx_v_e_high, int *__pyx_v_e_gap_low, int *__pyx_v_e_gap_high, int *__pyx_v_e_links_low, int __pyx_v_num_gaps, int __pyx_v_f_low, int __pyx_v_f_high, int *__pyx_v_f_gap_low, int *__pyx_v_f_gap_high, int *__pyx_v_f_links_low, int __pyx_v_sent_id, int __pyx_v_e_sent_len, int __pyx_v_e_sent_start) { +static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_e_low, int __pyx_v_e_high, int *__pyx_v_e_gap_low, int *__pyx_v_e_gap_high, int *__pyx_v_e_links_low, int __pyx_v_num_gaps, CYTHON_UNUSED int __pyx_v_f_low, CYTHON_UNUSED int __pyx_v_f_high, CYTHON_UNUSED int *__pyx_v_f_gap_low, CYTHON_UNUSED int *__pyx_v_f_gap_high, CYTHON_UNUSED int *__pyx_v_f_links_low, CYTHON_UNUSED int __pyx_v_sent_id, int __pyx_v_e_sent_len, int __pyx_v_e_sent_start) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; @@ -46737,9 +50066,9 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("extract_phrases"); + __Pyx_RefNannySetupContext("extract_phrases", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1296 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1296 * cdef result * * result = [] # <<<<<<<<<<<<<< @@ -46747,11 +50076,11 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ * e_gaps1 = <int*> malloc(0) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1297 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1297 * * result = [] * len1 = 0 # <<<<<<<<<<<<<< @@ -46760,7 +50089,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_len1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1298 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1298 * result = [] * len1 = 0 * e_gaps1 = <int*> malloc(0) # <<<<<<<<<<<<<< @@ -46769,7 +50098,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps1 = ((int *)malloc(0)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1299 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1299 * len1 = 0 * e_gaps1 = <int*> malloc(0) * ephr_arr = IntList() # <<<<<<<<<<<<<< @@ -46781,7 +50110,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_ephr_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1301 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1301 * ephr_arr = IntList() * * e_gap_order = <int*> malloc(num_gaps*sizeof(int)) # <<<<<<<<<<<<<< @@ -46790,7 +50119,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gap_order = ((int *)malloc((__pyx_v_num_gaps * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1302 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1302 * * e_gap_order = <int*> malloc(num_gaps*sizeof(int)) * if num_gaps > 0: # <<<<<<<<<<<<<< @@ -46800,7 +50129,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = (__pyx_v_num_gaps > 0); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1303 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1303 * e_gap_order = <int*> malloc(num_gaps*sizeof(int)) * if num_gaps > 0: * e_gap_order[0] = 0 # <<<<<<<<<<<<<< @@ -46809,7 +50138,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ (__pyx_v_e_gap_order[0]) = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1304 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1304 * if num_gaps > 0: * e_gap_order[0] = 0 * for i from 1 <= i < num_gaps: # <<<<<<<<<<<<<< @@ -46819,7 +50148,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_3 = __pyx_v_num_gaps; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1305 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1305 * e_gap_order[0] = 0 * for i from 1 <= i < num_gaps: * for j from 0 <= j < i: # <<<<<<<<<<<<<< @@ -46829,7 +50158,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_4 = __pyx_v_i; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1306 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1306 * for i from 1 <= i < num_gaps: * for j from 0 <= j < i: * if e_gap_low[i] < e_gap_low[j]: # <<<<<<<<<<<<<< @@ -46839,7 +50168,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = ((__pyx_v_e_gap_low[__pyx_v_i]) < (__pyx_v_e_gap_low[__pyx_v_j])); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1307 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1307 * for j from 0 <= j < i: * if e_gap_low[i] < e_gap_low[j]: * for k from j <= k < i: # <<<<<<<<<<<<<< @@ -46849,7 +50178,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_5 = __pyx_v_i; for (__pyx_v_k = __pyx_v_j; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1308 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1308 * if e_gap_low[i] < e_gap_low[j]: * for k from j <= k < i: * e_gap_order[k+1] = e_gap_order[k] # <<<<<<<<<<<<<< @@ -46859,7 +50188,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ (__pyx_v_e_gap_order[(__pyx_v_k + 1)]) = (__pyx_v_e_gap_order[__pyx_v_k]); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1309 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1309 * for k from j <= k < i: * e_gap_order[k+1] = e_gap_order[k] * e_gap_order[j] = i # <<<<<<<<<<<<<< @@ -46868,7 +50197,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ (__pyx_v_e_gap_order[__pyx_v_j]) = __pyx_v_i; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1310 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1310 * e_gap_order[k+1] = e_gap_order[k] * e_gap_order[j] = i * break # <<<<<<<<<<<<<< @@ -46882,7 +50211,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1312 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1312 * break * else: * e_gap_order[i] = i # <<<<<<<<<<<<<< @@ -46897,7 +50226,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L3:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1314 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1314 * e_gap_order[i] = i * * e_x_low = e_low # <<<<<<<<<<<<<< @@ -46906,7 +50235,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_x_low = __pyx_v_e_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1315 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1315 * * e_x_low = e_low * e_x_high = e_high # <<<<<<<<<<<<<< @@ -46915,7 +50244,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_x_high = __pyx_v_e_high; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1316 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1316 * e_x_low = e_low * e_x_high = e_high * if self.tight_phrases == 0: # <<<<<<<<<<<<<< @@ -46925,7 +50254,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = (__pyx_v_self->tight_phrases == 0); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1317 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1317 * e_x_high = e_high * if self.tight_phrases == 0: * while e_x_low > 0 and e_high - e_x_low < self.train_max_initial_size and e_links_low[e_x_low-1] == -1: # <<<<<<<<<<<<<< @@ -46948,7 +50277,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (!__pyx_t_6) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1318 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1318 * if self.tight_phrases == 0: * while e_x_low > 0 and e_high - e_x_low < self.train_max_initial_size and e_links_low[e_x_low-1] == -1: * e_x_low = e_x_low - 1 # <<<<<<<<<<<<<< @@ -46958,7 +50287,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_e_x_low = (__pyx_v_e_x_low - 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1319 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1319 * while e_x_low > 0 and e_high - e_x_low < self.train_max_initial_size and e_links_low[e_x_low-1] == -1: * e_x_low = e_x_low - 1 * while e_x_high < e_sent_len and e_x_high - e_low < self.train_max_initial_size and e_links_low[e_x_high] == -1: # <<<<<<<<<<<<<< @@ -46981,7 +50310,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (!__pyx_t_2) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1320 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1320 * e_x_low = e_x_low - 1 * while e_x_high < e_sent_len and e_x_high - e_low < self.train_max_initial_size and e_links_low[e_x_high] == -1: * e_x_high = e_x_high + 1 # <<<<<<<<<<<<<< @@ -46994,7 +50323,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L11:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1322 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1322 * e_x_high = e_x_high + 1 * * for i from e_x_low <= i <= e_low: # <<<<<<<<<<<<<< @@ -47004,7 +50333,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_3 = __pyx_v_e_low; for (__pyx_v_i = __pyx_v_e_x_low; __pyx_v_i <= __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1323 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1323 * * for i from e_x_low <= i <= e_low: * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) # <<<<<<<<<<<<<< @@ -47014,7 +50343,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_e_gaps1 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps1, (&__pyx_v_len1), (&__pyx_v_i), 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1325 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1325 * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) * * for i from 0 <= i < num_gaps: # <<<<<<<<<<<<<< @@ -47024,7 +50353,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_3 = __pyx_v_num_gaps; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1326 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1326 * * for i from 0 <= i < num_gaps: * e_gaps2 = <int*> malloc(0) # <<<<<<<<<<<<<< @@ -47033,7 +50362,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps2 = ((int *)malloc(0)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1327 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1327 * for i from 0 <= i < num_gaps: * e_gaps2 = <int*> malloc(0) * len2 = 0 # <<<<<<<<<<<<<< @@ -47042,7 +50371,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_len2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1329 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1329 * len2 = 0 * * j = e_gap_order[i] # <<<<<<<<<<<<<< @@ -47051,7 +50380,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_j = (__pyx_v_e_gap_order[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1330 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1330 * * j = e_gap_order[i] * e_x_gap_low = e_gap_low[j] # <<<<<<<<<<<<<< @@ -47060,7 +50389,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_x_gap_low = (__pyx_v_e_gap_low[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1331 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1331 * j = e_gap_order[i] * e_x_gap_low = e_gap_low[j] * e_x_gap_high = e_gap_high[j] # <<<<<<<<<<<<<< @@ -47069,7 +50398,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_x_gap_high = (__pyx_v_e_gap_high[__pyx_v_j]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1332 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1332 * e_x_gap_low = e_gap_low[j] * e_x_gap_high = e_gap_high[j] * if self.tight_phrases == 0: # <<<<<<<<<<<<<< @@ -47079,7 +50408,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = (__pyx_v_self->tight_phrases == 0); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1333 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1333 * e_x_gap_high = e_gap_high[j] * if self.tight_phrases == 0: * while e_x_gap_low > e_x_low and e_links_low[e_x_gap_low-1] == -1: # <<<<<<<<<<<<<< @@ -47096,7 +50425,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (!__pyx_t_7) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1334 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1334 * if self.tight_phrases == 0: * while e_x_gap_low > e_x_low and e_links_low[e_x_gap_low-1] == -1: * e_x_gap_low = e_x_gap_low - 1 # <<<<<<<<<<<<<< @@ -47106,7 +50435,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_e_x_gap_low = (__pyx_v_e_x_gap_low - 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1335 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1335 * while e_x_gap_low > e_x_low and e_links_low[e_x_gap_low-1] == -1: * e_x_gap_low = e_x_gap_low - 1 * while e_x_gap_high < e_x_high and e_links_low[e_x_gap_high] == -1: # <<<<<<<<<<<<<< @@ -47123,7 +50452,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (!__pyx_t_6) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1336 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1336 * e_x_gap_low = e_x_gap_low - 1 * while e_x_gap_high < e_x_high and e_links_low[e_x_gap_high] == -1: * e_x_gap_high = e_x_gap_high + 1 # <<<<<<<<<<<<<< @@ -47136,7 +50465,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L20:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1338 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1338 * e_x_gap_high = e_x_gap_high + 1 * * k = 0 # <<<<<<<<<<<<<< @@ -47145,7 +50474,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_k = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1339 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1339 * * k = 0 * step = 1+(i*2) # <<<<<<<<<<<<<< @@ -47154,7 +50483,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_step = (1 + (__pyx_v_i * 2)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1340 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1340 * k = 0 * step = 1+(i*2) * while k < len1: # <<<<<<<<<<<<<< @@ -47165,7 +50494,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_6 = (__pyx_v_k < __pyx_v_len1); if (!__pyx_t_6) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1341 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1341 * step = 1+(i*2) * while k < len1: * for m from e_x_gap_low <= m <= e_gap_low[j]: # <<<<<<<<<<<<<< @@ -47175,7 +50504,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_4 = (__pyx_v_e_gap_low[__pyx_v_j]); for (__pyx_v_m = __pyx_v_e_x_gap_low; __pyx_v_m <= __pyx_t_4; __pyx_v_m++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1342 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1342 * while k < len1: * for m from e_x_gap_low <= m <= e_gap_low[j]: * if m >= e_gaps1[k+step-1]: # <<<<<<<<<<<<<< @@ -47185,7 +50514,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_6 = (__pyx_v_m >= (__pyx_v_e_gaps1[((__pyx_v_k + __pyx_v_step) - 1)])); if (__pyx_t_6) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1343 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1343 * for m from e_x_gap_low <= m <= e_gap_low[j]: * if m >= e_gaps1[k+step-1]: * for n from e_gap_high[j] <= n <= e_x_gap_high: # <<<<<<<<<<<<<< @@ -47195,7 +50524,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_5 = __pyx_v_e_x_gap_high; for (__pyx_v_n = (__pyx_v_e_gap_high[__pyx_v_j]); __pyx_v_n <= __pyx_t_5; __pyx_v_n++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1344 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1344 * if m >= e_gaps1[k+step-1]: * for n from e_gap_high[j] <= n <= e_x_gap_high: * if n-m >= 1: # extractor.py doesn't restrict target-side gap length # <<<<<<<<<<<<<< @@ -47205,7 +50534,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_6 = ((__pyx_v_n - __pyx_v_m) >= 1); if (__pyx_t_6) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1345 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1345 * for n from e_gap_high[j] <= n <= e_x_gap_high: * if n-m >= 1: # extractor.py doesn't restrict target-side gap length * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step) # <<<<<<<<<<<<<< @@ -47214,7 +50543,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps2, (&__pyx_v_len2), (__pyx_v_e_gaps1 + __pyx_v_k), __pyx_v_step); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1346 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1346 * if n-m >= 1: # extractor.py doesn't restrict target-side gap length * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step) * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &m, 1) # <<<<<<<<<<<<<< @@ -47223,7 +50552,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps2, (&__pyx_v_len2), (&__pyx_v_m), 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1347 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1347 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step) * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &m, 1) * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) # <<<<<<<<<<<<<< @@ -47240,7 +50569,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_L29:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1348 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1348 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &m, 1) * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) * k = k + step # <<<<<<<<<<<<<< @@ -47250,7 +50579,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_k = (__pyx_v_k + __pyx_v_step); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1349 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1349 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) * k = k + step * free(e_gaps1) # <<<<<<<<<<<<<< @@ -47259,7 +50588,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ free(__pyx_v_e_gaps1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1350 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1350 * k = k + step * free(e_gaps1) * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< @@ -47268,7 +50597,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps1 = __pyx_v_e_gaps2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1351 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1351 * free(e_gaps1) * e_gaps1 = e_gaps2 * len1 = len2 # <<<<<<<<<<<<<< @@ -47278,7 +50607,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_len1 = __pyx_v_len2; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1353 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1353 * len1 = len2 * * step = 1+(num_gaps*2) # <<<<<<<<<<<<<< @@ -47287,7 +50616,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_step = (1 + (__pyx_v_num_gaps * 2)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1354 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1354 * * step = 1+(num_gaps*2) * e_gaps2 = <int*> malloc(0) # <<<<<<<<<<<<<< @@ -47296,7 +50625,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps2 = ((int *)malloc(0)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1355 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1355 * step = 1+(num_gaps*2) * e_gaps2 = <int*> malloc(0) * len2 = 0 # <<<<<<<<<<<<<< @@ -47305,7 +50634,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_len2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1356 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1356 * e_gaps2 = <int*> malloc(0) * len2 = 0 * for i from e_high <= i <= e_x_high: # <<<<<<<<<<<<<< @@ -47315,7 +50644,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_3 = __pyx_v_e_x_high; for (__pyx_v_i = __pyx_v_e_high; __pyx_v_i <= __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1357 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1357 * len2 = 0 * for i from e_high <= i <= e_x_high: * j = 0 # <<<<<<<<<<<<<< @@ -47324,7 +50653,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_j = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1358 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1358 * for i from e_high <= i <= e_x_high: * j = 0 * while j < len1: # <<<<<<<<<<<<<< @@ -47335,7 +50664,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_6 = (__pyx_v_j < __pyx_v_len1); if (!__pyx_t_6) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1359 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1359 * j = 0 * while j < len1: * if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]: # <<<<<<<<<<<<<< @@ -47351,7 +50680,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1360 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1360 * while j < len1: * if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]: * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+j, step) # <<<<<<<<<<<<<< @@ -47360,7 +50689,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps2, (&__pyx_v_len2), (__pyx_v_e_gaps1 + __pyx_v_j), __pyx_v_step); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1361 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1361 * if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]: * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+j, step) * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) # <<<<<<<<<<<<<< @@ -47372,7 +50701,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L37:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1362 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1362 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+j, step) * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) * j = j + step # <<<<<<<<<<<<<< @@ -47383,7 +50712,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1363 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1363 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) * j = j + step * free(e_gaps1) # <<<<<<<<<<<<<< @@ -47392,7 +50721,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ free(__pyx_v_e_gaps1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1364 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1364 * j = j + step * free(e_gaps1) * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< @@ -47401,7 +50730,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps1 = __pyx_v_e_gaps2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1365 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1365 * free(e_gaps1) * e_gaps1 = e_gaps2 * len1 = len2 # <<<<<<<<<<<<<< @@ -47410,7 +50739,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_len1 = __pyx_v_len2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1367 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1367 * len1 = len2 * * step = (num_gaps+1)*2 # <<<<<<<<<<<<<< @@ -47419,7 +50748,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_step = ((__pyx_v_num_gaps + 1) * 2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1368 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1368 * * step = (num_gaps+1)*2 * i = 0 # <<<<<<<<<<<<<< @@ -47428,7 +50757,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_i = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1370 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1370 * i = 0 * * while i < len1: # <<<<<<<<<<<<<< @@ -47439,7 +50768,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = (__pyx_v_i < __pyx_v_len1); if (!__pyx_t_2) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1371 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1371 * * while i < len1: * ephr_arr._clear() # <<<<<<<<<<<<<< @@ -47448,7 +50777,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_clear(__pyx_v_ephr_arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1372 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1372 * while i < len1: * ephr_arr._clear() * num_chunks = 0 # <<<<<<<<<<<<<< @@ -47457,7 +50786,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_num_chunks = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1373 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1373 * ephr_arr._clear() * num_chunks = 0 * indexes = [] # <<<<<<<<<<<<<< @@ -47465,12 +50794,12 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ * if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]: */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(((PyObject *)__pyx_v_indexes)); __pyx_v_indexes = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1374 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1374 * num_chunks = 0 * indexes = [] * for j from 0 <= j < num_gaps+1: # <<<<<<<<<<<<<< @@ -47480,7 +50809,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_9 = (__pyx_v_num_gaps + 1); for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_9; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1375 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1375 * indexes = [] * for j from 0 <= j < num_gaps+1: * if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]: # <<<<<<<<<<<<<< @@ -47490,7 +50819,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = ((__pyx_v_e_gaps1[(__pyx_v_i + (2 * __pyx_v_j))]) < (__pyx_v_e_gaps1[((__pyx_v_i + (2 * __pyx_v_j)) + 1)])); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1376 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1376 * for j from 0 <= j < num_gaps+1: * if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]: * num_chunks = num_chunks + 1 # <<<<<<<<<<<<<< @@ -47502,7 +50831,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L42:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1377 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1377 * if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]: * num_chunks = num_chunks + 1 * for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]: # <<<<<<<<<<<<<< @@ -47512,22 +50841,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_3 = (__pyx_v_e_gaps1[((__pyx_v_i + (2 * __pyx_v_j)) + 1)]); for (__pyx_v_k = (__pyx_v_e_gaps1[(__pyx_v_i + (2 * __pyx_v_j))]); __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1378 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1378 * num_chunks = num_chunks + 1 * for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]: * indexes.append(k) # <<<<<<<<<<<<<< * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) * if j < num_gaps: */ - if (unlikely(((PyObject *)__pyx_v_indexes) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyList_Append(__pyx_v_indexes, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1379 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1379 * for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]: * indexes.append(k) * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) # <<<<<<<<<<<<<< @@ -47542,7 +50868,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_t_4); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1380 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1380 * indexes.append(k) * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) * if j < num_gaps: # <<<<<<<<<<<<<< @@ -47552,22 +50878,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = (__pyx_v_j < __pyx_v_num_gaps); if (__pyx_t_2) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1381 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1381 * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) * if j < num_gaps: * indexes.append(sym_setindex(self.category, e_gap_order[j]+1)) # <<<<<<<<<<<<<< * ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1)) * i = i + step */ - if (unlikely(((PyObject *)__pyx_v_indexes) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, ((__pyx_v_e_gap_order[__pyx_v_j]) + 1))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyList_Append(__pyx_v_indexes, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1382 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1382 * if j < num_gaps: * indexes.append(sym_setindex(self.category, e_gap_order[j]+1)) * ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1)) # <<<<<<<<<<<<<< @@ -47580,7 +50903,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_L45:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1383 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1383 * indexes.append(sym_setindex(self.category, e_gap_order[j]+1)) * ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1)) * i = i + step # <<<<<<<<<<<<<< @@ -47589,7 +50912,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_i = (__pyx_v_i + __pyx_v_step); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1384 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1384 * ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1)) * i = i + step * if ephr_arr.len <= self.max_target_length and num_chunks <= self.max_target_chunks: # <<<<<<<<<<<<<< @@ -47605,7 +50928,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1385 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1385 * i = i + step * if ephr_arr.len <= self.max_target_length and num_chunks <= self.max_target_chunks: * result.append((Phrase(ephr_arr),indexes)) # <<<<<<<<<<<<<< @@ -47613,7 +50936,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ * free(e_gaps1) */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_ephr_arr)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_ephr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_ephr_arr)); @@ -47621,7 +50944,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __Pyx_INCREF(((PyObject *)__pyx_v_indexes)); @@ -47637,7 +50960,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_L46:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1387 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1387 * result.append((Phrase(ephr_arr),indexes)) * * free(e_gaps1) # <<<<<<<<<<<<<< @@ -47646,7 +50969,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ free(__pyx_v_e_gaps1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1388 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1388 * * free(e_gaps1) * free(e_gap_order) # <<<<<<<<<<<<<< @@ -47655,7 +50978,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ free(__pyx_v_e_gap_order); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1389 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1389 * free(e_gaps1) * free(e_gap_order) * return result # <<<<<<<<<<<<<< @@ -47683,7 +51006,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1391 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1391 * return result * * cdef IntList create_alignments(self, int* sent_links, int num_links, findexes, eindexes): # <<<<<<<<<<<<<< @@ -47691,7 +51014,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ * cdef IntList ret = IntList() */ -static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_create_alignments(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_sent_links, int __pyx_v_num_links, PyObject *__pyx_v_findexes, PyObject *__pyx_v_eindexes) { +static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_create_alignments(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_sent_links, int __pyx_v_num_links, PyObject *__pyx_v_findexes, PyObject *__pyx_v_eindexes) { unsigned int __pyx_v_i; struct __pyx_obj_3_sa_IntList *__pyx_v_ret = 0; PyObject *__pyx_v_s = NULL; @@ -47709,9 +51032,9 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("create_alignments"); + __Pyx_RefNannySetupContext("create_alignments", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1393 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1393 * cdef IntList create_alignments(self, int* sent_links, int num_links, findexes, eindexes): * cdef unsigned i * cdef IntList ret = IntList() # <<<<<<<<<<<<<< @@ -47723,7 +51046,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_v_ret = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1394 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1394 * cdef unsigned i * cdef IntList ret = IntList() * for i in range(len(findexes)): # <<<<<<<<<<<<<< @@ -47734,7 +51057,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1395 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1395 * cdef IntList ret = IntList() * for i in range(len(findexes)): * s = findexes[i] # <<<<<<<<<<<<<< @@ -47747,20 +51070,19 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_v_s = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1396 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1396 * for i in range(len(findexes)): * s = findexes[i] * if (s<0): # <<<<<<<<<<<<<< * continue * idx = 0 */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_s, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_s, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1397 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1397 * s = findexes[i] * if (s<0): * continue # <<<<<<<<<<<<<< @@ -47772,7 +51094,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre } __pyx_L5:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1398 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1398 * if (s<0): * continue * idx = 0 # <<<<<<<<<<<<<< @@ -47783,7 +51105,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __Pyx_XDECREF(__pyx_v_idx); __pyx_v_idx = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1399 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1399 * continue * idx = 0 * while (idx < num_links*2): # <<<<<<<<<<<<<< @@ -47793,14 +51115,13 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre while (1) { __pyx_t_1 = PyInt_FromLong((__pyx_v_num_links * 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!__pyx_t_4) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1400 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1400 * idx = 0 * while (idx < num_links*2): * if (sent_links[idx] == s): # <<<<<<<<<<<<<< @@ -47810,14 +51131,13 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_s, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_s, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1401 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1401 * while (idx < num_links*2): * if (sent_links[idx] == s): * j = eindexes.index(sent_links[idx+1]) # <<<<<<<<<<<<<< @@ -47833,7 +51153,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_t_5 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -47845,7 +51165,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_v_j = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1402 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1402 * if (sent_links[idx] == s): * j = eindexes.index(sent_links[idx+1]) * ret.append(i*65536+j) # <<<<<<<<<<<<<< @@ -47865,7 +51185,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre } __pyx_L8:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1403 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1403 * j = eindexes.index(sent_links[idx+1]) * ret.append(i*65536+j) * idx += 2 # <<<<<<<<<<<<<< @@ -47881,7 +51201,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_L3_continue:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1404 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1404 * ret.append(i*65536+j) * idx += 2 * return ret # <<<<<<<<<<<<<< @@ -47911,7 +51231,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1406 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1406 * return ret * * cdef extract(self, Phrase phrase, Matching* matching, int* chunklen, int num_chunks): # <<<<<<<<<<<<<< @@ -47951,7 +51271,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj int __pyx_v_f_sent_end; int __pyx_v_e_sent_len; int __pyx_v_f_sent_len; - int __pyx_v_e_word_count; + CYTHON_UNUSED int __pyx_v_e_word_count; int __pyx_v_f_x_low; int __pyx_v_f_x_high; int __pyx_v_e_x_low; @@ -47962,7 +51282,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj PyObject *__pyx_v_phrase_list = 0; struct __pyx_obj_3_sa_IntList *__pyx_v_fphr_arr = 0; struct __pyx_obj_3_sa_Phrase *__pyx_v_fphr = 0; - PyObject *__pyx_v_reason_for_failure = 0; + CYTHON_UNUSED PyObject *__pyx_v_reason_for_failure = 0; PyObject *__pyx_v_sofar = NULL; PyObject *__pyx_v_als = NULL; PyObject *__pyx_v_al = NULL; @@ -48003,9 +51323,9 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("extract"); + __Pyx_RefNannySetupContext("extract", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1419 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1419 * cdef reason_for_failure * * fphr_arr = IntList() # <<<<<<<<<<<<<< @@ -48017,7 +51337,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_fphr_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1420 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1420 * * fphr_arr = IntList() * phrase_len = phrase.n # <<<<<<<<<<<<<< @@ -48026,7 +51346,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_phrase_len = __pyx_v_phrase->n; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1421 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1421 * fphr_arr = IntList() * phrase_len = phrase.n * extracts = [] # <<<<<<<<<<<<<< @@ -48034,11 +51354,11 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj * */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_v_extracts = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1422 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1422 * phrase_len = phrase.n * extracts = [] * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) # <<<<<<<<<<<<<< @@ -48047,7 +51367,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_sent_links = ((struct __pyx_vtabstruct_3_sa_Alignment *)__pyx_v_self->alignment->__pyx_vtab)->_get_sent_links(__pyx_v_self->alignment, __pyx_v_matching->sent_id, (&__pyx_v_num_links)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1424 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1424 * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) * * e_sent_start = self.eda.sent_index.arr[matching.sent_id] # <<<<<<<<<<<<<< @@ -48056,7 +51376,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_sent_start = (__pyx_v_self->eda->sent_index->arr[__pyx_v_matching->sent_id]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1425 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1425 * * e_sent_start = self.eda.sent_index.arr[matching.sent_id] * e_sent_end = self.eda.sent_index.arr[matching.sent_id+1] # <<<<<<<<<<<<<< @@ -48065,7 +51385,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_sent_end = (__pyx_v_self->eda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1426 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1426 * e_sent_start = self.eda.sent_index.arr[matching.sent_id] * e_sent_end = self.eda.sent_index.arr[matching.sent_id+1] * e_sent_len = e_sent_end - e_sent_start - 1 # <<<<<<<<<<<<<< @@ -48074,7 +51394,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_sent_len = ((__pyx_v_e_sent_end - __pyx_v_e_sent_start) - 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1427 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1427 * e_sent_end = self.eda.sent_index.arr[matching.sent_id+1] * e_sent_len = e_sent_end - e_sent_start - 1 * f_sent_start = self.fda.sent_index.arr[matching.sent_id] # <<<<<<<<<<<<<< @@ -48083,7 +51403,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_sent_start = (__pyx_v_self->fda->sent_index->arr[__pyx_v_matching->sent_id]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1428 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1428 * e_sent_len = e_sent_end - e_sent_start - 1 * f_sent_start = self.fda.sent_index.arr[matching.sent_id] * f_sent_end = self.fda.sent_index.arr[matching.sent_id+1] # <<<<<<<<<<<<<< @@ -48092,7 +51412,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_sent_end = (__pyx_v_self->fda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1429 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1429 * f_sent_start = self.fda.sent_index.arr[matching.sent_id] * f_sent_end = self.fda.sent_index.arr[matching.sent_id+1] * f_sent_len = f_sent_end - f_sent_start - 1 # <<<<<<<<<<<<<< @@ -48101,7 +51421,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_sent_len = ((__pyx_v_f_sent_end - __pyx_v_f_sent_start) - 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1431 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1431 * f_sent_len = f_sent_end - f_sent_start - 1 * * self.findexes1.reset() # <<<<<<<<<<<<<< @@ -48115,7 +51435,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1432 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1432 * * self.findexes1.reset() * sofar = 0 # <<<<<<<<<<<<<< @@ -48125,7 +51445,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_INCREF(__pyx_int_0); __pyx_v_sofar = __pyx_int_0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1433 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1433 * self.findexes1.reset() * sofar = 0 * for i in range(num_chunks): # <<<<<<<<<<<<<< @@ -48136,7 +51456,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1434 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1434 * sofar = 0 * for i in range(num_chunks): * for j in range(chunklen[i]): # <<<<<<<<<<<<<< @@ -48147,7 +51467,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1435 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1435 * for i in range(num_chunks): * for j in range(chunklen[i]): * self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start); # <<<<<<<<<<<<<< @@ -48161,7 +51481,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1436 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1436 * for j in range(chunklen[i]): * self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start); * sofar += 1 # <<<<<<<<<<<<<< @@ -48175,7 +51495,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_1 = 0; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1437 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1437 * self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start); * sofar += 1 * if (i+1<num_chunks): # <<<<<<<<<<<<<< @@ -48185,7 +51505,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_i + 1) < __pyx_v_num_chunks); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1438 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1438 * sofar += 1 * if (i+1<num_chunks): * self.findexes1.append(phrase[sofar]) # <<<<<<<<<<<<<< @@ -48199,7 +51519,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1439 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1439 * if (i+1<num_chunks): * self.findexes1.append(phrase[sofar]) * sofar += 1 # <<<<<<<<<<<<<< @@ -48216,7 +51536,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_L7:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1442 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1442 * * * e_links_low = <int*> malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -48225,7 +51545,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_links_low = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1443 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1443 * * e_links_low = <int*> malloc(e_sent_len*sizeof(int)) * e_links_high = <int*> malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -48234,7 +51554,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_links_high = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1444 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1444 * e_links_low = <int*> malloc(e_sent_len*sizeof(int)) * e_links_high = <int*> malloc(e_sent_len*sizeof(int)) * f_links_low = <int*> malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -48243,7 +51563,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_links_low = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1445 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1445 * e_links_high = <int*> malloc(e_sent_len*sizeof(int)) * f_links_low = <int*> malloc(f_sent_len*sizeof(int)) * f_links_high = <int*> malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -48252,7 +51572,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_links_high = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1446 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1446 * f_links_low = <int*> malloc(f_sent_len*sizeof(int)) * f_links_high = <int*> malloc(f_sent_len*sizeof(int)) * f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -48261,7 +51581,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1447 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1447 * f_links_high = <int*> malloc(f_sent_len*sizeof(int)) * f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) * f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -48270,7 +51590,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1448 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1448 * f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) * f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) * e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -48279,7 +51599,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1449 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1449 * f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) * e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) * e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -48288,7 +51608,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1450 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1450 * e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) * e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) * memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -48297,7 +51617,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ memset(__pyx_v_f_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1451 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1451 * e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) * memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) * memset(f_gap_high, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -48306,7 +51626,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ memset(__pyx_v_f_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1452 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1452 * memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) * memset(f_gap_high, 0, (num_chunks+1)*sizeof(int)) * memset(e_gap_low, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -48315,7 +51635,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ memset(__pyx_v_e_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1453 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1453 * memset(f_gap_high, 0, (num_chunks+1)*sizeof(int)) * memset(e_gap_low, 0, (num_chunks+1)*sizeof(int)) * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -48324,7 +51644,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ memset(__pyx_v_e_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1455 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1455 * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) * * reason_for_failure = "" # <<<<<<<<<<<<<< @@ -48334,7 +51654,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_INCREF(((PyObject *)__pyx_kp_s_45)); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_45); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1457 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1457 * reason_for_failure = "" * * for i from 0 <= i < e_sent_len: # <<<<<<<<<<<<<< @@ -48344,7 +51664,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = __pyx_v_e_sent_len; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1458 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1458 * * for i from 0 <= i < e_sent_len: * e_links_low[i] = -1 # <<<<<<<<<<<<<< @@ -48353,7 +51673,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_e_links_low[__pyx_v_i]) = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1459 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1459 * for i from 0 <= i < e_sent_len: * e_links_low[i] = -1 * e_links_high[i] = -1 # <<<<<<<<<<<<<< @@ -48363,7 +51683,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj (__pyx_v_e_links_high[__pyx_v_i]) = -1; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1460 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1460 * e_links_low[i] = -1 * e_links_high[i] = -1 * for i from 0 <= i < f_sent_len: # <<<<<<<<<<<<<< @@ -48373,7 +51693,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = __pyx_v_f_sent_len; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1461 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1461 * e_links_high[i] = -1 * for i from 0 <= i < f_sent_len: * f_links_low[i] = -1 # <<<<<<<<<<<<<< @@ -48382,7 +51702,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_links_low[__pyx_v_i]) = -1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1462 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1462 * for i from 0 <= i < f_sent_len: * f_links_low[i] = -1 * f_links_high[i] = -1 # <<<<<<<<<<<<<< @@ -48392,7 +51712,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj (__pyx_v_f_links_high[__pyx_v_i]) = -1; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1468 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1468 * # links that we care about (but then how to look up * # when we want to check something on the e side?) * i = 0 # <<<<<<<<<<<<<< @@ -48401,7 +51721,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1469 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1469 * # when we want to check something on the e side?) * i = 0 * while i < num_links*2: # <<<<<<<<<<<<<< @@ -48412,7 +51732,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_i < (__pyx_v_num_links * 2)); if (!__pyx_t_7) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1470 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1470 * i = 0 * while i < num_links*2: * f_i = sent_links[i] # <<<<<<<<<<<<<< @@ -48421,7 +51741,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_i = (__pyx_v_sent_links[__pyx_v_i]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1471 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1471 * while i < num_links*2: * f_i = sent_links[i] * e_i = sent_links[i+1] # <<<<<<<<<<<<<< @@ -48430,7 +51750,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_i = (__pyx_v_sent_links[(__pyx_v_i + 1)]); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1472 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1472 * f_i = sent_links[i] * e_i = sent_links[i+1] * if f_links_low[f_i] == -1 or f_links_low[f_i] > e_i: # <<<<<<<<<<<<<< @@ -48446,7 +51766,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1473 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1473 * e_i = sent_links[i+1] * if f_links_low[f_i] == -1 or f_links_low[f_i] > e_i: * f_links_low[f_i] = e_i # <<<<<<<<<<<<<< @@ -48458,7 +51778,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L14:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1474 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1474 * if f_links_low[f_i] == -1 or f_links_low[f_i] > e_i: * f_links_low[f_i] = e_i * if f_links_high[f_i] == -1 or f_links_high[f_i] < e_i + 1: # <<<<<<<<<<<<<< @@ -48474,7 +51794,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1475 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1475 * f_links_low[f_i] = e_i * if f_links_high[f_i] == -1 or f_links_high[f_i] < e_i + 1: * f_links_high[f_i] = e_i + 1 # <<<<<<<<<<<<<< @@ -48486,7 +51806,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L15:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1476 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1476 * if f_links_high[f_i] == -1 or f_links_high[f_i] < e_i + 1: * f_links_high[f_i] = e_i + 1 * if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i: # <<<<<<<<<<<<<< @@ -48502,7 +51822,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1477 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1477 * f_links_high[f_i] = e_i + 1 * if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i: * e_links_low[e_i] = f_i # <<<<<<<<<<<<<< @@ -48514,7 +51834,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L16:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1478 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1478 * if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i: * e_links_low[e_i] = f_i * if e_links_high[e_i] == -1 or e_links_high[e_i] < f_i + 1: # <<<<<<<<<<<<<< @@ -48530,7 +51850,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1479 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1479 * e_links_low[e_i] = f_i * if e_links_high[e_i] == -1 or e_links_high[e_i] < f_i + 1: * e_links_high[e_i] = f_i + 1 # <<<<<<<<<<<<<< @@ -48542,7 +51862,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L17:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1480 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1480 * if e_links_high[e_i] == -1 or e_links_high[e_i] < f_i + 1: * e_links_high[e_i] = f_i + 1 * i = i + 2 # <<<<<<<<<<<<<< @@ -48552,7 +51872,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_i = (__pyx_v_i + 2); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1482 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1482 * i = i + 2 * * als = [] # <<<<<<<<<<<<<< @@ -48560,11 +51880,11 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj * al = (matching.arr[x]-f_sent_start,f_links_low[matching.arr[x]-f_sent_start]) */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __pyx_v_als = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1483 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1483 * * als = [] * for x in range(matching.start,matching.end): # <<<<<<<<<<<<<< @@ -48575,7 +51895,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj for (__pyx_t_4 = __pyx_v_matching->start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_x = __pyx_t_4; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1484 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1484 * als = [] * for x in range(matching.start,matching.end): * al = (matching.arr[x]-f_sent_start,f_links_low[matching.arr[x]-f_sent_start]) # <<<<<<<<<<<<<< @@ -48587,7 +51907,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_1 = PyInt_FromLong((__pyx_v_f_links_low[((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); @@ -48598,20 +51918,17 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_al = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1485 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1485 * for x in range(matching.start,matching.end): * al = (matching.arr[x]-f_sent_start,f_links_low[matching.arr[x]-f_sent_start]) * als.append(al) # <<<<<<<<<<<<<< * # check all source-side alignment constraints * met_constraints = 1 */ - if (unlikely(((PyObject *)__pyx_v_als) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_11 = PyList_Append(__pyx_v_als, ((PyObject *)__pyx_v_al)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1487 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1487 * als.append(al) * # check all source-side alignment constraints * met_constraints = 1 # <<<<<<<<<<<<<< @@ -48620,7 +51937,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1488 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1488 * # check all source-side alignment constraints * met_constraints = 1 * if self.require_aligned_terminal: # <<<<<<<<<<<<<< @@ -48629,7 +51946,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_self->require_aligned_terminal) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1489 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1489 * met_constraints = 1 * if self.require_aligned_terminal: * num_aligned_chunks = 0 # <<<<<<<<<<<<<< @@ -48638,7 +51955,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_aligned_chunks = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1490 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1490 * if self.require_aligned_terminal: * num_aligned_chunks = 0 * for i from 0 <= i < num_chunks: # <<<<<<<<<<<<<< @@ -48648,7 +51965,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = __pyx_v_num_chunks; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1491 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1491 * num_aligned_chunks = 0 * for i from 0 <= i < num_chunks: * for j from 0 <= j < chunklen[i]: # <<<<<<<<<<<<<< @@ -48658,7 +51975,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_4 = (__pyx_v_chunklen[__pyx_v_i]); for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1492 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1492 * for i from 0 <= i < num_chunks: * for j from 0 <= j < chunklen[i]: * if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1: # <<<<<<<<<<<<<< @@ -48668,7 +51985,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_f_links_low[(((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + __pyx_v_j) - __pyx_v_f_sent_start)]) > -1); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1493 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1493 * for j from 0 <= j < chunklen[i]: * if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1: * num_aligned_chunks = num_aligned_chunks + 1 # <<<<<<<<<<<<<< @@ -48677,7 +51994,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_aligned_chunks = (__pyx_v_num_aligned_chunks + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1494 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1494 * if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1: * num_aligned_chunks = num_aligned_chunks + 1 * break # <<<<<<<<<<<<<< @@ -48692,7 +52009,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_L24_break:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1495 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1495 * num_aligned_chunks = num_aligned_chunks + 1 * break * if num_aligned_chunks == 0: # <<<<<<<<<<<<<< @@ -48702,7 +52019,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_num_aligned_chunks == 0); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1496 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1496 * break * if num_aligned_chunks == 0: * reason_for_failure = "No aligned terminals" # <<<<<<<<<<<<<< @@ -48713,7 +52030,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_127); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1497 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1497 * if num_aligned_chunks == 0: * reason_for_failure = "No aligned terminals" * met_constraints = 0 # <<<<<<<<<<<<<< @@ -48725,7 +52042,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L26:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1498 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1498 * reason_for_failure = "No aligned terminals" * met_constraints = 0 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: # <<<<<<<<<<<<<< @@ -48740,7 +52057,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1499 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1499 * met_constraints = 0 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: * reason_for_failure = "Unaligned chunk" # <<<<<<<<<<<<<< @@ -48751,7 +52068,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_128); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1500 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1500 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: * reason_for_failure = "Unaligned chunk" * met_constraints = 0 # <<<<<<<<<<<<<< @@ -48766,7 +52083,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L20:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1502 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1502 * met_constraints = 0 * * if met_constraints and self.tight_phrases: # <<<<<<<<<<<<<< @@ -48780,7 +52097,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1504 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1504 * if met_constraints and self.tight_phrases: * # outside edge constraints are checked later * for i from 0 <= i < num_chunks-1: # <<<<<<<<<<<<<< @@ -48790,7 +52107,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_12 = (__pyx_v_num_chunks - 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1505 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1505 * # outside edge constraints are checked later * for i from 0 <= i < num_chunks-1: * if f_links_low[matching.arr[matching.start+i]+chunklen[i]-f_sent_start] == -1: # <<<<<<<<<<<<<< @@ -48800,7 +52117,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_f_links_low[(((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + (__pyx_v_chunklen[__pyx_v_i])) - __pyx_v_f_sent_start)]) == -1); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1506 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1506 * for i from 0 <= i < num_chunks-1: * if f_links_low[matching.arr[matching.start+i]+chunklen[i]-f_sent_start] == -1: * reason_for_failure = "Gaps are not tight phrases" # <<<<<<<<<<<<<< @@ -48811,7 +52128,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_129); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1507 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1507 * if f_links_low[matching.arr[matching.start+i]+chunklen[i]-f_sent_start] == -1: * reason_for_failure = "Gaps are not tight phrases" * met_constraints = 0 # <<<<<<<<<<<<<< @@ -48820,7 +52137,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1508 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1508 * reason_for_failure = "Gaps are not tight phrases" * met_constraints = 0 * break # <<<<<<<<<<<<<< @@ -48832,7 +52149,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L31:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1509 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1509 * met_constraints = 0 * break * if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: # <<<<<<<<<<<<<< @@ -48842,7 +52159,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_f_links_low[(((__pyx_v_matching->arr[((__pyx_v_matching->start + __pyx_v_i) + 1)]) - 1) - __pyx_v_f_sent_start)]) == -1); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1510 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1510 * break * if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: * reason_for_failure = "Gaps are not tight phrases" # <<<<<<<<<<<<<< @@ -48853,7 +52170,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_129); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1511 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1511 * if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: * reason_for_failure = "Gaps are not tight phrases" * met_constraints = 0 # <<<<<<<<<<<<<< @@ -48862,7 +52179,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1512 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1512 * reason_for_failure = "Gaps are not tight phrases" * met_constraints = 0 * break # <<<<<<<<<<<<<< @@ -48879,7 +52196,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L28:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1514 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1514 * break * * f_low = matching.arr[matching.start] - f_sent_start # <<<<<<<<<<<<<< @@ -48888,7 +52205,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_low = ((__pyx_v_matching->arr[__pyx_v_matching->start]) - __pyx_v_f_sent_start); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1515 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1515 * * f_low = matching.arr[matching.start] - f_sent_start * f_high = matching.arr[matching.start + matching.size - 1] + chunklen[num_chunks-1] - f_sent_start # <<<<<<<<<<<<<< @@ -48897,7 +52214,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_high = (((__pyx_v_matching->arr[((__pyx_v_matching->start + __pyx_v_matching->size) - 1)]) + (__pyx_v_chunklen[(__pyx_v_num_chunks - 1)])) - __pyx_v_f_sent_start); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1516 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1516 * f_low = matching.arr[matching.start] - f_sent_start * f_high = matching.arr[matching.start + matching.size - 1] + chunklen[num_chunks-1] - f_sent_start * if met_constraints: # <<<<<<<<<<<<<< @@ -48906,7 +52223,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_met_constraints) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1518 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1518 * if met_constraints: * * if self.find_fixpoint(f_low, f_high, f_links_low, f_links_high, e_links_low, e_links_high, # <<<<<<<<<<<<<< @@ -48916,7 +52233,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_10 = PyInt_FromLong(__pyx_v_f_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1522 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1522 * self.train_max_initial_size, self.train_max_initial_size, * self.train_min_gap_size, 0, * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): # <<<<<<<<<<<<<< @@ -48927,7 +52244,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1523 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1523 * self.train_min_gap_size, 0, * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): * gap_error = 0 # <<<<<<<<<<<<<< @@ -48936,7 +52253,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_error = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1524 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1524 * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): * gap_error = 0 * num_gaps = 0 # <<<<<<<<<<<<<< @@ -48945,7 +52262,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_gaps = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1526 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1526 * num_gaps = 0 * * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -48955,7 +52272,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_f_back_low < __pyx_v_f_low); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1527 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1527 * * if f_back_low < f_low: * f_gap_low[0] = f_back_low # <<<<<<<<<<<<<< @@ -48964,7 +52281,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_low[0]) = __pyx_v_f_back_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1528 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1528 * if f_back_low < f_low: * f_gap_low[0] = f_back_low * f_gap_high[0] = f_low # <<<<<<<<<<<<<< @@ -48973,7 +52290,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_high[0]) = __pyx_v_f_low; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1529 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1529 * f_gap_low[0] = f_back_low * f_gap_high[0] = f_low * num_gaps = 1 # <<<<<<<<<<<<<< @@ -48982,7 +52299,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_gaps = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1530 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1530 * f_gap_high[0] = f_low * num_gaps = 1 * gap_start = 0 # <<<<<<<<<<<<<< @@ -48991,7 +52308,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_start = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1531 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1531 * num_gaps = 1 * gap_start = 0 * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< @@ -49000,7 +52317,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1532 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1532 * gap_start = 0 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: # <<<<<<<<<<<<<< @@ -49010,7 +52327,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_phrase_len > __pyx_v_self->max_length); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1533 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1533 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: * gap_error = 1 # <<<<<<<<<<<<<< @@ -49022,7 +52339,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L36:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1534 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1534 * if phrase_len > self.max_length: * gap_error = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -49031,7 +52348,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_self->tight_phrases) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1535 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1535 * gap_error = 1 * if self.tight_phrases: * if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1: # <<<<<<<<<<<<<< @@ -49047,7 +52364,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1536 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1536 * if self.tight_phrases: * if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1: * gap_error = 1 # <<<<<<<<<<<<<< @@ -49056,7 +52373,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_error = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1537 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1537 * if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1: * gap_error = 1 * reason_for_failure = "Inside edges of preceding subphrase are not tight" # <<<<<<<<<<<<<< @@ -49076,7 +52393,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1539 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1539 * reason_for_failure = "Inside edges of preceding subphrase are not tight" * else: * gap_start = 1 # <<<<<<<<<<<<<< @@ -49085,7 +52402,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_start = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1540 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1540 * else: * gap_start = 1 * if self.tight_phrases and f_links_low[f_low] == -1: # <<<<<<<<<<<<<< @@ -49100,7 +52417,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1543 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1543 * # this is not a hard error. we can't extract this phrase * # but we still might be able to extract a superphrase * met_constraints = 0 # <<<<<<<<<<<<<< @@ -49114,7 +52431,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L35:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1545 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1545 * met_constraints = 0 * * for i from 0 <= i < matching.size - 1: # <<<<<<<<<<<<<< @@ -49124,7 +52441,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_12 = (__pyx_v_matching->size - 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1546 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1546 * * for i from 0 <= i < matching.size - 1: * f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start # <<<<<<<<<<<<<< @@ -49133,7 +52450,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_low[(1 + __pyx_v_i)]) = (((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + (__pyx_v_chunklen[__pyx_v_i])) - __pyx_v_f_sent_start); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1547 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1547 * for i from 0 <= i < matching.size - 1: * f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start * f_gap_high[1+i] = matching.arr[matching.start+i+1] - f_sent_start # <<<<<<<<<<<<<< @@ -49142,7 +52459,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_high[(1 + __pyx_v_i)]) = ((__pyx_v_matching->arr[((__pyx_v_matching->start + __pyx_v_i) + 1)]) - __pyx_v_f_sent_start); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1548 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1548 * f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start * f_gap_high[1+i] = matching.arr[matching.start+i+1] - f_sent_start * num_gaps = num_gaps + 1 # <<<<<<<<<<<<<< @@ -49152,7 +52469,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1550 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1550 * num_gaps = num_gaps + 1 * * if f_high < f_back_high: # <<<<<<<<<<<<<< @@ -49162,7 +52479,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_f_high < __pyx_v_f_back_high); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1551 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1551 * * if f_high < f_back_high: * f_gap_low[gap_start+num_gaps] = f_high # <<<<<<<<<<<<<< @@ -49171,7 +52488,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_high; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1552 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1552 * if f_high < f_back_high: * f_gap_low[gap_start+num_gaps] = f_high * f_gap_high[gap_start+num_gaps] = f_back_high # <<<<<<<<<<<<<< @@ -49180,7 +52497,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_back_high; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1553 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1553 * f_gap_low[gap_start+num_gaps] = f_high * f_gap_high[gap_start+num_gaps] = f_back_high * num_gaps = num_gaps + 1 # <<<<<<<<<<<<<< @@ -49189,7 +52506,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1554 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1554 * f_gap_high[gap_start+num_gaps] = f_back_high * num_gaps = num_gaps + 1 * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< @@ -49198,7 +52515,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1555 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1555 * num_gaps = num_gaps + 1 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: # <<<<<<<<<<<<<< @@ -49208,7 +52525,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_phrase_len > __pyx_v_self->max_length); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1556 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1556 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: * gap_error = 1 # <<<<<<<<<<<<<< @@ -49220,7 +52537,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L43:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1557 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1557 * if phrase_len > self.max_length: * gap_error = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -49229,7 +52546,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_self->tight_phrases) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1558 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1558 * gap_error = 1 * if self.tight_phrases: * if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1: # <<<<<<<<<<<<<< @@ -49245,7 +52562,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1559 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1559 * if self.tight_phrases: * if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1: * gap_error = 1 # <<<<<<<<<<<<<< @@ -49254,7 +52571,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_error = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1560 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1560 * if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1: * gap_error = 1 * reason_for_failure = "Inside edges of following subphrase are not tight" # <<<<<<<<<<<<<< @@ -49274,7 +52591,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1562 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1562 * reason_for_failure = "Inside edges of following subphrase are not tight" * else: * if self.tight_phrases and f_links_low[f_high-1] == -1: # <<<<<<<<<<<<<< @@ -49289,7 +52606,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1563 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1563 * else: * if self.tight_phrases and f_links_low[f_high-1] == -1: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -49303,7 +52620,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L42:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1565 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1565 * met_constraints = 0 * * if gap_error == 0: # <<<<<<<<<<<<<< @@ -49313,7 +52630,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_gap_error == 0); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1566 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1566 * * if gap_error == 0: * e_word_count = e_high - e_low # <<<<<<<<<<<<<< @@ -49322,7 +52639,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_word_count = (__pyx_v_e_high - __pyx_v_e_low); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1567 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1567 * if gap_error == 0: * e_word_count = e_high - e_low * for i from 0 <= i < num_gaps: # check integrity of subphrases # <<<<<<<<<<<<<< @@ -49332,7 +52649,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = __pyx_v_num_gaps; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1568 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1568 * e_word_count = e_high - e_low * for i from 0 <= i < num_gaps: # check integrity of subphrases * if self.find_fixpoint(f_gap_low[gap_start+i], f_gap_high[gap_start+i], # <<<<<<<<<<<<<< @@ -49342,7 +52659,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_10 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1573 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1573 * f_gap_low+gap_start+i, f_gap_high+gap_start+i, * f_sent_len, e_sent_len, * self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<< @@ -49353,7 +52670,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1575 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1575 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0) == 0: * gap_error = 1 # <<<<<<<<<<<<<< @@ -49362,7 +52679,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_error = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1576 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1576 * 0, 0, 0, 0, 0, 0, 0) == 0: * gap_error = 1 * reason_for_failure = "Subphrase [%d, %d] failed integrity check" % (f_gap_low[gap_start+i], f_gap_high[gap_start+i]) # <<<<<<<<<<<<<< @@ -49374,7 +52691,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_1 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); @@ -49388,7 +52705,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_reason_for_failure = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1577 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1577 * gap_error = 1 * reason_for_failure = "Subphrase [%d, %d] failed integrity check" % (f_gap_low[gap_start+i], f_gap_high[gap_start+i]) * break # <<<<<<<<<<<<<< @@ -49405,7 +52722,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L47:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1579 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1579 * break * * if gap_error == 0: # <<<<<<<<<<<<<< @@ -49415,7 +52732,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_gap_error == 0); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1580 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1580 * * if gap_error == 0: * i = 1 # <<<<<<<<<<<<<< @@ -49424,7 +52741,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1581 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1581 * if gap_error == 0: * i = 1 * self.findexes.reset() # <<<<<<<<<<<<<< @@ -49438,7 +52755,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1582 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1582 * i = 1 * self.findexes.reset() * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -49448,7 +52765,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_f_back_low < __pyx_v_f_low); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1583 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1583 * self.findexes.reset() * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -49457,7 +52774,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1584 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1584 * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -49466,7 +52783,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = (__pyx_v_i + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1585 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1585 * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -49483,7 +52800,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L52:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1586 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1586 * i = i+1 * self.findexes.append(sym_setindex(self.category, i)) * self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<< @@ -49493,7 +52810,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1586; __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[8]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->findexes1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); @@ -49503,7 +52820,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1587 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1587 * self.findexes.append(sym_setindex(self.category, i)) * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -49513,7 +52830,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1588 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1588 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<< @@ -49523,7 +52840,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1589 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1589 * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -49532,7 +52849,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1590 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1590 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -49544,7 +52861,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1592 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1592 * i = i + 1 * else: * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< @@ -49556,7 +52873,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_L55:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1593 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1593 * else: * fphr_arr._append(phrase.syms[j]) * if f_back_high > f_high: # <<<<<<<<<<<<<< @@ -49566,7 +52883,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_f_back_high > __pyx_v_f_high); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1594 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1594 * fphr_arr._append(phrase.syms[j]) * if f_back_high > f_high: * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -49575,7 +52892,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1595 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1595 * if f_back_high > f_high: * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -49592,7 +52909,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L56:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1597 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1597 * self.findexes.append(sym_setindex(self.category, i)) * * fphr = Phrase(fphr_arr) # <<<<<<<<<<<<<< @@ -49600,7 +52917,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj * phrase_list = self.extract_phrases(e_low, e_high, e_gap_low + gap_start, e_gap_high + gap_start, e_links_low, num_gaps, */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_fphr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); @@ -49610,7 +52927,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_10); __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1598 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1598 * * fphr = Phrase(fphr_arr) * if met_constraints: # <<<<<<<<<<<<<< @@ -49619,7 +52936,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_met_constraints) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1601 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1601 * phrase_list = self.extract_phrases(e_low, e_high, e_gap_low + gap_start, e_gap_high + gap_start, e_links_low, num_gaps, * f_back_low, f_back_high, f_gap_low + gap_start, f_gap_high + gap_start, f_links_low, * matching.sent_id, e_sent_len, e_sent_start) # <<<<<<<<<<<<<< @@ -49631,7 +52948,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_phrase_list = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1602 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1602 * f_back_low, f_back_high, f_gap_low + gap_start, f_gap_high + gap_start, f_links_low, * matching.sent_id, e_sent_len, e_sent_start) * if len(phrase_list) > 0: # <<<<<<<<<<<<<< @@ -49642,7 +52959,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_t_13 > 0); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1603 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1603 * matching.sent_id, e_sent_len, e_sent_start) * if len(phrase_list) > 0: * pair_count = 1.0 / len(phrase_list) # <<<<<<<<<<<<<< @@ -49659,7 +52976,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1605 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1605 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -49668,7 +52985,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_pair_count = 0.0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1606 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1606 * else: * pair_count = 0 * reason_for_failure = "Didn't extract anything from [%d, %d] -> [%d, %d]" % (f_back_low, f_back_high, e_low, e_high) # <<<<<<<<<<<<<< @@ -49684,7 +53001,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_14 = PyInt_FromLong(__pyx_v_e_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2); @@ -49706,7 +53023,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L58:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1607 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1607 * pair_count = 0 * reason_for_failure = "Didn't extract anything from [%d, %d] -> [%d, %d]" % (f_back_low, f_back_high, e_low, e_high) * for (phrase2,eindexes) in phrase_list: # <<<<<<<<<<<<<< @@ -49722,12 +53039,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_14)) { + if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_14)) { if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_14)) break; - __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; - } else if (PyTuple_CheckExact(__pyx_t_14)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_14)) { if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_14)) break; - __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_15 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_15)) { @@ -49741,27 +53066,33 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) { PyObject* sequence = __pyx_t_15; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); @@ -49772,12 +53103,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj index = 1; __pyx_t_2 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L61_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L62_unpacking_done; __pyx_L61_unpacking_failed:; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L62_unpacking_done:; } @@ -49788,7 +53120,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_eindexes = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1608 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1608 * reason_for_failure = "Didn't extract anything from [%d, %d] -> [%d, %d]" % (f_back_low, f_back_high, e_low, e_high) * for (phrase2,eindexes) in phrase_list: * als1 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<< @@ -49804,7 +53136,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_als1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1609 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1609 * for (phrase2,eindexes) in phrase_list: * als1 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) * extracts.append((fphr, phrase2, pair_count, tuple(als1))) # <<<<<<<<<<<<<< @@ -49814,7 +53146,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_als1)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_als1)); @@ -49822,7 +53154,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr)); @@ -49845,7 +53177,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L57:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1611 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1611 * extracts.append((fphr, phrase2, pair_count, tuple(als1))) * * if (num_gaps < self.max_nonterminals and # <<<<<<<<<<<<<< @@ -49855,7 +53187,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_num_gaps < __pyx_v_self->max_nonterminals); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1612 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1612 * * if (num_gaps < self.max_nonterminals and * phrase_len < self.max_length and # <<<<<<<<<<<<<< @@ -49865,7 +53197,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_phrase_len < __pyx_v_self->max_length); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1613 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1613 * if (num_gaps < self.max_nonterminals and * phrase_len < self.max_length and * f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size): # <<<<<<<<<<<<<< @@ -49883,7 +53215,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1614 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1614 * phrase_len < self.max_length and * f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size): * if (f_back_low == f_low and # <<<<<<<<<<<<<< @@ -49893,7 +53225,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_f_back_low == __pyx_v_f_low); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1615 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1615 * f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size): * if (f_back_low == f_low and * f_low >= self.train_min_gap_size and # <<<<<<<<<<<<<< @@ -49903,7 +53235,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (__pyx_v_f_low >= __pyx_v_self->train_min_gap_size); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1616 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1616 * if (f_back_low == f_low and * f_low >= self.train_min_gap_size and * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_back_high-1] != -1))): # <<<<<<<<<<<<<< @@ -49933,7 +53265,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1617 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1617 * f_low >= self.train_min_gap_size and * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_back_high-1] != -1))): * f_x_low = f_low-self.train_min_gap_size # <<<<<<<<<<<<<< @@ -49942,7 +53274,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1618 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1618 * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_back_high-1] != -1))): * f_x_low = f_low-self.train_min_gap_size * met_constraints = 1 # <<<<<<<<<<<<<< @@ -49951,7 +53283,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1619 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1619 * f_x_low = f_low-self.train_min_gap_size * met_constraints = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -49960,7 +53292,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_self->tight_phrases) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1620 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1620 * met_constraints = 1 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: # <<<<<<<<<<<<<< @@ -49977,7 +53309,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (!__pyx_t_18) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1621 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1621 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: * f_x_low = f_x_low - 1 # <<<<<<<<<<<<<< @@ -49990,7 +53322,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L65:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1622 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1622 * while f_x_low >= 0 and f_links_low[f_x_low] == -1: * f_x_low = f_x_low - 1 * if f_x_low < 0 or f_back_high - f_x_low > self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -50006,7 +53338,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1623 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1623 * f_x_low = f_x_low - 1 * if f_x_low < 0 or f_back_high - f_x_low > self.train_max_initial_size: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -50018,7 +53350,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L68:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1625 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1625 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -50027,7 +53359,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_met_constraints) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1626 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1626 * * if (met_constraints and * self.find_fixpoint(f_x_low, f_back_high, # <<<<<<<<<<<<<< @@ -50037,7 +53369,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_14 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1630 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1630 * e_low, e_high, &e_x_low, &e_x_high, &f_x_low, &f_x_high, * f_sent_len, e_sent_len, * self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<< @@ -50047,7 +53379,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 1, 1, 0, 1, 0)) { __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1632 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1632 * self.train_max_initial_size, self.train_max_initial_size, * 1, 1, 1, 1, 0, 1, 0) and * ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and # <<<<<<<<<<<<<< @@ -50063,7 +53395,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1633 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1633 * 1, 1, 1, 1, 0, 1, 0) and * ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and * self.find_fixpoint(f_x_low, f_low, # check integrity of new subphrase # <<<<<<<<<<<<<< @@ -50073,7 +53405,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_1 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1637 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1637 * -1, -1, e_gap_low, e_gap_high, f_gap_low, f_gap_high, * f_sent_len, e_sent_len, * self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<< @@ -50096,7 +53428,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1639 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1639 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() # <<<<<<<<<<<<<< @@ -50105,7 +53437,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1640 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1640 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -50114,7 +53446,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1641 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1641 * fphr_arr._clear() * i = 1 * self.findexes.reset() # <<<<<<<<<<<<<< @@ -50128,7 +53460,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1642 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1642 * i = 1 * self.findexes.reset() * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50142,7 +53474,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1643 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1643 * self.findexes.reset() * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50151,7 +53483,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1644 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1644 * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -50160,7 +53492,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = (__pyx_v_i + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1645 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1645 * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 * self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<< @@ -50170,7 +53502,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_14 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->findexes1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); @@ -50180,7 +53512,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1646 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1646 * i = i+1 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -50190,7 +53522,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1647 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1647 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<< @@ -50200,7 +53532,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1648 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1648 * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50209,7 +53541,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1649 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1649 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -50221,7 +53553,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1651 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1651 * i = i + 1 * else: * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< @@ -50233,7 +53565,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_L72:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1652 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1652 * else: * fphr_arr._append(phrase.syms[j]) * if f_back_high > f_high: # <<<<<<<<<<<<<< @@ -50243,7 +53575,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_f_back_high > __pyx_v_f_high); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1653 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1653 * fphr_arr._append(phrase.syms[j]) * if f_back_high > f_high: * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50252,7 +53584,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1654 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1654 * if f_back_high > f_high: * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50269,7 +53601,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L73:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1655 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1655 * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) * fphr = Phrase(fphr_arr) # <<<<<<<<<<<<<< @@ -50277,7 +53609,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj * f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, matching.sent_id, */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); @@ -50288,7 +53620,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_15); __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1658 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1658 * phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low, e_gap_high, e_links_low, num_gaps+1, * f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, matching.sent_id, * e_sent_len, e_sent_start) # <<<<<<<<<<<<<< @@ -50301,7 +53633,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_phrase_list = __pyx_t_15; __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1659 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1659 * f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, matching.sent_id, * e_sent_len, e_sent_start) * if len(phrase_list) > 0: # <<<<<<<<<<<<<< @@ -50312,7 +53644,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_t_13 > 0); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1660 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1660 * e_sent_len, e_sent_start) * if len(phrase_list) > 0: * pair_count = 1.0 / len(phrase_list) # <<<<<<<<<<<<<< @@ -50329,7 +53661,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1662 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1662 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -50340,7 +53672,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L74:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1663 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1663 * else: * pair_count = 0 * for phrase2,eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -50356,12 +53688,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_15)) { + if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_15)) { if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_15)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; - } else if (PyTuple_CheckExact(__pyx_t_15)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_15)) { if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_15)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_1 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_1)) { @@ -50375,27 +53715,33 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_14 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); @@ -50406,12 +53752,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj index = 1; __pyx_t_2 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L77_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L78_unpacking_done; __pyx_L77_unpacking_failed:; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L78_unpacking_done:; } @@ -50422,7 +53769,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_eindexes = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1664 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1664 * pair_count = 0 * for phrase2,eindexes in phrase_list: * als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<< @@ -50438,7 +53785,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_als2 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1665 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1665 * for phrase2,eindexes in phrase_list: * als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) * extracts.append((fphr, phrase2, pair_count, tuple(als2))) # <<<<<<<<<<<<<< @@ -50448,7 +53795,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_als2)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_als2)); __Pyx_GIVEREF(((PyObject *)__pyx_v_als2)); @@ -50456,7 +53803,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr)); @@ -50482,7 +53829,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L64:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1667 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1667 * extracts.append((fphr, phrase2, pair_count, tuple(als2))) * * if (f_back_high == f_high and # <<<<<<<<<<<<<< @@ -50492,7 +53839,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_f_back_high == __pyx_v_f_high); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1668 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1668 * * if (f_back_high == f_high and * f_sent_len - f_high >= self.train_min_gap_size and # <<<<<<<<<<<<<< @@ -50502,7 +53849,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_f_sent_len - __pyx_v_f_high) >= __pyx_v_self->train_min_gap_size); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1669 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1669 * if (f_back_high == f_high and * f_sent_len - f_high >= self.train_min_gap_size and * ((not self.tight_phrases) or (f_links_low[f_high] != -1 and f_links_low[f_back_low] != -1))): # <<<<<<<<<<<<<< @@ -50532,7 +53879,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1670 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1670 * f_sent_len - f_high >= self.train_min_gap_size and * ((not self.tight_phrases) or (f_links_low[f_high] != -1 and f_links_low[f_back_low] != -1))): * f_x_high = f_high+self.train_min_gap_size # <<<<<<<<<<<<<< @@ -50541,7 +53888,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1671 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1671 * ((not self.tight_phrases) or (f_links_low[f_high] != -1 and f_links_low[f_back_low] != -1))): * f_x_high = f_high+self.train_min_gap_size * met_constraints = 1 # <<<<<<<<<<<<<< @@ -50550,7 +53897,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1672 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1672 * f_x_high = f_high+self.train_min_gap_size * met_constraints = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -50559,7 +53906,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_self->tight_phrases) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1673 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1673 * met_constraints = 1 * if self.tight_phrases: * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: # <<<<<<<<<<<<<< @@ -50576,7 +53923,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (!__pyx_t_18) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1674 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1674 * if self.tight_phrases: * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: * f_x_high = f_x_high + 1 # <<<<<<<<<<<<<< @@ -50589,7 +53936,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L80:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1675 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1675 * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: * f_x_high = f_x_high + 1 * if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -50605,7 +53952,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1676 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1676 * f_x_high = f_x_high + 1 * if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -50617,7 +53964,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L83:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1678 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1678 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -50626,7 +53973,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_met_constraints) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1679 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1679 * * if (met_constraints and * self.find_fixpoint(f_back_low, f_x_high, # <<<<<<<<<<<<<< @@ -50636,7 +53983,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1683 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1683 * e_low, e_high, &e_x_low, &e_x_high, &f_x_low, &f_x_high, * f_sent_len, e_sent_len, * self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<< @@ -50646,7 +53993,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_back_low, __pyx_t_15, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 1, 0, 1, 1, 0)) { __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1685 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1685 * self.train_max_initial_size, self.train_max_initial_size, * 1, 1, 1, 0, 1, 1, 0) and * ((not self.tight_phrases) or f_links_low[f_x_high-1] != -1) and # <<<<<<<<<<<<<< @@ -50662,7 +54009,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1686 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1686 * 1, 1, 1, 0, 1, 1, 0) and * ((not self.tight_phrases) or f_links_low[f_x_high-1] != -1) and * self.find_fixpoint(f_high, f_x_high, # <<<<<<<<<<<<<< @@ -50672,7 +54019,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_14 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1691 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1691 * f_gap_low+gap_start+num_gaps, f_gap_high+gap_start+num_gaps, * f_sent_len, e_sent_len, * self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<< @@ -50695,7 +54042,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1693 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1693 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() # <<<<<<<<<<<<<< @@ -50704,7 +54051,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1694 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1694 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -50713,7 +54060,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1695 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1695 * fphr_arr._clear() * i = 1 * self.findexes.reset() # <<<<<<<<<<<<<< @@ -50727,7 +54074,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1696 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1696 * i = 1 * self.findexes.reset() * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -50737,7 +54084,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_f_back_low < __pyx_v_f_low); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1697 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1697 * self.findexes.reset() * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50746,7 +54093,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1698 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1698 * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -50755,7 +54102,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = (__pyx_v_i + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1699 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1699 * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50772,7 +54119,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L85:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1700 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1700 * i = i+1 * self.findexes.append(sym_setindex(self.category, i)) * self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<< @@ -50782,7 +54129,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_self->findexes1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); @@ -50792,7 +54139,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1701 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1701 * self.findexes.append(sym_setindex(self.category, i)) * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -50802,7 +54149,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1702 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1702 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<< @@ -50812,7 +54159,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1703 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1703 * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50821,7 +54168,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1704 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1704 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -50833,7 +54180,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1706 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1706 * i = i + 1 * else: * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< @@ -50845,7 +54192,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_L88:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1707 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1707 * else: * fphr_arr._append(phrase.syms[j]) * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50854,7 +54201,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1708 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1708 * fphr_arr._append(phrase.syms[j]) * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -50868,7 +54215,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1709 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1709 * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) * fphr = Phrase(fphr_arr) # <<<<<<<<<<<<<< @@ -50876,7 +54223,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj * f_x_low, f_x_high, f_gap_low+gap_start, f_gap_high+gap_start, f_links_low, */ __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_fphr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); @@ -50887,7 +54234,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1712 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1712 * phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low+gap_start, e_gap_high+gap_start, e_links_low, num_gaps+1, * f_x_low, f_x_high, f_gap_low+gap_start, f_gap_high+gap_start, f_links_low, * matching.sent_id, e_sent_len, e_sent_start) # <<<<<<<<<<<<<< @@ -50900,7 +54247,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_phrase_list = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1713 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1713 * f_x_low, f_x_high, f_gap_low+gap_start, f_gap_high+gap_start, f_links_low, * matching.sent_id, e_sent_len, e_sent_start) * if len(phrase_list) > 0: # <<<<<<<<<<<<<< @@ -50911,7 +54258,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_t_13 > 0); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1714 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1714 * matching.sent_id, e_sent_len, e_sent_start) * if len(phrase_list) > 0: * pair_count = 1.0 / len(phrase_list) # <<<<<<<<<<<<<< @@ -50928,7 +54275,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1716 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1716 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -50939,7 +54286,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L89:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1717 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1717 * else: * pair_count = 0 * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -50955,12 +54302,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_14 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_14 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_14)) { @@ -50974,27 +54329,33 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) { PyObject* sequence = __pyx_t_14; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_15 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); @@ -51005,12 +54366,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj index = 1; __pyx_t_2 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L92_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L93_unpacking_done; __pyx_L92_unpacking_failed:; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L93_unpacking_done:; } @@ -51021,7 +54383,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_eindexes = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1718 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1718 * pair_count = 0 * for phrase2, eindexes in phrase_list: * als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<< @@ -51037,7 +54399,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_als3 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1719 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1719 * for phrase2, eindexes in phrase_list: * als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) * extracts.append((fphr, phrase2, pair_count, tuple(als3))) # <<<<<<<<<<<<<< @@ -51047,7 +54409,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_v_als3)); PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_als3)); __Pyx_GIVEREF(((PyObject *)__pyx_v_als3)); @@ -51055,7 +54417,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_fphr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr)); @@ -51081,7 +54443,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L79:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1720 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1720 * als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) * extracts.append((fphr, phrase2, pair_count, tuple(als3))) * if (num_gaps < self.max_nonterminals - 1 and # <<<<<<<<<<<<<< @@ -51091,7 +54453,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_num_gaps < (__pyx_v_self->max_nonterminals - 1)); if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1721 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1721 * extracts.append((fphr, phrase2, pair_count, tuple(als3))) * if (num_gaps < self.max_nonterminals - 1 and * phrase_len+1 < self.max_length and # <<<<<<<<<<<<<< @@ -51101,7 +54463,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_phrase_len + 1) < __pyx_v_self->max_length); if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1722 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1722 * if (num_gaps < self.max_nonterminals - 1 and * phrase_len+1 < self.max_length and * f_back_high == f_high and # <<<<<<<<<<<<<< @@ -51111,7 +54473,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_18 = (__pyx_v_f_back_high == __pyx_v_f_high); if (__pyx_t_18) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1723 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1723 * phrase_len+1 < self.max_length and * f_back_high == f_high and * f_back_low == f_low and # <<<<<<<<<<<<<< @@ -51121,7 +54483,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_8 = (__pyx_v_f_back_low == __pyx_v_f_low); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1724 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1724 * f_back_high == f_high and * f_back_low == f_low and * f_back_high - f_back_low + (2*self.train_min_gap_size) <= self.train_max_initial_size and # <<<<<<<<<<<<<< @@ -51131,7 +54493,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_19 = (((__pyx_v_f_back_high - __pyx_v_f_back_low) + (2 * __pyx_v_self->train_min_gap_size)) <= __pyx_v_self->train_max_initial_size); if (__pyx_t_19) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1725 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1725 * f_back_low == f_low and * f_back_high - f_back_low + (2*self.train_min_gap_size) <= self.train_max_initial_size and * f_low >= self.train_min_gap_size and # <<<<<<<<<<<<<< @@ -51141,7 +54503,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_20 = (__pyx_v_f_low >= __pyx_v_self->train_min_gap_size); if (__pyx_t_20) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1726 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1726 * f_back_high - f_back_low + (2*self.train_min_gap_size) <= self.train_max_initial_size and * f_low >= self.train_min_gap_size and * f_high <= f_sent_len - self.train_min_gap_size and # <<<<<<<<<<<<<< @@ -51151,7 +54513,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_21 = (__pyx_v_f_high <= (__pyx_v_f_sent_len - __pyx_v_self->train_min_gap_size)); if (__pyx_t_21) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1727 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1727 * f_low >= self.train_min_gap_size and * f_high <= f_sent_len - self.train_min_gap_size and * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))): # <<<<<<<<<<<<<< @@ -51201,7 +54563,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1729 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1729 * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))): * * met_constraints = 1 # <<<<<<<<<<<<<< @@ -51210,7 +54572,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1730 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1730 * * met_constraints = 1 * f_x_low = f_low-self.train_min_gap_size # <<<<<<<<<<<<<< @@ -51219,7 +54581,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1731 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1731 * met_constraints = 1 * f_x_low = f_low-self.train_min_gap_size * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -51228,7 +54590,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_self->tight_phrases) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1732 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1732 * f_x_low = f_low-self.train_min_gap_size * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: # <<<<<<<<<<<<<< @@ -51245,7 +54607,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (!__pyx_t_18) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1733 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1733 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: * f_x_low = f_x_low - 1 # <<<<<<<<<<<<<< @@ -51258,7 +54620,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L95:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1734 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1734 * while f_x_low >= 0 and f_links_low[f_x_low] == -1: * f_x_low = f_x_low - 1 * if f_x_low < 0: # <<<<<<<<<<<<<< @@ -51268,7 +54630,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_18 = (__pyx_v_f_x_low < 0); if (__pyx_t_18) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1735 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1735 * f_x_low = f_x_low - 1 * if f_x_low < 0: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -51280,7 +54642,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L98:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1737 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1737 * met_constraints = 0 * * f_x_high = f_high+self.train_min_gap_size # <<<<<<<<<<<<<< @@ -51289,7 +54651,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1738 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1738 * * f_x_high = f_high+self.train_min_gap_size * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -51298,7 +54660,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_self->tight_phrases) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1739 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1739 * f_x_high = f_high+self.train_min_gap_size * if self.tight_phrases: * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: # <<<<<<<<<<<<<< @@ -51315,7 +54677,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (!__pyx_t_9) break; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1740 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1740 * if self.tight_phrases: * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: * f_x_high = f_x_high + 1 # <<<<<<<<<<<<<< @@ -51328,7 +54690,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L99:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1741 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1741 * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: * f_x_high = f_x_high + 1 * if f_x_high > f_sent_len or f_x_high - f_x_low > self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -51344,7 +54706,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1742 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1742 * f_x_high = f_x_high + 1 * if f_x_high > f_sent_len or f_x_high - f_x_low > self.train_max_initial_size: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -51356,7 +54718,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L102:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1744 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1744 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -51365,7 +54727,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if (__pyx_v_met_constraints) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1745 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1745 * * if (met_constraints and * self.find_fixpoint(f_x_low, f_x_high, # <<<<<<<<<<<<<< @@ -51375,7 +54737,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1749 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1749 * e_low, e_high, &e_x_low, &e_x_high, &f_x_low, &f_x_high, * f_sent_len, e_sent_len, * self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<< @@ -51385,7 +54747,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_1, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 2, 1, 1, 1, 1)) { __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1751 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1751 * self.train_max_initial_size, self.train_max_initial_size, * 1, 1, 2, 1, 1, 1, 1) and * ((not self.tight_phrases) or (f_links_low[f_x_low] != -1 and f_links_low[f_x_high-1] != -1)) and # <<<<<<<<<<<<<< @@ -51407,7 +54769,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1752 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1752 * 1, 1, 2, 1, 1, 1, 1) and * ((not self.tight_phrases) or (f_links_low[f_x_low] != -1 and f_links_low[f_x_high-1] != -1)) and * self.find_fixpoint(f_x_low, f_low, # <<<<<<<<<<<<<< @@ -51417,7 +54779,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_15 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1756 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1756 * -1, -1, e_gap_low, e_gap_high, f_gap_low, f_gap_high, * f_sent_len, e_sent_len, * self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<< @@ -51428,7 +54790,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_3) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1758 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1758 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0) and * self.find_fixpoint(f_high, f_x_high, # <<<<<<<<<<<<<< @@ -51438,7 +54800,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1763 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1763 * f_gap_low+1+num_gaps, f_gap_high+1+num_gaps, * f_sent_len, e_sent_len, * self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<< @@ -51466,7 +54828,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1765 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1765 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() # <<<<<<<<<<<<<< @@ -51475,7 +54837,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1766 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1766 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -51484,7 +54846,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1767 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1767 * fphr_arr._clear() * i = 1 * self.findexes.reset() # <<<<<<<<<<<<<< @@ -51498,7 +54860,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1768 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1768 * i = 1 * self.findexes.reset() * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -51512,7 +54874,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1769 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1769 * self.findexes.reset() * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -51521,7 +54883,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1770 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1770 * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -51530,7 +54892,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = (__pyx_v_i + 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1771 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1771 * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 * self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<< @@ -51540,7 +54902,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_self->findexes1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); @@ -51550,7 +54912,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1772 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1772 * i = i+1 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -51560,7 +54922,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1773 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1773 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<< @@ -51570,7 +54932,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_4 = __pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])); if (__pyx_t_4) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1774 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1774 * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -51579,7 +54941,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1775 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1775 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -51591,7 +54953,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1777 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1777 * i = i + 1 * else: * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< @@ -51603,7 +54965,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_L106:; } - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1778 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1778 * else: * fphr_arr._append(phrase.syms[j]) * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -51612,7 +54974,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1779 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1779 * fphr_arr._append(phrase.syms[j]) * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< @@ -51626,7 +54988,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1780 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1780 * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) * fphr = Phrase(fphr_arr) # <<<<<<<<<<<<<< @@ -51634,7 +54996,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj * f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, */ __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); @@ -51645,7 +55007,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_14); __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1783 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1783 * phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low, e_gap_high, e_links_low, num_gaps+2, * f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, * matching.sent_id, e_sent_len, e_sent_start) # <<<<<<<<<<<<<< @@ -51658,7 +55020,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_phrase_list = __pyx_t_14; __pyx_t_14 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1784 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1784 * f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, * matching.sent_id, e_sent_len, e_sent_start) * if len(phrase_list) > 0: # <<<<<<<<<<<<<< @@ -51669,7 +55031,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_8 = (__pyx_t_13 > 0); if (__pyx_t_8) { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1785 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1785 * matching.sent_id, e_sent_len, e_sent_start) * if len(phrase_list) > 0: * pair_count = 1.0 / len(phrase_list) # <<<<<<<<<<<<<< @@ -51686,7 +55048,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1787 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1787 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -51697,7 +55059,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L107:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1788 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1788 * else: * pair_count = 0 * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -51713,12 +55075,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_14)) { + if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_14)) { if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_14)) break; - __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; - } else if (PyTuple_CheckExact(__pyx_t_14)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_14)) { if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_14)) break; - __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_15 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_15)) { @@ -51732,27 +55102,33 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) { PyObject* sequence = __pyx_t_15; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); @@ -51763,12 +55139,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj index = 1; __pyx_t_2 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L110_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L111_unpacking_done; __pyx_L110_unpacking_failed:; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L111_unpacking_done:; } @@ -51779,7 +55156,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_eindexes = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1789 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1789 * pair_count = 0 * for phrase2, eindexes in phrase_list: * als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<< @@ -51795,7 +55172,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_als4 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1790 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1790 * for phrase2, eindexes in phrase_list: * als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) * extracts.append((fphr, phrase2, pair_count, tuple(als4))) # <<<<<<<<<<<<<< @@ -51805,7 +55182,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_als4)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als4)); __Pyx_GIVEREF(((PyObject *)__pyx_v_als4)); @@ -51813,7 +55190,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr)); @@ -51848,7 +55225,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1792 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1792 * extracts.append((fphr, phrase2, pair_count, tuple(als4))) * else: * reason_for_failure = "Unable to extract basic phrase" # <<<<<<<<<<<<<< @@ -51864,7 +55241,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L33:; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1794 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1794 * reason_for_failure = "Unable to extract basic phrase" * * free(sent_links) # <<<<<<<<<<<<<< @@ -51873,7 +55250,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_sent_links); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1795 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1795 * * free(sent_links) * free(f_links_low) # <<<<<<<<<<<<<< @@ -51882,7 +55259,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_f_links_low); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1796 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1796 * free(sent_links) * free(f_links_low) * free(f_links_high) # <<<<<<<<<<<<<< @@ -51891,7 +55268,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_f_links_high); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1797 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1797 * free(f_links_low) * free(f_links_high) * free(e_links_low) # <<<<<<<<<<<<<< @@ -51900,7 +55277,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_e_links_low); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1798 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1798 * free(f_links_high) * free(e_links_low) * free(e_links_high) # <<<<<<<<<<<<<< @@ -51909,7 +55286,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_e_links_high); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1799 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1799 * free(e_links_low) * free(e_links_high) * free(f_gap_low) # <<<<<<<<<<<<<< @@ -51918,7 +55295,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_f_gap_low); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1800 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1800 * free(e_links_high) * free(f_gap_low) * free(f_gap_high) # <<<<<<<<<<<<<< @@ -51927,7 +55304,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_f_gap_high); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1801 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1801 * free(f_gap_low) * free(f_gap_high) * free(e_gap_low) # <<<<<<<<<<<<<< @@ -51936,7 +55313,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_e_gap_low); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1802 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1802 * free(f_gap_high) * free(e_gap_low) * free(e_gap_high) # <<<<<<<<<<<<<< @@ -51945,7 +55322,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_e_gap_high); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1804 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1804 * free(e_gap_high) * * return extracts # <<<<<<<<<<<<<< @@ -51985,7 +55362,21 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":7 +/* Python wrapper */ +static int __pyx_pw_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_3_sa_13FeatureVector___cinit__(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":7 * * cdef class FeatureVector: * def __cinit__(self): # <<<<<<<<<<<<<< @@ -51993,8 +55384,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) */ -static int __pyx_pf_3_sa_13FeatureVector___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_13FeatureVector___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -52003,12 +55393,9 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(PyObject *__pyx_v_self, PyObj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":8 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":8 * cdef class FeatureVector: * def __cinit__(self): * self.names = IntList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<< @@ -52020,7 +55407,7 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(PyObject *__pyx_v_self, PyObj __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__INCREMENT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); @@ -52031,12 +55418,12 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(PyObject *__pyx_v_self, PyObj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)->names); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)->names)); - ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)->names = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->names); + __Pyx_DECREF(((PyObject *)__pyx_v_self->names)); + __pyx_v_self->names = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":9 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":9 * def __cinit__(self): * self.names = IntList(INITIAL_CAPACITY, INCREMENT) * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<< @@ -52048,7 +55435,7 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(PyObject *__pyx_v_self, PyObj __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__INCREMENT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); @@ -52059,9 +55446,9 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(PyObject *__pyx_v_self, PyObj __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)->values); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)->values)); - ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)->values = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->values); + __Pyx_DECREF(((PyObject *)__pyx_v_self->values)); + __pyx_v_self->values = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_3); __pyx_t_3 = 0; __pyx_r = 0; @@ -52077,52 +55464,39 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":11 - * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) - * - * def set(self, unsigned name, float value): # <<<<<<<<<<<<<< - * self.names.append(name) - * self.values.append(value) - */ - -static PyObject *__pyx_pf_3_sa_13FeatureVector_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_3_sa_13FeatureVector_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { unsigned int __pyx_v_name; float __pyx_v_value; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__value,0}; - __Pyx_RefNannySetupContext("set"); + __Pyx_RefNannySetupContext("set (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__value,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -52131,7 +55505,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_1set(PyObject *__pyx_v_self, PyOb values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_name = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_name == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_value = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; @@ -52141,8 +55515,30 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_1set(PyObject *__pyx_v_self, PyOb __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_3_sa_13FeatureVector_2set(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self), __pyx_v_name, __pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":12 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":11 + * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) + * + * def set(self, unsigned name, float value): # <<<<<<<<<<<<<< + * self.names.append(name) + * self.values.append(value) + */ + +static PyObject *__pyx_pf_3_sa_13FeatureVector_2set(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set", 0); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":12 * * def set(self, unsigned name, float value): * self.names.append(name) # <<<<<<<<<<<<<< @@ -52151,12 +55547,12 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_1set(PyObject *__pyx_v_self, PyOb */ __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)->names), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->names), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":13 * def set(self, unsigned name, float value): * self.names.append(name) * self.values.append(value) # <<<<<<<<<<<<<< @@ -52165,7 +55561,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_1set(PyObject *__pyx_v_self, PyOb */ __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)->values), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->values), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -52182,9 +55578,20 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_1set(PyObject *__pyx_v_self, PyOb __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_13FeatureVector_3generator5(struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_13FeatureVector_4__iter__(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":15 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":15 * self.values.append(value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -52192,36 +55599,45 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_3generator5(struct __pyx_obj_3_sa * for i in range(self.names.len): */ -static PyObject *__pyx_pf_3_sa_13FeatureVector_2__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_13FeatureVector_2__iter__(PyObject *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__"); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *)__pyx_ptype_3_sa___pyx_scope_struct_9___iter__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_9___iter__, __pyx_empty_tuple, NULL); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *)__pyx_ptype_3_sa___pyx_scope_struct_16___iter__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_16___iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __Pyx_INCREF(__pyx_v_self); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_13FeatureVector_3generator5; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_13FeatureVector_6generator5, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.FeatureVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_13FeatureVector_3generator5(struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; unsigned int __pyx_t_2; @@ -52230,8 +55646,8 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_3generator5(struct __pyx_obj_3_sa PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ @@ -52241,34 +55657,34 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_3generator5(struct __pyx_obj_3_sa __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":17 * def __iter__(self): * cdef unsigned i * for i in range(self.names.len): # <<<<<<<<<<<<<< * yield (FD.word(self.names[i]), self.values[i]) * */ - __pyx_t_1 = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_cur_scope->__pyx_v_self)->names->len; + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->names->len; 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/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":18 * cdef unsigned i * for i in range(self.names.len): * yield (FD.word(self.names[i]), self.values[i]) # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_3_sa_FeatureVector *)__pyx_cur_scope->__pyx_v_self)->names), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self->names), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyBytes_FromString(((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_3_sa_FD->__pyx_vtab)->word(__pyx_v_3_sa_FD, __pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_3_sa_FeatureVector *)__pyx_cur_scope->__pyx_v_self)->values), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self->values), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); @@ -52282,14 +55698,14 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_3generator5(struct __pyx_obj_3_sa __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); @@ -52298,13 +55714,25 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_3generator5(struct __pyx_obj_3_sa __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } -static PyObject *__pyx_gb_3_sa_7__str___3generator8(struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */ -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":21 +/* Python wrapper */ +static PyObject *__pyx_pw_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_3_sa_13FeatureVector_7__str__(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_3_sa_13FeatureVector_7__str___2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":21 * * def __str__(self): * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< @@ -52312,45 +55740,53 @@ static PyObject *__pyx_gb_3_sa_7__str___3generator8(struct __pyx_obj_3_sa___pyx_ * cdef class Scorer: */ -static PyObject *__pyx_pf_3_sa_7__str___2genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_3_sa_7__str___2genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str___genexpr(PyObject *__pyx_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("genexpr"); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_11_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_11_genexpr, __pyx_empty_tuple, NULL); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_18_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_18_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *)__pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - __pyx_self = __pyx_self; - __pyx_cur_scope->__pyx_base.resume_label = 0; - __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_3_sa_7__str___3generator8; - __Pyx_GIVEREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) __pyx_cur_scope; + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_13FeatureVector_7__str___2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_sa.FeatureVector.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_7__str___3generator8(struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_3_sa_13FeatureVector_7__str___2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { + struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *(*__pyx_t_3)(PyObject *); PyObject *__pyx_t_4 = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None"); - switch (__pyx_cur_scope->__pyx_base.resume_label) { + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ @@ -52359,21 +55795,30 @@ static PyObject *__pyx_gb_3_sa_7__str___3generator8(struct __pyx_obj_3_sa___pyx_ } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self))) { + __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -52401,7 +55846,7 @@ static PyObject *__pyx_gb_3_sa_7__str___3generator8(struct __pyx_obj_3_sa___pyx_ __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ - __pyx_cur_scope->__pyx_base.resume_label = 1; + __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; @@ -52412,7 +55857,7 @@ static PyObject *__pyx_gb_3_sa_7__str___3generator8(struct __pyx_obj_3_sa___pyx_ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -52420,12 +55865,13 @@ static PyObject *__pyx_gb_3_sa_7__str___3generator8(struct __pyx_obj_3_sa___pyx_ __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); - __pyx_cur_scope->__pyx_base.resume_label = -1; + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":20 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":20 * yield (FD.word(self.names[i]), self.values[i]) * * def __str__(self): # <<<<<<<<<<<<<< @@ -52433,9 +55879,8 @@ static PyObject *__pyx_gb_3_sa_7__str___3generator8(struct __pyx_obj_3_sa___pyx_ * */ -static PyObject *__pyx_pf_3_sa_13FeatureVector_4__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_3_sa_13FeatureVector_4__str__(PyObject *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *__pyx_cur_scope; +static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self) { + struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -52444,18 +55889,18 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_4__str__(PyObject *__pyx_v_self) int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__"); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *)__pyx_ptype_3_sa___pyx_scope_struct_10___str__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_10___str__, __pyx_empty_tuple, NULL); + __Pyx_RefNannySetupContext("__str__", 0); + __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *)__pyx_ptype_3_sa___pyx_scope_struct_17___str__->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_17___str__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __Pyx_INCREF(__pyx_v_self); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":21 * * def __str__(self): * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< @@ -52465,10 +55910,10 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_4__str__(PyObject *__pyx_v_self) __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_67), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_pf_3_sa_7__str___2genexpr(((PyObject*)__pyx_cur_scope), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_pf_3_sa_13FeatureVector_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __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[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; @@ -52495,7 +55940,23 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_4__str__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":25 +/* Python wrapper */ +static int __pyx_pw_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_models = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __Pyx_INCREF(__pyx_args); + __pyx_v_models = __pyx_args; + __pyx_r = __pyx_pf_3_sa_6Scorer___init__(((struct __pyx_obj_3_sa_Scorer *)__pyx_v_self), __pyx_v_models); + __Pyx_XDECREF(__pyx_v_models); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":25 * cdef class Scorer: * cdef models * def __init__(self, *models): # <<<<<<<<<<<<<< @@ -52503,9 +55964,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_4__str__(PyObject *__pyx_v_self) * self.models = zip(names, models) */ -static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_models = 0; +static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_models) { PyObject *__pyx_v_names = NULL; PyObject *__pyx_v_model = NULL; int __pyx_r; @@ -52518,12 +55977,9 @@ static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __Pyx_INCREF(__pyx_args); - __pyx_v_models = __pyx_args; + __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":26 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":26 * cdef models * def __init__(self, *models): * names = [FD.index(<char *>model.__name__) for model in models] # <<<<<<<<<<<<<< @@ -52531,14 +55987,15 @@ static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__py * */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (unlikely(((PyObject *)__pyx_v_models) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = ((PyObject *)__pyx_v_models); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; for (;;) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_model); __pyx_v_model = __pyx_t_4; __pyx_t_4 = 0; @@ -52548,7 +56005,7 @@ static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__py __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_3_sa_FD->__pyx_vtab)->index(__pyx_v_3_sa_FD, ((char *)__pyx_t_5))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -52556,7 +56013,7 @@ static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__py __pyx_v_names = __pyx_t_1; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":27 * def __init__(self, *models): * names = [FD.index(<char *>model.__name__) for model in models] * self.models = zip(names, models) # <<<<<<<<<<<<<< @@ -52564,7 +56021,7 @@ static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__py * cdef FeatureVector score(self, ctx): */ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_names)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_names)); __Pyx_GIVEREF(((PyObject *)__pyx_v_names)); @@ -52575,9 +56032,9 @@ static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__py __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_3_sa_Scorer *)__pyx_v_self)->models); - __Pyx_DECREF(((struct __pyx_obj_3_sa_Scorer *)__pyx_v_self)->models); - ((struct __pyx_obj_3_sa_Scorer *)__pyx_v_self)->models = __pyx_t_2; + __Pyx_GOTREF(__pyx_v_self->models); + __Pyx_DECREF(__pyx_v_self->models); + __pyx_v_self->models = __pyx_t_2; __pyx_t_2 = 0; __pyx_r = 0; @@ -52589,14 +56046,13 @@ static int __pyx_pf_3_sa_6Scorer___init__(PyObject *__pyx_v_self, PyObject *__py __Pyx_AddTraceback("_sa.Scorer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_models); __Pyx_XDECREF(__pyx_v_names); __Pyx_XDECREF(__pyx_v_model); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":29 +/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":29 * self.models = zip(names, models) * * cdef FeatureVector score(self, ctx): # <<<<<<<<<<<<<< @@ -52621,9 +56077,9 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("score"); + __Pyx_RefNannySetupContext("score", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":30 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":30 * * cdef FeatureVector score(self, ctx): * cdef FeatureVector scores = FeatureVector() # <<<<<<<<<<<<<< @@ -52635,7 +56091,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __pyx_v_scores = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":31 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":31 * cdef FeatureVector score(self, ctx): * cdef FeatureVector scores = FeatureVector() * for name, model in self.models: # <<<<<<<<<<<<<< @@ -52651,12 +56107,20 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { @@ -52670,27 +56134,33 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ } if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { + } else + { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); @@ -52701,12 +56171,13 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } @@ -52717,7 +56188,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __pyx_v_model = __pyx_t_6; __pyx_t_6 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":32 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":32 * cdef FeatureVector scores = FeatureVector() * for name, model in self.models: * scores.set(name, model(ctx)) # <<<<<<<<<<<<<< @@ -52726,7 +56197,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_scores), __pyx_n_s__set); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_ctx); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ctx); __Pyx_GIVEREF(__pyx_v_ctx); @@ -52734,7 +56205,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __Pyx_GOTREF(__pyx_t_5); __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[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_name); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); @@ -52749,7 +56220,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":33 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":33 * for name, model in self.models: * scores.set(name, model(ctx)) * return scores # <<<<<<<<<<<<<< @@ -52785,7 +56256,7 @@ static PyObject *__pyx_tp_new_3_sa_FloatList(PyTypeObject *t, PyObject *a, PyObj if (!o) return 0; p = ((struct __pyx_obj_3_sa_FloatList *)o); p->__pyx_vtab = __pyx_vtabptr_3_sa_FloatList; - if (__pyx_pf_3_sa_9FloatList___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_9FloatList_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -52796,7 +56267,7 @@ static void __pyx_tp_dealloc_3_sa_FloatList(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_3_sa_9FloatList_1__dealloc__(o); + __pyx_pw_3_sa_9FloatList_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -52813,7 +56284,7 @@ static PyObject *__pyx_sq_item_3_sa_FloatList(PyObject *o, Py_ssize_t i) { static int __pyx_mp_ass_subscript_3_sa_FloatList(PyObject *o, PyObject *i, PyObject *v) { if (v) { - return __pyx_pf_3_sa_9FloatList_3__setitem__(o, i, v); + return __pyx_pw_3_sa_9FloatList_7__setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, @@ -52823,9 +56294,9 @@ static int __pyx_mp_ass_subscript_3_sa_FloatList(PyObject *o, PyObject *i, PyObj } static PyMethodDef __pyx_methods_3_sa_FloatList[] = { - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_3_sa_9FloatList_5append, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_3_sa_9FloatList_6write, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pf_3_sa_9FloatList_7read, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_3_sa_9FloatList_11append, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_3_sa_9FloatList_13write, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_3_sa_9FloatList_15read, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -52888,7 +56359,7 @@ static PyNumberMethods __pyx_tp_as_number_FloatList = { }; static PySequenceMethods __pyx_tp_as_sequence_FloatList = { - __pyx_pf_3_sa_9FloatList_4__len__, /*sq_length*/ + __pyx_pw_3_sa_9FloatList_9__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_3_sa_FloatList, /*sq_item*/ @@ -52901,8 +56372,8 @@ static PySequenceMethods __pyx_tp_as_sequence_FloatList = { }; static PyMappingMethods __pyx_tp_as_mapping_FloatList = { - __pyx_pf_3_sa_9FloatList_4__len__, /*mp_length*/ - __pyx_pf_3_sa_9FloatList_2__getitem__, /*mp_subscript*/ + __pyx_pw_3_sa_9FloatList_9__len__, /*mp_length*/ + __pyx_pw_3_sa_9FloatList_5__getitem__, /*mp_subscript*/ __pyx_mp_ass_subscript_3_sa_FloatList, /*mp_ass_subscript*/ }; @@ -52990,7 +56461,7 @@ static PyObject *__pyx_tp_new_3_sa_IntList(PyTypeObject *t, PyObject *a, PyObjec if (!o) return 0; p = ((struct __pyx_obj_3_sa_IntList *)o); p->__pyx_vtab = __pyx_vtabptr_3_sa_IntList; - if (__pyx_pf_3_sa_7IntList___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_7IntList_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -53001,7 +56472,7 @@ static void __pyx_tp_dealloc_3_sa_IntList(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_3_sa_7IntList_7__dealloc__(o); + __pyx_pw_3_sa_7IntList_15__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -53018,7 +56489,7 @@ static PyObject *__pyx_sq_item_3_sa_IntList(PyObject *o, Py_ssize_t i) { static int __pyx_mp_ass_subscript_3_sa_IntList(PyObject *o, PyObject *i, PyObject *v) { if (v) { - return __pyx_pf_3_sa_7IntList_11__setitem__(o, i, v); + return __pyx_pw_3_sa_7IntList_22__setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, @@ -53028,16 +56499,16 @@ static int __pyx_mp_ass_subscript_3_sa_IntList(PyObject *o, PyObject *i, PyObjec } static PyMethodDef __pyx_methods_3_sa_IntList[] = { - {__Pyx_NAMESTR("index"), (PyCFunction)__pyx_pf_3_sa_7IntList_2index, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("partition"), (PyCFunction)__pyx_pf_3_sa_7IntList_3partition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_doquicksort"), (PyCFunction)__pyx_pf_3_sa_7IntList_4_doquicksort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sort"), (PyCFunction)__pyx_pf_3_sa_7IntList_5sort, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pf_3_sa_7IntList_6reset, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pf_3_sa_7IntList_13get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_3_sa_7IntList_14append, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pf_3_sa_7IntList_15extend, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_3_sa_7IntList_16write, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pf_3_sa_7IntList_17read, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("index"), (PyCFunction)__pyx_pw_3_sa_7IntList_5index, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("partition"), (PyCFunction)__pyx_pw_3_sa_7IntList_7partition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_doquicksort"), (PyCFunction)__pyx_pw_3_sa_7IntList_9_doquicksort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("sort"), (PyCFunction)__pyx_pw_3_sa_7IntList_11sort, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pw_3_sa_7IntList_13reset, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_3_sa_7IntList_26get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_3_sa_7IntList_28append, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pw_3_sa_7IntList_30extend, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_3_sa_7IntList_32write, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_3_sa_7IntList_34read, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -53100,7 +56571,7 @@ static PyNumberMethods __pyx_tp_as_number_IntList = { }; static PySequenceMethods __pyx_tp_as_sequence_IntList = { - __pyx_pf_3_sa_7IntList_12__len__, /*sq_length*/ + __pyx_pw_3_sa_7IntList_24__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_3_sa_IntList, /*sq_item*/ @@ -53113,8 +56584,8 @@ static PySequenceMethods __pyx_tp_as_sequence_IntList = { }; static PyMappingMethods __pyx_tp_as_mapping_IntList = { - __pyx_pf_3_sa_7IntList_12__len__, /*mp_length*/ - __pyx_pf_3_sa_7IntList_10__getitem__, /*mp_subscript*/ + __pyx_pw_3_sa_7IntList_24__len__, /*mp_length*/ + __pyx_pw_3_sa_7IntList_20__getitem__, /*mp_subscript*/ __pyx_mp_ass_subscript_3_sa_IntList, /*mp_ass_subscript*/ }; @@ -53159,7 +56630,7 @@ static PyTypeObject __pyx_type_3_sa_IntList = { &__pyx_tp_as_mapping_IntList, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pf_3_sa_7IntList_1__str__, /*tp_str*/ + __pyx_pw_3_sa_7IntList_3__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_IntList, /*tp_as_buffer*/ @@ -53169,7 +56640,7 @@ static PyTypeObject __pyx_type_3_sa_IntList = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pf_3_sa_7IntList_8__iter__, /*tp_iter*/ + __pyx_pw_3_sa_7IntList_17__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_3_sa_IntList, /*tp_methods*/ 0, /*tp_members*/ @@ -53195,14 +56666,14 @@ static PyTypeObject __pyx_type_3_sa_IntList = { #endif }; -static PyObject *__pyx_tp_new_3_sa_FeatureVector(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_FeatureVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_3_sa_FeatureVector *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_3_sa_FeatureVector *)o); p->names = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); p->values = ((struct __pyx_obj_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_13FeatureVector___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + if (__pyx_pw_3_sa_13FeatureVector_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; @@ -53210,8 +56681,8 @@ static PyObject *__pyx_tp_new_3_sa_FeatureVector(PyTypeObject *t, PyObject *a, P static void __pyx_tp_dealloc_3_sa_FeatureVector(PyObject *o) { struct __pyx_obj_3_sa_FeatureVector *p = (struct __pyx_obj_3_sa_FeatureVector *)o; - Py_XDECREF(((PyObject *)p->names)); - Py_XDECREF(((PyObject *)p->values)); + Py_CLEAR(p->names); + Py_CLEAR(p->values); (*Py_TYPE(o)->tp_free)(o); } @@ -53240,7 +56711,7 @@ static int __pyx_tp_clear_3_sa_FeatureVector(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_FeatureVector[] = { - {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_3_sa_13FeatureVector_1set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pw_3_sa_13FeatureVector_3set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -53362,7 +56833,7 @@ static PyTypeObject __pyx_type_3_sa_FeatureVector = { &__pyx_tp_as_mapping_FeatureVector, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pf_3_sa_13FeatureVector_4__str__, /*tp_str*/ + __pyx_pw_3_sa_13FeatureVector_8__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_FeatureVector, /*tp_as_buffer*/ @@ -53372,7 +56843,7 @@ static PyTypeObject __pyx_type_3_sa_FeatureVector = { __pyx_tp_clear_3_sa_FeatureVector, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pf_3_sa_13FeatureVector_2__iter__, /*tp_iter*/ + __pyx_pw_3_sa_13FeatureVector_5__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_3_sa_FeatureVector, /*tp_methods*/ 0, /*tp_members*/ @@ -53405,7 +56876,7 @@ static PyObject *__pyx_tp_new_3_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject if (!o) return 0; p = ((struct __pyx_obj_3_sa_Phrase *)o); p->__pyx_vtab = __pyx_vtabptr_3_sa_Phrase; - if (__pyx_pf_3_sa_6Phrase___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_6Phrase_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -53416,7 +56887,7 @@ static void __pyx_tp_dealloc_3_sa_Phrase(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_3_sa_6Phrase_1__dealloc__(o); + __pyx_pw_3_sa_6Phrase_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -53431,19 +56902,19 @@ static PyObject *__pyx_sq_item_3_sa_Phrase(PyObject *o, Py_ssize_t i) { return r; } -static PyObject *__pyx_getprop_3_sa_6Phrase_words(PyObject *o, void *x) { - return __pyx_pf_3_sa_6Phrase_5words___get__(o); +static PyObject *__pyx_getprop_3_sa_6Phrase_words(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_6Phrase_5words_1__get__(o); } static PyMethodDef __pyx_methods_3_sa_Phrase[] = { - {__Pyx_NAMESTR("handle"), (PyCFunction)__pyx_pf_3_sa_6Phrase_3handle, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3_sa_6Phrase_3handle)}, - {__Pyx_NAMESTR("strhandle"), (PyCFunction)__pyx_pf_3_sa_6Phrase_4strhandle, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pf_3_sa_6Phrase_5arity, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getvarpos"), (PyCFunction)__pyx_pf_3_sa_6Phrase_6getvarpos, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getvar"), (PyCFunction)__pyx_pf_3_sa_6Phrase_7getvar, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("clen"), (PyCFunction)__pyx_pf_3_sa_6Phrase_8clen, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getchunk"), (PyCFunction)__pyx_pf_3_sa_6Phrase_9getchunk, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("subst"), (PyCFunction)__pyx_pf_3_sa_6Phrase_16subst, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("handle"), (PyCFunction)__pyx_pw_3_sa_6Phrase_7handle, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3_sa_6Phrase_6handle)}, + {__Pyx_NAMESTR("strhandle"), (PyCFunction)__pyx_pw_3_sa_6Phrase_9strhandle, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_3_sa_6Phrase_11arity, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("getvarpos"), (PyCFunction)__pyx_pw_3_sa_6Phrase_13getvarpos, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("getvar"), (PyCFunction)__pyx_pw_3_sa_6Phrase_15getvar, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("clen"), (PyCFunction)__pyx_pw_3_sa_6Phrase_17clen, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("getchunk"), (PyCFunction)__pyx_pw_3_sa_6Phrase_19getchunk, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("subst"), (PyCFunction)__pyx_pw_3_sa_6Phrase_32subst, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -53511,7 +56982,7 @@ static PyNumberMethods __pyx_tp_as_number_Phrase = { }; static PySequenceMethods __pyx_tp_as_sequence_Phrase = { - __pyx_pf_3_sa_6Phrase_12__len__, /*sq_length*/ + __pyx_pw_3_sa_6Phrase_25__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_3_sa_Phrase, /*sq_item*/ @@ -53524,8 +56995,8 @@ static PySequenceMethods __pyx_tp_as_sequence_Phrase = { }; static PyMappingMethods __pyx_tp_as_mapping_Phrase = { - __pyx_pf_3_sa_6Phrase_12__len__, /*mp_length*/ - __pyx_pf_3_sa_6Phrase_13__getitem__, /*mp_subscript*/ + __pyx_pw_3_sa_6Phrase_25__len__, /*mp_length*/ + __pyx_pw_3_sa_6Phrase_27__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; @@ -53560,7 +57031,7 @@ static PyTypeObject __pyx_type_3_sa_Phrase = { 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - __pyx_pf_3_sa_6Phrase_10__cmp__, /*tp_compare*/ + __pyx_pw_3_sa_6Phrase_21__cmp__, /*tp_compare*/ #else 0, /*reserved*/ #endif @@ -53568,9 +57039,9 @@ static PyTypeObject __pyx_type_3_sa_Phrase = { &__pyx_tp_as_number_Phrase, /*tp_as_number*/ &__pyx_tp_as_sequence_Phrase, /*tp_as_sequence*/ &__pyx_tp_as_mapping_Phrase, /*tp_as_mapping*/ - __pyx_pf_3_sa_6Phrase_11__hash__, /*tp_hash*/ + __pyx_pw_3_sa_6Phrase_23__hash__, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pf_3_sa_6Phrase_2__str__, /*tp_str*/ + __pyx_pw_3_sa_6Phrase_5__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_Phrase, /*tp_as_buffer*/ @@ -53580,7 +57051,7 @@ static PyTypeObject __pyx_type_3_sa_Phrase = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pf_3_sa_6Phrase_14__iter__, /*tp_iter*/ + __pyx_pw_3_sa_6Phrase_29__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_3_sa_Phrase, /*tp_methods*/ 0, /*tp_members*/ @@ -53615,7 +57086,7 @@ static PyObject *__pyx_tp_new_3_sa_Rule(PyTypeObject *t, PyObject *a, PyObject * p->e = ((struct __pyx_obj_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); p->scores = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); p->word_alignments = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_3_sa_4Rule___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_4Rule_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -53623,10 +57094,10 @@ static PyObject *__pyx_tp_new_3_sa_Rule(PyTypeObject *t, PyObject *a, PyObject * static void __pyx_tp_dealloc_3_sa_Rule(PyObject *o) { struct __pyx_obj_3_sa_Rule *p = (struct __pyx_obj_3_sa_Rule *)o; - Py_XDECREF(((PyObject *)p->f)); - Py_XDECREF(((PyObject *)p->e)); - Py_XDECREF(((PyObject *)p->scores)); - Py_XDECREF(p->word_alignments); + Py_CLEAR(p->f); + Py_CLEAR(p->e); + Py_CLEAR(p->scores); + Py_CLEAR(p->word_alignments); (*Py_TYPE(o)->tp_free)(o); } @@ -53666,18 +57137,18 @@ static int __pyx_tp_clear_3_sa_Rule(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_3_sa_4Rule_f(PyObject *o, void *x) { - return __pyx_pf_3_sa_4Rule_1f___get__(o); +static PyObject *__pyx_getprop_3_sa_4Rule_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_4Rule_1f_1__get__(o); } -static PyObject *__pyx_getprop_3_sa_4Rule_e(PyObject *o, void *x) { - return __pyx_pf_3_sa_4Rule_1e___get__(o); +static PyObject *__pyx_getprop_3_sa_4Rule_e(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_4Rule_1e_1__get__(o); } static PyMethodDef __pyx_methods_3_sa_Rule[] = { - {__Pyx_NAMESTR("fmerge"), (PyCFunction)__pyx_pf_3_sa_4Rule_3fmerge, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pf_3_sa_4Rule_4arity, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("alignments"), (PyCFunction)__pyx_pf_3_sa_4Rule_6alignments, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("fmerge"), (PyCFunction)__pyx_pw_3_sa_4Rule_7fmerge, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_3_sa_4Rule_9arity, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("alignments"), (PyCFunction)__pyx_pw_3_sa_4Rule_13alignments, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -53795,7 +57266,7 @@ static PyTypeObject __pyx_type_3_sa_Rule = { 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - __pyx_pf_3_sa_4Rule_2__cmp__, /*tp_compare*/ + __pyx_pw_3_sa_4Rule_5__cmp__, /*tp_compare*/ #else 0, /*reserved*/ #endif @@ -53803,9 +57274,9 @@ static PyTypeObject __pyx_type_3_sa_Rule = { &__pyx_tp_as_number_Rule, /*tp_as_number*/ &__pyx_tp_as_sequence_Rule, /*tp_as_sequence*/ &__pyx_tp_as_mapping_Rule, /*tp_as_mapping*/ - __pyx_pf_3_sa_4Rule_1__hash__, /*tp_hash*/ + __pyx_pw_3_sa_4Rule_3__hash__, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pf_3_sa_4Rule_5__str__, /*tp_str*/ + __pyx_pw_3_sa_4Rule_11__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_Rule, /*tp_as_buffer*/ @@ -53842,13 +57313,13 @@ static PyTypeObject __pyx_type_3_sa_Rule = { }; static struct __pyx_vtabstruct_3_sa_StringMap __pyx_vtable_3_sa_StringMap; -static PyObject *__pyx_tp_new_3_sa_StringMap(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_StringMap(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_3_sa_StringMap *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_3_sa_StringMap *)o); p->__pyx_vtab = __pyx_vtabptr_3_sa_StringMap; - if (__pyx_pf_3_sa_9StringMap___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + if (__pyx_pw_3_sa_9StringMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; @@ -53859,7 +57330,7 @@ static void __pyx_tp_dealloc_3_sa_StringMap(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_3_sa_9StringMap_1__dealloc__(o); + __pyx_pw_3_sa_9StringMap_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -54037,7 +57508,7 @@ static PyObject *__pyx_tp_new_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObj p->data = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); p->sent_id = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); p->sent_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_9DataArray___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_9DataArray_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -54045,11 +57516,11 @@ static PyObject *__pyx_tp_new_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObj static void __pyx_tp_dealloc_3_sa_DataArray(PyObject *o) { struct __pyx_obj_3_sa_DataArray *p = (struct __pyx_obj_3_sa_DataArray *)o; - Py_XDECREF(p->word2id); - Py_XDECREF(p->id2word); - Py_XDECREF(((PyObject *)p->data)); - Py_XDECREF(((PyObject *)p->sent_id)); - Py_XDECREF(((PyObject *)p->sent_index)); + Py_CLEAR(p->word2id); + Py_CLEAR(p->id2word); + Py_CLEAR(p->data); + Py_CLEAR(p->sent_id); + Py_CLEAR(p->sent_index); (*Py_TYPE(o)->tp_free)(o); } @@ -54096,20 +57567,20 @@ static int __pyx_tp_clear_3_sa_DataArray(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_DataArray[] = { - {__Pyx_NAMESTR("get_data"), (PyCFunction)__pyx_pf_3_sa_9DataArray_2get_data, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_sentence_id"), (PyCFunction)__pyx_pf_3_sa_9DataArray_3get_sentence_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_sentence"), (PyCFunction)__pyx_pf_3_sa_9DataArray_4get_sentence, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_sentence_position"), (PyCFunction)__pyx_pf_3_sa_9DataArray_5get_sentence_position, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_id"), (PyCFunction)__pyx_pf_3_sa_9DataArray_6get_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_word"), (PyCFunction)__pyx_pf_3_sa_9DataArray_7get_word, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pf_3_sa_9DataArray_8write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pf_3_sa_9DataArray_9read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_bitext"), (PyCFunction)__pyx_pf_3_sa_9DataArray_10read_bitext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text_data"), (PyCFunction)__pyx_pf_3_sa_9DataArray_11read_text_data, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pf_3_sa_9DataArray_12read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pf_3_sa_9DataArray_13write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced_handle"), (PyCFunction)__pyx_pf_3_sa_9DataArray_14write_enhanced_handle, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pf_3_sa_9DataArray_15write_enhanced, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_data"), (PyCFunction)__pyx_pw_3_sa_9DataArray_5get_data, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_sentence_id"), (PyCFunction)__pyx_pw_3_sa_9DataArray_7get_sentence_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_sentence"), (PyCFunction)__pyx_pw_3_sa_9DataArray_9get_sentence, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_sentence_position"), (PyCFunction)__pyx_pw_3_sa_9DataArray_11get_sentence_position, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_id"), (PyCFunction)__pyx_pw_3_sa_9DataArray_13get_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_word"), (PyCFunction)__pyx_pw_3_sa_9DataArray_15get_word, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_9DataArray_17write_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_9DataArray_19read_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_bitext"), (PyCFunction)__pyx_pw_3_sa_9DataArray_21read_bitext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_text_data"), (PyCFunction)__pyx_pw_3_sa_9DataArray_23read_text_data, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_9DataArray_25read_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_9DataArray_27write_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced_handle"), (PyCFunction)__pyx_pw_3_sa_9DataArray_29write_enhanced_handle, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_9DataArray_31write_enhanced, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -54172,7 +57643,7 @@ static PyNumberMethods __pyx_tp_as_number_DataArray = { }; static PySequenceMethods __pyx_tp_as_sequence_DataArray = { - __pyx_pf_3_sa_9DataArray_1__len__, /*sq_length*/ + __pyx_pw_3_sa_9DataArray_3__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ @@ -54185,7 +57656,7 @@ static PySequenceMethods __pyx_tp_as_sequence_DataArray = { }; static PyMappingMethods __pyx_tp_as_mapping_DataArray = { - __pyx_pf_3_sa_9DataArray_1__len__, /*mp_length*/ + __pyx_pw_3_sa_9DataArray_3__len__, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; @@ -54276,7 +57747,7 @@ static PyObject *__pyx_tp_new_3_sa_Alignment(PyTypeObject *t, PyObject *a, PyObj p->__pyx_vtab = __pyx_vtabptr_3_sa_Alignment; p->links = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); p->sent_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_9Alignment_2__cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_9Alignment_5__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -54284,8 +57755,8 @@ static PyObject *__pyx_tp_new_3_sa_Alignment(PyTypeObject *t, PyObject *a, PyObj static void __pyx_tp_dealloc_3_sa_Alignment(PyObject *o) { struct __pyx_obj_3_sa_Alignment *p = (struct __pyx_obj_3_sa_Alignment *)o; - Py_XDECREF(((PyObject *)p->links)); - Py_XDECREF(((PyObject *)p->sent_index)); + Py_CLEAR(p->links); + Py_CLEAR(p->sent_index); (*Py_TYPE(o)->tp_free)(o); } @@ -54314,14 +57785,14 @@ static int __pyx_tp_clear_3_sa_Alignment(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_Alignment[] = { - {__Pyx_NAMESTR("unlink"), (PyCFunction)__pyx_pf_3_sa_9Alignment_unlink, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_9Alignment_unlink)}, - {__Pyx_NAMESTR("get_sent_links"), (PyCFunction)__pyx_pf_3_sa_9Alignment_1get_sent_links, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pf_3_sa_9Alignment_3read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pf_3_sa_9Alignment_4read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pf_3_sa_9Alignment_5write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pf_3_sa_9Alignment_6write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pf_3_sa_9Alignment_7write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("alignment"), (PyCFunction)__pyx_pf_3_sa_9Alignment_8alignment, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_9Alignment_8alignment)}, + {__Pyx_NAMESTR("unlink"), (PyCFunction)__pyx_pw_3_sa_9Alignment_1unlink, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_9Alignment_unlink)}, + {__Pyx_NAMESTR("get_sent_links"), (PyCFunction)__pyx_pw_3_sa_9Alignment_3get_sent_links, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_9Alignment_7read_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_9Alignment_9read_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_9Alignment_11write_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_9Alignment_13write_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_9Alignment_15write_enhanced, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("alignment"), (PyCFunction)__pyx_pw_3_sa_9Alignment_17alignment, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_9Alignment_16alignment)}, {0, 0, 0, 0} }; @@ -54494,7 +57965,7 @@ static PyObject *__pyx_tp_new_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject p->id2fword = Py_None; Py_INCREF(Py_None); p->eword2id = Py_None; Py_INCREF(Py_None); p->fword2id = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_3_sa_5BiLex___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_5BiLex_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -54502,14 +57973,14 @@ static PyObject *__pyx_tp_new_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_3_sa_BiLex(PyObject *o) { struct __pyx_obj_3_sa_BiLex *p = (struct __pyx_obj_3_sa_BiLex *)o; - Py_XDECREF(((PyObject *)p->col1)); - Py_XDECREF(((PyObject *)p->col2)); - Py_XDECREF(((PyObject *)p->f_index)); - Py_XDECREF(((PyObject *)p->e_index)); - Py_XDECREF(p->id2eword); - Py_XDECREF(p->id2fword); - Py_XDECREF(p->eword2id); - Py_XDECREF(p->fword2id); + Py_CLEAR(p->col1); + Py_CLEAR(p->col2); + Py_CLEAR(p->f_index); + Py_CLEAR(p->e_index); + Py_CLEAR(p->id2eword); + Py_CLEAR(p->id2fword); + Py_CLEAR(p->eword2id); + Py_CLEAR(p->fword2id); (*Py_TYPE(o)->tp_free)(o); } @@ -54574,14 +58045,14 @@ static int __pyx_tp_clear_3_sa_BiLex(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_BiLex[] = { - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pf_3_sa_5BiLex_1write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pf_3_sa_5BiLex_2read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_e_id"), (PyCFunction)__pyx_pf_3_sa_5BiLex_3get_e_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pf_3_sa_5BiLex_4get_f_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pf_3_sa_5BiLex_5read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pf_3_sa_5BiLex_6write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pf_3_sa_5BiLex_7get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pf_3_sa_5BiLex_8write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_5BiLex_8write_text)}, + {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_5BiLex_3write_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_5BiLex_5read_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_e_id"), (PyCFunction)__pyx_pw_3_sa_5BiLex_7get_e_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_3_sa_5BiLex_9get_f_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_5BiLex_11read_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_5BiLex_13write_enhanced, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_3_sa_5BiLex_15get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_5BiLex_17write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_5BiLex_16write_text)}, {0, 0, 0, 0} }; @@ -54739,7 +58210,7 @@ static PyTypeObject __pyx_type_3_sa_BiLex = { #endif }; -static PyObject *__pyx_tp_new_3_sa_BitSetIterator(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_BitSetIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -54750,7 +58221,7 @@ static void __pyx_tp_dealloc_3_sa_BitSetIterator(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_BitSetIterator[] = { - {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_3_sa_14BitSetIterator___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_3_sa_14BitSetIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -54883,7 +58354,7 @@ static PyTypeObject __pyx_type_3_sa_BitSetIterator = { 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - __pyx_pf_3_sa_14BitSetIterator___next__, /*tp_iternext*/ + __pyx_pw_3_sa_14BitSetIterator_1__next__, /*tp_iternext*/ __pyx_methods_3_sa_BitSetIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ @@ -54908,10 +58379,10 @@ static PyTypeObject __pyx_type_3_sa_BitSetIterator = { #endif }; -static PyObject *__pyx_tp_new_3_sa_BitSet(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_BitSet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - if (__pyx_pf_3_sa_6BitSet___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + if (__pyx_pw_3_sa_6BitSet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; @@ -54922,7 +58393,7 @@ static void __pyx_tp_dealloc_3_sa_BitSet(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_3_sa_6BitSet_1__dealloc__(o); + __pyx_pw_3_sa_6BitSet_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -54931,10 +58402,10 @@ static void __pyx_tp_dealloc_3_sa_BitSet(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_BitSet[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_3_sa_6BitSet_3insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pf_3_sa_6BitSet_4findsucc, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("min"), (PyCFunction)__pyx_pf_3_sa_6BitSet_6min, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("max"), (PyCFunction)__pyx_pf_3_sa_6BitSet_7max, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_3_sa_6BitSet_7insert, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pw_3_sa_6BitSet_9findsucc, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("min"), (PyCFunction)__pyx_pw_3_sa_6BitSet_13min, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("max"), (PyCFunction)__pyx_pw_3_sa_6BitSet_15max, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -54997,20 +58468,20 @@ static PyNumberMethods __pyx_tp_as_number_BitSet = { }; static PySequenceMethods __pyx_tp_as_sequence_BitSet = { - __pyx_pf_3_sa_6BitSet_8__len__, /*sq_length*/ + __pyx_pw_3_sa_6BitSet_17__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ - __pyx_pf_3_sa_6BitSet_9__contains__, /*sq_contains*/ + __pyx_pw_3_sa_6BitSet_19__contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_BitSet = { - __pyx_pf_3_sa_6BitSet_8__len__, /*mp_length*/ + __pyx_pw_3_sa_6BitSet_17__len__, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; @@ -55056,7 +58527,7 @@ static PyTypeObject __pyx_type_3_sa_BitSet = { &__pyx_tp_as_mapping_BitSet, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pf_3_sa_6BitSet_5__str__, /*tp_str*/ + __pyx_pw_3_sa_6BitSet_11__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_BitSet, /*tp_as_buffer*/ @@ -55066,7 +58537,7 @@ static PyTypeObject __pyx_type_3_sa_BitSet = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pf_3_sa_6BitSet_2__iter__, /*tp_iter*/ + __pyx_pw_3_sa_6BitSet_5__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_3_sa_BitSet, /*tp_methods*/ 0, /*tp_members*/ @@ -55092,7 +58563,7 @@ static PyTypeObject __pyx_type_3_sa_BitSet = { #endif }; -static PyObject *__pyx_tp_new_3_sa_VEBIterator(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_VEBIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; return o; @@ -55103,7 +58574,7 @@ static void __pyx_tp_dealloc_3_sa_VEBIterator(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_VEBIterator[] = { - {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_3_sa_11VEBIterator___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_3_sa_11VEBIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -55236,7 +58707,7 @@ static PyTypeObject __pyx_type_3_sa_VEBIterator = { 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - __pyx_pf_3_sa_11VEBIterator___next__, /*tp_iternext*/ + __pyx_pw_3_sa_11VEBIterator_1__next__, /*tp_iternext*/ __pyx_methods_3_sa_VEBIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ @@ -55268,7 +58739,7 @@ static PyObject *__pyx_tp_new_3_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k if (!o) return 0; p = ((struct __pyx_obj_3_sa_VEB *)o); p->__pyx_vtab = __pyx_vtabptr_3_sa_VEB; - if (__pyx_pf_3_sa_3VEB___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_3VEB_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -55279,7 +58750,7 @@ static void __pyx_tp_dealloc_3_sa_VEB(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_3_sa_3VEB_1__dealloc__(o); + __pyx_pw_3_sa_3VEB_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -55288,8 +58759,8 @@ static void __pyx_tp_dealloc_3_sa_VEB(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_VEB[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_3_sa_3VEB_3insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pf_3_sa_3VEB_4findsucc, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_3_sa_3VEB_7insert, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pw_3_sa_3VEB_9findsucc, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -55352,20 +58823,20 @@ static PyNumberMethods __pyx_tp_as_number_VEB = { }; static PySequenceMethods __pyx_tp_as_sequence_VEB = { - __pyx_pf_3_sa_3VEB_5__len__, /*sq_length*/ + __pyx_pw_3_sa_3VEB_11__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ - __pyx_pf_3_sa_3VEB_6__contains__, /*sq_contains*/ + __pyx_pw_3_sa_3VEB_13__contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_VEB = { - __pyx_pf_3_sa_3VEB_5__len__, /*mp_length*/ + __pyx_pw_3_sa_3VEB_11__len__, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; @@ -55421,7 +58892,7 @@ static PyTypeObject __pyx_type_3_sa_VEB = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pf_3_sa_3VEB_2__iter__, /*tp_iter*/ + __pyx_pw_3_sa_3VEB_5__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_3_sa_VEB, /*tp_methods*/ 0, /*tp_members*/ @@ -55454,7 +58925,7 @@ static PyObject *__pyx_tp_new_3_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k p = ((struct __pyx_obj_3_sa_LCP *)o); p->sa = ((struct __pyx_obj_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); p->lcp = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_3LCP___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_3LCP_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -55462,8 +58933,8 @@ static PyObject *__pyx_tp_new_3_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k static void __pyx_tp_dealloc_3_sa_LCP(PyObject *o) { struct __pyx_obj_3_sa_LCP *p = (struct __pyx_obj_3_sa_LCP *)o; - Py_XDECREF(((PyObject *)p->sa)); - Py_XDECREF(((PyObject *)p->lcp)); + Py_CLEAR(p->sa); + Py_CLEAR(p->lcp); (*Py_TYPE(o)->tp_free)(o); } @@ -55492,7 +58963,7 @@ static int __pyx_tp_clear_3_sa_LCP(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_LCP[] = { - {__Pyx_NAMESTR("compute_stats"), (PyCFunction)__pyx_pf_3_sa_3LCP_1compute_stats, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_3LCP_1compute_stats)}, + {__Pyx_NAMESTR("compute_stats"), (PyCFunction)__pyx_pw_3_sa_3LCP_3compute_stats, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_3LCP_2compute_stats)}, {0, 0, 0, 0} }; @@ -55651,7 +59122,7 @@ static PyTypeObject __pyx_type_3_sa_LCP = { }; static struct __pyx_vtabstruct_3_sa_Alphabet __pyx_vtable_3_sa_Alphabet; -static PyObject *__pyx_tp_new_3_sa_Alphabet(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_Alphabet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_3_sa_Alphabet *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -55660,7 +59131,7 @@ static PyObject *__pyx_tp_new_3_sa_Alphabet(PyTypeObject *t, PyObject *a, PyObje p->terminals = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); p->nonterminals = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_8Alphabet___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + if (__pyx_pw_3_sa_8Alphabet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; @@ -55672,14 +59143,14 @@ static void __pyx_tp_dealloc_3_sa_Alphabet(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_3_sa_8Alphabet_1__dealloc__(o); + __pyx_pw_3_sa_8Alphabet_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - Py_XDECREF(((PyObject *)p->terminals)); - Py_XDECREF(((PyObject *)p->nonterminals)); - Py_XDECREF(((PyObject *)p->id2sym)); + Py_CLEAR(p->terminals); + Py_CLEAR(p->nonterminals); + Py_CLEAR(p->id2sym); (*Py_TYPE(o)->tp_free)(o); } @@ -55713,12 +59184,12 @@ static int __pyx_tp_clear_3_sa_Alphabet(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_3_sa_8Alphabet_terminals(PyObject *o, void *x) { - return __pyx_pf_3_sa_8Alphabet_9terminals___get__(o); +static PyObject *__pyx_getprop_3_sa_8Alphabet_terminals(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_8Alphabet_9terminals_1__get__(o); } -static PyObject *__pyx_getprop_3_sa_8Alphabet_nonterminals(PyObject *o, void *x) { - return __pyx_pf_3_sa_8Alphabet_12nonterminals___get__(o); +static PyObject *__pyx_getprop_3_sa_8Alphabet_nonterminals(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_8Alphabet_12nonterminals_1__get__(o); } static PyMethodDef __pyx_methods_3_sa_Alphabet[] = { @@ -55892,7 +59363,7 @@ static PyObject *__pyx_tp_new_3_sa_TrieMap(PyTypeObject *t, PyObject *a, PyObjec if (!o) return 0; p = ((struct __pyx_obj_3_sa_TrieMap *)o); p->__pyx_vtab = __pyx_vtabptr_3_sa_TrieMap; - if (__pyx_pf_3_sa_7TrieMap___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_7TrieMap_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -55903,7 +59374,7 @@ static void __pyx_tp_dealloc_3_sa_TrieMap(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_3_sa_7TrieMap_1__dealloc__(o); + __pyx_pw_3_sa_7TrieMap_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -55912,9 +59383,9 @@ static void __pyx_tp_dealloc_3_sa_TrieMap(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_TrieMap[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_3_sa_7TrieMap_2insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("contains"), (PyCFunction)__pyx_pf_3_sa_7TrieMap_3contains, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("toMap"), (PyCFunction)__pyx_pf_3_sa_7TrieMap_4toMap, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_3_sa_7TrieMap_5insert, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("contains"), (PyCFunction)__pyx_pw_3_sa_7TrieMap_7contains, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("toMap"), (PyCFunction)__pyx_pw_3_sa_7TrieMap_9toMap, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -56081,7 +59552,7 @@ static PyObject *__pyx_tp_new_3_sa_Precomputation(PyTypeObject *t, PyObject *a, p->__pyx_vtab = __pyx_vtabptr_3_sa_Precomputation; p->precomputed_index = Py_None; Py_INCREF(Py_None); p->precomputed_collocations = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_3_sa_14Precomputation___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_14Precomputation_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -56089,8 +59560,8 @@ static PyObject *__pyx_tp_new_3_sa_Precomputation(PyTypeObject *t, PyObject *a, static void __pyx_tp_dealloc_3_sa_Precomputation(PyObject *o) { struct __pyx_obj_3_sa_Precomputation *p = (struct __pyx_obj_3_sa_Precomputation *)o; - Py_XDECREF(p->precomputed_index); - Py_XDECREF(p->precomputed_collocations); + Py_CLEAR(p->precomputed_index); + Py_CLEAR(p->precomputed_collocations); (*Py_TYPE(o)->tp_free)(o); } @@ -56119,9 +59590,9 @@ static int __pyx_tp_clear_3_sa_Precomputation(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_Precomputation[] = { - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pf_3_sa_14Precomputation_1read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pf_3_sa_14Precomputation_2write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pf_3_sa_14Precomputation_3precompute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_14Precomputation_3read_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_14Precomputation_5write_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pw_3_sa_14Precomputation_7precompute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -56289,7 +59760,7 @@ static PyObject *__pyx_tp_new_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyO p->darray = ((struct __pyx_obj_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); p->ha = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_11SuffixArray___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_11SuffixArray_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -56297,9 +59768,9 @@ static PyObject *__pyx_tp_new_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc_3_sa_SuffixArray(PyObject *o) { struct __pyx_obj_3_sa_SuffixArray *p = (struct __pyx_obj_3_sa_SuffixArray *)o; - Py_XDECREF(((PyObject *)p->darray)); - Py_XDECREF(((PyObject *)p->sa)); - Py_XDECREF(((PyObject *)p->ha)); + Py_CLEAR(p->darray); + Py_CLEAR(p->sa); + Py_CLEAR(p->ha); (*Py_TYPE(o)->tp_free)(o); } @@ -56341,16 +59812,16 @@ static PyObject *__pyx_sq_item_3_sa_SuffixArray(PyObject *o, Py_ssize_t i) { } static PyMethodDef __pyx_methods_3_sa_SuffixArray[] = { - {__Pyx_NAMESTR("get_sentence_id"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_2get_sentence_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_sentence"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_3get_sentence, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_sentence_position"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_4get_sentence_position, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_5read_text, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_11SuffixArray_5read_text)}, - {__Pyx_NAMESTR("q3sort"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_6q3sort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_11SuffixArray_6q3sort)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_7write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_8read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_9write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_10write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_3_sa_11SuffixArray_11lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_sentence_id"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_5get_sentence_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_sentence"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_7get_sentence, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_sentence_position"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_9get_sentence_position, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_11read_text, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_11SuffixArray_10read_text)}, + {__Pyx_NAMESTR("q3sort"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_13q3sort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_11SuffixArray_12q3sort)}, + {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_15write_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_17read_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_19write_binary, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_21write_enhanced, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_23lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -56427,7 +59898,7 @@ static PySequenceMethods __pyx_tp_as_sequence_SuffixArray = { static PyMappingMethods __pyx_tp_as_mapping_SuffixArray = { 0, /*mp_length*/ - __pyx_pf_3_sa_11SuffixArray_1__getitem__, /*mp_subscript*/ + __pyx_pw_3_sa_11SuffixArray_3__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; @@ -56508,13 +59979,13 @@ static PyTypeObject __pyx_type_3_sa_SuffixArray = { #endif }; -static PyObject *__pyx_tp_new_3_sa_TrieNode(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_TrieNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_3_sa_TrieNode *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_3_sa_TrieNode *)o); p->children = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_3_sa_8TrieNode___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + if (__pyx_pw_3_sa_8TrieNode_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; @@ -56522,7 +59993,7 @@ static PyObject *__pyx_tp_new_3_sa_TrieNode(PyTypeObject *t, PyObject *a, PyObje static void __pyx_tp_dealloc_3_sa_TrieNode(PyObject *o) { struct __pyx_obj_3_sa_TrieNode *p = (struct __pyx_obj_3_sa_TrieNode *)o; - Py_XDECREF(p->children); + Py_CLEAR(p->children); (*Py_TYPE(o)->tp_free)(o); } @@ -56544,16 +60015,16 @@ static int __pyx_tp_clear_3_sa_TrieNode(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_3_sa_8TrieNode_children(PyObject *o, void *x) { - return __pyx_pf_3_sa_8TrieNode_8children___get__(o); +static PyObject *__pyx_getprop_3_sa_8TrieNode_children(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_8TrieNode_8children_1__get__(o); } -static int __pyx_setprop_3_sa_8TrieNode_children(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_8TrieNode_children(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pf_3_sa_8TrieNode_8children_1__set__(o, v); + return __pyx_pw_3_sa_8TrieNode_8children_3__set__(o, v); } else { - return __pyx_pf_3_sa_8TrieNode_8children_2__del__(o); + return __pyx_pw_3_sa_8TrieNode_8children_5__del__(o); } } @@ -56728,7 +60199,7 @@ static PyObject *__pyx_tp_new_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a p->phrase = Py_None; Py_INCREF(Py_None); p->phrase_location = Py_None; Py_INCREF(Py_None); p->suffix_link = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_3_sa_16ExtendedTrieNode___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_16ExtendedTrieNode_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -56736,9 +60207,9 @@ static PyObject *__pyx_tp_new_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a static void __pyx_tp_dealloc_3_sa_ExtendedTrieNode(PyObject *o) { struct __pyx_obj_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_3_sa_ExtendedTrieNode *)o; - Py_XDECREF(p->phrase); - Py_XDECREF(p->phrase_location); - Py_XDECREF(p->suffix_link); + Py_CLEAR(p->phrase); + Py_CLEAR(p->phrase_location); + Py_CLEAR(p->suffix_link); __pyx_tp_dealloc_3_sa_TrieNode(o); } @@ -56774,42 +60245,42 @@ static int __pyx_tp_clear_3_sa_ExtendedTrieNode(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_phrase(PyObject *o, void *x) { - return __pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(o); +static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_phrase(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_1__get__(o); } -static int __pyx_setprop_3_sa_16ExtendedTrieNode_phrase(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_16ExtendedTrieNode_phrase(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_1__set__(o, v); + return __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_3__set__(o, v); } else { - return __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__del__(o); + return __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_5__del__(o); } } -static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, void *x) { - return __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(o); +static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(o); } -static int __pyx_setprop_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_1__set__(o, v); + return __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(o, v); } else { - return __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__del__(o); + return __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(o); } } -static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, void *x) { - return __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(o); +static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(o); } -static int __pyx_setprop_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_1__set__(o, v); + return __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(o, v); } else { - return __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__del__(o); + return __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(o); } } @@ -56984,7 +60455,7 @@ static PyObject *__pyx_tp_new_3_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObj if (!o) return 0; p = ((struct __pyx_obj_3_sa_TrieTable *)o); p->root = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_3_sa_9TrieTable___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_9TrieTable_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -56992,7 +60463,7 @@ static PyObject *__pyx_tp_new_3_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObj static void __pyx_tp_dealloc_3_sa_TrieTable(PyObject *o) { struct __pyx_obj_3_sa_TrieTable *p = (struct __pyx_obj_3_sa_TrieTable *)o; - Py_XDECREF(p->root); + Py_CLEAR(p->root); (*Py_TYPE(o)->tp_free)(o); } @@ -57014,13 +60485,13 @@ static int __pyx_tp_clear_3_sa_TrieTable(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_3_sa_9TrieTable_extended(PyObject *o, void *x) { - return __pyx_pf_3_sa_9TrieTable_8extended___get__(o); +static PyObject *__pyx_getprop_3_sa_9TrieTable_extended(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_9TrieTable_8extended_1__get__(o); } -static int __pyx_setprop_3_sa_9TrieTable_extended(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_9TrieTable_extended(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pf_3_sa_9TrieTable_8extended_1__set__(o, v); + return __pyx_pw_3_sa_9TrieTable_8extended_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -57028,13 +60499,13 @@ static int __pyx_setprop_3_sa_9TrieTable_extended(PyObject *o, PyObject *v, void } } -static PyObject *__pyx_getprop_3_sa_9TrieTable_count(PyObject *o, void *x) { - return __pyx_pf_3_sa_9TrieTable_5count___get__(o); +static PyObject *__pyx_getprop_3_sa_9TrieTable_count(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_9TrieTable_5count_1__get__(o); } -static int __pyx_setprop_3_sa_9TrieTable_count(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_9TrieTable_count(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pf_3_sa_9TrieTable_5count_1__set__(o, v); + return __pyx_pw_3_sa_9TrieTable_5count_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -57042,16 +60513,16 @@ static int __pyx_setprop_3_sa_9TrieTable_count(PyObject *o, PyObject *v, void *x } } -static PyObject *__pyx_getprop_3_sa_9TrieTable_root(PyObject *o, void *x) { - return __pyx_pf_3_sa_9TrieTable_4root___get__(o); +static PyObject *__pyx_getprop_3_sa_9TrieTable_root(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_3_sa_9TrieTable_4root_1__get__(o); } -static int __pyx_setprop_3_sa_9TrieTable_root(PyObject *o, PyObject *v, void *x) { +static int __pyx_setprop_3_sa_9TrieTable_root(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pf_3_sa_9TrieTable_4root_1__set__(o, v); + return __pyx_pw_3_sa_9TrieTable_4root_3__set__(o, v); } else { - return __pyx_pf_3_sa_9TrieTable_4root_2__del__(o); + return __pyx_pw_3_sa_9TrieTable_4root_5__del__(o); } } @@ -57228,7 +60699,7 @@ static PyObject *__pyx_tp_new_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, p = ((struct __pyx_obj_3_sa_PhraseLocation *)o); p->__pyx_vtab = __pyx_vtabptr_3_sa_PhraseLocation; p->arr = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_14PhraseLocation___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_14PhraseLocation_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -57236,7 +60707,7 @@ static PyObject *__pyx_tp_new_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, static void __pyx_tp_dealloc_3_sa_PhraseLocation(PyObject *o) { struct __pyx_obj_3_sa_PhraseLocation *p = (struct __pyx_obj_3_sa_PhraseLocation *)o; - Py_XDECREF(((PyObject *)p->arr)); + Py_CLEAR(p->arr); (*Py_TYPE(o)->tp_free)(o); } @@ -57422,7 +60893,7 @@ static PyObject *__pyx_tp_new_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObjec if (!o) return 0; p = ((struct __pyx_obj_3_sa_Sampler *)o); p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_7Sampler___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_7Sampler_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -57430,7 +60901,7 @@ static PyObject *__pyx_tp_new_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObjec static void __pyx_tp_dealloc_3_sa_Sampler(PyObject *o) { struct __pyx_obj_3_sa_Sampler *p = (struct __pyx_obj_3_sa_Sampler *)o; - Py_XDECREF(((PyObject *)p->sa)); + Py_CLEAR(p->sa); (*Py_TYPE(o)->tp_free)(o); } @@ -57453,7 +60924,7 @@ static int __pyx_tp_clear_3_sa_Sampler(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_Sampler[] = { - {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pf_3_sa_7Sampler_1sample, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_7Sampler_1sample)}, + {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_3_sa_7Sampler_3sample, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_7Sampler_2sample)}, {0, 0, 0, 0} }; @@ -57634,7 +61105,7 @@ static PyObject *__pyx_tp_new_3_sa_HieroCachingRuleFactory(PyTypeObject *t, PyOb p->fid2symid = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); p->findexes = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); p->findexes1 = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(o, a, k) < 0) { + if (__pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -57642,22 +61113,22 @@ static PyObject *__pyx_tp_new_3_sa_HieroCachingRuleFactory(PyTypeObject *t, PyOb static void __pyx_tp_dealloc_3_sa_HieroCachingRuleFactory(PyObject *o) { struct __pyx_obj_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_3_sa_HieroCachingRuleFactory *)o; - Py_XDECREF(((PyObject *)p->rules)); - Py_XDECREF(((PyObject *)p->sampler)); - Py_XDECREF(((PyObject *)p->scorer)); - Py_XDECREF(p->precomputed_index); - Py_XDECREF(p->precomputed_collocations); - Py_XDECREF(p->precompute_file); - Py_XDECREF(p->max_rank); - Py_XDECREF(p->prev_norm_prefix); - Py_XDECREF(((PyObject *)p->fsa)); - Py_XDECREF(((PyObject *)p->fda)); - Py_XDECREF(((PyObject *)p->eda)); - Py_XDECREF(((PyObject *)p->alignment)); - Py_XDECREF(((PyObject *)p->eid2symid)); - Py_XDECREF(((PyObject *)p->fid2symid)); - Py_XDECREF(((PyObject *)p->findexes)); - Py_XDECREF(((PyObject *)p->findexes1)); + Py_CLEAR(p->rules); + Py_CLEAR(p->sampler); + Py_CLEAR(p->scorer); + Py_CLEAR(p->precomputed_index); + Py_CLEAR(p->precomputed_collocations); + Py_CLEAR(p->precompute_file); + Py_CLEAR(p->max_rank); + Py_CLEAR(p->prev_norm_prefix); + Py_CLEAR(p->fsa); + Py_CLEAR(p->fda); + Py_CLEAR(p->eda); + Py_CLEAR(p->alignment); + Py_CLEAR(p->eid2symid); + Py_CLEAR(p->fid2symid); + Py_CLEAR(p->findexes); + Py_CLEAR(p->findexes1); (*Py_TYPE(o)->tp_free)(o); } @@ -57770,17 +61241,17 @@ static int __pyx_tp_clear_3_sa_HieroCachingRuleFactory(PyObject *o) { } static PyMethodDef __pyx_methods_3_sa_HieroCachingRuleFactory[] = { - {__Pyx_NAMESTR("configure"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_1configure, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_23HieroCachingRuleFactory_1configure)}, - {__Pyx_NAMESTR("pattern2phrase"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_2pattern2phrase, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("pattern2phrase_plus"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_3pattern2phrase_plus, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_4precompute, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_precomputed_collocation"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_5get_precomputed_collocation, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("advance"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_6advance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_all_nodes_isteps_away"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_7get_all_nodes_isteps_away, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("reachable"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_8reachable, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("shortest"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_9shortest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_next_states"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_next_states, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("input"), (PyCFunction)__pyx_pf_3_sa_23HieroCachingRuleFactory_11input, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_23HieroCachingRuleFactory_11input)}, + {__Pyx_NAMESTR("configure"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_3configure, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_23HieroCachingRuleFactory_2configure)}, + {__Pyx_NAMESTR("pattern2phrase"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_5pattern2phrase, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("pattern2phrase_plus"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9precompute, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_precomputed_collocation"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("advance"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_all_nodes_isteps_away"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("reachable"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("shortest"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_next_states"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("input"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_23input, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_23HieroCachingRuleFactory_22input)}, {0, 0, 0, 0} }; @@ -57939,7 +61410,7 @@ static PyTypeObject __pyx_type_3_sa_HieroCachingRuleFactory = { }; static struct __pyx_vtabstruct_3_sa_Scorer __pyx_vtable_3_sa_Scorer; -static PyObject *__pyx_tp_new_3_sa_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_3_sa_Scorer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_3_sa_Scorer *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -57951,7 +61422,7 @@ static PyObject *__pyx_tp_new_3_sa_Scorer(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_3_sa_Scorer(PyObject *o) { struct __pyx_obj_3_sa_Scorer *p = (struct __pyx_obj_3_sa_Scorer *)o; - Py_XDECREF(p->models); + Py_CLEAR(p->models); (*Py_TYPE(o)->tp_free)(o); } @@ -58115,7 +61586,7 @@ static PyTypeObject __pyx_type_3_sa_Scorer = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pf_3_sa_6Scorer___init__, /*tp_init*/ + __pyx_pw_3_sa_6Scorer_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_3_sa_Scorer, /*tp_new*/ 0, /*tp_free*/ @@ -58131,63 +61602,442 @@ static PyTypeObject __pyx_type_3_sa_Scorer = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_Generator(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_Generator_object *p; +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_Generator_object *)o); - p->exc_type = 0; - p->exc_value = 0; - p->exc_traceback = 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o); + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_Generator(PyObject *o) { - struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o; - Py_XDECREF(p->exc_type); - Py_XDECREF(p->exc_value); - Py_XDECREF(p->exc_traceback); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct____iter__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; + Py_CLEAR(p->__pyx_v_self); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_Generator(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o; - if (p->exc_type) { - e = (*v)(p->exc_type, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } - if (p->exc_value) { - e = (*v)(p->exc_value, a); if (e) return e; + return 0; +} + +static int __pyx_tp_clear_3_sa___pyx_scope_struct____iter__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct____iter__[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct____iter__ = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct____iter__ = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct____iter__ = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct____iter__ = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct____iter__ = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_sa.__pyx_scope_struct____iter__"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct____iter__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct____iter__, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct____iter__, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct____iter__, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct____iter__, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct____iter__, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct____iter__, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct____iter__, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa___pyx_scope_struct____iter__, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_3_sa___pyx_scope_struct____iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_1_read_bitext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o); + p->__pyx_v_fp = 0; + return o; +} + +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; + Py_CLEAR(p->__pyx_v_fp); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; + if (p->__pyx_v_fp) { + e = (*v)(p->__pyx_v_fp, a); if (e) return e; } - if (p->exc_traceback) { - e = (*v)(p->exc_traceback, a); if (e) return e; + return 0; +} + +static int __pyx_tp_clear_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_fp); + p->__pyx_v_fp = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_1_read_bitext[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1_read_bitext = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1_read_bitext = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_1_read_bitext = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_read_bitext = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_sa.__pyx_scope_struct_1_read_bitext"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_1_read_bitext, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct_1_read_bitext, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_1_read_bitext, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_1_read_bitext, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct_1_read_bitext, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_1_read_bitext, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_1_read_bitext, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa___pyx_scope_struct_1_read_bitext, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_3_sa___pyx_scope_struct_1_read_bitext, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_line = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o; + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_line); + Py_CLEAR(p->__pyx_t_0); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_line) { + e = (*v)(p->__pyx_v_line, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_Generator(PyObject *o) { - struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o; PyObject* tmp; - tmp = ((PyObject*)p->exc_type); - p->exc_type = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->exc_value); - p->exc_value = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_line); + p->__pyx_v_line = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->exc_traceback); - p->exc_traceback = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_Generator[] = { - {__Pyx_NAMESTR("send"), (PyCFunction)__Pyx_Generator_Send, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("close"), (PyCFunction)__Pyx_Generator_Close, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("throw"), (PyCFunction)__Pyx_Generator_Throw, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_2_genexpr[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_Generator = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_2_genexpr = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -58245,7 +62095,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_Generator = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_Generator = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_2_genexpr = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -58258,13 +62108,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_Generator = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_Generator = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_2_genexpr = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_Generator = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_2_genexpr = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -58285,12 +62135,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_Generator = { #endif }; -static PyTypeObject __pyx_Generator_type = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_Generator"), /*tp_name*/ - sizeof(struct __pyx_Generator_object), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_2_genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_Generator, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -58300,24 +62150,24 @@ static PyTypeObject __pyx_Generator_type = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_Generator, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_Generator, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_Generator, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_2_genexpr, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_2_genexpr, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_2_genexpr, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_Generator, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_2_genexpr, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_Generator, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_Generator, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_2_genexpr, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_2_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - PyObject_SelfIter, /*tp_iter*/ - __Pyx_Generator_Next, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_Generator, /*tp_methods*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa___pyx_scope_struct_2_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -58327,7 +62177,7 @@ static PyTypeObject __pyx_Generator_type = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_Generator, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_2_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -58341,46 +62191,84 @@ static PyTypeObject __pyx_Generator_type = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_3_compute_stats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o); + p->__pyx_v_ngram = 0; + p->__pyx_v_ngram_start = 0; + p->__pyx_v_ngram_starts = 0; + p->__pyx_v_run_start = 0; p->__pyx_v_self = 0; + p->__pyx_v_veb = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct____iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; - Py_XDECREF(((PyObject *)p->__pyx_v_self)); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o; + Py_CLEAR(p->__pyx_v_ngram); + Py_CLEAR(p->__pyx_v_ngram_start); + Py_CLEAR(p->__pyx_v_ngram_starts); + Py_CLEAR(p->__pyx_v_run_start); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_veb); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o; + if (p->__pyx_v_ngram) { + e = (*v)(p->__pyx_v_ngram, a); if (e) return e; + } + if (p->__pyx_v_ngram_start) { + e = (*v)(((PyObject*)p->__pyx_v_ngram_start), a); if (e) return e; + } + if (p->__pyx_v_ngram_starts) { + e = (*v)(p->__pyx_v_ngram_starts, a); if (e) return e; + } + if (p->__pyx_v_run_start) { + e = (*v)(((PyObject*)p->__pyx_v_run_start), a); if (e) return e; + } if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } + if (p->__pyx_v_veb) { + e = (*v)(((PyObject*)p->__pyx_v_veb), a); if (e) return e; + } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct____iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); + tmp = ((PyObject*)p->__pyx_v_ngram); + p->__pyx_v_ngram = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_ngram_start); + p->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_ngram_starts); + p->__pyx_v_ngram_starts = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_run_start); + p->__pyx_v_run_start = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = Py_None; Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_3_sa_LCP *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_veb); + p->__pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct____iter__[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_3_compute_stats[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct____iter__ = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_3_compute_stats = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -58438,7 +62326,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct____iter__ = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct____iter__ = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_3_compute_stats = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -58451,13 +62339,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct____iter__ = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct____iter__ = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_3_compute_stats = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct____iter__ = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_3_compute_stats = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -58478,12 +62366,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct____iter__ = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct____iter__ = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct____iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct____iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_3_compute_stats"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct____iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_3_compute_stats, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -58493,24 +62381,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct____iter__ = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct____iter__, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct____iter__, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct____iter__, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_3_compute_stats, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_3_compute_stats, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_3_compute_stats, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct____iter__, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_3_compute_stats, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct____iter__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct____iter__, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_3_compute_stats, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_3_compute_stats, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct____iter__, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_3_compute_stats, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -58520,7 +62408,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct____iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct____iter__, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_3_compute_stats, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -58534,44 +62422,52 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct____iter__ = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_1_read_bitext(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p; +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_4_make_lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o); - p->__pyx_v_fp = 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)o); + p->__pyx_v_word_ids = 0; + p->__pyx_v_words = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; - Py_XDECREF(p->__pyx_v_fp); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)o; + Py_CLEAR(p->__pyx_v_word_ids); + Py_CLEAR(p->__pyx_v_words); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; - if (p->__pyx_v_fp) { - e = (*v)(p->__pyx_v_fp, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)o; + if (p->__pyx_v_word_ids) { + e = (*v)(p->__pyx_v_word_ids, a); if (e) return e; + } + if (p->__pyx_v_words) { + e = (*v)(p->__pyx_v_words, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_fp); - p->__pyx_v_fp = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_word_ids); + p->__pyx_v_word_ids = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_words); + p->__pyx_v_words = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_1_read_bitext[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_4_make_lattice[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1_read_bitext = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_4_make_lattice = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -58629,7 +62525,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1_read_bitext = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1_read_bitext = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_4_make_lattice = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -58642,13 +62538,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1_read_bitext = 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_1_read_bitext = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_4_make_lattice = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_read_bitext = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_4_make_lattice = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -58669,12 +62565,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_read_bitext = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4_make_lattice = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_1_read_bitext"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_4_make_lattice"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_1_read_bitext, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_4_make_lattice, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -58684,24 +62580,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_1_read_bitext, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_1_read_bitext, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_1_read_bitext, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_4_make_lattice, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_4_make_lattice, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_4_make_lattice, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_1_read_bitext, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_4_make_lattice, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_1_read_bitext, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_1_read_bitext, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_4_make_lattice, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_4_make_lattice, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_1_read_bitext, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_4_make_lattice, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -58711,7 +62607,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_1_read_bitext, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_4_make_lattice, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -58725,34 +62621,33 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)o); p->__pyx_outer_scope = 0; - p->__pyx_v_line = 0; + p->__pyx_v_word = 0; p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o; - Py_XDECREF(((PyObject *)p->__pyx_outer_scope)); - Py_XDECREF(p->__pyx_v_line); - Py_XDECREF(p->__pyx_t_0); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)o; + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_word); + Py_CLEAR(p->__pyx_t_0); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->__pyx_v_line) { - e = (*v)(p->__pyx_v_line, a); if (e) return e; + if (p->__pyx_v_word) { + e = (*v)(p->__pyx_v_word, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; @@ -58760,15 +62655,14 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_2_genexpr(PyObject *o, visi return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_line); - p->__pyx_v_line = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_word); + p->__pyx_v_word = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); @@ -58776,11 +62670,11 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_2_genexpr[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_5_genexpr[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_2_genexpr = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_5_genexpr = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -58838,7 +62732,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_2_genexpr = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_2_genexpr = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_5_genexpr = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -58851,13 +62745,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_2_genexpr = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_2_genexpr = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_5_genexpr = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_2_genexpr = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_5_genexpr = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -58878,12 +62772,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_2_genexpr = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_genexpr = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_2_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_5_genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -58893,24 +62787,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_genexpr = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_2_genexpr, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_2_genexpr, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_2_genexpr, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_5_genexpr, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_5_genexpr, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_5_genexpr, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_2_genexpr, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_5_genexpr, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_2_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_2_genexpr, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_5_genexpr, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_5_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_2_genexpr, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_5_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -58920,7 +62814,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_2_genexpr, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_5_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -58934,86 +62828,506 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_genexpr = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_3_compute_stats(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o); - p->__pyx_v_ngram = 0; - p->__pyx_v_ngram_start = 0; - p->__pyx_v_ngram_starts = 0; - p->__pyx_v_run_start = 0; - p->__pyx_v_self = 0; - p->__pyx_v_veb = 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o; - Py_XDECREF(((PyObject *)p->__pyx_v_ngram)); - Py_XDECREF(((PyObject *)p->__pyx_v_ngram_start)); - Py_XDECREF(((PyObject *)p->__pyx_v_ngram_starts)); - Py_XDECREF(((PyObject *)p->__pyx_v_run_start)); - Py_XDECREF(((PyObject *)p->__pyx_v_self)); - Py_XDECREF(((PyObject *)p->__pyx_v_veb)); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o; + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_word); + Py_CLEAR(p->__pyx_t_0); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; - if (p->__pyx_v_ngram) { - e = (*v)(p->__pyx_v_ngram, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->__pyx_v_ngram_start) { - e = (*v)(((PyObject*)p->__pyx_v_ngram_start), a); if (e) return e; + if (p->__pyx_v_word) { + e = (*v)(p->__pyx_v_word, a); if (e) return e; } - if (p->__pyx_v_ngram_starts) { - e = (*v)(p->__pyx_v_ngram_starts, a); if (e) return e; + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; } - if (p->__pyx_v_run_start) { - e = (*v)(((PyObject*)p->__pyx_v_run_start), a); if (e) return e; + return 0; +} + +static int __pyx_tp_clear_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_word); + p->__pyx_v_word = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_6_genexpr[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_6_genexpr = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_6_genexpr = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_6_genexpr = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_6_genexpr = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_6_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_sa.__pyx_scope_struct_6_genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_6_genexpr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct_6_genexpr, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_6_genexpr, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_6_genexpr, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct_6_genexpr, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_6_genexpr, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_6_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa___pyx_scope_struct_6_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_3_sa___pyx_scope_struct_6_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_7_decode_lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)o); + p->__pyx_v_lattice = 0; + return o; +} + +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)o; + Py_CLEAR(p->__pyx_v_lattice); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)o; + if (p->__pyx_v_lattice) { + e = (*v)(p->__pyx_v_lattice, a); if (e) return e; } - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + return 0; +} + +static int __pyx_tp_clear_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_lattice); + p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_7_decode_lattice[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7_decode_lattice = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_7_decode_lattice = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_7_decode_lattice = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_7_decode_lattice = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_7_decode_lattice = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_sa.__pyx_scope_struct_7_decode_lattice"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct_7_decode_lattice, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_7_decode_lattice, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_7_decode_lattice, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct_7_decode_lattice, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_arc = 0; + p->__pyx_v_dist = 0; + p->__pyx_v_node = 0; + p->__pyx_v_sym = 0; + p->__pyx_v_weight = 0; + p->__pyx_t_0 = 0; + p->__pyx_t_3 = 0; + p->__pyx_t_4 = 0; + return o; +} + +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o; + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_arc); + Py_CLEAR(p->__pyx_v_dist); + Py_CLEAR(p->__pyx_v_node); + Py_CLEAR(p->__pyx_v_sym); + Py_CLEAR(p->__pyx_v_weight); + Py_CLEAR(p->__pyx_t_0); + Py_CLEAR(p->__pyx_t_3); + Py_CLEAR(p->__pyx_t_4); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->__pyx_v_veb) { - e = (*v)(((PyObject*)p->__pyx_v_veb), a); if (e) return e; + if (p->__pyx_v_arc) { + e = (*v)(p->__pyx_v_arc, a); if (e) return e; + } + if (p->__pyx_v_dist) { + e = (*v)(p->__pyx_v_dist, a); if (e) return e; + } + if (p->__pyx_v_node) { + e = (*v)(p->__pyx_v_node, a); if (e) return e; + } + if (p->__pyx_v_sym) { + e = (*v)(p->__pyx_v_sym, a); if (e) return e; + } + if (p->__pyx_v_weight) { + e = (*v)(p->__pyx_v_weight, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + if (p->__pyx_t_3) { + e = (*v)(p->__pyx_t_3, a); if (e) return e; + } + if (p->__pyx_t_4) { + e = (*v)(p->__pyx_t_4, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); - tmp = ((PyObject*)p->__pyx_v_ngram); - p->__pyx_v_ngram = ((PyObject*)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_ngram_start); - p->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_arc); + p->__pyx_v_arc = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_ngram_starts); - p->__pyx_v_ngram_starts = ((PyObject*)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_dist); + p->__pyx_v_dist = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_run_start); - p->__pyx_v_run_start = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_node); + p->__pyx_v_node = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_sym); + p->__pyx_v_sym = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_veb); - p->__pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_weight); + p->__pyx_v_weight = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_3); + p->__pyx_t_3 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_4); + p->__pyx_t_4 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_3_compute_stats[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_8_genexpr[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_3_compute_stats = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_8_genexpr = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -59071,7 +63385,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_3_compute_stats = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_3_compute_stats = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_8_genexpr = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -59084,13 +63398,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_3_compute_stats 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_3_compute_stats = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_8_genexpr = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_3_compute_stats = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_8_genexpr = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -59111,12 +63425,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_3_compute_stats = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_3_compute_stats"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_8_genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_3_compute_stats, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_8_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -59126,24 +63440,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_3_compute_stats, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_3_compute_stats, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_3_compute_stats, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_8_genexpr, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_8_genexpr, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_8_genexpr, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_3_compute_stats, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_8_genexpr, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_3_compute_stats, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_3_compute_stats, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_8_genexpr, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_8_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_3_compute_stats, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_8_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -59153,7 +63467,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_3_compute_stats, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_8_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -59167,46 +63481,450 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_4___iter__(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_9_decode_sentence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)o); + p->__pyx_v_lattice = 0; + return o; +} + +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)o; + Py_CLEAR(p->__pyx_v_lattice); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)o; + if (p->__pyx_v_lattice) { + e = (*v)(p->__pyx_v_lattice, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_lattice); + p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_9_decode_sentence[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_9_decode_sentence = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_9_decode_sentence = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_9_decode_sentence = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_9_decode_sentence = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9_decode_sentence = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_sa.__pyx_scope_struct_9_decode_sentence"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct_9_decode_sentence, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_9_decode_sentence, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_9_decode_sentence, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct_9_decode_sentence, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v__ = 0; + p->__pyx_v_sym = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)o; + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v__); + Py_CLEAR(p->__pyx_v_sym); + Py_CLEAR(p->__pyx_t_0); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v__) { + e = (*v)(p->__pyx_v__, a); if (e) return e; + } + if (p->__pyx_v_sym) { + e = (*v)(p->__pyx_v_sym, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v__); + p->__pyx_v__ = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sym); + p->__pyx_v_sym = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_10_genexpr[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_10_genexpr = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_10_genexpr = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_10_genexpr = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_10_genexpr = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_10_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_sa.__pyx_scope_struct_10_genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_10_genexpr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct_10_genexpr, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_10_genexpr, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_10_genexpr, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct_10_genexpr, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_10_genexpr, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_10_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_3_sa___pyx_scope_struct_10_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_3_sa___pyx_scope_struct_10_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_11___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_4___iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *)o; - Py_XDECREF(((PyObject *)p->__pyx_v_self)); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_11___iter__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *)o; + Py_CLEAR(p->__pyx_v_self); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_4___iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_11___iter__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_4___iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__ *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_11___iter__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__ *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = Py_None; Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_4___iter__[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_11___iter__[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_4___iter__ = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_11___iter__ = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -59264,7 +63982,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_4___iter__ = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_4___iter__ = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_11___iter__ = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -59277,13 +63995,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_4___iter__ = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_4___iter__ = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_11___iter__ = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_4___iter__ = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_11___iter__ = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -59304,12 +64022,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_4___iter__ = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4___iter__ = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_11___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_4___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_4___iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_11___iter__"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_11___iter__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_4___iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_11___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -59319,24 +64037,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4___iter__ = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_4___iter__, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_4___iter__, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_4___iter__, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_11___iter__, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_11___iter__, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_11___iter__, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_4___iter__, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_11___iter__, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_4___iter__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_4___iter__, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_11___iter__, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_11___iter__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_4___iter__, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_11___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -59346,7 +64064,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4___iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_4___iter__, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_11___iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -59360,44 +64078,44 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4___iter__ = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *p; +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_12___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_5___str__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *)o; - Py_XDECREF(((PyObject *)p->__pyx_v_self)); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_12___str__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *)o; + Py_CLEAR(p->__pyx_v_self); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_5___str__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_12___str__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *)o; + struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_5___str__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_12___str__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = Py_None; Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_3_sa_Rule *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_5___str__[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_12___str__[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_5___str__ = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_12___str__ = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -59455,7 +64173,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_5___str__ = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_5___str__ = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_12___str__ = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -59468,13 +64186,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_5___str__ = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_5___str__ = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_12___str__ = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_5___str__ = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_12___str__ = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -59495,12 +64213,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_5___str__ = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5___str__ = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_12___str__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_5___str__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_5___str__), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_12___str__"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_12___str__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_5___str__, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_12___str__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -59510,24 +64228,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5___str__ = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_5___str__, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_5___str__, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_5___str__, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_12___str__, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_12___str__, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_12___str__, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_5___str__, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_12___str__, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_5___str__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_5___str__, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_12___str__, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_12___str__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_5___str__, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_12___str__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -59537,7 +64255,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5___str__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_5___str__, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_12___str__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -59551,29 +64269,28 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5___str__ = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_13_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *)o); p->__pyx_outer_scope = 0; p->__pyx_v_a = 0; p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o; - Py_XDECREF(((PyObject *)p->__pyx_outer_scope)); - Py_XDECREF(p->__pyx_v_a); - Py_XDECREF(p->__pyx_t_0); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_13_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *)o; + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_a); + Py_CLEAR(p->__pyx_t_0); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_13_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -59586,12 +64303,11 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_6_genexpr(PyObject *o, visi return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_13_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_5___str__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_12___str__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_a); p->__pyx_v_a = Py_None; Py_INCREF(Py_None); @@ -59602,11 +64318,11 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_6_genexpr[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_13_genexpr[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_6_genexpr = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_13_genexpr = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -59664,7 +64380,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_6_genexpr = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_6_genexpr = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_13_genexpr = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -59677,13 +64393,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_6_genexpr = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_6_genexpr = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_13_genexpr = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_6_genexpr = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_13_genexpr = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -59704,12 +64420,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_6_genexpr = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_6_genexpr = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_13_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_6_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_13_genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_13_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_6_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_13_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -59719,24 +64435,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_6_genexpr = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_6_genexpr, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_6_genexpr, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_6_genexpr, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_13_genexpr, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_13_genexpr, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_13_genexpr, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_6_genexpr, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_13_genexpr, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_6_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_6_genexpr, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_13_genexpr, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_13_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_6_genexpr, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_13_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -59746,7 +64462,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_6_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_6_genexpr, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_13_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -59760,29 +64476,28 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_6_genexpr = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_7_alignments(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_14_alignments(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *)o); p->__pyx_v_point = 0; p->__pyx_v_self = 0; p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_7_alignments(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *)o; - Py_XDECREF(p->__pyx_v_point); - Py_XDECREF(((PyObject *)p->__pyx_v_self)); - Py_XDECREF(p->__pyx_t_0); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_14_alignments(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *)o; + Py_CLEAR(p->__pyx_v_point); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_t_0); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_7_alignments(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_14_alignments(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *)o; if (p->__pyx_v_point) { e = (*v)(p->__pyx_v_point, a); if (e) return e; } @@ -59795,15 +64510,14 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_7_alignments(PyObject *o, v return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_7_alignments(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_14_alignments(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); tmp = ((PyObject*)p->__pyx_v_point); p->__pyx_v_point = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = Py_None; Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_3_sa_Rule *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); @@ -59811,11 +64525,11 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_7_alignments(PyObject *o) { return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_7_alignments[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_14_alignments[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7_alignments = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_14_alignments = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -59873,7 +64587,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7_alignments = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_7_alignments = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_14_alignments = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -59886,13 +64600,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_7_alignments = 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_7_alignments = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_14_alignments = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_7_alignments = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_14_alignments = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -59913,12 +64627,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_7_alignments = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_7_alignments = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_14_alignments = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_7_alignments"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_7_alignments), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_14_alignments"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_14_alignments), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_7_alignments, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_14_alignments, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -59928,24 +64642,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_7_alignments = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_7_alignments, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_7_alignments, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_7_alignments, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_14_alignments, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_14_alignments, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_14_alignments, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_7_alignments, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_14_alignments, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_7_alignments, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_7_alignments, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_14_alignments, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_14_alignments, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_7_alignments, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_14_alignments, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -59955,7 +64669,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_7_alignments = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_7_alignments, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_14_alignments, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -59969,11 +64683,11 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_7_alignments = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_8_input(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_8_input *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_15_input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_15_input *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_8_input *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_15_input *)o); p->__pyx_v_alignment = 0; p->__pyx_v_als = 0; p->__pyx_v_alslist = 0; @@ -60019,69 +64733,68 @@ static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_8_input(PyTypeObject *t, P p->__pyx_v_xcat_index = 0; p->__pyx_v_xnode = 0; p->__pyx_v_xroot = 0; - p->__pyx_t_2 = 0; - p->__pyx_t_3 = 0; + p->__pyx_t_1 = 0; p->__pyx_t_4 = 0; + p->__pyx_t_5 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_8_input(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_8_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_input *)o; - Py_XDECREF(p->__pyx_v_alignment); - Py_XDECREF(p->__pyx_v_als); - Py_XDECREF(p->__pyx_v_alslist); - Py_XDECREF(((PyObject *)p->__pyx_v_chunklen)); - Py_XDECREF(p->__pyx_v_count); - Py_XDECREF(p->__pyx_v_e); - Py_XDECREF(p->__pyx_v_elist); - Py_XDECREF(p->__pyx_v_extract); - Py_XDECREF(p->__pyx_v_extract_start); - Py_XDECREF(p->__pyx_v_extract_stop); - Py_XDECREF(((PyObject *)p->__pyx_v_extracts)); - Py_XDECREF(p->__pyx_v_f); - Py_XDECREF(p->__pyx_v_fcount); - Py_XDECREF(p->__pyx_v_fphrases); - Py_XDECREF(((PyObject *)p->__pyx_v_frontier)); - Py_XDECREF(p->__pyx_v_frontier_nodes); - Py_XDECREF(p->__pyx_v_fwords); - Py_XDECREF(((PyObject *)p->__pyx_v_hiero_phrase)); - Py_XDECREF(p->__pyx_v_is_shadow_path); - Py_XDECREF(((PyObject *)p->__pyx_v_key)); - Py_XDECREF(p->__pyx_v_loc); - Py_XDECREF(((PyObject *)p->__pyx_v_locs)); - Py_XDECREF(p->__pyx_v_max_locs); - Py_XDECREF(((PyObject *)p->__pyx_v_new_frontier)); - Py_XDECREF(p->__pyx_v_new_node); - Py_XDECREF(((PyObject *)p->__pyx_v_next_states)); - Py_XDECREF(p->__pyx_v_node); - Py_XDECREF(((PyObject *)p->__pyx_v_nodes_isteps_away_buffer)); - Py_XDECREF(p->__pyx_v_pathlen); - Py_XDECREF(p->__pyx_v_phrase); - Py_XDECREF(((PyObject *)p->__pyx_v_phrase_location)); - Py_XDECREF(p->__pyx_v_prefix); - Py_XDECREF(((PyObject *)p->__pyx_v_reachable_buffer)); - Py_XDECREF(p->__pyx_v_sa_range); - Py_XDECREF(((PyObject *)p->__pyx_v_sample)); - Py_XDECREF(((PyObject *)p->__pyx_v_scores)); - Py_XDECREF(((PyObject *)p->__pyx_v_self)); - Py_XDECREF(p->__pyx_v_spanlen); - Py_XDECREF(p->__pyx_v_stop_time); - Py_XDECREF(p->__pyx_v_suffix_link); - Py_XDECREF(p->__pyx_v_suffix_link_xcat_index); - Py_XDECREF(p->__pyx_v_word_id); - Py_XDECREF(p->__pyx_v_xcat_index); - Py_XDECREF(p->__pyx_v_xnode); - Py_XDECREF(p->__pyx_v_xroot); - Py_XDECREF(p->__pyx_t_2); - Py_XDECREF(p->__pyx_t_3); - Py_XDECREF(p->__pyx_t_4); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); -} - -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_8_input(PyObject *o, visitproc v, void *a) { +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_15_input(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_15_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_15_input *)o; + Py_CLEAR(p->__pyx_v_alignment); + Py_CLEAR(p->__pyx_v_als); + Py_CLEAR(p->__pyx_v_alslist); + Py_CLEAR(p->__pyx_v_chunklen); + Py_CLEAR(p->__pyx_v_count); + Py_CLEAR(p->__pyx_v_e); + Py_CLEAR(p->__pyx_v_elist); + Py_CLEAR(p->__pyx_v_extract); + Py_CLEAR(p->__pyx_v_extract_start); + Py_CLEAR(p->__pyx_v_extract_stop); + Py_CLEAR(p->__pyx_v_extracts); + Py_CLEAR(p->__pyx_v_f); + Py_CLEAR(p->__pyx_v_fcount); + Py_CLEAR(p->__pyx_v_fphrases); + Py_CLEAR(p->__pyx_v_frontier); + Py_CLEAR(p->__pyx_v_frontier_nodes); + Py_CLEAR(p->__pyx_v_fwords); + Py_CLEAR(p->__pyx_v_hiero_phrase); + Py_CLEAR(p->__pyx_v_is_shadow_path); + Py_CLEAR(p->__pyx_v_key); + Py_CLEAR(p->__pyx_v_loc); + Py_CLEAR(p->__pyx_v_locs); + Py_CLEAR(p->__pyx_v_max_locs); + Py_CLEAR(p->__pyx_v_new_frontier); + Py_CLEAR(p->__pyx_v_new_node); + Py_CLEAR(p->__pyx_v_next_states); + Py_CLEAR(p->__pyx_v_node); + Py_CLEAR(p->__pyx_v_nodes_isteps_away_buffer); + Py_CLEAR(p->__pyx_v_pathlen); + Py_CLEAR(p->__pyx_v_phrase); + Py_CLEAR(p->__pyx_v_phrase_location); + Py_CLEAR(p->__pyx_v_prefix); + Py_CLEAR(p->__pyx_v_reachable_buffer); + Py_CLEAR(p->__pyx_v_sa_range); + Py_CLEAR(p->__pyx_v_sample); + Py_CLEAR(p->__pyx_v_scores); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_spanlen); + Py_CLEAR(p->__pyx_v_stop_time); + Py_CLEAR(p->__pyx_v_suffix_link); + Py_CLEAR(p->__pyx_v_suffix_link_xcat_index); + Py_CLEAR(p->__pyx_v_word_id); + Py_CLEAR(p->__pyx_v_xcat_index); + Py_CLEAR(p->__pyx_v_xnode); + Py_CLEAR(p->__pyx_v_xroot); + Py_CLEAR(p->__pyx_t_1); + Py_CLEAR(p->__pyx_t_4); + Py_CLEAR(p->__pyx_t_5); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_15_input(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_8_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_input *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_15_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_15_input *)o; if (p->__pyx_v_alignment) { e = (*v)(p->__pyx_v_alignment, a); if (e) return e; } @@ -60217,22 +64930,21 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_8_input(PyObject *o, visitp if (p->__pyx_v_xroot) { e = (*v)(p->__pyx_v_xroot, a); if (e) return e; } - if (p->__pyx_t_2) { - e = (*v)(p->__pyx_t_2, a); if (e) return e; - } - if (p->__pyx_t_3) { - e = (*v)(p->__pyx_t_3, a); if (e) return e; + if (p->__pyx_t_1) { + e = (*v)(p->__pyx_t_1, a); if (e) return e; } if (p->__pyx_t_4) { e = (*v)(p->__pyx_t_4, a); if (e) return e; } + if (p->__pyx_t_5) { + e = (*v)(p->__pyx_t_5, a); if (e) return e; + } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_8_input(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_8_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_input *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_15_input(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_15_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_15_input *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); tmp = ((PyObject*)p->__pyx_v_alignment); p->__pyx_v_alignment = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -60342,7 +65054,7 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_8_input(PyObject *o) { p->__pyx_v_scores = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = Py_None; Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_spanlen); p->__pyx_v_spanlen = Py_None; Py_INCREF(Py_None); @@ -60368,23 +65080,23 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_8_input(PyObject *o) { tmp = ((PyObject*)p->__pyx_v_xroot); p->__pyx_v_xroot = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_2); - p->__pyx_t_2 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_3); - p->__pyx_t_3 = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_t_1); + p->__pyx_t_1 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_4); p->__pyx_t_4 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_5); + p->__pyx_t_5 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_8_input[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_15_input[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_8_input = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_15_input = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -60442,7 +65154,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_8_input = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_8_input = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_15_input = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -60455,13 +65167,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_8_input = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_8_input = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_15_input = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_8_input = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_15_input = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -60482,12 +65194,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_8_input = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_input = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_15_input = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_8_input"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_8_input), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_15_input"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_15_input), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_8_input, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_15_input, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -60497,24 +65209,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_input = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_8_input, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_8_input, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_8_input, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_15_input, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_15_input, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_15_input, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_8_input, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_15_input, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_8_input, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_8_input, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_15_input, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_15_input, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_8_input, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_15_input, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -60524,7 +65236,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_input = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_8_input, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_15_input, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -60538,46 +65250,44 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_input = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_9___iter__(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_16___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_9___iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *)o; - Py_XDECREF(((PyObject *)p->__pyx_v_self)); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_16___iter__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *)o; + Py_CLEAR(p->__pyx_v_self); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_9___iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_16___iter__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_9___iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__ *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_16___iter__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__ *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = Py_None; Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_9___iter__[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_16___iter__[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_9___iter__ = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_16___iter__ = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -60635,7 +65345,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_9___iter__ = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_9___iter__ = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_16___iter__ = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -60648,13 +65358,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_9___iter__ = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_9___iter__ = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_16___iter__ = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_9___iter__ = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_16___iter__ = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -60675,12 +65385,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_9___iter__ = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9___iter__ = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_16___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_9___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_9___iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_16___iter__"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_16___iter__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_9___iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_16___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -60690,24 +65400,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9___iter__ = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_9___iter__, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_9___iter__, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_9___iter__, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_16___iter__, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_16___iter__, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_16___iter__, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_9___iter__, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_16___iter__, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_9___iter__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_9___iter__, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_16___iter__, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_16___iter__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_9___iter__, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_16___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -60717,7 +65427,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9___iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_9___iter__, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_16___iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -60731,44 +65441,44 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9___iter__ = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_10___str__(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *p; +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_17___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_10___str__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *)o; - Py_XDECREF(((PyObject *)p->__pyx_v_self)); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_17___str__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *)o; + Py_CLEAR(p->__pyx_v_self); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_10___str__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_17___str__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *)o; + struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_10___str__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_17___str__(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = Py_None; Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_10___str__[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_17___str__[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_10___str__ = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_17___str__ = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -60826,7 +65536,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_10___str__ = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_10___str__ = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_17___str__ = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -60839,13 +65549,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_10___str__ = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_10___str__ = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_17___str__ = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_10___str__ = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_17___str__ = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -60866,12 +65576,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_10___str__ = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_10___str__ = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_17___str__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_10___str__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_10___str__), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_17___str__"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_17___str__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_10___str__, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_17___str__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -60881,24 +65591,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_10___str__ = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_10___str__, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_10___str__, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_10___str__, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_17___str__, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_17___str__, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_17___str__, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_10___str__, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_17___str__, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_10___str__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_10___str__, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_17___str__, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_17___str__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_10___str__, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_17___str__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -60908,7 +65618,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_10___str__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_10___str__, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_17___str__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -60922,29 +65632,28 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_10___str__ = { #endif }; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_11_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *p; - PyObject *o = __pyx_tp_new_3_sa___pyx_Generator(t, a, k); +static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_18_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *p; + PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *)o); + p = ((struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *)o); p->__pyx_outer_scope = 0; p->__pyx_v_feat = 0; p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_11_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *)o; - Py_XDECREF(((PyObject *)p->__pyx_outer_scope)); - Py_XDECREF(p->__pyx_v_feat); - Py_XDECREF(p->__pyx_t_0); - __pyx_tp_dealloc_3_sa___pyx_Generator(o); +static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_18_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *)o; + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_feat); + Py_CLEAR(p->__pyx_t_0); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_11_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_3_sa___pyx_scope_struct_18_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *)o; - e = __pyx_tp_traverse_3_sa___pyx_Generator(o, v, a); if (e) return e; + struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } @@ -60957,12 +65666,11 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_11_genexpr(PyObject *o, vis return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_11_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr *)o; +static int __pyx_tp_clear_3_sa___pyx_scope_struct_18_genexpr(PyObject *o) { + struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr *)o; PyObject* tmp; - __pyx_tp_clear_3_sa___pyx_Generator(o); tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_10___str__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_17___str__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_feat); p->__pyx_v_feat = Py_None; Py_INCREF(Py_None); @@ -60973,11 +65681,11 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_11_genexpr(PyObject *o) { return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_11_genexpr[] = { +static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_18_genexpr[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_11_genexpr = { +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_18_genexpr = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ @@ -61035,7 +65743,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_11_genexpr = { #endif }; -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_11_genexpr = { +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_18_genexpr = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ @@ -61048,13 +65756,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_11_genexpr = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_11_genexpr = { +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_18_genexpr = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_11_genexpr = { +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_18_genexpr = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif @@ -61075,12 +65783,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_11_genexpr = { #endif }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_11_genexpr = { +static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_18_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_11_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_11_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("_sa.__pyx_scope_struct_18_genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_18_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_11_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_3_sa___pyx_scope_struct_18_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -61090,24 +65798,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_11_genexpr = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct_11_genexpr, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct_11_genexpr, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct_11_genexpr, /*tp_as_mapping*/ + &__pyx_tp_as_number___pyx_scope_struct_18_genexpr, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct_18_genexpr, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct_18_genexpr, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct_11_genexpr, /*tp_as_buffer*/ + &__pyx_tp_as_buffer___pyx_scope_struct_18_genexpr, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa___pyx_scope_struct_11_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_11_genexpr, /*tp_clear*/ + __pyx_tp_traverse_3_sa___pyx_scope_struct_18_genexpr, /*tp_traverse*/ + __pyx_tp_clear_3_sa___pyx_scope_struct_18_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_11_genexpr, /*tp_methods*/ + __pyx_methods_3_sa___pyx_scope_struct_18_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -61117,7 +65825,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_11_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_11_genexpr, /*tp_new*/ + __pyx_tp_new_3_sa___pyx_scope_struct_18_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -61183,9 +65891,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0}, {&__pyx_kp_s_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 0}, {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0}, - {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0}, {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0}, + {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0}, {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 0}, {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, @@ -61277,6 +65986,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1}, {&__pyx_n_s__curr_idx, __pyx_k__curr_idx, sizeof(__pyx_k__curr_idx), 0, 0, 1, 1}, {&__pyx_n_s__debug, __pyx_k__debug, sizeof(__pyx_k__debug), 0, 0, 1, 1}, + {&__pyx_n_s__decode_lattice, __pyx_k__decode_lattice, sizeof(__pyx_k__decode_lattice), 0, 0, 1, 1}, + {&__pyx_n_s__decode_sentence, __pyx_k__decode_sentence, sizeof(__pyx_k__decode_sentence), 0, 0, 1, 1}, {&__pyx_n_s__defaultdict, __pyx_k__defaultdict, sizeof(__pyx_k__defaultdict), 0, 0, 1, 1}, {&__pyx_n_s__dist, __pyx_k__dist, sizeof(__pyx_k__dist), 0, 0, 1, 1}, {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1}, @@ -61304,6 +66015,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__fword, __pyx_k__fword, sizeof(__pyx_k__fword), 0, 0, 1, 1}, {&__pyx_n_s__fwords, __pyx_k__fwords, sizeof(__pyx_k__fwords), 0, 0, 1, 1}, {&__pyx_n_s__gc, __pyx_k__gc, sizeof(__pyx_k__gc), 0, 0, 1, 1}, + {&__pyx_n_s__genexpr, __pyx_k__genexpr, sizeof(__pyx_k__genexpr), 0, 0, 1, 1}, {&__pyx_n_s__getLogger, __pyx_k__getLogger, sizeof(__pyx_k__getLogger), 0, 0, 1, 1}, {&__pyx_n_s__get_e_id, __pyx_k__get_e_id, sizeof(__pyx_k__get_e_id), 0, 0, 1, 1}, {&__pyx_n_s__get_f_id, __pyx_k__get_f_id, sizeof(__pyx_k__get_f_id), 0, 0, 1, 1}, @@ -61334,11 +66046,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1}, + {&__pyx_n_s__lattice, __pyx_k__lattice, sizeof(__pyx_k__lattice), 0, 0, 1, 1}, {&__pyx_n_s__lhs, __pyx_k__lhs, sizeof(__pyx_k__lhs), 0, 0, 1, 1}, {&__pyx_n_s__logger, __pyx_k__logger, sizeof(__pyx_k__logger), 0, 0, 1, 1}, {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1}, {&__pyx_n_s__lookup, __pyx_k__lookup, sizeof(__pyx_k__lookup), 0, 0, 1, 1}, {&__pyx_n_s__low, __pyx_k__low, sizeof(__pyx_k__low), 0, 0, 1, 1}, + {&__pyx_n_s__make_lattice, __pyx_k__make_lattice, sizeof(__pyx_k__make_lattice), 0, 0, 1, 1}, {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1}, {&__pyx_n_s__matches, __pyx_k__matches, sizeof(__pyx_k__matches), 0, 0, 1, 1}, {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, @@ -61404,10 +66118,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, {&__pyx_n_s__stats, __pyx_k__stats, sizeof(__pyx_k__stats), 0, 0, 1, 1}, {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1}, - {&__pyx_n_s__string, __pyx_k__string, sizeof(__pyx_k__string), 0, 0, 1, 1}, {&__pyx_n_s__suffix_link, __pyx_k__suffix_link, sizeof(__pyx_k__suffix_link), 0, 0, 1, 1}, - {&__pyx_n_s__sym_fromstring, __pyx_k__sym_fromstring, sizeof(__pyx_k__sym_fromstring), 0, 0, 1, 1}, - {&__pyx_n_s__terminal, __pyx_k__terminal, sizeof(__pyx_k__terminal), 0, 0, 1, 1}, {&__pyx_n_s__test_sentence, __pyx_k__test_sentence, sizeof(__pyx_k__test_sentence), 0, 0, 1, 1}, {&__pyx_n_s__tight_phrases, __pyx_k__tight_phrases, sizeof(__pyx_k__tight_phrases), 0, 0, 1, 1}, {&__pyx_n_s__toMap, __pyx_k__toMap, sizeof(__pyx_k__toMap), 0, 0, 1, 1}, @@ -61422,6 +66133,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__warn, __pyx_k__warn, sizeof(__pyx_k__warn), 0, 0, 1, 1}, {&__pyx_n_s__word, __pyx_k__word, sizeof(__pyx_k__word), 0, 0, 1, 1}, {&__pyx_n_s__word_alignments, __pyx_k__word_alignments, sizeof(__pyx_k__word_alignments), 0, 0, 1, 1}, + {&__pyx_n_s__word_ids, __pyx_k__word_ids, sizeof(__pyx_k__word_ids), 0, 0, 1, 1}, {&__pyx_n_s__words, __pyx_k__words, sizeof(__pyx_k__words), 0, 0, 1, 1}, {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, {&__pyx_n_s__write_text, __pyx_k__write_text, sizeof(__pyx_k__write_text), 0, 0, 1, 1}, @@ -61448,9 +66160,9 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":20 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":20 * self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} * self.id2word = ["END_OF_FILE", "END_OF_LINE"] * self.data = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -61458,7 +66170,7 @@ static int __Pyx_InitCachedConstants(void) { * self.sent_index = IntList(1000,1000) */ __pyx_k_tuple_10 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(__pyx_int_1000); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, __pyx_int_1000); __Pyx_GIVEREF(__pyx_int_1000); @@ -61467,7 +66179,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_1000); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":21 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":21 * self.id2word = ["END_OF_FILE", "END_OF_LINE"] * self.data = IntList(1000,1000) * self.sent_id = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -61475,7 +66187,7 @@ static int __Pyx_InitCachedConstants(void) { * self.use_sent_id = use_sent_id */ __pyx_k_tuple_11 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(__pyx_int_1000); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, __pyx_int_1000); __Pyx_GIVEREF(__pyx_int_1000); @@ -61484,7 +66196,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_1000); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":22 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":22 * self.data = IntList(1000,1000) * self.sent_id = IntList(1000,1000) * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -61492,7 +66204,7 @@ static int __Pyx_InitCachedConstants(void) { * if from_binary: */ __pyx_k_tuple_12 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(__pyx_int_1000); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, __pyx_int_1000); __Pyx_GIVEREF(__pyx_int_1000); @@ -61501,7 +66213,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_1000); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":68 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":68 * f.write("%s " % self.get_word(w_id)) * if w_id == 1: * f.write("\n") # <<<<<<<<<<<<<< @@ -61509,13 +66221,13 @@ static int __Pyx_InitCachedConstants(void) { * def read_text(self, char* filename): */ __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":63 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":63 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -61523,7 +66235,7 @@ static int __Pyx_InitCachedConstants(void) { * if w_id > 1: */ __pyx_k_tuple_16 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); + __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61535,7 +66247,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":71 * * def read_text(self, char* filename): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -61543,7 +66255,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_17 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); + __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61555,7 +66267,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":76 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":76 * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: * data = (line.split(' ||| ')[side] for line in fp) # <<<<<<<<<<<<<< @@ -61563,13 +66275,13 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); + __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/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":75 * * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -61577,7 +66289,7 @@ static int __Pyx_InitCachedConstants(void) { * self.read_text_data(data) */ __pyx_k_tuple_20 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); + __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61589,7 +66301,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":146 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":146 * for i in self.data: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -61597,13 +66309,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d " %i) */ __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); + __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":149 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":149 * for i in self.sent_index: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -61611,13 +66323,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d " %i) */ __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); + __Pyx_GOTREF(__pyx_k_tuple_23); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":152 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":152 * for i in self.sent_id: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -61625,13 +66337,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%s %d " % (word, self.word2id[word])) */ __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); + __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":155 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":155 * for word in self.id2word: * f.write("%s %d " % (word, self.word2id[word])) * f.write("\n") # <<<<<<<<<<<<<< @@ -61639,20 +66351,20 @@ static int __Pyx_InitCachedConstants(void) { * def write_enhanced(self, char* filename): */ __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); + __Pyx_GOTREF(__pyx_k_tuple_26); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/data_array.pxi":158 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":158 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< * self.write_enhanced_handle(self, f) */ __pyx_k_tuple_28 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28)); + __Pyx_GOTREF(__pyx_k_tuple_28); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61664,7 +66376,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":46 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":46 * * def __cinit__(self, from_binary=None, from_text=None): * self.links = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -61672,7 +66384,7 @@ static int __Pyx_InitCachedConstants(void) { * if from_binary: */ __pyx_k_tuple_29 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29)); + __Pyx_GOTREF(__pyx_k_tuple_29); __Pyx_INCREF(__pyx_int_1000); PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, __pyx_int_1000); __Pyx_GIVEREF(__pyx_int_1000); @@ -61681,7 +66393,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_1000); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":47 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":47 * def __cinit__(self, from_binary=None, from_text=None): * self.links = IntList(1000,1000) * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -61689,7 +66401,7 @@ static int __Pyx_InitCachedConstants(void) { * self.read_binary(from_binary) */ __pyx_k_tuple_30 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); + __Pyx_GOTREF(__pyx_k_tuple_30); __Pyx_INCREF(__pyx_int_1000); PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, __pyx_int_1000); __Pyx_GIVEREF(__pyx_int_1000); @@ -61698,7 +66410,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_1000); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":59 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":59 * pairs = line.split() * for pair in pairs: * (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<< @@ -61706,13 +66418,13 @@ static int __Pyx_InitCachedConstants(void) { * self.sent_index.append(len(self.links)) */ __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":54 * * def read_text(self, char* filename): * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -61720,7 +66432,7 @@ static int __Pyx_InitCachedConstants(void) { * self.sent_index.append(len(self.links)) */ __pyx_k_tuple_33 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33)); + __Pyx_GOTREF(__pyx_k_tuple_33); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61732,7 +66444,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":75 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":75 * for i, link in enumerate(self.links): * while i >= self.sent_index[sent_num]: * f.write("\n") # <<<<<<<<<<<<<< @@ -61740,13 +66452,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d-%d " % self.unlink(link)) */ __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_34)); + __Pyx_GOTREF(__pyx_k_tuple_34); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":78 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":78 * sent_num = sent_num + 1 * f.write("%d-%d " % self.unlink(link)) * f.write("\n") # <<<<<<<<<<<<<< @@ -61754,13 +66466,13 @@ static int __Pyx_InitCachedConstants(void) { * def write_binary(self, char* filename): */ __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36)); + __Pyx_GOTREF(__pyx_k_tuple_36); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":71 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":71 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -61768,7 +66480,7 @@ static int __Pyx_InitCachedConstants(void) { * for i, link in enumerate(self.links): */ __pyx_k_tuple_37 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37)); + __Pyx_GOTREF(__pyx_k_tuple_37); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61780,7 +66492,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":92 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":92 * for link in self.links: * f.write("%d " % link) * f.write("\n") # <<<<<<<<<<<<<< @@ -61788,13 +66500,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d " % i) */ __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38)); + __Pyx_GOTREF(__pyx_k_tuple_38); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":95 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":95 * for i in self.sent_index: * f.write("%d " % i) * f.write("\n") # <<<<<<<<<<<<<< @@ -61802,13 +66514,13 @@ static int __Pyx_InitCachedConstants(void) { * def alignment(self, i): */ __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39)); + __Pyx_GOTREF(__pyx_k_tuple_39); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/alignment.pxi":88 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":88 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -61816,7 +66528,7 @@ static int __Pyx_InitCachedConstants(void) { * for link in self.links: */ __pyx_k_tuple_40 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40)); + __Pyx_GOTREF(__pyx_k_tuple_40); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61828,7 +66540,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":297 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":297 * * # Re-read file, placing words into buckets * f.seek(0) # <<<<<<<<<<<<<< @@ -61836,13 +66548,13 @@ static int __Pyx_InitCachedConstants(void) { * (fword, eword, score1, score2) = line.split() */ __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_43)); + __Pyx_GOTREF(__pyx_k_tuple_43); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":273 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":273 * * fcount = IntList() * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -61850,7 +66562,7 @@ static int __Pyx_InitCachedConstants(void) { * for line in f: */ __pyx_k_tuple_44 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_44)); + __Pyx_GOTREF(__pyx_k_tuple_44); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61862,7 +66574,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":339 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":339 * * if i > j: * raise Exception("Sort error in CLex") # <<<<<<<<<<<<<< @@ -61870,13 +66582,13 @@ static int __Pyx_InitCachedConstants(void) { * return */ __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47)); + __Pyx_GOTREF(__pyx_k_tuple_47); __Pyx_INCREF(((PyObject *)__pyx_kp_s_46)); PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_46)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":362 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":362 * for i in self.f_index: * f.write("%d " % i) * f.write("\n") # <<<<<<<<<<<<<< @@ -61884,13 +66596,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d %f %f " % (i, s1, s2)) */ __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49)); + __Pyx_GOTREF(__pyx_k_tuple_49); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":365 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":365 * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): * f.write("%d %f %f " % (i, s1, s2)) * f.write("\n") # <<<<<<<<<<<<<< @@ -61898,13 +66610,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d %s " % (i, w)) */ __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51)); + __Pyx_GOTREF(__pyx_k_tuple_51); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":368 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":368 * for i, w in enumerate(self.id2fword): * f.write("%d %s " % (i, w)) * f.write("\n") # <<<<<<<<<<<<<< @@ -61912,13 +66624,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d %s " % (i, w)) */ __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53)); + __Pyx_GOTREF(__pyx_k_tuple_53); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":371 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":371 * for i, w in enumerate(self.id2eword): * f.write("%d %s " % (i, w)) * f.write("\n") # <<<<<<<<<<<<<< @@ -61926,13 +66638,13 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_54)); + __Pyx_GOTREF(__pyx_k_tuple_54); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":359 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":359 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -61940,7 +66652,7 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d " % i) */ __pyx_k_tuple_55 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_55)); + __Pyx_GOTREF(__pyx_k_tuple_55); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61952,7 +66664,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":404 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":404 * cdef i, N, e_id, f_id * * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -61960,7 +66672,7 @@ static int __Pyx_InitCachedConstants(void) { * f_id = 0 */ __pyx_k_tuple_57 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_57)); + __Pyx_GOTREF(__pyx_k_tuple_57); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -61972,7 +66684,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":13 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":13 * cdef IntList rank * * logger.info("Constructing LCP array") # <<<<<<<<<<<<<< @@ -61980,13 +66692,13 @@ static int __Pyx_InitCachedConstants(void) { * n = self.sa.sa.len */ __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_61)); + __Pyx_GOTREF(__pyx_k_tuple_61); __Pyx_INCREF(((PyObject *)__pyx_kp_s_60)); PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_60)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/lcp.pxi":34 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":34 * if h > 0: * h = h-1 * logger.info("LCP array completed") # <<<<<<<<<<<<<< @@ -61994,13 +66706,13 @@ static int __Pyx_InitCachedConstants(void) { * def compute_stats(self, int max_n): */ __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_63)); + __Pyx_GOTREF(__pyx_k_tuple_63); __Pyx_INCREF(((PyObject *)__pyx_kp_s_62)); PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_62)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_62)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":297 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":297 * pattern_rank = {} * * logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<< @@ -62008,13 +66720,13 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_73 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_73)); + __Pyx_GOTREF(__pyx_k_tuple_73); __Pyx_INCREF(((PyObject *)__pyx_kp_s_72)); PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_kp_s_72)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_72)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":314 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":314 * queue = IntList(increment=1000) * * logger.info(" Computing inverted indexes...") # <<<<<<<<<<<<<< @@ -62022,13 +66734,13 @@ static int __Pyx_InitCachedConstants(void) { * for i from 0 <= i < N: */ __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75)); + __Pyx_GOTREF(__pyx_k_tuple_75); __Pyx_INCREF(((PyObject *)__pyx_kp_s_74)); PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_74)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_74)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":329 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":329 * trie_node_data_append(node, i) * * logger.info(" Computing collocations...") # <<<<<<<<<<<<<< @@ -62036,13 +66748,13 @@ static int __Pyx_InitCachedConstants(void) { * ptr1 = 0 */ __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_77)); + __Pyx_GOTREF(__pyx_k_tuple_77); __Pyx_INCREF(((PyObject *)__pyx_kp_s_76)); PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_kp_s_76)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_76)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":393 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":393 * for pattern2 in J_set: * if len(pattern1) + len(pattern2) + 1 < self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -62050,13 +66762,13 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_79 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_79)); + __Pyx_GOTREF(__pyx_k_tuple_79); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":400 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":400 * x = x+1 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -62064,13 +66776,13 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_80)); + __Pyx_GOTREF(__pyx_k_tuple_80); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":407 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":407 * x = x+2 * if len(pattern1) + len(pattern2) + 1<= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -62078,13 +66790,13 @@ static int __Pyx_InitCachedConstants(void) { * combined_pattern = pattern2 + (-1,) + pattern1 */ __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_81)); + __Pyx_GOTREF(__pyx_k_tuple_81); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/precomputation.pxi":409 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":409 * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) * combined_pattern = pattern2 + (-1,) + pattern1 # <<<<<<<<<<<<<< @@ -62092,13 +66804,13 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_82 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_82)); + __Pyx_GOTREF(__pyx_k_tuple_82); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_82, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":103 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":103 * * '''Step 3: read off suffix array from inverse suffix array''' * logger.info(" Finalizing sort...") # <<<<<<<<<<<<<< @@ -62106,13 +66818,13 @@ static int __Pyx_InitCachedConstants(void) { * j = isa.arr[i] */ __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_94)); + __Pyx_GOTREF(__pyx_k_tuple_94); __Pyx_INCREF(((PyObject *)__pyx_kp_s_93)); PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_s_93)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":202 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":202 * for a_i in self.sa: * f.write("%d " % a_i) * f.write("\n") # <<<<<<<<<<<<<< @@ -62120,13 +66832,13 @@ static int __Pyx_InitCachedConstants(void) { * f.write("%d " % w_i) */ __pyx_k_tuple_97 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_97)); + __Pyx_GOTREF(__pyx_k_tuple_97); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_97, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":205 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":205 * for w_i in self.ha: * f.write("%d " % w_i) * f.write("\n") # <<<<<<<<<<<<<< @@ -62134,13 +66846,13 @@ static int __Pyx_InitCachedConstants(void) { * cdef int __search_high(self, int word_id, int offset, int low, int high): */ __pyx_k_tuple_98 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_98)); + __Pyx_GOTREF(__pyx_k_tuple_98); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_k_tuple_98, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/suffix_array.pxi":198 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":198 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -62148,7 +66860,7 @@ static int __Pyx_InitCachedConstants(void) { * for a_i in self.sa: */ __pyx_k_tuple_99 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_99)); + __Pyx_GOTREF(__pyx_k_tuple_99); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_99, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -62160,7 +66872,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":107 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":107 * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) * else: * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< @@ -62168,13 +66880,13 @@ static int __Pyx_InitCachedConstants(void) { * def sample(self, PhraseLocation phrase_location): */ __pyx_k_tuple_103 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_103)); + __Pyx_GOTREF(__pyx_k_tuple_103); __Pyx_INCREF(((PyObject *)__pyx_kp_s_102)); PyTuple_SET_ITEM(__pyx_k_tuple_103, 0, ((PyObject *)__pyx_kp_s_102)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_102)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":316 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":316 * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) * if alignment is None: * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< @@ -62182,13 +66894,13 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_108 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_108)); + __Pyx_GOTREF(__pyx_k_tuple_108); __Pyx_INCREF(((PyObject *)__pyx_kp_s_107)); PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_107)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_107)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108)); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":1022 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1022 * else: * #ERROR: We never get here * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< @@ -62196,12 +66908,30 @@ static int __Pyx_InitCachedConstants(void) { * if lookup_required: */ __pyx_k_tuple_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_123)); + __Pyx_GOTREF(__pyx_k_tuple_123); __Pyx_INCREF(((PyObject *)__pyx_kp_s_122)); PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_122)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_122)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123)); + /* "_sa.pyx":9 + * resource.getrusage(resource.RUSAGE_SELF).ru_stime) + * + * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< + * if filename.endswith('.gz'): + * return gzip.GzipFile(filename) + */ + __pyx_k_tuple_136 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_136); + __Pyx_INCREF(((PyObject *)__pyx_n_s__filename)); + PyTuple_SET_ITEM(__pyx_k_tuple_136, 0, ((PyObject *)__pyx_n_s__filename)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__filename)); + PyTuple_SET_ITEM(__pyx_k_tuple_136, 1, ((PyObject *)__pyx_n_s__filename)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_136)); + __pyx_k_codeobj_137 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_138, __pyx_n_s__gzip_or_text, 9, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /* "_sa.pyx":15 * return open(filename) * @@ -62209,12 +66939,80 @@ static int __Pyx_InitCachedConstants(void) { * * include "float_list.pxi" */ - __pyx_k_tuple_137 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_137)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_136)); - PyTuple_SET_ITEM(__pyx_k_tuple_137, 0, ((PyObject *)__pyx_kp_s_136)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_136)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137)); + __pyx_k_tuple_140 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_140); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_139)); + PyTuple_SET_ITEM(__pyx_k_tuple_140, 0, ((PyObject *)__pyx_kp_s_139)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_139)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_140)); + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":107 + * return ALPHABET.fromstring(string, terminal) + * + * def make_lattice(words): # <<<<<<<<<<<<<< + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) + */ + __pyx_k_tuple_141 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_141)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_141); + __Pyx_INCREF(((PyObject *)__pyx_n_s__words)); + PyTuple_SET_ITEM(__pyx_k_tuple_141, 0, ((PyObject *)__pyx_n_s__words)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__words)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__word_ids)); + PyTuple_SET_ITEM(__pyx_k_tuple_141, 1, ((PyObject *)__pyx_n_s__word_ids)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__word_ids)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr)); + PyTuple_SET_ITEM(__pyx_k_tuple_141, 2, ((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_141, 3, ((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_141, 4, ((PyObject *)__pyx_n_s__genexpr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_141)); + __pyx_k_codeobj_142 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_143, __pyx_n_s__make_lattice, 107, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_142)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":111 + * return tuple(((word, None, 1), ) for word in word_ids) + * + * def decode_lattice(lattice): # <<<<<<<<<<<<<< + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc + * for arc in node for node in lattice) + */ + __pyx_k_tuple_144 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_144); + __Pyx_INCREF(((PyObject *)__pyx_n_s__lattice)); + PyTuple_SET_ITEM(__pyx_k_tuple_144, 0, ((PyObject *)__pyx_n_s__lattice)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lattice)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr)); + PyTuple_SET_ITEM(__pyx_k_tuple_144, 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_144, 2, ((PyObject *)__pyx_n_s__genexpr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144)); + __pyx_k_codeobj_145 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_143, __pyx_n_s__decode_lattice, 111, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_145)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":115 + * for arc in node for node in lattice) + * + * def decode_sentence(lattice): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) + */ + __pyx_k_tuple_146 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_146)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_146); + __Pyx_INCREF(((PyObject *)__pyx_n_s__lattice)); + PyTuple_SET_ITEM(__pyx_k_tuple_146, 0, ((PyObject *)__pyx_n_s__lattice)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lattice)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr)); + PyTuple_SET_ITEM(__pyx_k_tuple_146, 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_146, 2, ((PyObject *)__pyx_n_s__genexpr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_146)); + __pyx_k_codeobj_147 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_146, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_143, __pyx_n_s__decode_sentence, 115, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_147)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -62223,9 +67021,6 @@ static int __Pyx_InitCachedConstants(void) { } static int __Pyx_InitGlobals(void) { - #if PY_VERSION_HEX < 0x02040000 - if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; @@ -62253,7 +67048,6 @@ PyMODINIT_FUNC PyInit__sa(void) PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); @@ -62264,12 +67058,18 @@ PyMODINIT_FUNC PyInit__sa(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__sa(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__sa(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -62280,16 +67080,15 @@ PyMODINIT_FUNC PyInit__sa(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_sa"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_sa"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -62426,10 +67225,10 @@ PyMODINIT_FUNC PyInit__sa(void) if (__Pyx_SetAttrString(__pyx_m, "Precomputation", (PyObject *)&__pyx_type_3_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_3_sa_Precomputation = &__pyx_type_3_sa_Precomputation; __pyx_vtabptr_3_sa_SuffixArray = &__pyx_vtable_3_sa_SuffixArray; - __pyx_vtable_3_sa_SuffixArray.__search_high = (int (*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___search_high; - __pyx_vtable_3_sa_SuffixArray.__search_low = (int (*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___search_low; - __pyx_vtable_3_sa_SuffixArray.__get_range = (PyObject *(*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int, int))__pyx_f_3_sa_11SuffixArray___get_range; - __pyx_vtable_3_sa_SuffixArray.__lookup_helper = (PyObject *(*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___lookup_helper; + __pyx_vtable_3_sa_SuffixArray.__pyx___search_high = (int (*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___search_high; + __pyx_vtable_3_sa_SuffixArray.__pyx___search_low = (int (*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___search_low; + __pyx_vtable_3_sa_SuffixArray.__pyx___get_range = (PyObject *(*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int, int))__pyx_f_3_sa_11SuffixArray___get_range; + __pyx_vtable_3_sa_SuffixArray.__pyx___lookup_helper = (PyObject *(*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___lookup_helper; if (PyType_Ready(&__pyx_type_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_3_sa_SuffixArray.tp_dict, __pyx_vtabptr_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "SuffixArray", (PyObject *)&__pyx_type_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -62479,41 +67278,44 @@ PyMODINIT_FUNC PyInit__sa(void) if (__Pyx_SetVtable(__pyx_type_3_sa_Scorer.tp_dict, __pyx_vtabptr_3_sa_Scorer) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_3_sa_Scorer) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_3_sa_Scorer = &__pyx_type_3_sa_Scorer; - if (PyType_Ready(&__pyx_Generator_type) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_Generator = &__pyx_Generator_type; - __pyx_type_3_sa___pyx_scope_struct____iter__.tp_base = __pyx_ptype_3_sa___pyx_Generator; if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_3_sa___pyx_scope_struct____iter__ = &__pyx_type_3_sa___pyx_scope_struct____iter__; if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_1_read_bitext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_3_sa___pyx_scope_struct_1_read_bitext = &__pyx_type_3_sa___pyx_scope_struct_1_read_bitext; - __pyx_type_3_sa___pyx_scope_struct_2_genexpr.tp_base = __pyx_ptype_3_sa___pyx_Generator; if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_2_genexpr) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_3_sa___pyx_scope_struct_2_genexpr = &__pyx_type_3_sa___pyx_scope_struct_2_genexpr; - __pyx_type_3_sa___pyx_scope_struct_3_compute_stats.tp_base = __pyx_ptype_3_sa___pyx_Generator; if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_3_compute_stats) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_3_sa___pyx_scope_struct_3_compute_stats = &__pyx_type_3_sa___pyx_scope_struct_3_compute_stats; - __pyx_type_3_sa___pyx_scope_struct_4___iter__.tp_base = __pyx_ptype_3_sa___pyx_Generator; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_4___iter__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_4___iter__ = &__pyx_type_3_sa___pyx_scope_struct_4___iter__; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_5___str__ = &__pyx_type_3_sa___pyx_scope_struct_5___str__; - __pyx_type_3_sa___pyx_scope_struct_6_genexpr.tp_base = __pyx_ptype_3_sa___pyx_Generator; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_4_make_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_4_make_lattice = &__pyx_type_3_sa___pyx_scope_struct_4_make_lattice; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_5_genexpr = &__pyx_type_3_sa___pyx_scope_struct_5_genexpr; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_3_sa___pyx_scope_struct_6_genexpr = &__pyx_type_3_sa___pyx_scope_struct_6_genexpr; - __pyx_type_3_sa___pyx_scope_struct_7_alignments.tp_base = __pyx_ptype_3_sa___pyx_Generator; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_7_alignments) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_7_alignments = &__pyx_type_3_sa___pyx_scope_struct_7_alignments; - __pyx_type_3_sa___pyx_scope_struct_8_input.tp_base = __pyx_ptype_3_sa___pyx_Generator; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_8_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_8_input = &__pyx_type_3_sa___pyx_scope_struct_8_input; - __pyx_type_3_sa___pyx_scope_struct_9___iter__.tp_base = __pyx_ptype_3_sa___pyx_Generator; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_9___iter__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_9___iter__ = &__pyx_type_3_sa___pyx_scope_struct_9___iter__; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_10___str__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_10___str__ = &__pyx_type_3_sa___pyx_scope_struct_10___str__; - __pyx_type_3_sa___pyx_scope_struct_11_genexpr.tp_base = __pyx_ptype_3_sa___pyx_Generator; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_11_genexpr) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_11_genexpr = &__pyx_type_3_sa___pyx_scope_struct_11_genexpr; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_7_decode_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_7_decode_lattice = &__pyx_type_3_sa___pyx_scope_struct_7_decode_lattice; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_8_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_8_genexpr = &__pyx_type_3_sa___pyx_scope_struct_8_genexpr; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_9_decode_sentence) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_9_decode_sentence = &__pyx_type_3_sa___pyx_scope_struct_9_decode_sentence; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_10_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_10_genexpr = &__pyx_type_3_sa___pyx_scope_struct_10_genexpr; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_11___iter__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_11___iter__ = &__pyx_type_3_sa___pyx_scope_struct_11___iter__; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_12___str__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_12___str__ = &__pyx_type_3_sa___pyx_scope_struct_12___str__; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_13_genexpr) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_13_genexpr = &__pyx_type_3_sa___pyx_scope_struct_13_genexpr; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_14_alignments) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_14_alignments = &__pyx_type_3_sa___pyx_scope_struct_14_alignments; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_15_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_15_input = &__pyx_type_3_sa___pyx_scope_struct_15_input; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_16___iter__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_16___iter__ = &__pyx_type_3_sa___pyx_scope_struct_16___iter__; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_17___str__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_17___str__ = &__pyx_type_3_sa___pyx_scope_struct_17___str__; + if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_18_genexpr) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_3_sa___pyx_scope_struct_18_genexpr = &__pyx_type_3_sa___pyx_scope_struct_18_genexpr; /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ @@ -62559,7 +67361,7 @@ PyMODINIT_FUNC PyInit__sa(void) * if filename.endswith('.gz'): * return gzip.GzipFile(filename) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_gzip_or_text, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_1gzip_or_text, NULL, __pyx_n_s___sa); 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); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gzip_or_text, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -62576,13 +67378,13 @@ PyMODINIT_FUNC PyInit__sa(void) __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_137), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_140), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logger, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/bilex.pxi":54 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":54 * cdef id2eword, id2fword, eword2id, fword2id * * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< @@ -62595,7 +67397,7 @@ PyMODINIT_FUNC PyInit__sa(void) __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":17 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":17 * from libc.string cimport memset * * cdef int MIN_BOTTOM_SIZE = 32 # <<<<<<<<<<<<<< @@ -62604,7 +67406,7 @@ PyMODINIT_FUNC PyInit__sa(void) */ __pyx_v_3_sa_MIN_BOTTOM_SIZE = 32; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":18 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":18 * * cdef int MIN_BOTTOM_SIZE = 32 * cdef int MIN_BOTTOM_BITS = 5 # <<<<<<<<<<<<<< @@ -62613,7 +67415,7 @@ PyMODINIT_FUNC PyInit__sa(void) */ __pyx_v_3_sa_MIN_BOTTOM_BITS = 5; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/veb.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":28 * LOWER_MASK[i] = mask * * _init_lower_mask() # <<<<<<<<<<<<<< @@ -62622,7 +67424,7 @@ PyMODINIT_FUNC PyInit__sa(void) */ __pyx_f_3_sa__init_lower_mask(); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":4 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":4 * from libc.stdlib cimport malloc, realloc, strtol * * cdef int INDEX_SHIFT = 3 # <<<<<<<<<<<<<< @@ -62631,7 +67433,7 @@ PyMODINIT_FUNC PyInit__sa(void) */ __pyx_v_3_sa_INDEX_SHIFT = 3; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":5 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":5 * * cdef int INDEX_SHIFT = 3 * cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 # <<<<<<<<<<<<<< @@ -62640,7 +67442,7 @@ PyMODINIT_FUNC PyInit__sa(void) */ __pyx_v_3_sa_INDEX_MASK = ((1 << __pyx_v_3_sa_INDEX_SHIFT) - 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":87 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":87 * return self.terminals.index(s) * * cdef Alphabet ALPHABET = Alphabet() # <<<<<<<<<<<<<< @@ -62655,18 +67457,42 @@ PyMODINIT_FUNC PyInit__sa(void) __pyx_v_3_sa_ALPHABET = ((struct __pyx_obj_3_sa_Alphabet *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/sym.pxi":104 - * return ALPHABET.setindex(sym, id) - * - * def sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<< + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":107 * return ALPHABET.fromstring(string, terminal) + * + * def make_lattice(words): # <<<<<<<<<<<<<< + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_1sym_fromstring, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_3make_lattice, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sym_fromstring, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__make_lattice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":5 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":111 + * return tuple(((word, None, 1), ) for word in word_ids) + * + * def decode_lattice(lattice): # <<<<<<<<<<<<<< + * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc + * for arc in node for node in lattice) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_5decode_lattice, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__decode_lattice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":115 + * for arc in node for node in lattice) + * + * def decode_sentence(lattice): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_7decode_sentence, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__decode_sentence, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":5 * # Much faster than the Python numbers reported there. * # Note to reader: this code is closer to C than Python * import gc # <<<<<<<<<<<<<< @@ -62678,7 +67504,7 @@ PyMODINIT_FUNC PyInit__sa(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":6 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":6 * # Note to reader: this code is closer to C than Python * import gc * import itertools # <<<<<<<<<<<<<< @@ -62690,7 +67516,7 @@ PyMODINIT_FUNC PyInit__sa(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":12 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":12 * from libc.math cimport fmod, ceil, floor, log * * from collections import defaultdict, Counter, namedtuple # <<<<<<<<<<<<<< @@ -62698,7 +67524,7 @@ PyMODINIT_FUNC PyInit__sa(void) * FeatureContext = namedtuple('FeatureContext', */ __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__defaultdict)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__defaultdict)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__defaultdict)); @@ -62711,21 +67537,33 @@ PyMODINIT_FUNC PyInit__sa(void) __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__defaultdict); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__defaultdict); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__defaultdict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Counter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Counter); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__Counter); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Counter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__namedtuple); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__namedtuple); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__namedtuple, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __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; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":14 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":14 * from collections import defaultdict, Counter, namedtuple * * FeatureContext = namedtuple('FeatureContext', # <<<<<<<<<<<<<< @@ -62735,7 +67573,7 @@ PyMODINIT_FUNC PyInit__sa(void) __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":15 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":15 * * FeatureContext = namedtuple('FeatureContext', * ['fphrase', # <<<<<<<<<<<<<< @@ -62743,7 +67581,7 @@ PyMODINIT_FUNC PyInit__sa(void) * 'paircount', */ __pyx_t_1 = PyList_New(10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__fphrase)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__fphrase)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fphrase)); @@ -62775,7 +67613,7 @@ PyMODINIT_FUNC PyInit__sa(void) PyList_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_n_s__e_text)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__e_text)); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_n_s__FeatureContext)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__FeatureContext)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FeatureContext)); @@ -62789,7 +67627,7 @@ PyMODINIT_FUNC PyInit__sa(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FeatureContext, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":27 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":27 * ]) * * cdef int PRECOMPUTE = 0 # <<<<<<<<<<<<<< @@ -62798,7 +67636,7 @@ PyMODINIT_FUNC PyInit__sa(void) */ __pyx_v_3_sa_PRECOMPUTE = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":28 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":28 * * cdef int PRECOMPUTE = 0 * cdef int MERGE = 1 # <<<<<<<<<<<<<< @@ -62807,7 +67645,7 @@ PyMODINIT_FUNC PyInit__sa(void) */ __pyx_v_3_sa_MERGE = 1; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":29 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":29 * cdef int PRECOMPUTE = 0 * cdef int MERGE = 1 * cdef int BAEZA_YATES = 2 # <<<<<<<<<<<<<< @@ -62816,60 +67654,42 @@ PyMODINIT_FUNC PyInit__sa(void) */ __pyx_v_3_sa_BAEZA_YATES = 2; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":32 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":32 * * # NOTE: was encoded as a non-terminal in the previous version * cdef int EPSILON = sym_fromstring('*EPS*', True) # <<<<<<<<<<<<<< * * cdef class TrieNode: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sym_fromstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_138)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_138)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_138)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_3_sa_EPSILON = __pyx_t_4; + __pyx_v_3_sa_EPSILON = __pyx_f_3_sa_sym_fromstring(__pyx_k_148, 1); - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/rulefactory.pxi":55 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":55 * cdef public int count * cdef public root * def __cinit__(self, extended=False): # <<<<<<<<<<<<<< * self.count = 0 * self.extended = extended */ - __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_k_100 = __pyx_t_3; - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_100 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":1 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":1 * cdef StringMap FD = StringMap() # Feature name dictionary # <<<<<<<<<<<<<< * * INITIAL_CAPACITY = 7 # default number of features */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(((PyObject *)__pyx_v_3_sa_FD)); __Pyx_DECREF(((PyObject *)__pyx_v_3_sa_FD)); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_v_3_sa_FD = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_3_sa_FD = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":3 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":3 * cdef StringMap FD = StringMap() # Feature name dictionary * * INITIAL_CAPACITY = 7 # default number of features # <<<<<<<<<<<<<< @@ -62878,27 +67698,27 @@ PyMODINIT_FUNC PyInit__sa(void) */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__INITIAL_CAPACITY, __pyx_int_7) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/hltcoe/alopez/dev/cdec/python/src/sa/features.pxi":4 + /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":4 * * INITIAL_CAPACITY = 7 # default number of features * INCREMENT = INITIAL_CAPACITY # double size # <<<<<<<<<<<<<< * * cdef class FeatureVector: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__INITIAL_CAPACITY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__INCREMENT, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__INITIAL_CAPACITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__INCREMENT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "_sa.pyx":1 * import logging # <<<<<<<<<<<<<< * import resource * import gzip */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - 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; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -62920,7 +67740,6 @@ PyMODINIT_FUNC PyInit__sa(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -62952,92 +67771,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { return result; } -static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - const char* self_ptr = PyBytes_AS_STRING(self); - Py_ssize_t self_len = PyBytes_GET_SIZE(self); - const char* sub_ptr; - Py_ssize_t sub_len; - int retval; - -#if PY_VERSION_HEX >= 0x02060000 - Py_buffer view; - view.obj = NULL; -#endif - - if ( PyBytes_Check(arg) ) { - sub_ptr = PyBytes_AS_STRING(arg); - sub_len = PyBytes_GET_SIZE(arg); - } -#if PY_MAJOR_VERSION < 3 - // Python 2.x allows mixing unicode and str - else if ( PyUnicode_Check(arg) ) { - return PyUnicode_Tailmatch(self, arg, start, end, direction); - } -#endif - else { -#if PY_VERSION_HEX < 0x02060000 - if (unlikely(PyObject_AsCharBuffer(arg, &sub_ptr, &sub_len))) - return -1; -#else - if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1)) - return -1; - sub_ptr = (const char*) view.buf; - sub_len = view.len; -#endif - } - - if (end > self_len) - end = self_len; - else if (end < 0) - end += self_len; - if (end < 0) - end = 0; - if (start < 0) - start += self_len; - if (start < 0) - start = 0; - - if (direction > 0) { - /* endswith */ - if (end-sub_len > start) - start = end - sub_len; - } - - if (start + sub_len <= end) - retval = !memcmp(self_ptr+start, sub_ptr, sub_len); - else - retval = 0; - -#if PY_VERSION_HEX >= 0x02060000 - if (view.obj) - PyBuffer_Release(&view); -#endif - - return retval; -} - -static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - if (unlikely(PyTuple_Check(substr))) { - int result; - Py_ssize_t i; - for (i = 0; i < PyTuple_GET_SIZE(substr); i++) { - result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i), - start, end, direction); - if (result) { - return result; - } - } - return 0; - } - - return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction); -} - - static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) @@ -63047,7 +67780,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -63063,55 +67796,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; } } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -63139,7 +67894,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -63151,15 +67905,15 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -63169,55 +67923,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise <class>, <instance> */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -63240,7 +67999,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -63249,10 +68007,9 @@ raise_error: Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -63262,7 +68019,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -63271,13 +68027,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -63294,14 +68073,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -63311,8 +68085,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif @@ -63336,13 +68110,17 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings( { PyObject* key = 0; Py_ssize_t pos = 0; +#if CPYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else while (PyDict_Next(kwdict, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) #endif - goto invalid_keyword_type; + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; } if ((!kw_allowed) && unlikely(key)) goto invalid_keyword; @@ -63351,6 +68129,7 @@ invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); return 0; +#endif invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 @@ -63363,9 +68142,9 @@ invalid_keyword: return 0; } - static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); local_type = tstate->curexc_type; @@ -63374,19 +68153,27 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_COMPILING_IN_CPYTHON if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif goto bad; #if PY_MAJOR_VERSION >= 3 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; #endif - *type = local_type; - *value = local_value; - *tb = local_tb; Py_INCREF(local_type); Py_INCREF(local_value); Py_INCREF(local_tb); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_COMPILING_IN_CPYTHON tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; @@ -63394,10 +68181,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) tstate->exc_value = local_value; tstate->exc_traceback = local_tb; /* Make sure tstate is in a consistent state when we XDECREF - these objects (XDECREF may run arbitrary code). */ + these objects (DECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif return 0; bad: *type = 0; @@ -63409,7 +68199,6 @@ bad: return -1; } - static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } @@ -63427,23 +68216,40 @@ static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { return r; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else if (PyErr_Occurred()) { +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; @@ -63452,11 +68258,25 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { } } return 0; +#endif } +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} static double __Pyx__PyObject_AsDouble(PyObject* obj) { PyObject* float_value; +#if CYTHON_COMPILING_IN_PYPY + float_value = PyNumber_Float(obj); +#else if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) { return PyFloat_AsDouble(obj); } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { @@ -63473,6 +68293,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) { PyTuple_SET_ITEM(args, 0, 0); Py_DECREF(args); } +#endif if (likely(float_value)) { double value = PyFloat_AS_DOUBLE(float_value); Py_DECREF(float_value); @@ -63506,8 +68327,158 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed return 0; } -static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, + int is_tuple, int has_known_size, int decref_tuple) { + Py_ssize_t index; + PyObject *value1 = NULL, *value2 = NULL, *iter = NULL; + if (!is_tuple && unlikely(!PyTuple_Check(tuple))) { + iternextfunc iternext; + iter = PyObject_GetIter(tuple); + if (unlikely(!iter)) goto bad; + if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; } + iternext = Py_TYPE(iter)->tp_iternext; + value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; } + value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; } + if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad; + Py_DECREF(iter); + } else { + if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) { + __Pyx_UnpackTupleError(tuple, 2); + goto bad; + } +#if CYTHON_COMPILING_IN_PYPY + value1 = PySequence_ITEM(tuple, 0); + if (unlikely(!value1)) goto bad; + value2 = PySequence_ITEM(tuple, 1); + if (unlikely(!value2)) goto bad; +#else + value1 = PyTuple_GET_ITEM(tuple, 0); + value2 = PyTuple_GET_ITEM(tuple, 1); + Py_INCREF(value1); + Py_INCREF(value2); +#endif + if (decref_tuple) { Py_DECREF(tuple); } + } + *pvalue1 = value1; + *pvalue2 = value2; + return 0; +unpacking_failed: + if (!has_known_size && __Pyx_IterFinish() == 0) + __Pyx_RaiseNeedMoreValuesError(index); +bad: + Py_XDECREF(iter); + Py_XDECREF(value1); + Py_XDECREF(value2); + if (decref_tuple) { Py_XDECREF(tuple); } + return -1; +} + +static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name, + Py_ssize_t* p_orig_length, int* p_source_is_dict) { + is_dict = is_dict || likely(PyDict_CheckExact(iterable)); + *p_source_is_dict = is_dict; +#if !CYTHON_COMPILING_IN_PYPY + if (is_dict) { + *p_orig_length = PyDict_Size(iterable); + Py_INCREF(iterable); + return iterable; + } +#endif + *p_orig_length = 0; + if (method_name) { + PyObject* iter; + iterable = PyObject_CallMethodObjArgs(iterable, method_name, NULL); + if (!iterable) + return NULL; +#if !CYTHON_COMPILING_IN_PYPY + if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable)) + return iterable; +#endif + iter = PyObject_GetIter(iterable); + Py_DECREF(iterable); + return iter; + } + return PyObject_GetIter(iterable); +} +static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t orig_length, Py_ssize_t* ppos, + PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) { + PyObject* next_item; +#if !CYTHON_COMPILING_IN_PYPY + if (source_is_dict) { + PyObject *key, *value; + if (unlikely(orig_length != PyDict_Size(iter_obj))) { + PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); + return -1; + } + if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) { + return 0; + } + if (pitem) { + PyObject* tuple = PyTuple_New(2); + if (unlikely(!tuple)) { + return -1; + } + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(tuple, 0, key); + PyTuple_SET_ITEM(tuple, 1, value); + *pitem = tuple; + } else { + if (pkey) { + Py_INCREF(key); + *pkey = key; + } + if (pvalue) { + Py_INCREF(value); + *pvalue = value; + } + } + return 1; + } else if (PyTuple_CheckExact(iter_obj)) { + Py_ssize_t pos = *ppos; + if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0; + *ppos = pos + 1; + next_item = PyTuple_GET_ITEM(iter_obj, pos); + Py_INCREF(next_item); + } else if (PyList_CheckExact(iter_obj)) { + Py_ssize_t pos = *ppos; + if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0; + *ppos = pos + 1; + next_item = PyList_GET_ITEM(iter_obj, pos); + Py_INCREF(next_item); + } else +#endif + { + next_item = PyIter_Next(iter_obj); + if (unlikely(!next_item)) { + return __Pyx_IterFinish(); + } + } + if (pitem) { + *pitem = next_item; + } else if (pkey && pvalue) { + if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1)) + return -1; + } else if (pkey) { + *pkey = next_item; + } else { + *pvalue = next_item; + } + return 1; } static CYTHON_INLINE int __Pyx_div_int(int a, int b) { @@ -63518,6 +68489,7 @@ static CYTHON_INLINE int __Pyx_div_int(int a, int b) { } static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; @@ -63525,9 +68497,12 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); +#endif } - static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; @@ -63539,6 +68514,9 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(type, value, tb); +#endif } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { @@ -63567,12 +68545,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - 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); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + 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); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + 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 if (level>0) { @@ -63589,106 +68588,422 @@ bad: return module; } -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyBytes_GET_SIZE(s1) == 1) { - if (equals == Py_EQ) - return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); - else - return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); - } else { - int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { +#if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif } -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ - return (equals == Py_EQ); - } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { - if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_SIZE(s1) == 1) { - if (equals == Py_EQ) - return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); - else - return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); - } else { - int result = PyUnicode_Compare(s1, s2); - if ((result == -1) && unlikely(PyErr_Occurred())) - return -1; - return (equals == Py_EQ) ? (result == 0) : (result != 0); +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 PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + } + if (op->func_doc == 0) { + Py_INCREF(Py_None); + return Py_None; + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__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); + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) +{ + if (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 + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (value == NULL || !PyUnicode_Check(value)) { +#else + if (value == NULL || !PyString_Check(value)) { +#endif + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) +{ + if (op->func_dict == NULL) { + op->func_dict = PyDict_New(); + if (op->func_dict == NULL) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; + if (value == NULL) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + PyObject* dict = PyModule_GetDict(__pyx_m); + Py_XINCREF(dict); + return dict; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) +{ + if (op->defaults_tuple) { + Py_INCREF(op->defaults_tuple); + return op->defaults_tuple; + } + if (op->defaults_getter) { + PyObject *res = op->defaults_getter((PyObject *) op); + if (res) { + Py_INCREF(res); + op->defaults_tuple = res; } - } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + return res; } + Py_INCREF(Py_None); + return Py_None; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(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 *) "__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}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */ +#define PY_WRITE_RESTRICTED WRITE_RESTRICTED +#endif +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif } - - -static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) { - __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType); +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, + PyObject *closure, PyObject *module, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); if (op == NULL) return NULL; + op->flags = flags; + op->func_weakreflist = NULL; op->func.m_ml = ml; - Py_XINCREF(self); - op->func.m_self = self; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; Py_XINCREF(module); op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + op->func_doc = NULL; + op->func_classobj = NULL; + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_getter = NULL; PyObject_GC_Track(op); - return (PyObject *)op; + return (PyObject *) op; } - -static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) { +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyMem_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ PyObject_GC_UnTrack(m); - Py_XDECREF(m->func.m_self); - Py_XDECREF(m->func.m_module); + if (m->func_weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); PyObject_GC_Del(m); } - -static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) { +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return PyMethod_New(func, + type, (PyObject *)(Py_TYPE(type))); + } if (obj == Py_None) - obj = NULL; + obj = NULL; return PyMethod_New(func, obj, type); } - -static int __pyx_binding_PyCFunctionType_init(void) { - __pyx_binding_PyCFunctionType_type = PyCFunction_Type; - __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method"); - __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc; - __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get; - if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) { - return -1; +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); +#else + return PyString_FromFormat("<cyfunction %s at %p>", + PyString_AsString(func_name), (void *)op); +#endif +} +#if CYTHON_COMPILING_IN_PYPY +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + Py_ssize_t size; + switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { + case METH_VARARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 0) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 1) + return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; } - __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type; + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +#else +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return PyCFunction_Call(func, arg, kw); +} +#endif +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/ + sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ +#if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ +#else + 0, /*reserved*/ +#endif + (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __Pyx_CyFunction_Call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ + 0, /*tp_doc*/ + (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/ + (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_CyFunction_methods, /*tp_methods*/ + __pyx_CyFunction_members, /*tp_members*/ + __pyx_CyFunction_getsets, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + __Pyx_CyFunction_descr_get, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ +#if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ +#endif +}; +static int __Pyx_CyFunction_init(void) { +#if !CYTHON_COMPILING_IN_PYPY + __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; +#endif + if (PyType_Ready(&__pyx_CyFunctionType_type) < 0) + return -1; + __pyx_CyFunctionType = &__pyx_CyFunctionType_type; return 0; - +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyMem_Malloc(size); + if (!m->defaults) + return PyErr_NoMemory(); + memset(m->defaults, 0, sizeof(size)); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); } static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -64091,8 +69406,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename) { +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); @@ -64112,125 +69427,522 @@ static void __Pyx_WriteUnraisable(const char *name, int clineno, static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; - +#else + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); +#endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } -static CYTHON_INLINE void __Pyx_Generator_ExceptionClear(struct __pyx_Generator_object *self) -{ - Py_XDECREF(self->exc_type); - Py_XDECREF(self->exc_value); - Py_XDECREF(self->exc_traceback); - +static PyObject *__Pyx_Generator_Next(PyObject *self); +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Generator_Close(PyObject *self); +static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args); +static PyTypeObject *__pyx_GeneratorType = 0; +#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) +#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +#if 1 || PY_VERSION_HEX < 0x030300B0 +static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (unlikely(et != PyExc_StopIteration) && + unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + if (likely(et == PyExc_StopIteration)) { + if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + ev = Py_None; + } + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = ev; + return 0; + } + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if PY_VERSION_HEX >= 0x030300A0 + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); +#else + { + PyObject* args = PyObject_GetAttrString(ev, "args"); + Py_DECREF(ev); + if (likely(args)) { + value = PyObject_GetItem(args, 0); + Py_DECREF(args); + } + if (unlikely(!value)) { + __Pyx_ErrRestore(NULL, NULL, NULL); + Py_INCREF(Py_None); + value = Py_None; + } + } +#endif + *pvalue = value; + return 0; +} +#endif +static CYTHON_INLINE +void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) { + PyObject *exc_type = self->exc_type; + PyObject *exc_value = self->exc_value; + PyObject *exc_traceback = self->exc_traceback; self->exc_type = NULL; self->exc_value = NULL; self->exc_traceback = NULL; + Py_XDECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_traceback); } - -static CYTHON_INLINE PyObject *__Pyx_Generator_SendEx(struct __pyx_Generator_object *self, PyObject *value) -{ - PyObject *retval; - - if (self->is_running) { +static CYTHON_INLINE +int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { + if (unlikely(gen->is_running)) { PyErr_SetString(PyExc_ValueError, "generator already executing"); - return NULL; + return 1; } - - if (self->resume_label == 0) { - if (value && value != Py_None) { + return 0; +} +static CYTHON_INLINE +PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { + PyObject *retval; + assert(!self->is_running); + if (unlikely(self->resume_label == 0)) { + if (unlikely(value && value != Py_None)) { PyErr_SetString(PyExc_TypeError, "can't send non-None value to a " "just-started generator"); return NULL; } } - - if (self->resume_label == -1) { + if (unlikely(self->resume_label == -1)) { PyErr_SetNone(PyExc_StopIteration); return NULL; } - - - if (value) - __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); - else + if (value) { +#if CYTHON_COMPILING_IN_PYPY +#else + /* Generators always return to their most recent caller, not + * necessarily their creator. */ + if (self->exc_traceback) { + PyThreadState *tstate = PyThreadState_GET(); + PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_XINCREF(tstate->frame); + assert(f->f_back == NULL); + f->f_back = tstate->frame; + } +#endif + __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, + &self->exc_traceback); + } else { __Pyx_Generator_ExceptionClear(self); - + } self->is_running = 1; retval = self->body((PyObject *) self, value); self->is_running = 0; - - if (retval) - __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); - else + if (retval) { + __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, + &self->exc_traceback); +#if CYTHON_COMPILING_IN_PYPY +#else + /* Don't keep the reference to f_back any longer than necessary. It + * may keep a chain of frames alive or it could create a reference + * cycle. */ + if (self->exc_traceback) { + PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + } +#endif + } else { __Pyx_Generator_ExceptionClear(self); - + } return retval; } - -static PyObject *__Pyx_Generator_Next(PyObject *self) -{ - return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, Py_None); -} - -static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) -{ - return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, value); +static CYTHON_INLINE +PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) { + PyObject *ret; + PyObject *val = NULL; + __Pyx_Generator_Undelegate(gen); + __Pyx_PyGen_FetchStopIterationValue(&val); + ret = __Pyx_Generator_SendEx(gen, val); + Py_XDECREF(val); + return ret; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + ret = Py_TYPE(yf)->tp_iternext(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, Py_None); } - -static PyObject *__Pyx_Generator_Close(PyObject *self) -{ - struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self; - PyObject *retval; +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Send(yf, value); + } else { + if (value == Py_None) + ret = PyIter_Next(yf); + else + ret = PyObject_CallMethod(yf, (char*)"send", (char*)"O", value); + } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, value); +} +static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) { + PyObject *retval = NULL; + int err = 0; + if (__Pyx_Generator_CheckExact(yf)) { + retval = __Pyx_Generator_Close(yf); + if (!retval) + return -1; + } else { + PyObject *meth; + gen->is_running = 1; + meth = PyObject_GetAttrString(yf, "close"); + if (unlikely(!meth)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_WriteUnraisable(yf); + } + PyErr_Clear(); + } else { + retval = PyObject_CallFunction(meth, NULL); + Py_DECREF(meth); + if (!retval) + err = -1; + } + gen->is_running = 0; + } + Py_XDECREF(retval); + return err; +} +static PyObject *__Pyx_Generator_Close(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject *retval, *raised_exception; + PyObject *yf = gen->yieldfrom; + int err = 0; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Generator_CloseIter(gen, yf); + __Pyx_Generator_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) #if PY_VERSION_HEX < 0x02050000 - PyErr_SetNone(PyExc_StopIteration); + PyErr_SetNone(PyExc_StopIteration); #else - PyErr_SetNone(PyExc_GeneratorExit); + PyErr_SetNone(PyExc_GeneratorExit); #endif - retval = __Pyx_Generator_SendEx(generator, NULL); + retval = __Pyx_Generator_SendEx(gen, NULL); if (retval) { Py_DECREF(retval); PyErr_SetString(PyExc_RuntimeError, "generator ignored GeneratorExit"); return NULL; } -#if PY_VERSION_HEX < 0x02050000 - if (PyErr_ExceptionMatches(PyExc_StopIteration)) -#else - if (PyErr_ExceptionMatches(PyExc_StopIteration) - || PyErr_ExceptionMatches(PyExc_GeneratorExit)) + raised_exception = PyErr_Occurred(); + if (!raised_exception + || raised_exception == PyExc_StopIteration +#if PY_VERSION_HEX >= 0x02050000 + || raised_exception == PyExc_GeneratorExit + || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit) #endif + || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration)) { - PyErr_Clear(); /* ignore these errors */ + if (raised_exception) PyErr_Clear(); /* ignore these errors */ Py_INCREF(Py_None); return Py_None; } return NULL; } - -static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args, CYTHON_UNUSED PyObject *kwds) -{ - struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self; +static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; PyObject *typ; PyObject *tb = NULL; PyObject *val = NULL; - + PyObject *yf = gen->yieldfrom; if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) return NULL; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + Py_INCREF(yf); +#if PY_VERSION_HEX >= 0x02050000 + if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { + int err = __Pyx_Generator_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Generator_Undelegate(gen); + if (err < 0) + return __Pyx_Generator_SendEx(gen, NULL); + goto throw_here; + } +#endif + gen->is_running = 1; + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Throw(yf, args); + } else { + PyObject *meth = PyObject_GetAttrString(yf, "throw"); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + gen->is_running = 0; + return NULL; + } + PyErr_Clear(); + __Pyx_Generator_Undelegate(gen); + gen->is_running = 0; + goto throw_here; + } + ret = PyObject_CallObject(meth, args); + Py_DECREF(meth); + } + gen->is_running = 0; + Py_DECREF(yf); + if (!ret) { + ret = __Pyx_Generator_FinishDelegation(gen); + } + return ret; + } +throw_here: __Pyx_Raise(typ, val, tb, NULL); - return __Pyx_Generator_SendEx(generator, NULL); + return __Pyx_Generator_SendEx(gen, NULL); +} +static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + Py_VISIT(gen->exc_type); + Py_VISIT(gen->exc_value); + Py_VISIT(gen->exc_traceback); + return 0; +} +static int __Pyx_Generator_clear(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + Py_CLEAR(gen->yieldfrom); + Py_CLEAR(gen->exc_type); + Py_CLEAR(gen->exc_value); + Py_CLEAR(gen->exc_traceback); + return 0; +} +static void __Pyx_Generator_dealloc(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject_GC_UnTrack(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs(self); + PyObject_GC_Track(self); + if (gen->resume_label > 0) { + Py_TYPE(gen)->tp_del(self); + if (self->ob_refcnt > 0) + return; /* resurrected. :( */ + } + PyObject_GC_UnTrack(self); + __Pyx_Generator_clear(self); + PyObject_GC_Del(gen); +} +static void __Pyx_Generator_del(PyObject *self) { + PyObject *res; + PyObject *error_type, *error_value, *error_traceback; + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + if (gen->resume_label <= 0) + return ; + assert(self->ob_refcnt == 0); + self->ob_refcnt = 1; + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); + res = __Pyx_Generator_Close(self); + if (res == NULL) + PyErr_WriteUnraisable(self); + else + Py_DECREF(res); + __Pyx_ErrRestore(error_type, error_value, error_traceback); + /* Undo the temporary resurrection; can't use DECREF here, it would + * cause a recursive call. + */ + assert(self->ob_refcnt > 0); + if (--self->ob_refcnt == 0) + return; /* this is the normal path out */ + /* close() resurrected it! Make it look like the original Py_DECREF + * never happened. + */ + { + Py_ssize_t refcnt = self->ob_refcnt; + _Py_NewReference(self); + self->ob_refcnt = refcnt; + } +#if CYTHON_COMPILING_FOR_CPYTHON + assert(PyType_IS_GC(self->ob_type) && + _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); + /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so + * we need to undo that. */ + _Py_DEC_REFTOTAL; +#endif + /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object + * chain, so no more to do there. + * If COUNT_ALLOCS, the original decref bumped tp_frees, and + * _Py_NewReference bumped tp_allocs: both of those need to be + * undone. + */ +#ifdef COUNT_ALLOCS + --Py_TYPE(self)->tp_frees; + --Py_TYPE(self)->tp_allocs; +#endif +} +static PyMemberDef __pyx_Generator_memberlist[] = { + {(char *) "gi_running", +#if PY_VERSION_HEX >= 0x02060000 + T_BOOL, +#else + T_BYTE, +#endif + offsetof(__pyx_GeneratorObject, is_running), + READONLY, + NULL}, + {0, 0, 0, 0, 0} +}; +static PyMethodDef __pyx_Generator_methods[] = { + {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0}, + {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0}, + {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyTypeObject __pyx_GeneratorType_type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("generator"), /*tp_name*/ + sizeof(__pyx_GeneratorObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ +#if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ +#else + 0, /*reserved*/ +#endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ + 0, /*tp_doc*/ + (traverseproc) __Pyx_Generator_traverse, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */ + 0, /*tp_iter*/ + (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/ + __pyx_Generator_methods, /*tp_methods*/ + __pyx_Generator_memberlist, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + __Pyx_Generator_del, /*tp_del*/ +#if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ +#endif +}; +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure) { + __pyx_GeneratorObject *gen = + PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type); + if (gen == NULL) + return NULL; + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->exc_type = NULL; + gen->exc_value = NULL; + gen->exc_traceback = NULL; + gen->gi_weakreflist = NULL; + PyObject_GC_Track(gen); + return gen; +} +static int __pyx_Generator_init(void) { + __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; + __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; + if (PyType_Ready(&__pyx_GeneratorType_type)) { + return -1; + } + __pyx_GeneratorType = &__pyx_GeneratorType_type; + return 0; } static int __Pyx_check_binary_version(void) { @@ -64259,7 +69971,6 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s void (*fp)(void); void *p; } tmp; - d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); if (!d) { PyErr_Clear(); @@ -64306,29 +70017,105 @@ bad: return -1; } +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -64339,28 +70126,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -64368,11 +70172,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -64407,6 +70209,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/python/src/sa/sym.pxi b/python/src/sa/sym.pxi index 132925f6..f47599cf 100644 --- a/python/src/sa/sym.pxi +++ b/python/src/sa/sym.pxi @@ -101,5 +101,16 @@ cdef int sym_getindex(int sym): cdef int sym_setindex(int sym, int id): return ALPHABET.setindex(sym, id) -def sym_fromstring(char* string, bint terminal): +cdef int sym_fromstring(char* string, bint terminal): return ALPHABET.fromstring(string, terminal) + +def make_lattice(words): + word_ids = (sym_fromstring(word, True) for word in words) + return tuple(((word, None, 1), ) for word in word_ids) + +def decode_lattice(lattice): + return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc + for arc in node for node in lattice) + +def decode_sentence(lattice): + return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) |