summaryrefslogtreecommitdiff
path: root/python/src/_cdec.cpp
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-06-19 15:06:34 +0100
committerPaul Baltescu <pauldb89@gmail.com>2013-06-19 15:06:34 +0100
commit459775095b46b4625ce26ea5a34001ec74ab3aa8 (patch)
tree844d1a650a302114ae619d37b8778ab66207a834 /python/src/_cdec.cpp
parent02099a01350a41a99ec400e9b29df08a01d88979 (diff)
parent0dc7755f7fb1ef15db5a60c70866aa61b6367898 (diff)
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'python/src/_cdec.cpp')
-rw-r--r--python/src/_cdec.cpp14166
1 files changed, 5617 insertions, 8549 deletions
diff --git a/python/src/_cdec.cpp b/python/src/_cdec.cpp
index 4b950f01..ae36b773 100644
--- a/python/src/_cdec.cpp
+++ b/python/src/_cdec.cpp
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.18 on Tue Apr 23 18:41:37 2013 */
+/* Generated by Cython 0.19.1 on Sun Jun 2 14:47:49 2013 */
#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
@@ -116,6 +128,9 @@
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
+#if PY_VERSION_HEX < 0x02060000
+ #define Py_TPFLAGS_HAVE_VERSION_TAG 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)) ? \
@@ -155,6 +170,14 @@
#define PyBytes_Concat PyString_Concat
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+ PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
#if PY_VERSION_HEX < 0x02060000
#define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
#define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -227,6 +250,40 @@
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER)
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
#if PY_MAJOR_VERSION >= 3
@@ -298,17 +355,6 @@
#define CYTHON_WITHOUT_ASSERTIONS
#endif
-#ifndef CYTHON_INLINE
- #if defined(__GNUC__)
- #define CYTHON_INLINE __inline__
- #elif defined(_MSC_VER)
- #define CYTHON_INLINE __inline
- #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
- #define CYTHON_INLINE inline
- #else
- #define CYTHON_INLINE
- #endif
-#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -322,10 +368,44 @@
# define CYTHON_UNUSED
# endif
#endif
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
@@ -339,6 +419,78 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+ PyObject* sys = NULL;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ sys = PyImport_ImportModule("sys");
+ if (sys == NULL) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ if (default_encoding == NULL) goto bad;
+ if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (ascii_chars_u == NULL) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ }
+ Py_XDECREF(sys);
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return 0;
+bad:
+ Py_XDECREF(sys);
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+ PyObject* sys = NULL;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (sys == NULL) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ if (default_encoding == NULL) goto bad;
+ default_encoding_c = PyBytes_AS_STRING(default_encoding);
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(sys);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(sys);
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
#ifdef __GNUC__
@@ -354,8 +506,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
-
+
static PyObject *__pyx_m;
+static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
@@ -372,7 +525,6 @@ static const char *__pyx_f[] = {
"hypergraph.pxi",
"lattice.pxi",
"mteval.pxi",
- "stringsource",
"cdec.sa._sa.pxd",
};
@@ -441,7 +593,7 @@ struct __pyx_opt_args_5_cdec_as_str {
char *error_msg;
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":25
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":25
* cdef void read_handle(self, FILE* f)
*
* cdef class FeatureVector: # <<<<<<<<<<<<<<
@@ -468,7 +620,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":21
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":21
* return '[%s]' % self.cat
*
* cdef class NTRef: # <<<<<<<<<<<<<<
@@ -481,7 +633,7 @@ struct __pyx_obj_5_cdec_NTRef {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":121
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":121
* return CandidateSet(self)
*
* cdef class Scorer: # <<<<<<<<<<<<<<
@@ -495,7 +647,7 @@ struct __pyx_obj_5_cdec_Scorer {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":12
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":12
* cdef void read_handle(self, FILE* f)
*
* cdef class IntList: # <<<<<<<<<<<<<<
@@ -512,7 +664,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_IntList {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":29
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":29
* cdef FloatList values
*
* cdef class Phrase: # <<<<<<<<<<<<<<
@@ -529,7 +681,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":90
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90
* return candidate
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -545,7 +697,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":193
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":193
* super(MRule, self).__init__(lhs, rhs, e, scores, None)
*
* cdef class Grammar: # <<<<<<<<<<<<<<
@@ -558,7 +710,7 @@ struct __pyx_obj_5_cdec_Grammar {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":63
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
* def todot(self):
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines(): # <<<<<<<<<<<<<<
@@ -581,7 +733,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":108
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108
* del hypos
*
* def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
@@ -599,7 +751,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":161
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":161
*
* property edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -615,7 +767,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":5
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -628,7 +780,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":65
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":65
* return result
*
* cdef class CandidateSet: # <<<<<<<<<<<<<<
@@ -643,7 +795,7 @@ struct __pyx_obj_5_cdec_CandidateSet {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":167
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167
*
* property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -659,7 +811,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":49
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":49
* return TRule(lhs, f, e, scores, a)
*
* cdef class TRule: # <<<<<<<<<<<<<<
@@ -672,7 +824,7 @@ struct __pyx_obj_5_cdec_TRule {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":35
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":35
* cdef public int chunklen(self, int k)
*
* cdef class Rule: # <<<<<<<<<<<<<<
@@ -690,7 +842,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Rule {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":177
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":177
* _phrase(self.f), _phrase(self.e), scores)
*
* cdef class MRule(TRule): # <<<<<<<<<<<<<<
@@ -702,7 +854,7 @@ struct __pyx_obj_5_cdec_MRule {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":100
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":100
* self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get())
*
* cdef class SegmentEvaluator: # <<<<<<<<<<<<<<
@@ -733,7 +885,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":61
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":61
* yield self[i]
*
* def todot(self): # <<<<<<<<<<<<<<
@@ -746,7 +898,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":12
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":12
* return stats
*
* cdef class Candidate: # <<<<<<<<<<<<<<
@@ -760,7 +912,7 @@ struct __pyx_obj_5_cdec_Candidate {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":173
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -777,7 +929,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":8
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":8
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
* cdef class NT: # <<<<<<<<<<<<<<
@@ -791,7 +943,7 @@ struct __pyx_obj_5_cdec_NT {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":3
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":3
* from libc.stdio cimport FILE
*
* cdef class FloatList: # <<<<<<<<<<<<<<
@@ -808,7 +960,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_FloatList {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":196
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":196
* return vector
*
* cdef class HypergraphEdge: # <<<<<<<<<<<<<<
@@ -824,7 +976,7 @@ struct __pyx_obj_5_cdec_HypergraphEdge {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":72
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":72
* self.vector.set_value(fid, value)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -841,7 +993,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":256
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":256
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -857,7 +1009,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":131
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131
*
* property a:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -874,7 +1026,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":56
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":56
* return unicode(str(self), 'utf8')
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -904,7 +1056,7 @@ struct __pyx_obj_5_cdec_Decoder {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":246
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":246
* raise NotImplemented('comparison not implemented for HypergraphEdge')
*
* cdef class HypergraphNode: # <<<<<<<<<<<<<<
@@ -919,7 +1071,7 @@ struct __pyx_obj_5_cdec_HypergraphNode {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":48
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":48
* return sparse
*
* cdef class SparseVector: # <<<<<<<<<<<<<<
@@ -932,7 +1084,7 @@ struct __pyx_obj_5_cdec_SparseVector {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":262
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":262
*
* property out_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -948,7 +1100,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":32
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":32
* self.vector[0][fid] = value
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -964,7 +1116,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":44
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
* return self.stats.size()
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -981,7 +1133,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":3
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":3
* from cython.operator cimport preincrement as pinc
*
* cdef class DenseVector: # <<<<<<<<<<<<<<
@@ -995,7 +1147,7 @@ struct __pyx_obj_5_cdec_DenseVector {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":199
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":199
* del self.grammar
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -1014,7 +1166,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":176
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":176
* out.fields[i] = ss[i]
*
* cdef class Metric: # <<<<<<<<<<<<<<
@@ -1027,7 +1179,7 @@ struct __pyx_obj_5_cdec_Metric {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":26
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":26
* return fmap
*
* cdef class SufficientStats: # <<<<<<<<<<<<<<
@@ -1041,7 +1193,7 @@ struct __pyx_obj_5_cdec_SufficientStats {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":49
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":49
* return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
* def kbest(self, size): # <<<<<<<<<<<<<<
@@ -1060,7 +1212,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":81
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":81
* del e_derivations
*
* def kbest_features(self, size): # <<<<<<<<<<<<<<
@@ -1080,7 +1232,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":216
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
*
* property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -1096,7 +1248,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":172
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172
* self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -1109,7 +1261,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":6
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -1126,7 +1278,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":62
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":62
* del derivations
*
* def kbest_trees(self, size): # <<<<<<<<<<<<<<
@@ -1149,7 +1301,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":4
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4
* cimport kbest
*
* cdef class Hypergraph: # <<<<<<<<<<<<<<
@@ -1164,7 +1316,7 @@ struct __pyx_obj_5_cdec_Hypergraph {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":3
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":3
* cimport lattice
*
* cdef class Lattice: # <<<<<<<<<<<<<<
@@ -1177,7 +1329,7 @@ struct __pyx_obj_5_cdec_Lattice {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":97
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":97
* del derivations
*
* def sample(self, unsigned n): # <<<<<<<<<<<<<<
@@ -1218,7 +1370,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config {
};
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":217
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":217
* self.grammar.get().SetGrammarName(name)
*
* cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<<
@@ -1231,7 +1383,7 @@ struct __pyx_obj_5_cdec_TextGrammar {
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":4
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4
* cimport kbest
*
* cdef class Hypergraph: # <<<<<<<<<<<<<<
@@ -1245,7 +1397,7 @@ struct __pyx_vtabstruct_5_cdec_Hypergraph {
static struct __pyx_vtabstruct_5_cdec_Hypergraph *__pyx_vtabptr_5_cdec_Hypergraph;
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":196
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":196
* return vector
*
* cdef class HypergraphEdge: # <<<<<<<<<<<<<<
@@ -1259,7 +1411,7 @@ struct __pyx_vtabstruct_5_cdec_HypergraphEdge {
static struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtabptr_5_cdec_HypergraphEdge;
-/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":12
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":12
* cdef void read_handle(self, FILE* f)
*
* cdef class IntList: # <<<<<<<<<<<<<<
@@ -1279,7 +1431,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtabptr_4cdec_2sa_3_sa_IntList;
-/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":3
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":3
* from libc.stdio cimport FILE
*
* cdef class FloatList: # <<<<<<<<<<<<<<
@@ -1295,7 +1447,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtabptr_4cdec_2sa_3_sa_FloatList;
-/* "/usr0/home/cdyer/cdec-merge/python/src/cdec.sa._sa.pxd":29
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":29
* cdef FloatList values
*
* cdef class Phrase: # <<<<<<<<<<<<<<
@@ -1310,7 +1462,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtabptr_4cdec_2sa_3_sa_Phrase;
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":246
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":246
* raise NotImplemented('comparison not implemented for HypergraphEdge')
*
* cdef class HypergraphNode: # <<<<<<<<<<<<<<
@@ -1376,7 +1528,22 @@ static struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtabptr_5_cdec_Hyper
#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*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
@@ -1391,11 +1558,6 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char*
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact); /*proto*/
-static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) {
- return (PyObject*) (((PyTypeObject*)(type_obj))->tp_new(
- (PyTypeObject*)(type_obj), __pyx_empty_tuple, NULL));
-}
-
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
@@ -1406,106 +1568,80 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
-static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
- if (likely(PyList_CheckExact(L))) {
- if (unlikely(PyList_Append(L, x) < 0)) return NULL;
- Py_INCREF(Py_None);
- return Py_None; /* this is just to have an accurate signature */
- } else {
- PyObject *r, *m;
- m = __Pyx_GetAttrString(L, "append");
- if (!m) return NULL;
- r = PyObject_CallFunctionObjArgs(m, x, NULL);
- Py_DECREF(m);
- return r;
- }
-}
-
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
- PyObject *r;
- if (!j) return NULL;
- r = PyObject_GetItem(o, 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 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;
+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) & likely(len > (L->allocated >> 1))) {
+ Py_INCREF(x);
+ PyList_SET_ITEM(list, len, x);
+ Py_SIZE(list) = len+1;
+ return 0;
}
- return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+ return PyList_Append(list, x);
+}
#else
- return PySequence_GetItem(o, i);
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#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 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);
+#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
+static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_setattro))
+ return tp->tp_setattro(obj, attr_name, value);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_setattr))
+ return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
+ return PyObject_SetAttr(obj, attr_name, value);
}
-#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) {
-#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 (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
- if (PySequence_Check(o)) {
- return PySequence_GetItem(o, i);
- }
+#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
+#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif
- return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+
+static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) {
+ PyObject *method, *result = NULL;
+ if (unlikely(!args)) return NULL;
+ method = __Pyx_PyObject_GetAttrStr(obj, method_name);
+ if (unlikely(!method)) goto bad;
+ result = PyObject_Call(method, args, NULL);
+ Py_DECREF(method);
+bad:
+ Py_DECREF(args);
+ return result;
}
+#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \
+ __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3))
+#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \
+ __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2))
+#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \
+ __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1))
+#define __Pyx_PyObject_CallMethod0(obj, name) \
+ __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple))
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x); /*proto*/
+
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+ (((size) <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+ (((size) <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+ (((size) <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck);
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
@@ -1515,6 +1651,11 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+ int lineno, const char *filename); /*proto*/
+
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));
@@ -1523,34 +1664,56 @@ static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, i
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*proto*/
-static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
- PyObject* value;
-#if PY_MAJOR_VERSION >= 3
- value = PyDict_GetItemWithError(d, key);
- if (unlikely(!value)) {
- if (unlikely(PyErr_Occurred()))
- return NULL;
- value = default_value;
- }
- Py_INCREF(value);
-#else
- if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
- value = PyDict_GetItem(d, key);
- if (unlikely(!value)) {
- value = default_value;
- }
- Py_INCREF(value);
- } else {
- PyObject *m;
- m = __Pyx_GetAttrString(d, "get");
- if (!m) return NULL;
- value = PyObject_CallFunctionObjArgs(m, key,
- (default_value == Py_None) ? NULL : default_value, NULL);
- Py_DECREF(m);
- }
-#endif
- return value;
-}
+#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;
+ int flags;
+ PyObject *func_dict;
+ PyObject *func_weakreflist;
+ PyObject *func_name;
+ PyObject *func_qualname;
+ 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_kwdict; /* Const kwonly defaults dict */
+ PyObject *(*defaults_getter)(PyObject *);
+ PyObject *func_annotations; /* function annotations dict */
+} __pyx_CyFunctionObject;
+static PyTypeObject *__pyx_CyFunctionType = 0;
+#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \
+ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code)
+static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
+ int flags, PyObject* qualname,
+ PyObject *self, PyObject *module,
+ PyObject* code);
+static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
+ size_t size,
+ int pyobjects);
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
+ PyObject *tuple);
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
+ PyObject *dict);
+static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
+ PyObject *dict);
+static int __Pyx_CyFunction_init(void);
+
+static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); /*proto*/
static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
#if CYTHON_COMPILING_IN_PYPY
@@ -1566,6 +1729,12 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+#include <string.h>
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
+static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
+
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
@@ -1619,49 +1788,6 @@ static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject *);
static PyObject* __Pyx_Globals(void); /*proto*/
-#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;
- int flags;
- PyObject *func_dict;
- PyObject *func_weakreflist;
- PyObject *func_name;
- PyObject *func_qualname;
- 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, qualname, self, module, code) \
- __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code)
-static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
- int flags, PyObject* qualname,
- PyObject *self, PyObject *module,
- PyObject* code);
-static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
- 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 *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
@@ -1723,13 +1849,8 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
- int lineno, const char *filename); /*proto*/
-
static int __Pyx_check_binary_version(void);
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
-
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -1742,8 +1863,6 @@ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/
-static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
-
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/
typedef struct {
@@ -1804,51 +1923,51 @@ static int (*__pyx_f_4cdec_2sa_3_sa_sym_getindex)(int); /*proto*/
/* Module declarations from 'mteval' */
/* Module declarations from '_cdec' */
-static PyTypeObject *__pyx_ptype_5_cdec_DenseVector = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_SparseVector = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_NT = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_Scorer = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_24___init__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec_NTRef = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_TRule = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_MRule = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec_Grammar = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_TextGrammar = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_Hypergraph = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_HypergraphEdge = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_HypergraphNode = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_Lattice = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_Candidate = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_SufficientStats = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_20_lines = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_2__phrase = 0;
static PyTypeObject *__pyx_ptype_5_cdec_CandidateSet = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_TRule = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_MRule = 0;
static PyTypeObject *__pyx_ptype_5_cdec_SegmentEvaluator = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_Scorer = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_Metric = 0;
-static PyTypeObject *__pyx_ptype_5_cdec_Decoder = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct____iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_19_todot = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_Candidate = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_NT = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_HypergraphEdge = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_1___iter__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_2__phrase = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_4___get__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_5___str__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_Decoder = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_HypergraphNode = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_SparseVector = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct____iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_DenseVector = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_Metric = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_SufficientStats = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_11_sample = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_15___get__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_19_todot = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_20_lines = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_5___str__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_Hypergraph = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_Lattice = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_11_sample = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_24___init__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_TextGrammar = 0;
static PyObject *__pyx_f_5_cdec_as_str(PyObject *, struct __pyx_opt_args_5_cdec_as_str *__pyx_optional_args); /*proto*/
static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *); /*proto*/
static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject *, PyObject *); /*proto*/
@@ -1866,7 +1985,6 @@ static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_ValueError;
-static PyObject *__pyx_builtin_basestring;
static PyObject *__pyx_builtin_eval;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_IndexError;
@@ -2024,6 +2142,51 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_sentence, PyObject *__pyx_v_grammar); /* proto */
+static PyObject *__pyx_tp_new_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_Grammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_Candidate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_Decoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_SparseVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_Lattice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_1[] = "Cannot convert type %s to str";
static char __pyx_k_3[] = "cannot take the dot product of %s and SparseVector";
static char __pyx_k_4[] = "comparison not implemented for SparseVector";
@@ -2049,7 +2212,7 @@ static char __pyx_k_26[] = "digraph lattice {";
static char __pyx_k_31[] = "\\\"";
static char __pyx_k_33[] = "%d [shape=doublecircle]";
static char __pyx_k_34[] = "}";
-static char __pyx_k_37[] = "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi";
+static char __pyx_k_37[] = "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi";
static char __pyx_k_38[] = "Lattice.todot.<locals>.lines";
static char __pyx_k_39[] = "\n";
static char __pyx_k_41[] = "sufficient stats vector index out of range";
@@ -2062,8 +2225,8 @@ static char __pyx_k_49[] = "#";
static char __pyx_k_52[] = "Cannot translate input type %s";
static char __pyx_k_53[] = "cdec.sa._sa";
static char __pyx_k_54[] = "*";
-static char __pyx_k_57[] = "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi";
-static char __pyx_k_65[] = "/usr0/home/cdyer/cdec-merge/python/src/_cdec.pyx";
+static char __pyx_k_57[] = "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi";
+static char __pyx_k_65[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx";
static char __pyx_k__a[] = "a";
static char __pyx_k__e[] = "e";
static char __pyx_k__f[] = "f";
@@ -2078,6 +2241,7 @@ static char __pyx_k___sa[] = "_sa";
static char __pyx_k__cat[] = "cat";
static char __pyx_k__dot[] = "dot";
static char __pyx_k__fst[] = "fst";
+static char __pyx_k__get[] = "get";
static char __pyx_k__hyp[] = "hyp";
static char __pyx_k__inp[] = "inp";
static char __pyx_k__key[] = "key";
@@ -2087,6 +2251,7 @@ static char __pyx_k__ref[] = "ref";
static char __pyx_k__rhs[] = "rhs";
static char __pyx_k__BLEU[] = "BLEU";
static char __pyx_k__QCRI[] = "QCRI";
+static char __pyx_k__args[] = "args";
static char __pyx_k__eval[] = "eval";
static char __pyx_k__info[] = "info";
static char __pyx_k__join[] = "join";
@@ -2095,9 +2260,11 @@ static char __pyx_k__open[] = "open";
static char __pyx_k__refs[] = "refs";
static char __pyx_k__scfg[] = "scfg";
static char __pyx_k__self[] = "self";
+static char __pyx_k__send[] = "send";
static char __pyx_k__span[] = "span";
static char __pyx_k__utf8[] = "utf8";
static char __pyx_k___cdec[] = "_cdec";
+static char __pyx_k__close[] = "close";
static char __pyx_k__delta[] = "delta";
static char __pyx_k__items[] = "items";
static char __pyx_k__label[] = "label";
@@ -2108,7 +2275,9 @@ static char __pyx_k__score[] = "score";
static char __pyx_k__split[] = "split";
static char __pyx_k__strip[] = "strip";
static char __pyx_k__super[] = "super";
+static char __pyx_k__throw[] = "throw";
static char __pyx_k__value[] = "value";
+static char __pyx_k__append[] = "append";
static char __pyx_k__config[] = "config";
static char __pyx_k__csplit[] = "csplit";
static char __pyx_k__encode[] = "encode";
@@ -2124,6 +2293,7 @@ static char __pyx_k__grammar[] = "grammar";
static char __pyx_k__replace[] = "replace";
static char __pyx_k__IBM_BLEU[] = "IBM_BLEU";
static char __pyx_k__KeyError[] = "KeyError";
+static char __pyx_k____dict__[] = "__dict__";
static char __pyx_k____exit__[] = "__exit__";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
@@ -2145,17 +2315,21 @@ static char __pyx_k__evaluator[] = "evaluator";
static char __pyx_k__formalism[] = "formalism";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____import__[] = "__import__";
+static char __pyx_k____module__[] = "__module__";
static char __pyx_k__alignments[] = "alignments";
-static char __pyx_k__basestring[] = "basestring";
static char __pyx_k__beam_alpha[] = "beam_alpha";
static char __pyx_k__config_str[] = "config_str";
static char __pyx_k__hypergraph[] = "hypergraph";
static char __pyx_k__set_silent[] = "set_silent";
static char __pyx_k__startswith[] = "startswith";
static char __pyx_k__ParseFailed[] = "ParseFailed";
+static char __pyx_k____qualname__[] = "__qualname__";
static char __pyx_k___make_config[] = "_make_config";
static char __pyx_k__InvalidConfig[] = "InvalidConfig";
+static char __pyx_k____metaclass__[] = "__metaclass__";
static char __pyx_k__NotImplemented[] = "NotImplemented";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_12;
@@ -2211,11 +2385,17 @@ static PyObject *__pyx_n_s__TER;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____class__;
+static PyObject *__pyx_n_s____dict__;
static PyObject *__pyx_n_s____enter__;
static PyObject *__pyx_n_s____exit__;
+static PyObject *__pyx_n_s____import__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____metaclass__;
+static PyObject *__pyx_n_s____module__;
static PyObject *__pyx_n_s____name__;
+static PyObject *__pyx_n_s____pyx_vtable__;
+static PyObject *__pyx_n_s____qualname__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___cdec;
static PyObject *__pyx_n_s___make_config;
@@ -2223,9 +2403,11 @@ static PyObject *__pyx_n_s___phrase;
static PyObject *__pyx_n_s___sa;
static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__alignments;
-static PyObject *__pyx_n_s__basestring;
+static PyObject *__pyx_n_s__append;
+static PyObject *__pyx_n_s__args;
static PyObject *__pyx_n_s__beam_alpha;
static PyObject *__pyx_n_s__cat;
+static PyObject *__pyx_n_s__close;
static PyObject *__pyx_n_s__config;
static PyObject *__pyx_n_s__config_str;
static PyObject *__pyx_n_s__csplit;
@@ -2244,6 +2426,7 @@ static PyObject *__pyx_n_s__formalism;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_s__fst;
static PyObject *__pyx_n_s__genexpr;
+static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__grammar;
static PyObject *__pyx_n_s__hyp;
static PyObject *__pyx_n_s__hypergraph;
@@ -2275,6 +2458,7 @@ static PyObject *__pyx_n_s__scfg;
static PyObject *__pyx_n_s__score;
static PyObject *__pyx_n_s__scores;
static PyObject *__pyx_n_s__self;
+static PyObject *__pyx_n_s__send;
static PyObject *__pyx_n_s__sentence;
static PyObject *__pyx_n_s__set_silent;
static PyObject *__pyx_n_s__span;
@@ -2283,6 +2467,7 @@ static PyObject *__pyx_n_s__startswith;
static PyObject *__pyx_n_s__strip;
static PyObject *__pyx_n_s__super;
static PyObject *__pyx_n_s__tagger;
+static PyObject *__pyx_n_s__throw;
static PyObject *__pyx_n_s__utf8;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_n_s__weight;
@@ -2331,9 +2516,10 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = 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;
@@ -2352,7 +2538,8 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_
* elif isinstance(data, str):
*/
__pyx_t_1 = PyUnicode_Check(__pyx_v_data);
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
/* "_cdec.pyx":9
* cdef bytes ret
@@ -2361,14 +2548,14 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_
* elif isinstance(data, str):
* ret = data
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ret = ((PyObject*)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_ret = ((PyObject*)__pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
@@ -2379,7 +2566,8 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_
* ret = data
* else:
*/
- __pyx_t_1 = PyString_Check(__pyx_v_data);
+ __pyx_t_2 = PyString_Check(__pyx_v_data);
+ __pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* "_cdec.pyx":11
@@ -2403,30 +2591,30 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_
* return ret
*
*/
- __pyx_t_3 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_error_msg); 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_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_4), __pyx_n_s__format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __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(__pyx_t_4);
__Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data)));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(__pyx_v_data)));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(__pyx_v_data)));
__Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data)));
- __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __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[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -2446,9 +2634,9 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_
__pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("_cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -2476,7 +2664,7 @@ static int __pyx_pw_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":7
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":7
* cdef bint owned # if True, do not manage memory
*
* def __init__(self): # <<<<<<<<<<<<<<
@@ -2493,7 +2681,7 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":9
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":9
* def __init__(self):
* """DenseVector() -> Dense weight/feature vector."""
* self.vector = new vector[weight_t]() # <<<<<<<<<<<<<<
@@ -2508,7 +2696,7 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV
}
__pyx_v_self->vector = __pyx_t_1;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":10
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":10
* """DenseVector() -> Dense weight/feature vector."""
* self.vector = new vector[weight_t]()
* self.owned = False # <<<<<<<<<<<<<<
@@ -2536,7 +2724,7 @@ static void __pyx_pw_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":12
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":12
* self.owned = False
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -2549,17 +2737,17 @@ static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_D
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":13
*
* def __dealloc__(self):
* if not self.owned: # <<<<<<<<<<<<<<
* del self.vector
*
*/
- __pyx_t_1 = (!__pyx_v_self->owned);
+ __pyx_t_1 = ((!(__pyx_v_self->owned != 0)) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":14
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":14
* def __dealloc__(self):
* if not self.owned:
* del self.vector # <<<<<<<<<<<<<<
@@ -2585,7 +2773,7 @@ static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":16
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":16
* del self.vector
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -2598,7 +2786,7 @@ static Py_ssize_t __pyx_pf_5_cdec_11DenseVector_4__len__(struct __pyx_obj_5_cdec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":17
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":17
*
* def __len__(self):
* return self.vector.size() # <<<<<<<<<<<<<<
@@ -2618,11 +2806,14 @@ static Py_ssize_t __pyx_pf_5_cdec_11DenseVector_4__len__(struct __pyx_obj_5_cdec
static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
char *__pyx_v_fname;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_fname); {
- __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_fname = __Pyx_PyObject_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -2635,7 +2826,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":19
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":19
* return self.vector.size()
*
* def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
@@ -2648,14 +2839,15 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = 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("__getitem__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":20
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":20
*
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -2664,7 +2856,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":21
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":21
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname)
* if 0 <= fid < self.vector.size(): # <<<<<<<<<<<<<<
@@ -2675,9 +2867,10 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c
if (__pyx_t_1) {
__pyx_t_1 = (__pyx_v_fid < __pyx_v_self->vector->size());
}
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":22
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":22
* cdef int fid = FDConvert(fname)
* if 0 <= fid < self.vector.size():
* return self.vector[0][fid] # <<<<<<<<<<<<<<
@@ -2685,41 +2878,41 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_self->vector[0])[__pyx_v_fid])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_self->vector[0])[__pyx_v_fid])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":23
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":23
* if 0 <= fid < self.vector.size():
* return self.vector[0][fid]
* raise KeyError(fname) # <<<<<<<<<<<<<<
*
* def __setitem__(self, char* fname, float value):
*/
- __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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;
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__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;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("_cdec.DenseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -2733,11 +2926,14 @@ static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, Py
static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) {
char *__pyx_v_fname;
float __pyx_v_value;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
assert(__pyx_arg_fname); {
- __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_fname = __Pyx_PyObject_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
assert(__pyx_arg_value); {
__pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
@@ -2753,7 +2949,7 @@ static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":25
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":25
* raise KeyError(fname)
*
* def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
@@ -2773,7 +2969,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":26
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":26
*
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -2782,16 +2978,16 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":27
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":27
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1)
*/
- __pyx_t_1 = (__pyx_v_fid < 0);
+ __pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
- __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -2808,17 +3004,17 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":28
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":28
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* if self.vector.size() <= fid: # <<<<<<<<<<<<<<
* self.vector.resize(fid + 1)
* self.vector[0][fid] = value
*/
- __pyx_t_1 = (__pyx_v_self->vector->size() <= __pyx_v_fid);
+ __pyx_t_1 = ((__pyx_v_self->vector->size() <= __pyx_v_fid) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":29
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":29
* if fid < 0: raise KeyError(fname)
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1) # <<<<<<<<<<<<<<
@@ -2830,7 +3026,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
}
__pyx_L4:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":30
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":30
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1)
* self.vector[0][fid] = value # <<<<<<<<<<<<<<
@@ -2863,7 +3059,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":32
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":32
* self.vector[0][fid] = value
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -2879,7 +3075,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_5_cde
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct____iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(__pyx_ptype_5_cdec___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -2916,6 +3112,9 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject
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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -2928,7 +3127,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":34
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":34
* def __iter__(self):
* cdef unsigned fid
* for fid in range(1, self.vector.size()): # <<<<<<<<<<<<<<
@@ -2939,14 +3138,14 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject
for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_fid = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":35
* cdef unsigned fid
* for fid in range(1, self.vector.size()):
* yield str(FDConvert(fid).c_str()), self.vector[0][fid] # <<<<<<<<<<<<<<
*
* def dot(self, SparseVector other):
*/
- __pyx_t_3 = PyBytes_FromString(FD::Convert(__pyx_cur_scope->__pyx_v_fid).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(FD::Convert(__pyx_cur_scope->__pyx_v_fid).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -2999,6 +3198,9 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject
static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_5_cdec_11DenseVector_13dot[] = "vector.dot(SparseVector other) -> Dot product of the two vectors.";
static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dot (wrapper)", 0);
@@ -3012,7 +3214,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyO
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":37
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":37
* yield str(FDConvert(fid).c_str()), self.vector[0][fid]
*
* def dot(self, SparseVector other): # <<<<<<<<<<<<<<
@@ -3031,7 +3233,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_Den
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":39
* def dot(self, SparseVector other):
* """vector.dot(SparseVector other) -> Dot product of the two vectors."""
* return other.dot(self) # <<<<<<<<<<<<<<
@@ -3039,7 +3241,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_Den
* def tosparse(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other), __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __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[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -3080,7 +3282,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":41
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":41
* return other.dot(self)
*
* def tosparse(self): # <<<<<<<<<<<<<<
@@ -3098,20 +3300,20 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("tosparse", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":43
* def tosparse(self):
* """vector.tosparse() -> Equivalent SparseVector."""
* cdef SparseVector sparse = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector)
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_sparse = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":44
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":44
* """vector.tosparse() -> Equivalent SparseVector."""
* cdef SparseVector sparse = SparseVector.__new__(SparseVector)
* sparse.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<<
@@ -3120,7 +3322,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde
*/
__pyx_v_sparse->vector = new FastSparseVector<weight_t>();
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":45
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":45
* cdef SparseVector sparse = SparseVector.__new__(SparseVector)
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector) # <<<<<<<<<<<<<<
@@ -3129,7 +3331,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde
*/
Weights::InitSparseVector((__pyx_v_self->vector[0]), __pyx_v_sparse->vector);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":46
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":46
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector)
* return sparse # <<<<<<<<<<<<<<
@@ -3172,7 +3374,7 @@ static int __pyx_pw_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyOb
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":51
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":51
* cdef FastSparseVector[weight_t]* vector
*
* def __init__(self): # <<<<<<<<<<<<<<
@@ -3185,7 +3387,7 @@ static int __pyx_pf_5_cdec_12SparseVector___init__(struct __pyx_obj_5_cdec_Spars
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":53
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":53
* def __init__(self):
* """SparseVector() -> Sparse feature/weight vector."""
* self.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<<
@@ -3208,7 +3410,7 @@ static void __pyx_pw_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self)
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":55
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":55
* self.vector = new FastSparseVector[weight_t]()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -3220,7 +3422,7 @@ static void __pyx_pf_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":56
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":56
*
* def __dealloc__(self):
* del self.vector # <<<<<<<<<<<<<<
@@ -3244,7 +3446,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CY
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":58
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":58
* del self.vector
*
* def copy(self): # <<<<<<<<<<<<<<
@@ -3261,7 +3463,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_Sp
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":60
* def copy(self):
* """vector.copy() -> SparseVector copy."""
* return self * 1 # <<<<<<<<<<<<<<
@@ -3291,11 +3493,14 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_Sp
static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
char *__pyx_v_fname;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_fname); {
- __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_fname = __Pyx_PyObject_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -3308,7 +3513,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":62
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":62
* return self * 1
*
* def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
@@ -3328,7 +3533,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":63
*
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3337,16 +3542,16 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":64
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
* return self.vector.value(fid)
*
*/
- __pyx_t_1 = (__pyx_v_fid < 0);
+ __pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
- __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -3363,7 +3568,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":65
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* return self.vector.value(fid) # <<<<<<<<<<<<<<
@@ -3395,11 +3600,14 @@ static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, P
static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) {
char *__pyx_v_fname;
float __pyx_v_value;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
assert(__pyx_arg_fname); {
- __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_fname = __Pyx_PyObject_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
assert(__pyx_arg_value); {
__pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
@@ -3415,7 +3623,7 @@ static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":67
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":67
* return self.vector.value(fid)
*
* def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
@@ -3435,7 +3643,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":68
*
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3444,16 +3652,16 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":69
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":69
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
* self.vector.set_value(fid, value)
*
*/
- __pyx_t_1 = (__pyx_v_fid < 0);
+ __pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
- __pyx_t_2 = PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -3470,7 +3678,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":70
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":70
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* self.vector.set_value(fid, value) # <<<<<<<<<<<<<<
@@ -3503,7 +3711,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":72
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":72
* self.vector.set_value(fid, value)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -3519,7 +3727,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_5_cd
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_1___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_1___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_1___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -3556,6 +3764,9 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -3568,7 +3779,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":73
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":73
*
* def __iter__(self):
* cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) # <<<<<<<<<<<<<<
@@ -3577,7 +3788,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
*/
__pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t>::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":75
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":75
* cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
* cdef unsigned i
* try: # <<<<<<<<<<<<<<
@@ -3586,7 +3797,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
*/
/*try:*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":76
* cdef unsigned i
* try:
* for i in range(self.vector.size()): # <<<<<<<<<<<<<<
@@ -3597,14 +3808,14 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":77
* try:
* for i in range(self.vector.size()):
* yield (str(FDConvert(it[0].ptr().first).c_str()), it[0].ptr().second) # <<<<<<<<<<<<<<
* pinc(it[0]) # ++it
* finally:
*/
- __pyx_t_3 = PyBytes_FromString(FD::Convert((__pyx_cur_scope->__pyx_v_it[0]).operator->()->first).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(FD::Convert((__pyx_cur_scope->__pyx_v_it[0]).operator->()->first).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_4);
@@ -3638,7 +3849,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":78
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":78
* for i in range(self.vector.size()):
* yield (str(FDConvert(it[0].ptr().first).c_str()), it[0].ptr().second)
* pinc(it[0]) # ++it # <<<<<<<<<<<<<<
@@ -3649,7 +3860,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
}
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":80
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":80
* pinc(it[0]) # ++it
* finally:
* del it # <<<<<<<<<<<<<<
@@ -3711,7 +3922,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":82
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":82
* del it
*
* def dot(self, other): # <<<<<<<<<<<<<<
@@ -3723,14 +3934,15 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = 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("dot", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":84
* def dot(self, other):
* """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
* if isinstance(other, DenseVector): # <<<<<<<<<<<<<<
@@ -3738,9 +3950,10 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
* elif isinstance(other, SparseVector):
*/
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_5_cdec_DenseVector));
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":85
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":85
* """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
* if isinstance(other, DenseVector):
* return self.vector.dot((<DenseVector> other).vector[0]) # <<<<<<<<<<<<<<
@@ -3748,25 +3961,26 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
* return self.vector.dot((<SparseVector> other).vector[0])
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":86
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":86
* if isinstance(other, DenseVector):
* return self.vector.dot((<DenseVector> other).vector[0])
* elif isinstance(other, SparseVector): # <<<<<<<<<<<<<<
* return self.vector.dot((<SparseVector> other).vector[0])
* raise TypeError('cannot take the dot product of %s and SparseVector' % type(other))
*/
- __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_5_cdec_SparseVector));
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_5_cdec_SparseVector));
+ __pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":87
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":87
* return self.vector.dot((<DenseVector> other).vector[0])
* elif isinstance(other, SparseVector):
* return self.vector.dot((<SparseVector> other).vector[0]) # <<<<<<<<<<<<<<
@@ -3774,41 +3988,41 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":88
* elif isinstance(other, SparseVector):
* return self.vector.dot((<SparseVector> other).vector[0])
* raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) # <<<<<<<<<<<<<<
*
* def __richcmp__(SparseVector x, SparseVector y, int op):
*/
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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;
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("_cdec.SparseVector.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -3820,6 +4034,9 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
@@ -3834,7 +4051,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":90
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":90
* raise TypeError('cannot take the dot product of %s and SparseVector' % type(other))
*
* def __richcmp__(SparseVector x, SparseVector y, int op): # <<<<<<<<<<<<<<
@@ -3852,7 +4069,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":93
* if op == 2: # ==
* return x.vector[0] == y.vector[0]
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -3861,7 +4078,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
*/
switch (__pyx_v_op) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":91
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":91
*
* def __richcmp__(SparseVector x, SparseVector y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -3870,7 +4087,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
*/
case 2:
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":92
* def __richcmp__(SparseVector x, SparseVector y, int op):
* if op == 2: # ==
* return x.vector[0] == y.vector[0] # <<<<<<<<<<<<<<
@@ -3885,7 +4102,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
goto __pyx_L0;
break;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":93
* if op == 2: # ==
* return x.vector[0] == y.vector[0]
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -3894,7 +4111,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
*/
case 3:
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":94
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":94
* return x.vector[0] == y.vector[0]
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -3913,7 +4130,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
break;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":95
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<<
@@ -3949,7 +4166,7 @@ static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":97
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":97
* raise NotImplemented('comparison not implemented for SparseVector')
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -3962,7 +4179,7 @@ static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_17__len__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":98
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":98
*
* def __len__(self):
* return self.vector.size() # <<<<<<<<<<<<<<
@@ -3982,11 +4199,14 @@ static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_17__len__(struct __pyx_obj_5_cd
static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
char *__pyx_v_fname;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
assert(__pyx_arg_fname); {
- __pyx_v_fname = PyBytes_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_fname = __Pyx_PyObject_AsString(__pyx_arg_fname); if (unlikely((!__pyx_v_fname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -3999,7 +4219,7 @@ static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":100
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":100
* return self.vector.size()
*
* def __contains__(self, char* fname): # <<<<<<<<<<<<<<
@@ -4012,7 +4232,7 @@ static int __pyx_pf_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_5_cdec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__contains__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":101
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":101
*
* def __contains__(self, char* fname):
* return self.vector.nonzero(FDConvert(fname)) # <<<<<<<<<<<<<<
@@ -4039,7 +4259,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":103
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":103
* return self.vector.nonzero(FDConvert(fname))
*
* def __neg__(self): # <<<<<<<<<<<<<<
@@ -4057,20 +4277,20 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__neg__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":104
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":104
*
* def __neg__(self):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":105
* def __neg__(self):
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](self.vector[0]) # <<<<<<<<<<<<<<
@@ -4079,7 +4299,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>((__pyx_v_self->vector[0]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":106
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":106
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0 # <<<<<<<<<<<<<<
@@ -4088,7 +4308,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde
*/
(__pyx_v_result->vector[0]) *= -1.0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":107
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":107
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0
* return result # <<<<<<<<<<<<<<
@@ -4116,6 +4336,9 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
@@ -4129,7 +4352,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":109
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":109
* return result
*
* def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
@@ -4142,7 +4365,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":110
*
* def __iadd__(SparseVector self, SparseVector other):
* self.vector[0] += other.vector[0] # <<<<<<<<<<<<<<
@@ -4151,7 +4374,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd
*/
(__pyx_v_self->vector[0]) += (__pyx_v_other->vector[0]);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":111
* def __iadd__(SparseVector self, SparseVector other):
* self.vector[0] += other.vector[0]
* return self # <<<<<<<<<<<<<<
@@ -4173,6 +4396,9 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
@@ -4186,7 +4412,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":113
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":113
* return self
*
* def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
@@ -4199,7 +4425,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__isub__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":114
*
* def __isub__(SparseVector self, SparseVector other):
* self.vector[0] -= other.vector[0] # <<<<<<<<<<<<<<
@@ -4208,7 +4434,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd
*/
(__pyx_v_self->vector[0]) -= (__pyx_v_other->vector[0]);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":115
* def __isub__(SparseVector self, SparseVector other):
* self.vector[0] -= other.vector[0]
* return self # <<<<<<<<<<<<<<
@@ -4231,6 +4457,9 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd
static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/
static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) {
float __pyx_v_scalar;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__imul__ (wrapper)", 0);
@@ -4248,7 +4477,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":117
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":117
* return self
*
* def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
@@ -4261,7 +4490,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__imul__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":118
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":118
*
* def __imul__(SparseVector self, float scalar):
* self.vector[0] *= scalar # <<<<<<<<<<<<<<
@@ -4270,7 +4499,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd
*/
(__pyx_v_self->vector[0]) *= __pyx_v_scalar;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":119
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":119
* def __imul__(SparseVector self, float scalar):
* self.vector[0] *= scalar
* return self # <<<<<<<<<<<<<<
@@ -4294,6 +4523,9 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd
static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/
static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) {
float __pyx_v_scalar;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0);
@@ -4312,7 +4544,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_sel
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":121
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":121
* return self
*
* def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
@@ -4326,7 +4558,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__idiv__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":122
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":122
*
* def __idiv__(SparseVector self, float scalar):
* self.vector[0] /= scalar # <<<<<<<<<<<<<<
@@ -4335,7 +4567,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd
*/
(__pyx_v_self->vector[0]) /= __pyx_v_scalar;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":123
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":123
* def __idiv__(SparseVector self, float scalar):
* self.vector[0] /= scalar
* return self # <<<<<<<<<<<<<<
@@ -4358,6 +4590,9 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
@@ -4372,7 +4607,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, P
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":125
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":125
* return self
*
* def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
@@ -4390,20 +4625,20 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":126
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":126
*
* def __add__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
* return result
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":127
* def __add__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) # <<<<<<<<<<<<<<
@@ -4412,7 +4647,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0])));
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":128
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":128
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
* return result # <<<<<<<<<<<<<<
@@ -4440,6 +4675,9 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
@@ -4454,7 +4692,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, P
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":130
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":130
* return result
*
* def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
@@ -4472,20 +4710,20 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__sub__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":131
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":131
*
* def __sub__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
* return result
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":132
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":132
* def __sub__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) # <<<<<<<<<<<<<<
@@ -4494,7 +4732,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0])));
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":133
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":133
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
* return result # <<<<<<<<<<<<<<
@@ -4530,7 +4768,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, P
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":135
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":135
* return result
*
* def __mul__(x, y): # <<<<<<<<<<<<<<
@@ -4545,14 +4783,15 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- float __pyx_t_3;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ float __pyx_t_4;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__mul__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":138
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":138
* cdef SparseVector vector
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<<
@@ -4560,19 +4799,20 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
* cdef SparseVector result = SparseVector.__new__(SparseVector)
*/
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SparseVector));
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __pyx_v_x;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_v_scalar = __pyx_t_3;
+ __pyx_t_3 = __pyx_v_x;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_v_scalar = __pyx_t_4;
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":139
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":139
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x # <<<<<<<<<<<<<<
@@ -4580,29 +4820,29 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar)
*/
if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __pyx_v_y;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_v_scalar = __pyx_t_3;
+ __pyx_t_3 = __pyx_v_y;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_v_scalar = __pyx_t_4;
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":140
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":140
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar)
* return result
*/
- __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_3 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":141
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":141
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) # <<<<<<<<<<<<<<
@@ -4611,7 +4851,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) * __pyx_v_scalar));
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":142
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar)
* return result # <<<<<<<<<<<<<<
@@ -4626,7 +4866,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("_cdec.SparseVector.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -4650,7 +4890,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, P
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":144
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":144
* return result
*
* def __div__(x, y): # <<<<<<<<<<<<<<
@@ -4666,14 +4906,15 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- float __pyx_t_3;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ float __pyx_t_4;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__div__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":147
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":147
* cdef SparseVector vector
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<<
@@ -4681,19 +4922,20 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
* cdef SparseVector result = SparseVector.__new__(SparseVector)
*/
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SparseVector));
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __pyx_v_x;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_v_scalar = __pyx_t_3;
+ __pyx_t_3 = __pyx_v_x;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_v_scalar = __pyx_t_4;
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":148
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":148
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x # <<<<<<<<<<<<<<
@@ -4701,29 +4943,29 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar)
*/
if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __pyx_v_y;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_v_scalar = __pyx_t_3;
+ __pyx_t_3 = __pyx_v_y;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_v_scalar = __pyx_t_4;
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":149
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":149
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar)
* return result
*/
- __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_3 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":150
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":150
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) # <<<<<<<<<<<<<<
@@ -4731,7 +4973,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) / __pyx_v_scalar));
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":151
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":151
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar)
* return result # <<<<<<<<<<<<<<
@@ -4744,7 +4986,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("_cdec.SparseVector.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -4769,7 +5011,7 @@ static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_
}
static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":6
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -4785,7 +5027,7 @@ static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) {
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)__pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(__pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -4824,6 +5066,9 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -4876,8 +5121,8 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__
__pyx_cur_scope->__pyx_v_w = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_t_5 = PyUnicode_Check(__pyx_cur_scope->__pyx_v_w);
- if (__pyx_t_5) {
- __pyx_t_6 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s__encode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if ((__pyx_t_5 != 0)) {
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s__encode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
@@ -4932,7 +5177,7 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__
return NULL;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":5
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -4951,7 +5196,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_phrase", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)__pyx_ptype_5_cdec___pyx_scope_struct_2__phrase->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_2__phrase, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(__pyx_ptype_5_cdec___pyx_scope_struct_2__phrase, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -4961,7 +5206,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":6
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -4969,7 +5214,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO
* cdef class NT:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_pf_5_cdec_7_phrase_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -5010,6 +5255,9 @@ struct wrapperbase __pyx_wrapperbase_5_cdec_2NT___init__;
static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_cat = 0;
unsigned int __pyx_v_ref;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -5072,7 +5320,7 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":11
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":11
* cdef public bytes cat
* cdef public unsigned ref
* def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<<
@@ -5085,7 +5333,7 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":13
* def __init__(self, bytes cat, unsigned ref=0):
* """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
* self.cat = cat # <<<<<<<<<<<<<<
@@ -5098,7 +5346,7 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self
__Pyx_DECREF(((PyObject *)__pyx_v_self->cat));
__pyx_v_self->cat = __pyx_v_cat;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":14
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":14
* """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
* self.cat = cat
* self.ref = ref # <<<<<<<<<<<<<<
@@ -5123,7 +5371,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":16
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":16
* self.ref = ref
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -5142,17 +5390,17 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":17
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":17
*
* def __str__(self):
* if self.ref > 0: # <<<<<<<<<<<<<<
* return '[%s,%d]' % (self.cat, self.ref)
* return '[%s]' % self.cat
*/
- __pyx_t_1 = (__pyx_v_self->ref > 0);
+ __pyx_t_1 = ((__pyx_v_self->ref > 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":18
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":18
* def __str__(self):
* if self.ref > 0:
* return '[%s,%d]' % (self.cat, self.ref) # <<<<<<<<<<<<<<
@@ -5180,7 +5428,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":19
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":19
* if self.ref > 0:
* return '[%s,%d]' % (self.cat, self.ref)
* return '[%s]' % self.cat # <<<<<<<<<<<<<<
@@ -5218,7 +5466,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":9
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":9
*
* cdef class NT:
* cdef public bytes cat # <<<<<<<<<<<<<<
@@ -5314,7 +5562,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":10
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":10
* cdef class NT:
* cdef public bytes cat
* cdef public unsigned ref # <<<<<<<<<<<<<<
@@ -5389,6 +5637,9 @@ struct wrapperbase __pyx_wrapperbase_5_cdec_5NTRef___init__;
#endif
static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
unsigned int __pyx_v_ref;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -5432,7 +5683,7 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":23
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":23
* cdef class NTRef:
* cdef public unsigned ref
* def __init__(self, unsigned ref): # <<<<<<<<<<<<<<
@@ -5445,7 +5696,7 @@ static int __pyx_pf_5_cdec_5NTRef___init__(struct __pyx_obj_5_cdec_NTRef *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":25
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":25
* def __init__(self, unsigned ref):
* """NTRef(int ref) -> Non-terminal reference."""
* self.ref = ref # <<<<<<<<<<<<<<
@@ -5470,7 +5721,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":27
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":27
* self.ref = ref
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -5488,7 +5739,7 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_2__str__(struct __pyx_obj_5_cdec_NTRef *
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":28
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":28
*
* def __str__(self):
* return '[%d]' % self.ref # <<<<<<<<<<<<<<
@@ -5529,7 +5780,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":22
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":22
*
* cdef class NTRef:
* cdef public unsigned ref # <<<<<<<<<<<<<<
@@ -5596,7 +5847,7 @@ static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":30
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":30
* return '[%d]' % self.ref
*
* cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<<
@@ -5627,7 +5878,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_rule", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":31
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":31
*
* cdef TRule convert_rule(_sa.Rule rule):
* lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<<
@@ -5636,7 +5887,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
*/
__pyx_v_lhs = __pyx_f_4cdec_2sa_3_sa_sym_tocat(__pyx_v_rule->lhs);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":32
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":32
* cdef TRule convert_rule(_sa.Rule rule):
* lhs = _sa.sym_tocat(rule.lhs)
* scores = dict(rule.scores) # <<<<<<<<<<<<<<
@@ -5654,7 +5905,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_v_scores = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":33
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":33
* lhs = _sa.sym_tocat(rule.lhs)
* scores = dict(rule.scores)
* f, e = [], [] # <<<<<<<<<<<<<<
@@ -5670,7 +5921,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_v_e = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":34
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":34
* scores = dict(rule.scores)
* f, e = [], []
* cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<<
@@ -5680,7 +5931,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_t_3 = __pyx_v_rule->f->syms;
__pyx_v_fsyms = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":35
* f, e = [], []
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n): # <<<<<<<<<<<<<<
@@ -5691,24 +5942,24 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
__pyx_v_i = __pyx_t_5;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":36
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":36
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]): # <<<<<<<<<<<<<<
* f.append(NT(_sa.sym_tocat(fsyms[i])))
* else:
*/
- __pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i]));
+ __pyx_t_6 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i])) != 0);
if (__pyx_t_6) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":37
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]):
* f.append(NT(_sa.sym_tocat(fsyms[i]))) # <<<<<<<<<<<<<<
* else:
* f.append(_sa.sym_tostring(fsyms[i]))
*/
- __pyx_t_1 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tocat((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tocat((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -5718,28 +5969,28 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_7 = PyList_Append(__pyx_v_f, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_f, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":39
* f.append(NT(_sa.sym_tocat(fsyms[i])))
* else:
* f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<<
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n):
*/
- __pyx_t_1 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_7 = PyList_Append(__pyx_v_f, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_f, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
}
__pyx_L5:;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":40
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":40
* else:
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms # <<<<<<<<<<<<<<
@@ -5749,7 +6000,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_t_3 = __pyx_v_rule->e->syms;
__pyx_v_esyms = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":41
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n): # <<<<<<<<<<<<<<
@@ -5760,17 +6011,17 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
__pyx_v_i = __pyx_t_5;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":42
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]): # <<<<<<<<<<<<<<
* e.append(NTRef(_sa.sym_getindex(esyms[i])))
* else:
*/
- __pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i]));
+ __pyx_t_6 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i])) != 0);
if (__pyx_t_6) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":43
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]):
* e.append(NTRef(_sa.sym_getindex(esyms[i]))) # <<<<<<<<<<<<<<
@@ -5787,35 +6038,35 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_e, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L8;
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":45
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":45
* e.append(NTRef(_sa.sym_getindex(esyms[i])))
* else:
* e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<<
* a = list(rule.alignments())
* return TRule(lhs, f, e, scores, a)
*/
- __pyx_t_1 = PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_7 = PyList_Append(__pyx_v_e, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_e, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
}
__pyx_L8:;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":46
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":46
* else:
* e.append(_sa.sym_tostring(esyms[i]))
* a = list(rule.alignments()) # <<<<<<<<<<<<<<
* return TRule(lhs, f, e, scores, a)
*
*/
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_rule), __pyx_n_s__alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rule), __pyx_n_s__alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -5831,7 +6082,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_v_a = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":47
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":47
* e.append(_sa.sym_tostring(esyms[i]))
* a = list(rule.alignments())
* return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<<
@@ -5839,7 +6090,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
* cdef class TRule:
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
- __pyx_t_2 = PyBytes_FromString(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
@@ -5894,6 +6145,9 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
PyObject *__pyx_v_e = 0;
PyObject *__pyx_v_scores = 0;
PyObject *__pyx_v_a = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -5901,7 +6155,7 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,0};
PyObject* values[5] = {0,0,0,0,0};
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":52
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":52
* cdef shared_ptr[grammar.TRule]* rule
*
* def __init__(self, lhs, f, e, scores, a=None): # <<<<<<<<<<<<<<
@@ -5990,7 +6244,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":59
* scores: dictionary of feature scores
* a: optional list of alignment points"""
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) # <<<<<<<<<<<<<<
@@ -6005,43 +6259,43 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
}
__pyx_v_self->rule = new boost::shared_ptr<TRule>(__pyx_t_1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":60
* a: optional list of alignment points"""
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* self.lhs = lhs # <<<<<<<<<<<<<<
* self.e = e
* self.f = f
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":61
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* self.lhs = lhs
* self.e = e # <<<<<<<<<<<<<<
* self.f = f
* self.scores = scores
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":62
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":62
* self.lhs = lhs
* self.e = e
* self.f = f # <<<<<<<<<<<<<<
* self.scores = scores
* if a:
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":63
* self.e = e
* self.f = f
* self.scores = scores # <<<<<<<<<<<<<<
* if a:
* self.a = a
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":64
* self.f = f
* self.scores = scores
* if a: # <<<<<<<<<<<<<<
@@ -6051,19 +6305,19 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":65
* self.scores = scores
* if a:
* self.a = a # <<<<<<<<<<<<<<
* self.rule.get().ComputeArity()
*
*/
- if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":66
* if a:
* self.a = a
* self.rule.get().ComputeArity() # <<<<<<<<<<<<<<
@@ -6091,7 +6345,7 @@ static void __pyx_pw_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":68
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":68
* self.rule.get().ComputeArity()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -6103,7 +6357,7 @@ static void __pyx_pf_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":69
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":69
*
* def __dealloc__(self):
* del self.rule # <<<<<<<<<<<<<<
@@ -6126,7 +6380,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":72
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":72
*
* property arity:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6143,7 +6397,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_T
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":73
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":73
* property arity:
* def __get__(self):
* return self.rule.get().arity_ # <<<<<<<<<<<<<<
@@ -6180,7 +6434,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":76
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":76
*
* property f:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6207,7 +6461,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":77
* property f:
* def __get__(self):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6216,7 +6470,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":79
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":79
* cdef vector[WordID]* f_ = &self.rule.get().f_
* cdef WordID w
* cdef f = [] # <<<<<<<<<<<<<<
@@ -6228,7 +6482,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
__pyx_v_f = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":81
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":81
* cdef f = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6237,7 +6491,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":82
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":82
* cdef unsigned i
* cdef int idx = 0
* for i in range(f_.size()): # <<<<<<<<<<<<<<
@@ -6248,7 +6502,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":83
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":83
* cdef int idx = 0
* for i in range(f_.size()):
* w = f_[0][i] # <<<<<<<<<<<<<<
@@ -6257,17 +6511,17 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_w = ((__pyx_v_f_[0])[__pyx_v_i]);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":84
* for i in range(f_.size()):
* w = f_[0][i]
* if w < 0: # <<<<<<<<<<<<<<
* idx += 1
* f.append(NT(TDConvert(-w).c_str(), idx))
*/
- __pyx_t_4 = (__pyx_v_w < 0);
+ __pyx_t_4 = ((__pyx_v_w < 0) != 0);
if (__pyx_t_4) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":85
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":85
* w = f_[0][i]
* if w < 0:
* idx += 1 # <<<<<<<<<<<<<<
@@ -6276,14 +6530,14 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":86
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":86
* if w < 0:
* idx += 1
* f.append(NT(TDConvert(-w).c_str(), idx)) # <<<<<<<<<<<<<<
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
*/
- __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_w)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(TD::Convert((-__pyx_v_w)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
@@ -6306,14 +6560,14 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":88
* f.append(NT(TDConvert(-w).c_str(), idx))
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<<
* return f
*
*/
- __pyx_t_6 = PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
@@ -6335,7 +6589,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
__pyx_L5:;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":89
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":89
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
* return f # <<<<<<<<<<<<<<
@@ -6373,7 +6627,7 @@ static int __pyx_pw_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":91
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":91
* return f
*
* def __set__(self, f): # <<<<<<<<<<<<<<
@@ -6392,14 +6646,15 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
unsigned int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
- char *__pyx_t_5;
- PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_5;
+ char *__pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":92
*
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6408,7 +6663,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":93
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_
* f_.resize(len(f)) # <<<<<<<<<<<<<<
@@ -6418,7 +6673,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
__pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f_->resize(__pyx_t_1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":95
* f_.resize(len(f))
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6427,7 +6682,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_idx = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":96
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":96
* cdef unsigned i
* cdef int idx = 0
* for i in range(len(f)): # <<<<<<<<<<<<<<
@@ -6438,60 +6693,61 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":97
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":97
* cdef int idx = 0
* for i in range(len(f)):
* if isinstance(f[i], NT): # <<<<<<<<<<<<<<
* f_[0][i] = -TDConvert((<NT> f[i]).cat)
* else:
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_5_cdec_NT));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_4) {
+ __pyx_t_5 = (__pyx_t_4 != 0);
+ if (__pyx_t_5) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":98
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":98
* for i in range(len(f)):
* if isinstance(f[i], NT):
* f_[0][i] = -TDConvert((<NT> f[i]).cat) # <<<<<<<<<<<<<<
* else:
* fi = as_str(f[i])
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyBytes_AsString(((PyObject *)((struct __pyx_obj_5_cdec_NT *)__pyx_t_3)->cat)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_AsString(((PyObject *)((struct __pyx_obj_5_cdec_NT *)__pyx_t_3)->cat)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- ((__pyx_v_f_[0])[__pyx_v_i]) = (-TD::Convert(__pyx_t_5));
+ ((__pyx_v_f_[0])[__pyx_v_i]) = (-TD::Convert(__pyx_t_6));
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":100
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":100
* f_[0][i] = -TDConvert((<NT> f[i]).cat)
* else:
* fi = as_str(f[i]) # <<<<<<<<<<<<<<
* f_[0][i] = TDConvert(fi)
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(((PyObject *)__pyx_v_fi));
- __pyx_v_fi = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ __pyx_v_fi = ((PyObject*)__pyx_t_7);
+ __pyx_t_7 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":101
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":101
* else:
* fi = as_str(f[i])
* f_[0][i] = TDConvert(fi) # <<<<<<<<<<<<<<
*
* property e:
*/
- __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_fi)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- ((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_fi)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ ((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_6);
}
__pyx_L5:;
}
@@ -6500,7 +6756,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("_cdec.TRule.f.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -6520,7 +6776,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":104
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":104
*
* property e:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6547,7 +6803,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":105
* property e:
* def __get__(self):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -6556,7 +6812,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":107
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":107
* cdef vector[WordID]* e_ = &self.rule.get().e_
* cdef WordID w
* cdef e = [] # <<<<<<<<<<<<<<
@@ -6568,7 +6824,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
__pyx_v_e = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":109
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":109
* cdef e = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6577,7 +6833,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":110
* cdef unsigned i
* cdef int idx = 0
* for i in range(e_.size()): # <<<<<<<<<<<<<<
@@ -6588,7 +6844,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":111
* cdef int idx = 0
* for i in range(e_.size()):
* w = e_[0][i] # <<<<<<<<<<<<<<
@@ -6597,17 +6853,17 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_w = ((__pyx_v_e_[0])[__pyx_v_i]);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":112
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":112
* for i in range(e_.size()):
* w = e_[0][i]
* if w < 1: # <<<<<<<<<<<<<<
* idx += 1
* e.append(NTRef(1-w))
*/
- __pyx_t_4 = (__pyx_v_w < 1);
+ __pyx_t_4 = ((__pyx_v_w < 1) != 0);
if (__pyx_t_4) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":113
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":113
* w = e_[0][i]
* if w < 1:
* idx += 1 # <<<<<<<<<<<<<<
@@ -6616,7 +6872,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":114
* if w < 1:
* idx += 1
* e.append(NTRef(1-w)) # <<<<<<<<<<<<<<
@@ -6641,14 +6897,14 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":116
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":116
* e.append(NTRef(1-w))
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<<
* return e
*
*/
- __pyx_t_5 = PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
@@ -6670,7 +6926,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
__pyx_L5:;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":117
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":117
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
* return e # <<<<<<<<<<<<<<
@@ -6708,7 +6964,7 @@ static int __pyx_pw_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":119
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":119
* return e
*
* def __set__(self, e): # <<<<<<<<<<<<<<
@@ -6726,15 +6982,16 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
unsigned int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
- PyObject *__pyx_t_5 = NULL;
- WordID __pyx_t_6;
- char *__pyx_t_7;
+ int __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ WordID __pyx_t_7;
+ char *__pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":120
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":120
*
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -6743,7 +7000,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":121
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":121
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_
* e_.resize(len(e)) # <<<<<<<<<<<<<<
@@ -6753,7 +7010,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
__pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_e_->resize(__pyx_t_1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":123
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":123
* e_.resize(len(e))
* cdef unsigned i
* for i in range(len(e)): # <<<<<<<<<<<<<<
@@ -6764,66 +7021,67 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":124
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124
* cdef unsigned i
* for i in range(len(e)):
* if isinstance(e[i], NTRef): # <<<<<<<<<<<<<<
* e_[0][i] = 1-e[i].ref
* else:
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_5_cdec_NTRef));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_4) {
+ __pyx_t_5 = (__pyx_t_4 != 0);
+ if (__pyx_t_5) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":125
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":125
* for i in range(len(e)):
* if isinstance(e[i], NTRef):
* e_[0][i] = 1-e[i].ref # <<<<<<<<<<<<<<
* else:
* ei = as_str(e[i])
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ref); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ref); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_6 = __Pyx_PyInt_from_py_WordID(__pyx_t_3); if (unlikely((__pyx_t_6 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_7 = __Pyx_PyInt_from_py_WordID(__pyx_t_3); if (unlikely((__pyx_t_7 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- ((__pyx_v_e_[0])[__pyx_v_i]) = __pyx_t_6;
+ ((__pyx_v_e_[0])[__pyx_v_i]) = __pyx_t_7;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":127
* e_[0][i] = 1-e[i].ref
* else:
* ei = as_str(e[i]) # <<<<<<<<<<<<<<
* e_[0][i] = TDConvert(ei)
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(((PyObject *)__pyx_v_ei));
- __pyx_v_ei = ((PyObject*)__pyx_t_5);
- __pyx_t_5 = 0;
+ __pyx_v_ei = ((PyObject*)__pyx_t_6);
+ __pyx_t_6 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":128
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":128
* else:
* ei = as_str(e[i])
* e_[0][i] = TDConvert(ei) # <<<<<<<<<<<<<<
*
* property a:
*/
- __pyx_t_7 = PyBytes_AsString(((PyObject *)__pyx_v_ei)); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- ((__pyx_v_e_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_7);
+ __pyx_t_8 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_ei)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ ((__pyx_v_e_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_8);
}
__pyx_L5:;
}
@@ -6832,7 +7090,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("_cdec.TRule.e.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -6853,7 +7111,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":131
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131
*
* property a:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6869,7 +7127,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1a___get__(struct __pyx_obj_5_cdec_TRule
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_4___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_4___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(__pyx_ptype_5_cdec___pyx_scope_struct_4___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -6906,6 +7164,9 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -6918,7 +7179,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":133
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":133
* def __get__(self):
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -6927,7 +7188,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
*/
__pyx_cur_scope->__pyx_v_a = (&__pyx_cur_scope->__pyx_v_self->rule->get()->a_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":134
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":134
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()): # <<<<<<<<<<<<<<
@@ -6938,7 +7199,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":135
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()):
* yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<<
@@ -6997,7 +7258,7 @@ static int __pyx_pw_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":137
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":137
* yield (a[0][i].s_, a[0][i].t_)
*
* def __set__(self, a): # <<<<<<<<<<<<<<
@@ -7026,7 +7287,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":138
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":138
*
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -7035,7 +7296,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_a_ = (&__pyx_v_self->rule->get()->a_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":139
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":139
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
* a_.resize(len(a)) # <<<<<<<<<<<<<<
@@ -7045,7 +7306,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
__pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_a_->resize(__pyx_t_1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":142
* cdef unsigned i
* cdef int s, t
* for i in range(len(a)): # <<<<<<<<<<<<<<
@@ -7056,14 +7317,14 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":143
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":143
* cdef int s, t
* for i in range(len(a)):
* s, t = a[i] # <<<<<<<<<<<<<<
* a_[0][i] = grammar.AlignmentPoint(s, t)
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
@@ -7123,7 +7384,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
__pyx_v_s = __pyx_t_8;
__pyx_v_t = __pyx_t_9;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":144
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":144
* for i in range(len(a)):
* s, t = a[i]
* a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<<
@@ -7158,7 +7419,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":147
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":147
*
* property scores:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -7176,20 +7437,20 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":148
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":148
* property scores:
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* scores.vector = new FastSparseVector[double](self.rule.get().scores_)
* return scores
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_scores = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":149
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":149
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<<
@@ -7198,7 +7459,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_
*/
__pyx_v_scores->vector = new FastSparseVector<double>(__pyx_v_self->rule->get()->scores_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":150
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":150
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_)
* return scores # <<<<<<<<<<<<<<
@@ -7234,7 +7495,7 @@ static int __pyx_pw_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":152
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":152
* return scores
*
* def __set__(self, scores): # <<<<<<<<<<<<<<
@@ -7266,7 +7527,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":153
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":153
*
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<<
@@ -7275,7 +7536,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_scores_ = (&__pyx_v_self->rule->get()->scores_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":154
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":154
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
* scores_.clear() # <<<<<<<<<<<<<<
@@ -7284,14 +7545,14 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_scores_->clear();
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":157
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":157
* cdef int fid
* cdef float fval
* for fname, fval in scores.items(): # <<<<<<<<<<<<<<
* fn = as_str(fname)
* fid = FDConvert(fn)
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_scores, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_scores, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -7389,7 +7650,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
__pyx_t_5 = 0;
__pyx_v_fval = __pyx_t_9;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":158
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":158
* cdef float fval
* for fname, fval in scores.items():
* fn = as_str(fname) # <<<<<<<<<<<<<<
@@ -7402,24 +7663,24 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
__pyx_v_fn = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":159
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":159
* for fname, fval in scores.items():
* fn = as_str(fname)
* fid = FDConvert(fn) # <<<<<<<<<<<<<<
* if fid < 0: raise KeyError(fname)
* scores_.set_value(fid, fval)
*/
- __pyx_t_10 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fid = FD::Convert(__pyx_t_10);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":160
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":160
* fn = as_str(fname)
* fid = FDConvert(fn)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
* scores_.set_value(fid, fval)
*
*/
- __pyx_t_11 = (__pyx_v_fid < 0);
+ __pyx_t_11 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_11) {
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -7436,7 +7697,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
}
__pyx_L7:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":161
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":161
* fid = FDConvert(fn)
* if fid < 0: raise KeyError(fname)
* scores_.set_value(fid, fval) # <<<<<<<<<<<<<<
@@ -7475,7 +7736,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":164
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164
*
* property lhs:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -7493,7 +7754,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":165
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165
* property lhs:
* def __get__(self):
* return NT(TDConvert(-self.rule.get().lhs_).c_str()) # <<<<<<<<<<<<<<
@@ -7501,7 +7762,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu
* def __set__(self, lhs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->rule->get()->lhs_)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(TD::Convert((-__pyx_v_self->rule->get()->lhs_)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -7539,7 +7800,7 @@ static int __pyx_pw_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":167
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":167
* return NT(TDConvert(-self.rule.get().lhs_).c_str())
*
* def __set__(self, lhs): # <<<<<<<<<<<<<<
@@ -7561,7 +7822,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_lhs);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":168
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":168
*
* def __set__(self, lhs):
* if not isinstance(lhs, NT): # <<<<<<<<<<<<<<
@@ -7569,10 +7830,10 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
* self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
*/
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_lhs, ((PyObject*)__pyx_ptype_5_cdec_NT));
- __pyx_t_2 = (!__pyx_t_1);
+ __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":169
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":169
* def __set__(self, lhs):
* if not isinstance(lhs, NT):
* lhs = NT(lhs) # <<<<<<<<<<<<<<
@@ -7594,14 +7855,14 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":170
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":170
* if not isinstance(lhs, NT):
* lhs = NT(lhs)
* self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
- __pyx_t_5 = PyBytes_AsString(((PyObject *)((struct __pyx_obj_5_cdec_NT *)__pyx_v_lhs)->cat)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_AsString(((PyObject *)((struct __pyx_obj_5_cdec_NT *)__pyx_v_lhs)->cat)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->rule->get()->lhs_ = (-TD::Convert(__pyx_t_5));
__pyx_r = 0;
@@ -7629,7 +7890,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) {
}
static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":173
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -7645,7 +7906,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) {
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -7681,6 +7942,9 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
PyObject *__pyx_t_2 = NULL;
Py_ssize_t __pyx_t_3;
PyObject *(*__pyx_t_4)(PyObject *);
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -7693,7 +7957,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
@@ -7771,7 +8035,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
return NULL;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":172
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172
* self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -7793,7 +8057,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)__pyx_ptype_5_cdec___pyx_scope_struct_5___str__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_5___str__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(__pyx_ptype_5_cdec___pyx_scope_struct_5___str__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -7803,14 +8067,14 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":173
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
* return '%s ||| %s ||| %s ||| %s' % (self.lhs,
* _phrase(self.f), _phrase(self.e), scores)
*/
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_pf_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -7826,7 +8090,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
__pyx_v_scores = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":174
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":174
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<<
@@ -7834,19 +8098,19 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":175
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs,
* _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<<
*
* cdef class MRule(TRule):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -7857,9 +8121,9 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
@@ -7919,6 +8183,9 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__
PyObject *__pyx_v_lhs = 0;
PyObject *__pyx_v_rhs = 0;
PyObject *__pyx_v_scores = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -7978,7 +8245,7 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":178
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":178
*
* cdef class MRule(TRule):
* def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<<
@@ -7997,14 +8264,15 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
PyObject *(*__pyx_t_3)(PyObject *);
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
- PyObject *__pyx_t_6 = NULL;
- int __pyx_t_7;
+ int __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":183
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":183
* rhs: right hand side phrase (list of words/NT)
* scores: dictionary of feature scores"""
* cdef unsigned i = 1 # <<<<<<<<<<<<<<
@@ -8013,7 +8281,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
*/
__pyx_v_i = 1;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":184
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":184
* scores: dictionary of feature scores"""
* cdef unsigned i = 1
* e = [] # <<<<<<<<<<<<<<
@@ -8025,7 +8293,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__pyx_v_e = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":185
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":185
* cdef unsigned i = 1
* e = []
* for s in rhs: # <<<<<<<<<<<<<<
@@ -8070,7 +8338,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__pyx_v_s = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":186
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":186
* e = []
* for s in rhs:
* if isinstance(s, NT): # <<<<<<<<<<<<<<
@@ -8078,9 +8346,10 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
* i += 1
*/
__pyx_t_5 = __Pyx_TypeCheck(__pyx_v_s, ((PyObject*)__pyx_ptype_5_cdec_NT));
- if (__pyx_t_5) {
+ __pyx_t_6 = (__pyx_t_5 != 0);
+ if (__pyx_t_6) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":187
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":187
* for s in rhs:
* if isinstance(s, NT):
* e.append(NTRef(i)) # <<<<<<<<<<<<<<
@@ -8089,18 +8358,18 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
*/
__pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NTRef)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+ __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_e, __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":188
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":188
* if isinstance(s, NT):
* e.append(NTRef(i))
* i += 1 # <<<<<<<<<<<<<<
@@ -8112,20 +8381,20 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":190
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":190
* i += 1
* else:
* e.append(s) # <<<<<<<<<<<<<<
* super(MRule, self).__init__(lhs, rhs, e, scores, None)
*
*/
- __pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_v_s); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_e, __pyx_v_s); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L5:;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":191
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":191
* else:
* e.append(s)
* super(MRule, self).__init__(lhs, rhs, e, scores, None) # <<<<<<<<<<<<<<
@@ -8143,7 +8412,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__pyx_t_4 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8163,18 +8432,18 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_4, 4, Py_None);
__Pyx_GIVEREF(Py_None);
- __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __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_4)); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("_cdec.MRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -8193,7 +8462,7 @@ static void __pyx_pw_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":196
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":196
* cdef shared_ptr[grammar.Grammar]* grammar
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -8205,7 +8474,7 @@ static void __pyx_pf_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":197
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":197
*
* def __dealloc__(self):
* del self.grammar # <<<<<<<<<<<<<<
@@ -8229,7 +8498,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":199
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":199
* del self.grammar
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -8245,7 +8514,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_2__iter__(struct __pyx_obj_5_cdec_Gram
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -8280,6 +8549,9 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
int __pyx_t_1;
unsigned int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -8292,7 +8564,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":200
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":200
*
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<<
@@ -8301,7 +8573,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_root = __pyx_cur_scope->__pyx_v_self->grammar->get()->GetRoot();
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":201
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":201
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
* cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<<
@@ -8310,7 +8582,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_rbin = __pyx_cur_scope->__pyx_v_root->GetRules();
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":204
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":204
* cdef TRule trule
* cdef unsigned i
* for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<<
@@ -8321,14 +8593,14 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":205
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":205
* cdef unsigned i
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule) # <<<<<<<<<<<<<<
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i))
* yield trule
*/
- __pyx_t_3 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_tp_new_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_trule));
@@ -8337,7 +8609,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
__pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":206
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":206
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<<
@@ -8346,7 +8618,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_trule->rule = new boost::shared_ptr<TRule>(__pyx_cur_scope->__pyx_v_rbin->GetIthRule(__pyx_cur_scope->__pyx_v_i));
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":207
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":207
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i))
* yield trule # <<<<<<<<<<<<<<
@@ -8391,7 +8663,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":210
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":210
*
* property name:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -8409,14 +8681,14 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":211
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":211
* property name:
* def __get__(self):
* str(self.grammar.get().GetGrammarName().c_str()) # <<<<<<<<<<<<<<
*
* def __set__(self, name):
*/
- __pyx_t_1 = PyBytes_FromString(__pyx_v_self->grammar->get()->GetGrammarName().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->grammar->get()->GetGrammarName().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -8452,7 +8724,7 @@ static int __pyx_pw_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":213
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":213
* str(self.grammar.get().GetGrammarName().c_str())
*
* def __set__(self, name): # <<<<<<<<<<<<<<
@@ -8471,7 +8743,7 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_name);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":214
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":214
*
* def __set__(self, name):
* name = as_str(name) # <<<<<<<<<<<<<<
@@ -8484,7 +8756,7 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm
__pyx_v_name = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":215
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":215
* def __set__(self, name):
* name = as_str(name)
* self.grammar.get().SetGrammarName(name) # <<<<<<<<<<<<<<
@@ -8514,6 +8786,9 @@ struct wrapperbase __pyx_wrapperbase_5_cdec_11TextGrammar___init__;
#endif
static int __pyx_pw_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_rules = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -8557,7 +8832,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":218
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":218
*
* cdef class TextGrammar(Grammar):
* def __init__(self, rules): # <<<<<<<<<<<<<<
@@ -8581,7 +8856,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":220
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":220
* def __init__(self, rules):
* """TextGrammar(rules) -> SCFG Grammar containing the rules."""
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) # <<<<<<<<<<<<<<
@@ -8590,7 +8865,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr
*/
__pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar>(new TextGrammar());
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":221
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":221
* """TextGrammar(rules) -> SCFG Grammar containing the rules."""
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() # <<<<<<<<<<<<<<
@@ -8599,7 +8874,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr
*/
__pyx_v__g = ((TextGrammar *)__pyx_v_self->__pyx_base.grammar->get());
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":222
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":222
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules: # <<<<<<<<<<<<<<
@@ -8644,7 +8919,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr
__pyx_v_trule = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":223
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":223
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules:
* if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<<
@@ -8652,9 +8927,10 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr
* elif not isinstance(trule, TRule):
*/
__pyx_t_5 = __Pyx_TypeCheck(__pyx_v_trule, ((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule));
- if (__pyx_t_5) {
+ __pyx_t_6 = (__pyx_t_5 != 0);
+ if (__pyx_t_6) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":224
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":224
* for trule in rules:
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule) # <<<<<<<<<<<<<<
@@ -8670,18 +8946,18 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr
goto __pyx_L5;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":225
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":225
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule): # <<<<<<<<<<<<<<
* raise ValueError('the grammar should contain TRule objects')
* _g.AddRule((<TRule> trule).rule[0])
*/
- __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_trule, ((PyObject*)__pyx_ptype_5_cdec_TRule));
- __pyx_t_6 = (!__pyx_t_5);
- if (__pyx_t_6) {
+ __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_trule, ((PyObject*)__pyx_ptype_5_cdec_TRule));
+ __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
+ if (__pyx_t_5) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":226
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":226
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
@@ -8696,7 +8972,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr
}
__pyx_L5:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":227
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":227
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects')
* _g.AddRule((<TRule> trule).rule[0]) # <<<<<<<<<<<<<<
@@ -8727,7 +9003,7 @@ static void __pyx_pw_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":8
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":8
* cdef MT19937* rng
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -8740,7 +9016,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":9
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":9
*
* def __dealloc__(self):
* del self.hg # <<<<<<<<<<<<<<
@@ -8749,17 +9025,17 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp
*/
delete __pyx_v_self->hg;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":10
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":10
* def __dealloc__(self):
* del self.hg
* if self.rng != NULL: # <<<<<<<<<<<<<<
* del self.rng
*
*/
- __pyx_t_1 = (__pyx_v_self->rng != NULL);
+ __pyx_t_1 = ((__pyx_v_self->rng != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":11
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":11
* del self.hg
* if self.rng != NULL:
* del self.rng # <<<<<<<<<<<<<<
@@ -8774,7 +9050,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":13
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":13
* del self.rng
*
* cdef MT19937* _rng(self): # <<<<<<<<<<<<<<
@@ -8792,17 +9068,17 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_rng", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":14
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":14
*
* cdef MT19937* _rng(self):
* if self.rng == NULL: # <<<<<<<<<<<<<<
* self.rng = new MT19937()
* return self.rng
*/
- __pyx_t_1 = (__pyx_v_self->rng == NULL);
+ __pyx_t_1 = ((__pyx_v_self->rng == NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":15
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":15
* cdef MT19937* _rng(self):
* if self.rng == NULL:
* self.rng = new MT19937() # <<<<<<<<<<<<<<
@@ -8820,7 +9096,7 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":16
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":16
* if self.rng == NULL:
* self.rng = new MT19937()
* return self.rng # <<<<<<<<<<<<<<
@@ -8852,7 +9128,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, C
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":18
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":18
* return self.rng
*
* def viterbi(self): # <<<<<<<<<<<<<<
@@ -8871,7 +9147,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":21
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":21
* """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans) # <<<<<<<<<<<<<<
@@ -8880,7 +9156,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
*/
ViterbiESentence((__pyx_v_self->hg[0]), (&__pyx_v_trans));
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":22
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":22
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans)
* return unicode(GetString(trans).c_str(), 'utf8') # <<<<<<<<<<<<<<
@@ -8888,7 +9164,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
* def viterbi_trees(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::GetString(__pyx_v_trans).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_v_trans).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __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 = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -8930,7 +9206,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":24
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":24
* return unicode(GetString(trans).c_str(), 'utf8')
*
* def viterbi_trees(self): # <<<<<<<<<<<<<<
@@ -8950,14 +9226,14 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_trees", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":29
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":29
* e_tree: Target tree for the best hypothesis in the hypergraph.
* """
* f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<<
* e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8')
* return (f_tree, e_tree)
*/
- __pyx_t_1 = PyBytes_FromString(ViterbiFTree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(ViterbiFTree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -8973,14 +9249,14 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_
__pyx_v_f_tree = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":30
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":30
* """
* f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8')
* e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<<
* return (f_tree, e_tree)
*
*/
- __pyx_t_1 = PyBytes_FromString(ViterbiETree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(ViterbiETree((__pyx_v_self->hg[0])).c_str()); 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_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -8996,7 +9272,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_
__pyx_v_e_tree = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":31
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":31
* f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8')
* e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8')
* return (f_tree, e_tree) # <<<<<<<<<<<<<<
@@ -9043,7 +9319,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":33
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":33
* return (f_tree, e_tree)
*
* def viterbi_features(self): # <<<<<<<<<<<<<<
@@ -9061,20 +9337,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_features", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":36
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":36
* """hg.viterbi_features() -> SparseVector with the features corresponding
* to the best derivation in the hypergraph."""
* cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
* return fmap
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":37
* to the best derivation in the hypergraph."""
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) # <<<<<<<<<<<<<<
@@ -9083,7 +9359,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj
*/
__pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0])));
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":38
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":38
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
* return fmap # <<<<<<<<<<<<<<
@@ -9119,7 +9395,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":40
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":40
* return fmap
*
* def viterbi_forest(self): # <<<<<<<<<<<<<<
@@ -9137,7 +9413,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_forest", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":41
*
* def viterbi_forest(self):
* cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<<
@@ -9149,7 +9425,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5
__pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":42
* def viterbi_forest(self):
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) # <<<<<<<<<<<<<<
@@ -9158,7 +9434,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5
*/
__pyx_v_hg->hg = new Hypergraph(((__pyx_v_self->hg[0]).CreateViterbiHypergraph(NULL).get()[0]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":43
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
* return hg # <<<<<<<<<<<<<<
@@ -9195,7 +9471,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *__pyx_v
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":45
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":45
* return hg
*
* def viterbi_joshua(self): # <<<<<<<<<<<<<<
@@ -9213,7 +9489,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_joshua", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":47
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":47
* def viterbi_joshua(self):
* """hg.viterbi_joshua() -> Joshua representation of the best derivation."""
* return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<<
@@ -9221,7 +9497,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_
* def kbest(self, size):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(JoshuaVisualizationString((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(JoshuaVisualizationString((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -9264,7 +9540,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":49
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":49
* return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
* def kbest(self, size): # <<<<<<<<<<<<<<
@@ -9280,7 +9556,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_5_cdec_Hy
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("kbest", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -9320,6 +9596,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject
int __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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -9332,7 +9611,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":51
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":51
* def kbest(self, size):
* """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
@@ -9342,7 +9621,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject
__pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":54
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal].Derivation* derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -9351,7 +9630,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":55
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
@@ -9362,7 +9641,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":56
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":56
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9371,28 +9650,28 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":57
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":57
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
* yield unicode(GetString(derivation._yield).c_str(), 'utf8')
* finally:
*/
- __pyx_t_3 = (!(__pyx_cur_scope->__pyx_v_derivation != 0));
+ __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_derivation != 0)) != 0);
if (__pyx_t_3) {
goto __pyx_L8_break;
goto __pyx_L9;
}
__pyx_L9:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":58
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
* yield unicode(GetString(derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del derivations
*/
- __pyx_t_4 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_5);
@@ -9422,7 +9701,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject
__pyx_L8_break:;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":60
* yield unicode(GetString(derivation._yield).c_str(), 'utf8')
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -9483,7 +9762,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_16kbest_trees(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":62
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":62
* del derivations
*
* def kbest_trees(self, size): # <<<<<<<<<<<<<<
@@ -9499,7 +9778,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_5_c
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("kbest_trees", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -9541,6 +9820,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -9553,7 +9835,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":64
* def kbest_trees(self, size):
* """hg.kbest_trees(size) -> List of k-best trees in the hypergraph."""
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
@@ -9563,7 +9845,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
__pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size)
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
@@ -9573,7 +9855,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
__pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":69
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":69
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal].Derivation* e_derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -9582,7 +9864,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":70
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":70
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
@@ -9593,7 +9875,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":71
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":71
* try:
* for k in range(size):
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9602,7 +9884,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_f_derivation = __pyx_cur_scope->__pyx_v_f_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":72
* for k in range(size):
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9611,16 +9893,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_e_derivation = __pyx_cur_scope->__pyx_v_e_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":73
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":73
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not f_derivation or not e_derivation: break # <<<<<<<<<<<<<<
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
*/
- __pyx_t_3 = (!(__pyx_cur_scope->__pyx_v_f_derivation != 0));
+ __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_f_derivation != 0)) != 0);
if (!__pyx_t_3) {
- __pyx_t_4 = (!(__pyx_cur_scope->__pyx_v_e_derivation != 0));
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
__pyx_t_5 = __pyx_t_4;
} else {
__pyx_t_5 = __pyx_t_3;
@@ -9631,14 +9913,14 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":74
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":74
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not f_derivation or not e_derivation: break
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
* yield (f_tree, e_tree)
*/
- __pyx_t_6 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_6 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_7);
@@ -9657,14 +9939,14 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6);
__pyx_t_6 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":75
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":75
* if not f_derivation or not e_derivation: break
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* yield (f_tree, e_tree)
* finally:
*/
- __pyx_t_6 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_6 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_7);
@@ -9683,7 +9965,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6);
__pyx_t_6 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":76
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
* yield (f_tree, e_tree) # <<<<<<<<<<<<<<
@@ -9715,7 +9997,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
__pyx_L8_break:;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":78
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":78
* yield (f_tree, e_tree)
* finally:
* del f_derivations # <<<<<<<<<<<<<<
@@ -9739,7 +10021,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject
__pyx_L6:;
delete __pyx_cur_scope->__pyx_v_f_derivations;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":79
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":79
* finally:
* del f_derivations
* del e_derivations # <<<<<<<<<<<<<<
@@ -9785,7 +10067,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_19kbest_features(PyObject *__pyx_v
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":81
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":81
* del e_derivations
*
* def kbest_features(self, size): # <<<<<<<<<<<<<<
@@ -9801,7 +10083,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("kbest_features", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -9840,6 +10122,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
long __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -9852,7 +10137,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":83
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":83
* def kbest_features(self, size):
* """hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph."""
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
@@ -9862,7 +10147,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
__pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":87
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":87
* cdef SparseVector fmap
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -9871,7 +10156,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":88
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
@@ -9882,7 +10167,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":89
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":89
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9891,28 +10176,28 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":90
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":90
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
*/
- __pyx_t_3 = (!(__pyx_cur_scope->__pyx_v_derivation != 0));
+ __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_derivation != 0)) != 0);
if (__pyx_t_3) {
goto __pyx_L8_break;
goto __pyx_L9;
}
__pyx_L9:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":91
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap
*/
- __pyx_t_4 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_4);
if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
@@ -9921,7 +10206,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":92
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<<
@@ -9930,7 +10215,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":93
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap # <<<<<<<<<<<<<<
@@ -9954,7 +10239,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject
__pyx_L8_break:;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":95
* yield fmap
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -10006,6 +10291,9 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, P
static char __pyx_doc_5_cdec_10Hypergraph_21sample[] = "hg.sample(n) -> Sample of n hypotheses from the hypergraph.";
static PyObject *__pyx_pw_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
unsigned int __pyx_v_n;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sample (wrapper)", 0);
@@ -10023,7 +10311,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":97
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":97
* del derivations
*
* def sample(self, unsigned n): # <<<<<<<<<<<<<<
@@ -10039,7 +10327,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_21sample(struct __pyx_obj_5_cdec_H
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sample", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)__pyx_ptype_5_cdec___pyx_scope_struct_11_sample->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_11_sample, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(__pyx_ptype_5_cdec___pyx_scope_struct_11_sample, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -10077,6 +10365,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject
unsigned int __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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -10089,7 +10380,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":99
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":99
* def sample(self, unsigned n):
* """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<<
@@ -10104,7 +10395,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject
}
__pyx_cur_scope->__pyx_v_hypos = __pyx_t_1;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":100
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":100
* """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
* hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) # <<<<<<<<<<<<<<
@@ -10113,7 +10404,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject
*/
HypergraphSampler::sample_hypotheses((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_hypos);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":102
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":102
* hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10122,7 +10413,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":103
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":103
* cdef unsigned k
* try:
* for k in range(hypos.size()): # <<<<<<<<<<<<<<
@@ -10133,14 +10424,14 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":104
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":104
* try:
* for k in range(hypos.size()):
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del hypos
*/
- __pyx_t_4 = PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_5);
@@ -10169,7 +10460,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject
}
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":106
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":106
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
* finally:
* del hypos # <<<<<<<<<<<<<<
@@ -10223,6 +10514,9 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_s
static char __pyx_doc_5_cdec_10Hypergraph_24sample_trees[] = "hg.sample_trees(n) -> Sample of n trees from the hypergraph.";
static PyObject *__pyx_pw_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
unsigned int __pyx_v_n;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sample_trees (wrapper)", 0);
@@ -10240,7 +10534,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":108
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108
* del hypos
*
* def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
@@ -10256,7 +10550,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24sample_trees(struct __pyx_obj_5_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sample_trees", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -10294,6 +10588,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject
unsigned int __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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -10306,7 +10603,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":110
* def sample_trees(self, unsigned n):
* """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
* cdef vector[string]* trees = new vector[string]() # <<<<<<<<<<<<<<
@@ -10321,7 +10618,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject
}
__pyx_cur_scope->__pyx_v_trees = __pyx_t_1;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":111
* """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
* cdef vector[string]* trees = new vector[string]()
* hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) # <<<<<<<<<<<<<<
@@ -10330,7 +10627,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject
*/
HypergraphSampler::sample_trees((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_trees);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":113
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113
* hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10339,7 +10636,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":114
* cdef unsigned k
* try:
* for k in range(trees.size()): # <<<<<<<<<<<<<<
@@ -10350,14 +10647,14 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":115
* try:
* for k in range(trees.size()):
* yield unicode(trees[0][k].c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del trees
*/
- __pyx_t_4 = PyBytes_FromString(((__pyx_cur_scope->__pyx_v_trees[0])[__pyx_cur_scope->__pyx_v_k]).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(((__pyx_cur_scope->__pyx_v_trees[0])[__pyx_cur_scope->__pyx_v_k]).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_5);
@@ -10386,7 +10683,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject
}
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":117
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":117
* yield unicode(trees[0][k].c_str(), 'utf8')
* finally:
* del trees # <<<<<<<<<<<<<<
@@ -10446,7 +10743,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28intersect(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":119
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":119
* del trees
*
* def intersect(self, inp): # <<<<<<<<<<<<<<
@@ -10459,14 +10756,15 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = 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("intersect", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":122
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":122
* """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
* cdef Lattice lat
* if isinstance(inp, Lattice): # <<<<<<<<<<<<<<
@@ -10474,9 +10772,10 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde
* elif isinstance(inp, basestring):
*/
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_inp, ((PyObject*)__pyx_ptype_5_cdec_Lattice));
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":123
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":123
* cdef Lattice lat
* if isinstance(inp, Lattice):
* lat = <Lattice> inp # <<<<<<<<<<<<<<
@@ -10488,61 +10787,62 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde
goto __pyx_L3;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":124
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":124
* if isinstance(inp, Lattice):
* lat = <Lattice> inp
* elif isinstance(inp, basestring): # <<<<<<<<<<<<<<
* lat = Lattice(inp)
* else:
*/
- __pyx_t_1 = PyObject_IsInstance(__pyx_v_inp, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBaseString_Check(__pyx_v_inp);
+ __pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":125
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":125
* lat = <Lattice> inp
* elif isinstance(inp, basestring):
* lat = Lattice(inp) # <<<<<<<<<<<<<<
* else:
* raise TypeError('cannot intersect hypergraph with %s' % type(inp))
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_inp);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_inp);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
__Pyx_GIVEREF(__pyx_v_inp);
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_v_lat = ((struct __pyx_obj_5_cdec_Lattice *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_v_lat = ((struct __pyx_obj_5_cdec_Lattice *)__pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":127
* lat = Lattice(inp)
* else:
* raise TypeError('cannot intersect hypergraph with %s' % type(inp)) # <<<<<<<<<<<<<<
* return hypergraph.Intersect(lat.lattice[0], self.hg)
*
*/
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":128
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":128
* else:
* raise TypeError('cannot intersect hypergraph with %s' % type(inp))
* return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<<
@@ -10550,17 +10850,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde
* def prune(self, beam_alpha=0, density=0, **kwargs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __Pyx_PyBool_FromLong(HG::Intersect((__pyx_v_lat->lattice[0]), __pyx_v_self->hg)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyBool_FromLong(HG::Intersect((__pyx_v_lat->lattice[0]), __pyx_v_self->hg)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("_cdec.Hypergraph.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -10577,6 +10877,9 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_self, Py
PyObject *__pyx_v_beam_alpha = 0;
PyObject *__pyx_v_density = 0;
PyObject *__pyx_v_kwargs = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("prune (wrapper)", 0);
@@ -10638,7 +10941,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":130
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":130
* return hypergraph.Intersect(lat.lattice[0], self.hg)
*
* def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
@@ -10651,14 +10954,15 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- double __pyx_t_2;
+ int __pyx_t_2;
double __pyx_t_3;
+ double __pyx_t_4;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("prune", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":134
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":134
* beam_alpha: use beam pruning
* density: use density pruning"""
* cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<<
@@ -10667,7 +10971,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_preserve_mask = NULL;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":135
* density: use density pruning"""
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs: # <<<<<<<<<<<<<<
@@ -10675,9 +10979,10 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
*/
__pyx_t_1 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s_16), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":136
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":136
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<<
@@ -10686,7 +10991,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_preserve_mask = new std::vector<bool>(__pyx_v_self->hg->edges_.size());
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":137
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":137
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True # <<<<<<<<<<<<<<
@@ -10698,28 +11003,28 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":138
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) # <<<<<<<<<<<<<<
* if preserve_mask:
* del preserve_mask
*/
- __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_beam_alpha); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_density); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_self->hg->PruneInsideOutside(__pyx_t_2, __pyx_t_3, __pyx_v_preserve_mask, 0, 1.0, 0);
+ __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_beam_alpha); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_density); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->hg->PruneInsideOutside(__pyx_t_3, __pyx_t_4, __pyx_v_preserve_mask, 0, 1.0, 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":139
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":139
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask: # <<<<<<<<<<<<<<
* del preserve_mask
*
*/
- __pyx_t_1 = (__pyx_v_preserve_mask != 0);
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_v_preserve_mask != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":140
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":140
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask:
* del preserve_mask # <<<<<<<<<<<<<<
@@ -10754,7 +11059,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_32lattice(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":142
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":142
* del preserve_mask
*
* def lattice(self): # TODO direct hg -> lattice conversion in cdec # <<<<<<<<<<<<<<
@@ -10774,19 +11079,19 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lattice", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":144
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":144
* def lattice(self): # TODO direct hg -> lattice conversion in cdec
* """hg.lattice() -> Lattice corresponding to the hypergraph."""
* cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() # <<<<<<<<<<<<<<
* return Lattice(eval(plf))
*
*/
- __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_v_plf = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":145
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":145
* """hg.lattice() -> Lattice corresponding to the hypergraph."""
* cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str()
* return Lattice(eval(plf)) # <<<<<<<<<<<<<<
@@ -10857,7 +11162,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_34plf(PyObject *__pyx_v_self, CYTH
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":147
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":147
* return Lattice(eval(plf))
*
* def plf(self): # <<<<<<<<<<<<<<
@@ -10875,7 +11180,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33plf(struct __pyx_obj_5_cdec_Hype
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("plf", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":149
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":149
* def plf(self):
* """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
* return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) # <<<<<<<<<<<<<<
@@ -10883,7 +11188,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33plf(struct __pyx_obj_5_cdec_Hype
* def reweight(self, weights):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -10922,7 +11227,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":151
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":151
* return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
*
* def reweight(self, weights): # <<<<<<<<<<<<<<
@@ -10934,14 +11239,15 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = 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("reweight", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":153
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":153
* def reweight(self, weights):
* """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
* if isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -10949,9 +11255,10 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec
* elif isinstance(weights, DenseVector):
*/
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_SparseVector));
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":154
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":154
* """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -10962,17 +11269,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec
goto __pyx_L3;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":155
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":155
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
* self.hg.Reweight((<DenseVector> weights).vector[0])
* else:
*/
- __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_DenseVector));
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_DenseVector));
+ __pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":156
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":156
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector):
* self.hg.Reweight((<DenseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -10984,25 +11292,25 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":158
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":158
* self.hg.Reweight((<DenseVector> weights).vector[0])
* else:
* raise TypeError('cannot reweight hypergraph with %s' % type(weights)) # <<<<<<<<<<<<<<
*
* property edges:
*/
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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;
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -11010,8 +11318,8 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("_cdec.Hypergraph.reweight", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -11032,7 +11340,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":161
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":161
*
* property edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11048,7 +11356,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_13___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_13___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(__pyx_ptype_5_cdec___pyx_scope_struct_13___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -11084,6 +11392,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
unsigned 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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -11096,7 +11407,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":163
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":163
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<<
@@ -11107,7 +11418,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":164
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":164
* cdef unsigned i
* for i in range(self.hg.edges_.size()):
* yield HypergraphEdge().init(self.hg, i) # <<<<<<<<<<<<<<
@@ -11159,7 +11470,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":167
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167
*
* property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11175,7 +11486,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_14___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_14___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(__pyx_ptype_5_cdec___pyx_scope_struct_14___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -11211,6 +11522,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
unsigned 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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -11223,7 +11537,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":169
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":169
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<<
@@ -11234,7 +11548,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":170
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":170
* cdef unsigned i
* for i in range(self.hg.nodes_.size()):
* yield HypergraphNode().init(self.hg, i) # <<<<<<<<<<<<<<
@@ -11285,7 +11599,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":173
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":173
*
* property goal:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11303,7 +11617,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":174
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":174
* property goal:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<<
@@ -11344,7 +11658,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":177
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":177
*
* property npaths:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11361,7 +11675,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":178
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":178
* property npaths:
* def __get__(self):
* return self.hg.NumberOfPaths() # <<<<<<<<<<<<<<
@@ -11399,7 +11713,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_38inside_outside(PyObject *__pyx_v
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":180
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
* return self.hg.NumberOfPaths()
*
* def inside_outside(self): # <<<<<<<<<<<<<<
@@ -11423,7 +11737,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("inside_outside", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":182
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":182
* def inside_outside(self):
* """hg.inside_outside() -> SparseVector with inside-outside scores for each feature."""
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() # <<<<<<<<<<<<<<
@@ -11432,7 +11746,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
*/
__pyx_v_result = new FastSparseVector<prob_t>();
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":183
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":183
* """hg.inside_outside() -> SparseVector with inside-outside scores for each feature."""
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) # <<<<<<<<<<<<<<
@@ -11441,7 +11755,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
*/
__pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":184
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":184
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z # <<<<<<<<<<<<<<
@@ -11450,20 +11764,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
*/
(__pyx_v_result[0]) /= __pyx_v_z;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":185
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":185
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* vector.vector = new FastSparseVector[double]()
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False)
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":186
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":186
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<<
@@ -11472,7 +11786,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
*/
__pyx_v_vector->vector = new FastSparseVector<double>();
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":187
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":187
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double]()
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) # <<<<<<<<<<<<<<
@@ -11481,7 +11795,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
*/
__pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":189
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":189
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False)
* cdef unsigned i
* for i in range(result.size()): # <<<<<<<<<<<<<<
@@ -11492,7 +11806,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":190
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":190
* cdef unsigned i
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) # <<<<<<<<<<<<<<
@@ -11501,7 +11815,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
*/
__pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second));
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":191
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":191
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it # <<<<<<<<<<<<<<
@@ -11511,7 +11825,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
(++(__pyx_v_it[0]));
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":192
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":192
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it
* del it # <<<<<<<<<<<<<<
@@ -11520,7 +11834,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
*/
delete __pyx_v_it;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":193
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":193
* pinc(it[0]) # ++it
* del it
* del result # <<<<<<<<<<<<<<
@@ -11529,7 +11843,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
*/
delete __pyx_v_result;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":194
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":194
* del it
* del result
* return vector # <<<<<<<<<<<<<<
@@ -11554,7 +11868,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":201
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":201
* cdef public TRule trule
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -11571,7 +11885,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("init", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":202
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -11580,7 +11894,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":203
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":203
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.edge = &hg.edges_[i] # <<<<<<<<<<<<<<
@@ -11589,14 +11903,14 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":204
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":204
* self.hg = hg
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule) # <<<<<<<<<<<<<<
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GIVEREF(__pyx_t_1);
@@ -11605,7 +11919,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
__pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":205
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":205
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<<
@@ -11614,7 +11928,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->trule->rule = new boost::shared_ptr<TRule>(__pyx_v_self->edge->rule_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":206
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self # <<<<<<<<<<<<<<
@@ -11649,7 +11963,7 @@ static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":208
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":208
* return self
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -11662,7 +11976,7 @@ static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":209
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":209
*
* def __len__(self):
* return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<<
@@ -11689,7 +12003,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":212
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":212
*
* property head_node:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11707,7 +12021,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":213
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":213
* property head_node:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<<
@@ -11749,7 +12063,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":216
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
*
* property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11765,7 +12079,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_15___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_15___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(__pyx_ptype_5_cdec___pyx_scope_struct_15___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -11801,6 +12115,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
unsigned 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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -11813,7 +12130,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":218
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":218
* def __get__(self):
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<<
@@ -11824,7 +12141,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":219
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":219
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()):
* yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i]) # <<<<<<<<<<<<<<
@@ -11875,7 +12192,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":222
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222
*
* property span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11894,7 +12211,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":223
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":223
* property span:
* def __get__(self):
* return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<<
@@ -11943,7 +12260,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":226
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":226
*
* property src_span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11962,7 +12279,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":227
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":227
* property src_span:
* def __get__(self):
* return (self.edge.prev_i_, self.edge.prev_j_) # <<<<<<<<<<<<<<
@@ -12011,7 +12328,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyOb
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":230
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":230
*
* property feature_values:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12029,20 +12346,20 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":231
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":231
* property feature_values:
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":232
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":232
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<<
@@ -12051,7 +12368,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc
*/
__pyx_v_vector->vector = new FastSparseVector<double>(__pyx_v_self->edge->feature_values_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":233
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":233
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector # <<<<<<<<<<<<<<
@@ -12087,7 +12404,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":236
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":236
*
* property prob:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12104,7 +12421,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":237
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":237
* property prob:
* def __get__(self):
* return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<<
@@ -12133,6 +12450,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
@@ -12147,7 +12467,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":239
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239
* return self.edge.edge_prob_.as_float()
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
@@ -12165,7 +12485,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":242
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":242
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12174,7 +12494,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
switch (__pyx_v_op) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":240
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":240
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -12183,7 +12503,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
case 2:
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":241
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":241
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # ==
* return x.edge == y.edge # <<<<<<<<<<<<<<
@@ -12198,7 +12518,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
goto __pyx_L0;
break;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":242
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":242
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12207,7 +12527,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
case 3:
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":243
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":243
* return x.edge == y.edge
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -12226,7 +12546,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
break;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":244
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":244
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
@@ -12262,7 +12582,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__py
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":199
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":199
* cdef hypergraph.Hypergraph* hg
* cdef hypergraph.HypergraphEdge* edge
* cdef public TRule trule # <<<<<<<<<<<<<<
@@ -12347,7 +12667,7 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_c
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":250
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":250
* cdef hypergraph.HypergraphNode* node
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -12360,7 +12680,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("init", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":251
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":251
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -12369,7 +12689,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":252
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":252
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.node = &hg.nodes_[i] # <<<<<<<<<<<<<<
@@ -12378,7 +12698,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->node = (&(__pyx_v_hg->nodes_[__pyx_v_i]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":253
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":253
* self.hg = hg
* self.node = &hg.nodes_[i]
* return self # <<<<<<<<<<<<<<
@@ -12409,7 +12729,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":256
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":256
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12425,7 +12745,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_16___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_16___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(__pyx_ptype_5_cdec___pyx_scope_struct_16___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -12461,6 +12781,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
unsigned 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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -12473,7 +12796,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":258
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":258
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<<
@@ -12484,7 +12807,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":259
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":259
* cdef unsigned i
* for i in range(self.node.in_edges_.size()):
* yield HypergraphEdge().init(self.hg, self.node.in_edges_[i]) # <<<<<<<<<<<<<<
@@ -12536,7 +12859,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":262
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":262
*
* property out_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12552,7 +12875,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __py
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_17___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_17___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(__pyx_ptype_5_cdec___pyx_scope_struct_17___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -12588,6 +12911,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
unsigned 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_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -12600,7 +12926,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":264
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":264
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<<
@@ -12611,7 +12937,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":265
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":265
* cdef unsigned i
* for i in range(self.node.out_edges_.size()):
* yield HypergraphEdge().init(self.hg, self.node.out_edges_[i]) # <<<<<<<<<<<<<<
@@ -12662,7 +12988,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":268
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":268
*
* property span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12680,7 +13006,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":269
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":269
* property span:
* def __get__(self):
* return next(self.in_edges).span # <<<<<<<<<<<<<<
@@ -12688,12 +13014,12 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj
* property cat:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__in_edges); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__in_edges); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__span); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__span); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -12724,7 +13050,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":272
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":272
*
* property cat:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12735,23 +13061,25 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_
static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
+ 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("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":273
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":273
* property cat:
* def __get__(self):
* if self.node.cat_: # <<<<<<<<<<<<<<
* return str(TDConvert(-self.node.cat_).c_str())
*
*/
- if (__pyx_v_self->node->cat_) {
+ __pyx_t_1 = (__pyx_v_self->node->cat_ != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":274
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":274
* def __get__(self):
* if self.node.cat_:
* return str(TDConvert(-self.node.cat_).c_str()) # <<<<<<<<<<<<<<
@@ -12759,18 +13087,18 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->node->cat_)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBytes_FromString(TD::Convert((-__pyx_v_self->node->cat_)).c_str()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __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 = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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;
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __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;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
@@ -12779,8 +13107,8 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("_cdec.HypergraphNode.cat.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -12792,6 +13120,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
@@ -12806,7 +13137,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":276
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":276
* return str(TDConvert(-self.node.cat_).c_str())
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
@@ -12824,7 +13155,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":279
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":279
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12833,7 +13164,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
switch (__pyx_v_op) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":277
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":277
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -12842,7 +13173,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
case 2:
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":278
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":278
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # ==
* return x.node == y.node # <<<<<<<<<<<<<<
@@ -12857,7 +13188,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
goto __pyx_L0;
break;
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":279
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":279
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12866,7 +13197,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
case 3:
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":280
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":280
* return x.node == y.node
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -12884,7 +13215,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
break;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":281
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":281
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
@@ -12921,7 +13252,7 @@ static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":6
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":6
* cdef lattice.Lattice* lattice
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -12934,7 +13265,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":7
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":7
*
* def __cinit__(self):
* self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<<
@@ -12956,6 +13287,9 @@ struct wrapperbase __pyx_wrapperbase_5_cdec_7Lattice_2__init__;
#endif
static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_inp = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -12999,7 +13333,7 @@ static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":9
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":9
* self.lattice = new lattice.Lattice()
*
* def __init__(self, inp): # <<<<<<<<<<<<<<
@@ -13013,18 +13347,19 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- Py_ssize_t __pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_2;
+ Py_ssize_t __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
- PyObject *(*__pyx_t_5)(PyObject *);
- PyObject *__pyx_t_6 = NULL;
- std::string __pyx_t_7;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *(*__pyx_t_6)(PyObject *);
+ PyObject *__pyx_t_7 = NULL;
+ std::string __pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":12
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":12
* """Lattice(tuple) -> Lattice from node list.
* Lattice(string) -> Lattice from PLF representation."""
* if isinstance(inp, tuple): # <<<<<<<<<<<<<<
@@ -13032,19 +13367,20 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_
* for i, arcs in enumerate(inp):
*/
__pyx_t_1 = PyTuple_Check(__pyx_v_inp);
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":13
* Lattice(string) -> Lattice from PLF representation."""
* if isinstance(inp, tuple):
* self.lattice.resize(len(inp)) # <<<<<<<<<<<<<<
* for i, arcs in enumerate(inp):
* self[i] = arcs
*/
- __pyx_t_2 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_self->lattice->resize(__pyx_t_2);
+ __pyx_t_3 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->lattice->resize(__pyx_t_3);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":14
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":14
* if isinstance(inp, tuple):
* self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp): # <<<<<<<<<<<<<<
@@ -13052,54 +13388,54 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_
* elif isinstance(inp, basestring):
*/
__Pyx_INCREF(__pyx_int_0);
- __pyx_t_3 = __pyx_int_0;
+ __pyx_t_4 = __pyx_int_0;
if (PyList_CheckExact(__pyx_v_inp) || PyTuple_CheckExact(__pyx_v_inp)) {
- __pyx_t_4 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
- __pyx_t_5 = NULL;
+ __pyx_t_5 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0;
+ __pyx_t_6 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_5)) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
#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[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_5)) {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
#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[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_6 = __pyx_t_5(__pyx_t_4);
- if (unlikely(!__pyx_t_6)) {
+ __pyx_t_7 = __pyx_t_6(__pyx_t_5);
+ if (unlikely(!__pyx_t_7)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_7);
}
__Pyx_XDECREF(__pyx_v_arcs);
- __pyx_v_arcs = __pyx_t_6;
- __pyx_t_6 = 0;
- __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_arcs = __pyx_t_7;
+ __pyx_t_7 = 0;
+ __Pyx_INCREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_v_i);
- __pyx_v_i = __pyx_t_3;
- __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_3);
- __pyx_t_3 = __pyx_t_6;
- __pyx_t_6 = 0;
+ __pyx_v_i = __pyx_t_4;
+ __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_4);
+ __pyx_t_4 = __pyx_t_7;
+ __pyx_t_7 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":15
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":15
* self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp):
* self[i] = arcs # <<<<<<<<<<<<<<
@@ -13108,56 +13444,57 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_
*/
if (PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_i, __pyx_v_arcs) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":16
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":16
* for i, arcs in enumerate(inp):
* self[i] = arcs
* elif isinstance(inp, basestring): # <<<<<<<<<<<<<<
* lattice.ConvertTextOrPLF(as_str(inp), self.lattice)
* else:
*/
- __pyx_t_1 = PyObject_IsInstance(__pyx_v_inp, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBaseString_Check(__pyx_v_inp);
+ __pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":17
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":17
* self[i] = arcs
* elif isinstance(inp, basestring):
* lattice.ConvertTextOrPLF(as_str(inp), self.lattice) # <<<<<<<<<<<<<<
* else:
* raise TypeError('cannot create lattice from %s' % type(inp))
*/
- __pyx_t_3 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_v_inp, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = __pyx_convert_string_from_py_(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- LatticeTools::ConvertTextOrPLF(__pyx_t_7, __pyx_v_self->lattice);
+ __pyx_t_4 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_v_inp, NULL)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __pyx_convert_string_from_py_(__pyx_t_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ LatticeTools::ConvertTextOrPLF(__pyx_t_8, __pyx_v_self->lattice);
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":19
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":19
* lattice.ConvertTextOrPLF(as_str(inp), self.lattice)
* else:
* raise TypeError('cannot create lattice from %s' % type(inp)) # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __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_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -13165,9 +13502,9 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("_cdec.Lattice.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -13186,7 +13523,7 @@ static void __pyx_pw_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":21
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":21
* raise TypeError('cannot create lattice from %s' % type(inp))
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -13198,7 +13535,7 @@ static void __pyx_pf_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":22
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":22
*
* def __dealloc__(self):
* del self.lattice # <<<<<<<<<<<<<<
@@ -13214,6 +13551,9 @@ static void __pyx_pf_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj
static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
int __pyx_v_index;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
@@ -13231,7 +13571,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":24
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24
* del self.lattice
*
* def __getitem__(self, int index): # <<<<<<<<<<<<<<
@@ -13261,7 +13601,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":25
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":25
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -13273,10 +13613,10 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
__pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_v_index < __pyx_t_2);
}
- __pyx_t_3 = (!__pyx_t_1);
+ __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":26
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
@@ -13292,7 +13632,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":27
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":27
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range')
* arcs = [] # <<<<<<<<<<<<<<
@@ -13304,7 +13644,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
__pyx_v_arcs = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":28
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":28
* raise IndexError('lattice index out of range')
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<<
@@ -13313,7 +13653,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
*/
__pyx_v_arc_vector = ((__pyx_v_self->lattice[0])[__pyx_v_index]);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":31
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":31
* cdef lattice.LatticeArc* arc
* cdef unsigned i
* for i in range(arc_vector.size()): # <<<<<<<<<<<<<<
@@ -13324,7 +13664,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i = __pyx_t_6;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":32
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":32
* cdef unsigned i
* for i in range(arc_vector.size()):
* arc = &arc_vector[i] # <<<<<<<<<<<<<<
@@ -13333,14 +13673,14 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
*/
__pyx_v_arc = (&(__pyx_v_arc_vector[__pyx_v_i]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":33
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33
* for i in range(arc_vector.size()):
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label).c_str(), 'utf8') # <<<<<<<<<<<<<<
* arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs)
*/
- __pyx_t_4 = PyBytes_FromString(TD::Convert(__pyx_v_arc->label).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(TD::Convert(__pyx_v_arc->label).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
@@ -13357,7 +13697,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
__pyx_v_label = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":34
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":34
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label).c_str(), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<<
@@ -13379,11 +13719,11 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_4 = 0;
__pyx_t_7 = 0;
- __pyx_t_9 = PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":35
* label = unicode(TDConvert(arc.label).c_str(), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs) # <<<<<<<<<<<<<<
@@ -13417,6 +13757,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L
static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs); /*proto*/
static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs) {
int __pyx_v_index;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
@@ -13439,7 +13782,7 @@ static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObjec
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":37
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37
* return tuple(arcs)
*
* def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
@@ -13473,7 +13816,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":38
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":38
*
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -13485,10 +13828,10 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice
__pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_v_index < __pyx_t_2);
}
- __pyx_t_3 = (!__pyx_t_1);
+ __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
@@ -13504,7 +13847,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41
* raise IndexError('lattice index out of range')
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<<
@@ -13591,7 +13934,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice
__pyx_v_dist2next = __pyx_t_8;
__pyx_t_8 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":42
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
* label_str = as_str(label) # <<<<<<<<<<<<<<
@@ -13604,19 +13947,19 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice
__pyx_v_label_str = ((PyObject*)__pyx_t_5);
__pyx_t_5 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43
* for (label, cost, dist2next) in arcs:
* label_str = as_str(label)
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) # <<<<<<<<<<<<<<
* self.lattice[0][index].push_back(arc[0])
* del arc
*/
- __pyx_t_11 = PyBytes_AsString(((PyObject *)__pyx_v_label_str)); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_label_str)); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cost); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_arc = new LatticeArc(TD::Convert(__pyx_t_11), __pyx_t_12, __pyx_t_13);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":44
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":44
* label_str = as_str(label)
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
* self.lattice[0][index].push_back(arc[0]) # <<<<<<<<<<<<<<
@@ -13625,7 +13968,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice
*/
((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":45
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":45
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
* del arc # <<<<<<<<<<<<<<
@@ -13667,7 +14010,7 @@ static Py_ssize_t __pyx_pw_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":47
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":47
* del arc
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -13680,7 +14023,7 @@ static Py_ssize_t __pyx_pf_5_cdec_7Lattice_10__len__(struct __pyx_obj_5_cdec_Lat
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":48
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":48
*
* def __len__(self):
* return self.lattice.size() # <<<<<<<<<<<<<<
@@ -13707,7 +14050,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":50
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":50
* return self.lattice.size()
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -13725,7 +14068,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Latt
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":51
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":51
*
* def __str__(self):
* return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) # <<<<<<<<<<<<<<
@@ -13733,7 +14076,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Latt
* def __unicode__(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -13771,7 +14114,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":53
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":53
* return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
*
* def __unicode__(self): # <<<<<<<<<<<<<<
@@ -13789,7 +14132,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__unicode__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":54
*
* def __unicode__(self):
* return unicode(str(self), 'utf8') # <<<<<<<<<<<<<<
@@ -13845,7 +14188,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":56
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":56
* return unicode(str(self), 'utf8')
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -13861,7 +14204,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_16__iter__(struct __pyx_obj_5_cdec_Lat
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -13896,6 +14239,9 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *_
Py_ssize_t __pyx_t_1;
unsigned int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -13908,7 +14254,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *_
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -13919,14 +14265,14 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *_
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def todot(self):
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -13980,7 +14326,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CY
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":63
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
* def todot(self):
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines(): # <<<<<<<<<<<<<<
@@ -13996,7 +14342,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) {
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lines", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)__pyx_ptype_5_cdec___pyx_scope_struct_20_lines->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_20_lines, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(__pyx_ptype_5_cdec___pyx_scope_struct_20_lines, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -14040,6 +14386,9 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
PyObject *(*__pyx_t_12)(PyObject *);
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -14057,7 +14406,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines():
* yield 'digraph lattice {' # <<<<<<<<<<<<<<
@@ -14074,7 +14423,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L4_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":65
* def lines():
* yield 'digraph lattice {'
* yield 'rankdir = LR;' # <<<<<<<<<<<<<<
@@ -14091,7 +14440,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L5_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":66
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
* yield 'node [shape=circle];' # <<<<<<<<<<<<<<
@@ -14108,7 +14457,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L6_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -14171,7 +14520,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_cur_scope->__pyx_v_i = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":68
* yield 'node [shape=circle];'
* for i in range(len(self)):
* for label, weight, delta in self[i]: # <<<<<<<<<<<<<<
@@ -14289,7 +14638,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_cur_scope->__pyx_v_delta = __pyx_t_10;
__pyx_t_10 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":69
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":69
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
@@ -14298,7 +14647,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
*/
__pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_i, __pyx_cur_scope->__pyx_v_delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_label, __pyx_n_s__replace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_label, __pyx_n_s__replace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
@@ -14349,7 +14698,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":70
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":70
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self) # <<<<<<<<<<<<<<
@@ -14375,7 +14724,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L14_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":71
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":71
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
* yield '}' # <<<<<<<<<<<<<<
@@ -14410,7 +14759,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
return NULL;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":61
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":61
* yield self[i]
*
* def todot(self): # <<<<<<<<<<<<<<
@@ -14430,7 +14779,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("todot", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)__pyx_ptype_5_cdec___pyx_scope_struct_19_todot->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_19_todot, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(__pyx_ptype_5_cdec___pyx_scope_struct_19_todot, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -14440,7 +14789,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
* def todot(self):
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines(): # <<<<<<<<<<<<<<
@@ -14452,7 +14801,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic
__pyx_v_lines = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":72
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
@@ -14460,7 +14809,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic
* def as_hypergraph(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_pf_5_cdec_7Lattice_5todot_lines(__pyx_v_lines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -14473,7 +14822,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -14511,7 +14860,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":74
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":74
* return '\n'.join(lines()).encode('utf8')
*
* def as_hypergraph(self): # <<<<<<<<<<<<<<
@@ -14532,20 +14881,20 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("as_hypergraph", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":76
* def as_hypergraph(self):
* """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
* cdef Hypergraph result = Hypergraph.__new__(Hypergraph) # <<<<<<<<<<<<<<
* result.hg = new hypergraph.Hypergraph()
* cdef bytes plf = str(self)
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_Hypergraph)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_Hypergraph(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_Hypergraph)))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":77
* """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
* cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
* result.hg = new hypergraph.Hypergraph() # <<<<<<<<<<<<<<
@@ -14554,7 +14903,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde
*/
__pyx_v_result->hg = new Hypergraph();
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":78
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":78
* cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
* result.hg = new hypergraph.Hypergraph()
* cdef bytes plf = str(self) # <<<<<<<<<<<<<<
@@ -14573,7 +14922,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde
__pyx_v_plf = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":79
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":79
* result.hg = new hypergraph.Hypergraph()
* cdef bytes plf = str(self)
* hypergraph.ReadFromPLF(plf, result.hg) # <<<<<<<<<<<<<<
@@ -14582,7 +14931,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde
__pyx_t_3 = __pyx_convert_string_from_py_(((PyObject *)__pyx_v_plf)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
HypergraphIO::ReadFromPLF(__pyx_t_3, __pyx_v_result->hg);
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":80
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":80
* cdef bytes plf = str(self)
* hypergraph.ReadFromPLF(plf, result.hg)
* return result # <<<<<<<<<<<<<<
@@ -14607,7 +14956,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":3
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":3
* cimport mteval
*
* cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<<
@@ -14620,8 +14969,8 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
struct __pyx_obj_5_cdec_SufficientStats *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
EvaluationMetric *__pyx_t_5;
int __pyx_lineno = 0;
@@ -14629,7 +14978,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("as_stats", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":4
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":4
*
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats): # <<<<<<<<<<<<<<
@@ -14637,9 +14986,10 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
* elif x == 0 and isinstance(y, SufficientStats):
*/
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SufficientStats));
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":5
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":5
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats):
* return x # <<<<<<<<<<<<<<
@@ -14654,37 +15004,37 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
goto __pyx_L3;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":6
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":6
* if isinstance(x, SufficientStats):
* return x
* elif x == 0 and isinstance(y, SufficientStats): # <<<<<<<<<<<<<<
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats()
*/
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_1) {
- __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_5_cdec_SufficientStats));
- __pyx_t_4 = __pyx_t_3;
- } else {
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __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[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_2) {
+ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_5_cdec_SufficientStats));
__pyx_t_4 = __pyx_t_1;
+ } else {
+ __pyx_t_4 = __pyx_t_2;
}
if (__pyx_t_4) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":7
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":7
* return x
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats() # <<<<<<<<<<<<<<
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric
*/
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_v_stats = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_v_stats = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":8
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":8
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -14693,7 +15043,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
*/
__pyx_v_stats->stats = new SufficientStats();
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":9
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":9
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric # <<<<<<<<<<<<<<
@@ -14703,7 +15053,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
__pyx_t_5 = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_y)->metric;
__pyx_v_stats->metric = __pyx_t_5;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":10
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":10
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric
* return stats # <<<<<<<<<<<<<<
@@ -14721,7 +15071,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
__pyx_r = ((struct __pyx_obj_5_cdec_SufficientStats *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("_cdec.as_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -14742,7 +15092,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":17
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":17
*
* property words:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -14761,7 +15111,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":18
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":18
* property words:
* def __get__(self):
* return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8') # <<<<<<<<<<<<<<
@@ -14769,7 +15119,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd
* property fmap:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::GetString(__pyx_v_self->candidate->ewords).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_v_self->candidate->ewords).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __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[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -14812,7 +15162,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":21
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":21
*
* property fmap:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -14830,20 +15180,20 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":22
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":22
* property fmap:
* def __get__(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
* return fmap
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":23
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":23
* def __get__(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<<
@@ -14852,7 +15202,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde
*/
__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_v_self->candidate->fmap);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":24
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":24
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
* return fmap # <<<<<<<<<<<<<<
@@ -14888,7 +15238,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":14
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":14
* cdef class Candidate:
* cdef mteval.const_Candidate* candidate
* cdef public float score # <<<<<<<<<<<<<<
@@ -14964,7 +15314,7 @@ static void __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_sel
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":30
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":30
* cdef mteval.EvaluationMetric* metric
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -14976,7 +15326,7 @@ static void __pyx_pf_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct _
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":31
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":31
*
* def __dealloc__(self):
* del self.stats # <<<<<<<<<<<<<<
@@ -14999,7 +15349,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5score_1__get__(PyObject *__p
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":34
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":34
*
* property score:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -15016,7 +15366,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":35
* property score:
* def __get__(self):
* return self.metric.ComputeScore(self.stats[0]) # <<<<<<<<<<<<<<
@@ -15053,7 +15403,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":38
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":38
*
* property detail:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -15071,7 +15421,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":39
* property detail:
* def __get__(self):
* return str(self.metric.DetailedScore(self.stats[0]).c_str()) # <<<<<<<<<<<<<<
@@ -15079,7 +15429,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_
* def __len__(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(__pyx_v_self->metric->DetailedScore((__pyx_v_self->stats[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->metric->DetailedScore((__pyx_v_self->stats[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 39; __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[5]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -15117,7 +15467,7 @@ static Py_ssize_t __pyx_pw_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":41
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":41
* return str(self.metric.DetailedScore(self.stats[0]).c_str())
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -15130,7 +15480,7 @@ static Py_ssize_t __pyx_pf_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_5_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":42
*
* def __len__(self):
* return self.stats.size() # <<<<<<<<<<<<<<
@@ -15158,7 +15508,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":44
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
* return self.stats.size()
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -15174,7 +15524,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -15210,6 +15560,9 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *(*__pyx_t_4)(PyObject *);
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -15222,7 +15575,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":45
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":45
*
* def __iter__(self):
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -15281,7 +15634,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":46
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":46
* def __iter__(self):
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
@@ -15328,6 +15681,9 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO
static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
int __pyx_v_index;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
@@ -15345,7 +15701,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":48
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":48
* yield self[i]
*
* def __getitem__(self, int index): # <<<<<<<<<<<<<<
@@ -15365,7 +15721,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":49
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":49
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -15377,10 +15733,10 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj
__pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_v_index < __pyx_t_2);
}
- __pyx_t_3 = (!__pyx_t_1);
+ __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":50
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":50
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<<
@@ -15396,7 +15752,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":51
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":51
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range')
* return self.stats[0][index] # <<<<<<<<<<<<<<
@@ -15425,6 +15781,9 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
+ CYTHON_UNUSED int __pyx_lineno = 0;
+ CYTHON_UNUSED const char *__pyx_filename = NULL;
+ CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
@@ -15438,7 +15797,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":53
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":53
* return self.stats[0][index]
*
* def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
@@ -15451,7 +15810,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":54
*
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0] # <<<<<<<<<<<<<<
@@ -15460,7 +15819,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_
*/
(__pyx_v_self->stats[0]) += (__pyx_v_other->stats[0]);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":55
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0]
* return self # <<<<<<<<<<<<<<
@@ -15490,7 +15849,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":57
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":57
* return self
*
* def __add__(x, y): # <<<<<<<<<<<<<<
@@ -15511,7 +15870,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":58
*
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y) # <<<<<<<<<<<<<<
@@ -15523,7 +15882,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
__pyx_v_sx = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":59
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x) # <<<<<<<<<<<<<<
@@ -15535,7 +15894,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
__pyx_v_sy = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":60
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats() # <<<<<<<<<<<<<<
@@ -15547,7 +15906,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
__pyx_v_result = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":61
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) # <<<<<<<<<<<<<<
@@ -15556,7 +15915,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
*/
__pyx_v_result->stats = new SufficientStats(operator+((__pyx_v_sx->stats[0]), (__pyx_v_sy->stats[0])));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":62
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":62
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric # <<<<<<<<<<<<<<
@@ -15566,7 +15925,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
__pyx_t_2 = __pyx_v_sx->metric;
__pyx_v_result->metric = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":63
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric
* return result # <<<<<<<<<<<<<<
@@ -15597,6 +15956,9 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -15645,7 +16007,7 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":70
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":70
* cdef mteval.CandidateSet* cs
*
* def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
@@ -15659,7 +16021,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
EvaluationMetric *__pyx_t_1;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":71
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":71
*
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) # <<<<<<<<<<<<<<
@@ -15668,7 +16030,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
*/
__pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator>((__pyx_v_evaluator->scorer[0]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":72
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric # <<<<<<<<<<<<<<
@@ -15678,7 +16040,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
__pyx_t_1 = __pyx_v_evaluator->metric;
__pyx_v_self->metric = __pyx_t_1;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":73
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":73
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric
* self.cs = new mteval.CandidateSet() # <<<<<<<<<<<<<<
@@ -15701,7 +16063,7 @@ static void __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self)
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":75
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":75
* self.cs = new mteval.CandidateSet()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -15713,7 +16075,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":76
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -15722,7 +16084,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p
*/
delete __pyx_v_self->scorer;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":77
* def __dealloc__(self):
* del self.scorer
* del self.cs # <<<<<<<<<<<<<<
@@ -15745,7 +16107,7 @@ static Py_ssize_t __pyx_pw_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":79
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":79
* del self.cs
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -15758,7 +16120,7 @@ static Py_ssize_t __pyx_pf_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_5_cde
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":80
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":80
*
* def __len__(self):
* return self.cs.size() # <<<<<<<<<<<<<<
@@ -15778,6 +16140,9 @@ static Py_ssize_t __pyx_pf_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_5_cde
static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/
static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) {
int __pyx_v_k;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
@@ -15795,7 +16160,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":82
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":82
* return self.cs.size()
*
* def __getitem__(self,int k): # <<<<<<<<<<<<<<
@@ -15815,7 +16180,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":83
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":83
*
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size(): # <<<<<<<<<<<<<<
@@ -15826,10 +16191,10 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
if (__pyx_t_1) {
__pyx_t_1 = (__pyx_v_k < __pyx_v_self->cs->size());
}
- __pyx_t_2 = (!__pyx_t_1);
+ __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":84
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
@@ -15845,7 +16210,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":85
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":85
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate() # <<<<<<<<<<<<<<
@@ -15857,7 +16222,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
__pyx_v_candidate = ((struct __pyx_obj_5_cdec_Candidate *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":86
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":86
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k] # <<<<<<<<<<<<<<
@@ -15866,7 +16231,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
*/
__pyx_v_candidate->candidate = (&((__pyx_v_self->cs[0])[__pyx_v_k]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":87
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":87
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) # <<<<<<<<<<<<<<
@@ -15875,7 +16240,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
*/
__pyx_v_candidate->score = __pyx_v_self->metric->ComputeScore(((__pyx_v_self->cs[0])[__pyx_v_k]).eval_feats);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":88
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats)
* return candidate # <<<<<<<<<<<<<<
@@ -15912,7 +16277,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":90
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90
* return candidate
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -15928,7 +16293,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cde
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -15963,6 +16328,9 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj
Py_ssize_t __pyx_t_1;
unsigned int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -15975,7 +16343,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":92
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -15986,14 +16354,14 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":93
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def add_kbest(self, Hypergraph hypergraph, unsigned k):
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -16028,6 +16396,9 @@ static char __pyx_doc_5_cdec_12CandidateSet_11add_kbest[] = "cs.add_kbest(Hyperg
static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_hypergraph = 0;
unsigned int __pyx_v_k;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest (wrapper)", 0);
@@ -16084,7 +16455,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":95
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":95
* yield self[i]
*
* def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
@@ -16097,7 +16468,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_5_c
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":98
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":98
* """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses
* from the hypergraph and add them to the candidate set."""
* self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) # <<<<<<<<<<<<<<
@@ -16121,7 +16492,7 @@ static void __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_se
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":104
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":104
* cdef mteval.EvaluationMetric* metric
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -16133,7 +16504,7 @@ static void __pyx_pf_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":105
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -16157,7 +16528,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":107
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":107
* del self.scorer
*
* def evaluate(self, sentence): # <<<<<<<<<<<<<<
@@ -16179,7 +16550,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("evaluate", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":110
* """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats() # <<<<<<<<<<<<<<
@@ -16191,7 +16562,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
__pyx_v_sf = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":111
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric # <<<<<<<<<<<<<<
@@ -16201,7 +16572,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
__pyx_t_2 = __pyx_v_self->metric;
__pyx_v_sf->metric = __pyx_t_2;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":112
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":112
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -16210,14 +16581,14 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
*/
__pyx_v_sf->stats = new SufficientStats();
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":113
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":113
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(as_str(sentence.strip()), &hyp) # <<<<<<<<<<<<<<
* self.scorer.get().Evaluate(hyp, sf.stats)
* return sf
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -16229,7 +16600,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
TD::ConvertSentence(__pyx_t_4, (&__pyx_v_hyp));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":114
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(as_str(sentence.strip()), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats) # <<<<<<<<<<<<<<
@@ -16238,7 +16609,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
*/
__pyx_v_self->scorer->get()->Evaluate(__pyx_v_hyp, __pyx_v_sf->stats);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":115
* ConvertSentence(as_str(sentence.strip()), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats)
* return sf # <<<<<<<<<<<<<<
@@ -16276,7 +16647,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__p
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":117
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":117
* return sf
*
* def candidate_set(self): # <<<<<<<<<<<<<<
@@ -16294,7 +16665,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("candidate_set", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":119
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":119
* def candidate_set(self):
* """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
* return CandidateSet(self) # <<<<<<<<<<<<<<
@@ -16331,6 +16702,9 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_
static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_name = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -16338,7 +16712,7 @@ static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0};
PyObject* values[1] = {0};
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":125
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":125
* cdef mteval.EvaluationMetric* metric
*
* def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<<
@@ -16403,7 +16777,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":126
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":126
*
* def __cinit__(self, bytes name=None):
* if name: # <<<<<<<<<<<<<<
@@ -16413,14 +16787,14 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p
__pyx_t_1 = (((PyObject *)__pyx_v_name) != Py_None) && (PyBytes_GET_SIZE(((PyObject *)__pyx_v_name)) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":127
* def __cinit__(self, bytes name=None):
* if name:
* self.name = new string(name) # <<<<<<<<<<<<<<
* self.metric = mteval.MetricInstance(self.name[0])
*
*/
- __pyx_t_2 = PyBytes_AsString(((PyObject *)__pyx_v_name)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_name)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
try {
__pyx_t_3 = new std::string(__pyx_t_2);
} catch(...) {
@@ -16429,7 +16803,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p
}
__pyx_v_self->name = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":128
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":128
* if name:
* self.name = new string(name)
* self.metric = mteval.MetricInstance(self.name[0]) # <<<<<<<<<<<<<<
@@ -16460,7 +16834,7 @@ static void __pyx_pw_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":130
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":130
* self.metric = mteval.MetricInstance(self.name[0])
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -16472,7 +16846,7 @@ static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":131
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":131
*
* def __dealloc__(self):
* del self.name # <<<<<<<<<<<<<<
@@ -16488,6 +16862,9 @@ static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_
static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_refs = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
@@ -16531,7 +16908,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":133
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":133
* del self.name
*
* def __call__(self, refs): # <<<<<<<<<<<<<<
@@ -16547,51 +16924,53 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- std::vector<std::vector<WordID> > *__pyx_t_3;
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
- PyObject *__pyx_t_6 = NULL;
- std::vector<WordID> *__pyx_t_7;
- PyObject *__pyx_t_8 = NULL;
- std::string __pyx_t_9;
- EvaluationMetric *__pyx_t_10;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ std::vector<std::vector<WordID> > *__pyx_t_4;
+ Py_ssize_t __pyx_t_5;
+ PyObject *(*__pyx_t_6)(PyObject *);
+ PyObject *__pyx_t_7 = NULL;
+ std::vector<WordID> *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ std::string __pyx_t_10;
+ EvaluationMetric *__pyx_t_11;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__call__", 0);
__Pyx_INCREF(__pyx_v_refs);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":134
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":134
*
* def __call__(self, refs):
* if isinstance(refs, basestring): # <<<<<<<<<<<<<<
* refs = [refs]
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
*/
- __pyx_t_1 = PyObject_IsInstance(__pyx_v_refs, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_1) {
+ __pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_v_refs);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":135
* def __call__(self, refs):
* if isinstance(refs, basestring):
* refs = [refs] # <<<<<<<<<<<<<<
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
* cdef vector[WordID]* refv
*/
- __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_refs);
- PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_refs);
+ PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_refs);
__Pyx_GIVEREF(__pyx_v_refs);
__Pyx_DECREF(__pyx_v_refs);
- __pyx_v_refs = ((PyObject *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_v_refs = ((PyObject *)__pyx_t_3);
+ __pyx_t_3 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":136
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":136
* if isinstance(refs, basestring):
* refs = [refs]
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<<
@@ -16599,14 +16978,14 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
* for ref in refs:
*/
try {
- __pyx_t_3 = new std::vector<std::vector<WordID> >();
+ __pyx_t_4 = new std::vector<std::vector<WordID> >();
} catch(...) {
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_v_refsv = __pyx_t_3;
+ __pyx_v_refsv = __pyx_t_4;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":138
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":138
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
* cdef vector[WordID]* refv
* for ref in refs: # <<<<<<<<<<<<<<
@@ -16614,44 +16993,44 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
* ConvertSentence(as_str(ref.strip()), refv)
*/
if (PyList_CheckExact(__pyx_v_refs) || PyTuple_CheckExact(__pyx_v_refs)) {
- __pyx_t_2 = __pyx_v_refs; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
- __pyx_t_5 = NULL;
+ __pyx_t_3 = __pyx_v_refs; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
+ __pyx_t_6 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_3)) {
+ if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_3)) {
+ if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_6 = __pyx_t_5(__pyx_t_2);
- if (unlikely(!__pyx_t_6)) {
+ __pyx_t_7 = __pyx_t_6(__pyx_t_3);
+ if (unlikely(!__pyx_t_7)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_7);
}
__Pyx_XDECREF(__pyx_v_ref);
- __pyx_v_ref = __pyx_t_6;
- __pyx_t_6 = 0;
+ __pyx_v_ref = __pyx_t_7;
+ __pyx_t_7 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":139
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":139
* cdef vector[WordID]* refv
* for ref in refs:
* refv = new vector[WordID]() # <<<<<<<<<<<<<<
@@ -16659,33 +17038,33 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
* refsv.push_back(refv[0])
*/
try {
- __pyx_t_7 = new std::vector<WordID>();
+ __pyx_t_8 = new std::vector<WordID>();
} catch(...) {
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[5]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_v_refv = __pyx_t_7;
+ __pyx_v_refv = __pyx_t_8;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":140
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":140
* for ref in refs:
* refv = new vector[WordID]()
* ConvertSentence(as_str(ref.strip()), refv) # <<<<<<<<<<<<<<
* refsv.push_back(refv[0])
* del refv
*/
- __pyx_t_6 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__strip); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_8, NULL)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_9 = __pyx_convert_string_from_py_(__pyx_t_6); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- TD::ConvertSentence(__pyx_t_9, __pyx_v_refv);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref, __pyx_n_s__strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_9, NULL)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_10 = __pyx_convert_string_from_py_(__pyx_t_7); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ TD::ConvertSentence(__pyx_t_10, __pyx_v_refv);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":141
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":141
* refv = new vector[WordID]()
* ConvertSentence(as_str(ref.strip()), refv)
* refsv.push_back(refv[0]) # <<<<<<<<<<<<<<
@@ -16694,7 +17073,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_refsv->push_back((__pyx_v_refv[0]));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":142
* ConvertSentence(as_str(ref.strip()), refv)
* refsv.push_back(refv[0])
* del refv # <<<<<<<<<<<<<<
@@ -16703,31 +17082,31 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
delete __pyx_v_refv;
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":144
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":144
* del refv
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator() # <<<<<<<<<<<<<<
* evaluator.metric = self.metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
*/
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SegmentEvaluator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_v_evaluator = ((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SegmentEvaluator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_v_evaluator = ((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":145
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":145
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = self.metric # <<<<<<<<<<<<<<
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
* self.metric.CreateSegmentEvaluator(refsv[0]))
*/
- __pyx_t_10 = __pyx_v_self->metric;
- __pyx_v_evaluator->metric = __pyx_t_10;
+ __pyx_t_11 = __pyx_v_self->metric;
+ __pyx_v_evaluator->metric = __pyx_t_11;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":146
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":146
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = self.metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( # <<<<<<<<<<<<<<
@@ -16736,7 +17115,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator>(__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0])));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":148
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":148
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator # <<<<<<<<<<<<<<
@@ -16745,7 +17124,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
delete __pyx_v_refsv;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":149
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":149
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator
* return evaluator # <<<<<<<<<<<<<<
@@ -16760,9 +17139,9 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("_cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -16785,7 +17164,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":151
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":151
* return evaluator
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -16803,7 +17182,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":152
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":152
*
* def __str__(self):
* return str(self.name.c_str()) # <<<<<<<<<<<<<<
@@ -16811,7 +17190,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(__pyx_v_self->name->c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->name->c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __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[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -16838,7 +17217,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":154
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":154
* return str(self.name.c_str())
*
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<<
@@ -16864,7 +17243,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_compute_score", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":155
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":155
*
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
* cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<<
@@ -16874,7 +17253,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_)));
__pyx_v_metric = ((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":156
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":156
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
* cdef Metric metric = <Metric> metric_
* cdef list ss = [] # <<<<<<<<<<<<<<
@@ -16886,7 +17265,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
__pyx_v_ss = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":158
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":158
* cdef list ss = []
* cdef unsigned i
* for i in range(stats.size()): # <<<<<<<<<<<<<<
@@ -16897,7 +17276,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":159
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":159
* cdef unsigned i
* for i in range(stats.size()):
* ss.append(stats[0][i]) # <<<<<<<<<<<<<<
@@ -16906,18 +17285,18 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
*/
__pyx_t_1 = PyFloat_FromDouble(((__pyx_v_stats[0])[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyList_Append(__pyx_v_ss, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_ss, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":160
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":160
* for i in range(stats.size()):
* ss.append(stats[0][i])
* return metric.score(ss) # <<<<<<<<<<<<<<
*
* cdef void _compute_sufficient_stats(void* metric_,
*/
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_metric), __pyx_n_s__score); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_metric), __pyx_n_s__score); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __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[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
@@ -16948,7 +17327,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":162
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":162
* return metric.score(ss)
*
* cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<<
@@ -16975,7 +17354,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_compute_sufficient_stats", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":166
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":166
* vector[string]* refs,
* mteval.SufficientStats* out):
* cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<<
@@ -16985,7 +17364,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_)));
__pyx_v_metric = ((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":167
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":167
* mteval.SufficientStats* out):
* cdef Metric metric = <Metric> metric_
* cdef list refs_ = [] # <<<<<<<<<<<<<<
@@ -16997,7 +17376,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__pyx_v_refs_ = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":169
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":169
* cdef list refs_ = []
* cdef unsigned i
* for i in range(refs.size()): # <<<<<<<<<<<<<<
@@ -17008,14 +17387,14 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":170
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":170
* cdef unsigned i
* for i in range(refs.size()):
* refs_.append(str(refs[0][i].c_str())) # <<<<<<<<<<<<<<
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_)
* out.fields.resize(len(ss))
*/
- __pyx_t_1 = PyBytes_FromString(((__pyx_v_refs[0])[__pyx_v_i]).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(((__pyx_v_refs[0])[__pyx_v_i]).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __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[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -17025,20 +17404,20 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_5 = PyList_Append(__pyx_v_refs_, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_refs_, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":171
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":171
* for i in range(refs.size()):
* refs_.append(str(refs[0][i].c_str()))
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) # <<<<<<<<<<<<<<
* out.fields.resize(len(ss))
* for i in range(len(ss)):
*/
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_metric), __pyx_n_s__evaluate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_metric), __pyx_n_s__evaluate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyBytes_FromString(__pyx_v_hyp->c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_hyp->c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
@@ -17064,7 +17443,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__pyx_v_ss = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":172
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":172
* refs_.append(str(refs[0][i].c_str()))
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_)
* out.fields.resize(len(ss)) # <<<<<<<<<<<<<<
@@ -17078,7 +17457,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_out->fields.resize(__pyx_t_7);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":173
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":173
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_)
* out.fields.resize(len(ss))
* for i in range(len(ss)): # <<<<<<<<<<<<<<
@@ -17093,7 +17472,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":174
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":174
* out.fields.resize(len(ss))
* for i in range(len(ss)):
* out.fields[i] = ss[i] # <<<<<<<<<<<<<<
@@ -17104,7 +17483,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
{__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ss), __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ss), __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 1, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -17138,7 +17517,7 @@ static int __pyx_pw_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":178
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":178
* cdef class Metric:
* cdef Scorer scorer
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -17159,7 +17538,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":179
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":179
* cdef Scorer scorer
* def __cinit__(self):
* self.scorer = Scorer() # <<<<<<<<<<<<<<
@@ -17174,30 +17553,30 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
__pyx_v_self->scorer = ((struct __pyx_obj_5_cdec_Scorer *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":180
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":180
* def __cinit__(self):
* self.scorer = Scorer()
* cdef bytes class_name = self.__class__.__name__ # <<<<<<<<<<<<<<
* self.scorer.name = new string(class_name)
* self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0],
*/
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_class_name = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":181
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":181
* self.scorer = Scorer()
* cdef bytes class_name = self.__class__.__name__
* self.scorer.name = new string(class_name) # <<<<<<<<<<<<<<
* self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0],
* <void*> self, _compute_sufficient_stats, _compute_score)
*/
- __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_class_name)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_class_name)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
try {
__pyx_t_4 = new std::string(__pyx_t_3);
} catch(...) {
@@ -17206,7 +17585,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
}
__pyx_v_self->scorer->name = __pyx_t_4;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":182
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":182
* cdef bytes class_name = self.__class__.__name__
* self.scorer.name = new string(class_name)
* self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0], # <<<<<<<<<<<<<<
@@ -17232,6 +17611,9 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_refs = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
@@ -17275,7 +17657,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":185
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":185
* <void*> self, _compute_sufficient_stats, _compute_score)
*
* def __call__(self, refs): # <<<<<<<<<<<<<<
@@ -17293,7 +17675,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metri
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__call__", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":186
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":186
*
* def __call__(self, refs):
* return self.scorer(refs) # <<<<<<<<<<<<<<
@@ -17337,7 +17719,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":188
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":188
* return self.scorer(refs)
*
* def score(SufficientStats stats): # <<<<<<<<<<<<<<
@@ -17350,7 +17732,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_5
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("score", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":189
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":189
*
* def score(SufficientStats stats):
* return 0 # <<<<<<<<<<<<<<
@@ -17374,6 +17756,9 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj
static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
CYTHON_UNUSED PyObject *__pyx_v_hyp = 0;
CYTHON_UNUSED PyObject *__pyx_v_refs = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
@@ -17425,7 +17810,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":191
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":191
* return 0
*
* def evaluate(self, hyp, refs): # <<<<<<<<<<<<<<
@@ -17442,7 +17827,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("evaluate", 0);
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":192
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":192
*
* def evaluate(self, hyp, refs):
* return [] # <<<<<<<<<<<<<<
@@ -17548,7 +17933,7 @@ static PyObject *__pyx_pf_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_sel
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_make_config", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)__pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config(__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -17589,9 +17974,13 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
int __pyx_t_9;
- Py_ssize_t __pyx_t_10;
- PyObject *(*__pyx_t_11)(PyObject *);
- PyObject *__pyx_t_12 = NULL;
+ int __pyx_t_10;
+ Py_ssize_t __pyx_t_11;
+ PyObject *(*__pyx_t_12)(PyObject *);
+ PyObject *__pyx_t_13 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -17613,7 +18002,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
* if isinstance(value, dict):
* for name, info in value.items():
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __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[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -17723,7 +18112,8 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
* yield key, '%s %s' % (name, info)
*/
__pyx_t_9 = PyDict_Check(__pyx_cur_scope->__pyx_v_value);
- if (__pyx_t_9) {
+ __pyx_t_10 = (__pyx_t_9 != 0);
+ if (__pyx_t_10) {
/* "_cdec.pyx":35
* for key, value in config.items():
@@ -17732,37 +18122,37 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
* yield key, '%s %s' % (name, info)
* elif isinstance(value, list):
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_value, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_value, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
- __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
- __pyx_t_11 = NULL;
+ __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0;
+ __pyx_t_12 = NULL;
} else {
- __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_6 = __pyx_t_11(__pyx_t_2);
+ __pyx_t_6 = __pyx_t_12(__pyx_t_2);
if (unlikely(!__pyx_t_6)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -17804,20 +18194,20 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
} else
{
Py_ssize_t index = -1;
- __pyx_t_12 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_8 = Py_TYPE(__pyx_t_12)->tp_iternext;
- index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
+ __pyx_t_8 = Py_TYPE(__pyx_t_13)->tp_iternext;
+ index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
- index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
+ index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
goto __pyx_L12_unpacking_done;
__pyx_L11_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -17868,8 +18258,8 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
__pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
- __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
- __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
+ __pyx_cur_scope->__pyx_t_4 = __pyx_t_11;
+ __pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -17884,8 +18274,8 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_XGOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
- __pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
- __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
+ __pyx_t_11 = __pyx_cur_scope->__pyx_t_4;
+ __pyx_t_12 = __pyx_cur_scope->__pyx_t_5;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -17899,7 +18289,8 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
* for name in value:
* yield key, name
*/
- __pyx_t_9 = PyList_Check(__pyx_cur_scope->__pyx_v_value);
+ __pyx_t_10 = PyList_Check(__pyx_cur_scope->__pyx_v_value);
+ __pyx_t_9 = (__pyx_t_10 != 0);
if (__pyx_t_9) {
/* "_cdec.pyx":38
@@ -17910,30 +18301,30 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
* else:
*/
if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_value) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_value)) {
- __pyx_t_2 = __pyx_cur_scope->__pyx_v_value; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
- __pyx_t_11 = NULL;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_v_value; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0;
+ __pyx_t_12 = NULL;
} else {
- __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_6 = __pyx_t_11(__pyx_t_2);
+ __pyx_t_6 = __pyx_t_12(__pyx_t_2);
if (unlikely(!__pyx_t_6)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -17972,8 +18363,8 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
__pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
- __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
- __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
+ __pyx_cur_scope->__pyx_t_4 = __pyx_t_11;
+ __pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -17988,8 +18379,8 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_XGOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
- __pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
- __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
+ __pyx_t_11 = __pyx_cur_scope->__pyx_t_4;
+ __pyx_t_12 = __pyx_cur_scope->__pyx_t_5;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -18050,7 +18441,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
- __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("_make_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -18069,6 +18460,9 @@ struct wrapperbase __pyx_wrapperbase_5_cdec_7Decoder___init__;
static int __pyx_pw_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_config_str = 0;
PyObject *__pyx_v_config = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -18146,7 +18540,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)__pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr(__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -18183,6 +18577,9 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_Generator
PyObject *__pyx_t_3 = NULL;
Py_ssize_t __pyx_t_4;
PyObject *(*__pyx_t_5)(PyObject *);
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -18194,7 +18591,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_Generator
}
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___make_config); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___make_config); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)) { __Pyx_RaiseClosureNameError("config"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -18298,9 +18695,9 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- int __pyx_t_4;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
char *__pyx_t_7;
@@ -18308,7 +18705,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)__pyx_ptype_5_cdec___pyx_scope_struct_24___init__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_24___init__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_24___init__(__pyx_ptype_5_cdec___pyx_scope_struct_24___init__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return -1;
@@ -18327,7 +18724,8 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
*/
__pyx_t_1 = (__pyx_v_config_str == Py_None);
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
/* "_cdec.pyx":52
* Create a decoder using a given configuration. Formalism is required."""
@@ -18336,10 +18734,10 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
* 'csplit', 'tagger', 'lexalign'):
*/
- __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_cur_scope->__pyx_v_config), ((PyObject *)__pyx_n_s__formalism), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_v_formalism = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_cur_scope->__pyx_v_config), ((PyObject *)__pyx_n_s__formalism), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_v_formalism = __pyx_t_3;
+ __pyx_t_3 = 0;
/* "_cdec.pyx":53
* if config_str is None:
@@ -18349,61 +18747,61 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
* raise InvalidConfig('formalism "%s" unknown' % formalism)
*/
__Pyx_INCREF(__pyx_v_formalism);
- __pyx_t_2 = __pyx_v_formalism;
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__scfg), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (((int)__pyx_t_1)) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__fst), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_5 = ((int)__pyx_t_4);
- } else {
+ __pyx_t_3 = __pyx_v_formalism;
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__scfg), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (((int)__pyx_t_2)) {
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fst), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_5 = ((int)__pyx_t_1);
+ } else {
+ __pyx_t_5 = ((int)__pyx_t_2);
}
if (__pyx_t_5) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__lextrans), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = ((int)__pyx_t_1);
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__lextrans), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_1 = ((int)__pyx_t_2);
} else {
- __pyx_t_4 = __pyx_t_5;
+ __pyx_t_1 = __pyx_t_5;
}
- if (__pyx_t_4) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__pb), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = ((int)__pyx_t_5);
+ if (__pyx_t_1) {
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__pb), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_2 = ((int)__pyx_t_5);
} else {
- __pyx_t_1 = __pyx_t_4;
+ __pyx_t_2 = __pyx_t_1;
}
- if (__pyx_t_1) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__csplit), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_5 = ((int)__pyx_t_4);
+ if (__pyx_t_2) {
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__csplit), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = ((int)__pyx_t_1);
} else {
- __pyx_t_5 = __pyx_t_1;
+ __pyx_t_5 = __pyx_t_2;
}
if (__pyx_t_5) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__tagger), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = ((int)__pyx_t_1);
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__tagger), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_1 = ((int)__pyx_t_2);
} else {
- __pyx_t_4 = __pyx_t_5;
+ __pyx_t_1 = __pyx_t_5;
}
- if (__pyx_t_4) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__lexalign), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = ((int)__pyx_t_5);
+ if (__pyx_t_1) {
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__lexalign), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_2 = ((int)__pyx_t_5);
} else {
- __pyx_t_1 = __pyx_t_4;
+ __pyx_t_2 = __pyx_t_1;
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = __pyx_t_1;
- if (__pyx_t_4) {
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = (__pyx_t_2 != 0);
+ if (__pyx_t_1) {
/* "_cdec.pyx":55
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
@@ -18412,21 +18810,21 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config))
* cdef istringstream* config_stream = new istringstream(config_str)
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__InvalidConfig); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), __pyx_v_formalism); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__InvalidConfig); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), __pyx_v_formalism); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __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_6)); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
@@ -18439,19 +18837,19 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
* cdef istringstream* config_stream = new istringstream(config_str)
* self.dec = new decoder.Decoder(config_stream)
*/
- __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = __pyx_pf_5_cdec_7Decoder_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __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;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_v_config_str);
__pyx_v_config_str = __pyx_t_6;
__pyx_t_6 = 0;
@@ -18466,7 +18864,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
* self.dec = new decoder.Decoder(config_stream)
* del config_stream
*/
- __pyx_t_7 = PyBytes_AsString(__pyx_v_config_str); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_config_str); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_config_stream = new std::istringstream(__pyx_t_7);
/* "_cdec.pyx":58
@@ -18494,7 +18892,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
* self.weights.vector = &self.dec.CurrentWeightVector()
* self.weights.owned = True
*/
- __pyx_t_6 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_DenseVector)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __pyx_tp_new_5_cdec_DenseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_DenseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GIVEREF(__pyx_t_6);
@@ -18524,8 +18922,8 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("_cdec.Decoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
@@ -18638,14 +19036,15 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
- PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *(*__pyx_t_6)(PyObject *);
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
- PyObject *(*__pyx_t_9)(PyObject *);
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *(*__pyx_t_10)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -18659,14 +19058,15 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
* elif isinstance(weights, SparseVector):
*/
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_DenseVector));
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
/* "_cdec.pyx":73
* def __set__(self, weights):
* if isinstance(weights, DenseVector):
* self.weights.vector[0] = (<DenseVector> weights).vector[0] # <<<<<<<<<<<<<<
* elif isinstance(weights, SparseVector):
- * self.weights.vector.clear()
+ * ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
*/
(__pyx_v_self->weights->vector[0]) = (((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_weights)->vector[0]);
goto __pyx_L3;
@@ -18676,24 +19076,16 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
* if isinstance(weights, DenseVector):
* self.weights.vector[0] = (<DenseVector> weights).vector[0]
* elif isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
- * self.weights.vector.clear()
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
+ * elif isinstance(weights, dict):
*/
- __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_SparseVector));
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_SparseVector));
+ __pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* "_cdec.pyx":75
* self.weights.vector[0] = (<DenseVector> weights).vector[0]
* elif isinstance(weights, SparseVector):
- * self.weights.vector.clear() # <<<<<<<<<<<<<<
- * ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
- * elif isinstance(weights, dict):
- */
- __pyx_v_self->weights->vector->clear();
-
- /* "_cdec.pyx":76
- * elif isinstance(weights, SparseVector):
- * self.weights.vector.clear()
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) # <<<<<<<<<<<<<<
* elif isinstance(weights, dict):
* self.weights.vector.clear()
@@ -18702,17 +19094,18 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
goto __pyx_L3;
}
- /* "_cdec.pyx":77
- * self.weights.vector.clear()
+ /* "_cdec.pyx":76
+ * elif isinstance(weights, SparseVector):
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
* elif isinstance(weights, dict): # <<<<<<<<<<<<<<
* self.weights.vector.clear()
* for fname, fval in weights.items():
*/
__pyx_t_1 = PyDict_Check(__pyx_v_weights);
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "_cdec.pyx":78
+ /* "_cdec.pyx":77
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
* elif isinstance(weights, dict):
* self.weights.vector.clear() # <<<<<<<<<<<<<<
@@ -18721,55 +19114,55 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
*/
__pyx_v_self->weights->vector->clear();
- /* "_cdec.pyx":79
+ /* "_cdec.pyx":78
* elif isinstance(weights, dict):
* self.weights.vector.clear()
* for fname, fval in weights.items(): # <<<<<<<<<<<<<<
* self.weights[fname] = fval
* else:
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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_4 = 0;
- __pyx_t_5 = NULL;
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
+ __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
+ __pyx_t_6 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_3)) {
+ if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_3)) {
+ if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_3 = __pyx_t_5(__pyx_t_2);
- if (unlikely(!__pyx_t_3)) {
+ __pyx_t_4 = __pyx_t_6(__pyx_t_3);
+ if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_4);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
- PyObject* sequence = __pyx_t_3;
+ 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
@@ -18778,99 +19171,99 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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_7 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
}
- __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[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
#endif
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __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_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_6);
- index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
+ __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
+ index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = NULL;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = NULL;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_fname);
- __pyx_v_fname = __pyx_t_6;
- __pyx_t_6 = 0;
- __Pyx_XDECREF(__pyx_v_fval);
- __pyx_v_fval = __pyx_t_7;
+ __pyx_v_fname = __pyx_t_7;
__pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_v_fval);
+ __pyx_v_fval = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "_cdec.pyx":80
+ /* "_cdec.pyx":79
* self.weights.vector.clear()
* for fname, fval in weights.items():
* self.weights[fname] = fval # <<<<<<<<<<<<<<
* else:
* raise TypeError('cannot initialize weights with %s' % type(weights))
*/
- if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "_cdec.pyx":82
+ /* "_cdec.pyx":81
* self.weights[fname] = fval
* else:
* raise TypeError('cannot initialize weights with %s' % type(weights)) # <<<<<<<<<<<<<<
*
* property formalism:
*/
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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;
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__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;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("_cdec.Decoder.weights.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -18891,7 +19284,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "_cdec.pyx":85
+/* "_cdec.pyx":84
*
* property formalism:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -18910,7 +19303,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "_cdec.pyx":86
+ /* "_cdec.pyx":85
* property formalism:
* def __get__(self):
* cdef variables_map* conf = &self.dec.GetConf() # <<<<<<<<<<<<<<
@@ -18919,7 +19312,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_
*/
__pyx_v_conf = (&__pyx_v_self->dec->GetConf());
- /* "_cdec.pyx":87
+ /* "_cdec.pyx":86
* def __get__(self):
* cdef variables_map* conf = &self.dec.GetConf()
* return str(conf[0]['formalism'].as_str().c_str()) # <<<<<<<<<<<<<<
@@ -18927,14 +19320,14 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_
* def read_weights(self, weights):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(((__pyx_v_conf[0])[__pyx_k__formalism]).as<std::string>().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(((__pyx_v_conf[0])[__pyx_k__formalism]).as<std::string>().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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;
@@ -18966,7 +19359,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "_cdec.pyx":89
+/* "_cdec.pyx":88
* return str(conf[0]['formalism'].as_str().c_str())
*
* def read_weights(self, weights): # <<<<<<<<<<<<<<
@@ -19002,7 +19395,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_weights", 0);
- /* "_cdec.pyx":91
+ /* "_cdec.pyx":90
* def read_weights(self, weights):
* """decoder.read_weights(filename): Read decoder weights from a file."""
* with open(weights) as fp: # <<<<<<<<<<<<<<
@@ -19010,19 +19403,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
* if line.strip().startswith('#'): continue
*/
/*with:*/ {
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_weights);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_weights);
__Pyx_GIVEREF(__pyx_v_weights);
- __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -19037,7 +19430,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_v_fp = __pyx_t_4;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "_cdec.pyx":92
+ /* "_cdec.pyx":91
* """decoder.read_weights(filename): Read decoder weights from a file."""
* with open(weights) as fp:
* for line in fp: # <<<<<<<<<<<<<<
@@ -19048,7 +19441,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_t_4 = __pyx_v_fp; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
__pyx_t_9 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
@@ -19056,23 +19449,23 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
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[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __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[0]; __pyx_lineno = 91; __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[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __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[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __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[0]; __pyx_lineno = 91; __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[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
#endif
} else {
__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[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
@@ -19082,25 +19475,25 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_v_line = __pyx_t_2;
__pyx_t_2 = 0;
- /* "_cdec.pyx":93
+ /* "_cdec.pyx":92
* with open(weights) as fp:
* for line in fp:
* if line.strip().startswith('#'): continue # <<<<<<<<<<<<<<
* fname, value = line.split()
* self.weights[fname.strip()] = float(value)
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_10) {
goto __pyx_L16_continue;
@@ -19108,16 +19501,16 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
}
__pyx_L18:;
- /* "_cdec.pyx":94
+ /* "_cdec.pyx":93
* for line in fp:
* if line.strip().startswith('#'): continue
* fname, value = line.split() # <<<<<<<<<<<<<<
* self.weights[fname.strip()] = float(value)
*
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
@@ -19130,7 +19523,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -19143,16 +19536,16 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_11);
#else
- __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_11);
#endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
@@ -19160,7 +19553,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_GOTREF(__pyx_t_1);
index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L19_unpacking_failed;
__Pyx_GOTREF(__pyx_t_11);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_t_13 = NULL;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
goto __pyx_L20_unpacking_done;
@@ -19168,7 +19561,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_13 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_L20_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_fname);
@@ -19178,22 +19571,22 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_v_value = __pyx_t_11;
__pyx_t_11 = 0;
- /* "_cdec.pyx":95
+ /* "_cdec.pyx":94
* if line.strip().startswith('#'): continue
* fname, value = line.split()
* self.weights[fname.strip()] = float(value) # <<<<<<<<<<<<<<
*
* def translate(self, sentence, grammar=None):
*/
- __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = PyObject_GetAttr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_L16_continue:;
@@ -19211,7 +19604,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "_cdec.pyx":91
+ /* "_cdec.pyx":90
* def read_weights(self, weights):
* """decoder.read_weights(filename): Read decoder weights from a file."""
* with open(weights) as fp: # <<<<<<<<<<<<<<
@@ -19220,11 +19613,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
*/
/*except:*/ {
__Pyx_AddTraceback("_cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_INCREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
@@ -19237,19 +19630,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_15);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_16 = (!__pyx_t_10);
+ if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_16 = ((!(__pyx_t_10 != 0)) != 0);
if (__pyx_t_16) {
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_ErrRestore(__pyx_t_4, __pyx_t_2, __pyx_t_1);
__pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
goto __pyx_L23;
}
__pyx_L23:;
@@ -19277,11 +19670,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
if (__pyx_t_3) {
__pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_51, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __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[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
goto __pyx_L24;
@@ -19317,6 +19710,9 @@ static char __pyx_doc_5_cdec_7Decoder_6translate[] = "decoder.translate(sentence
static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_sentence = 0;
PyObject *__pyx_v_grammar = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("translate (wrapper)", 0);
@@ -19324,7 +19720,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0};
PyObject* values[2] = {0,0};
- /* "_cdec.pyx":97
+ /* "_cdec.pyx":96
* self.weights[fname.strip()] = float(value)
*
* def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
@@ -19353,7 +19749,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -19368,7 +19764,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("translate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("translate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -19386,159 +19782,163 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- std::string __pyx_t_4;
+ PyObject *__pyx_t_4 = NULL;
+ std::string __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("translate", 0);
- /* "_cdec.pyx":101
+ /* "_cdec.pyx":100
* Translate a sentence (string/Lattice) with a grammar (string/list of rules)."""
* cdef bytes input_str
* if isinstance(sentence, basestring): # <<<<<<<<<<<<<<
* input_str = as_str(sentence.strip())
* elif isinstance(sentence, Lattice):
*/
- __pyx_t_1 = PyObject_IsInstance(__pyx_v_sentence, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_1) {
+ __pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_v_sentence);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "_cdec.pyx":102
+ /* "_cdec.pyx":101
* cdef bytes input_str
* if isinstance(sentence, basestring):
* input_str = as_str(sentence.strip()) # <<<<<<<<<<<<<<
* elif isinstance(sentence, Lattice):
* input_str = str(sentence) # PLF format
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_v_input_str = ((PyObject*)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_3 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_input_str = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
goto __pyx_L3;
}
- /* "_cdec.pyx":103
+ /* "_cdec.pyx":102
* if isinstance(sentence, basestring):
* input_str = as_str(sentence.strip())
* elif isinstance(sentence, Lattice): # <<<<<<<<<<<<<<
* input_str = str(sentence) # PLF format
* else:
*/
- __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_sentence, ((PyObject*)__pyx_ptype_5_cdec_Lattice));
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, ((PyObject*)__pyx_ptype_5_cdec_Lattice));
+ __pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "_cdec.pyx":104
+ /* "_cdec.pyx":103
* input_str = as_str(sentence.strip())
* elif isinstance(sentence, Lattice):
* input_str = str(sentence) # PLF format # <<<<<<<<<<<<<<
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence))
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_sentence);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sentence);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_sentence);
__Pyx_GIVEREF(__pyx_v_sentence);
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_input_str = ((PyObject*)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_input_str = ((PyObject*)__pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "_cdec.pyx":106
+ /* "_cdec.pyx":105
* input_str = str(sentence) # PLF format
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence)) # <<<<<<<<<<<<<<
* if grammar:
* if isinstance(grammar, basestring):
*/
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
- /* "_cdec.pyx":107
+ /* "_cdec.pyx":106
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar: # <<<<<<<<<<<<<<
* if isinstance(grammar, basestring):
* self.dec.AddSupplementalGrammarFromString(as_str(grammar))
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- /* "_cdec.pyx":108
+ /* "_cdec.pyx":107
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar:
* if isinstance(grammar, basestring): # <<<<<<<<<<<<<<
* self.dec.AddSupplementalGrammarFromString(as_str(grammar))
* else:
*/
- __pyx_t_1 = PyObject_IsInstance(__pyx_v_grammar, __pyx_builtin_basestring); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_1) {
+ __pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_v_grammar);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
- /* "_cdec.pyx":109
+ /* "_cdec.pyx":108
* if grammar:
* if isinstance(grammar, basestring):
* self.dec.AddSupplementalGrammarFromString(as_str(grammar)) # <<<<<<<<<<<<<<
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
*/
- __pyx_t_3 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_v_grammar, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __pyx_convert_string_from_py_(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_v_self->dec->AddSupplementalGrammarFromString(__pyx_t_4);
+ __pyx_t_4 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_v_grammar, NULL)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __pyx_convert_string_from_py_(__pyx_t_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_self->dec->AddSupplementalGrammarFromString(__pyx_t_5);
goto __pyx_L5;
}
/*else*/ {
- /* "_cdec.pyx":111
+ /* "_cdec.pyx":110
* self.dec.AddSupplementalGrammarFromString(as_str(grammar))
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) # <<<<<<<<<<<<<<
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(input_str, &observer)
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_grammar);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_grammar);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_grammar);
__Pyx_GIVEREF(__pyx_v_grammar);
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_5_cdec_TextGrammar *)__pyx_t_2)->__pyx_base.grammar[0]));
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_5_cdec_TextGrammar *)__pyx_t_3)->__pyx_base.grammar[0]));
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_L5:;
goto __pyx_L4;
}
__pyx_L4:;
- /* "_cdec.pyx":112
+ /* "_cdec.pyx":111
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
* cdef decoder.BasicObserver observer = decoder.BasicObserver() # <<<<<<<<<<<<<<
@@ -19547,58 +19947,58 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
*/
__pyx_v_observer = BasicObserver();
- /* "_cdec.pyx":113
+ /* "_cdec.pyx":112
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(input_str, &observer) # <<<<<<<<<<<<<<
* if observer.hypergraph == NULL:
* raise ParseFailed()
*/
- __pyx_t_4 = __pyx_convert_string_from_py_(((PyObject *)__pyx_v_input_str)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_self->dec->Decode(__pyx_t_4, (&__pyx_v_observer));
+ __pyx_t_5 = __pyx_convert_string_from_py_(((PyObject *)__pyx_v_input_str)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->dec->Decode(__pyx_t_5, (&__pyx_v_observer));
- /* "_cdec.pyx":114
+ /* "_cdec.pyx":113
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(input_str, &observer)
* if observer.hypergraph == NULL: # <<<<<<<<<<<<<<
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph()
*/
- __pyx_t_1 = (__pyx_v_observer.hypergraph == NULL);
- if (__pyx_t_1) {
+ __pyx_t_2 = ((__pyx_v_observer.hypergraph == NULL) != 0);
+ if (__pyx_t_2) {
- /* "_cdec.pyx":115
+ /* "_cdec.pyx":114
* self.dec.Decode(input_str, &observer)
* if observer.hypergraph == NULL:
* raise ParseFailed() # <<<<<<<<<<<<<<
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "_cdec.pyx":116
+ /* "_cdec.pyx":115
* if observer.hypergraph == NULL:
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<<
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "_cdec.pyx":117
+ /* "_cdec.pyx":116
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) # <<<<<<<<<<<<<<
@@ -19606,7 +20006,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
*/
__pyx_v_hg->hg = new Hypergraph((__pyx_v_observer.hypergraph[0]));
- /* "_cdec.pyx":118
+ /* "_cdec.pyx":117
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg # <<<<<<<<<<<<<<
@@ -19619,8 +20019,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -19631,191 +20031,187 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
return __pyx_r;
}
-/* "string.from_py":12
+/* "string.from_py":13
*
* @cname("__pyx_convert_string_from_py_")
* cdef string __pyx_convert_string_from_py_(object o) except *: # <<<<<<<<<<<<<<
- * return string(<char*>o, len(o))
- *
+ * cdef Py_ssize_t length
+ * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
*/
static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) {
+ Py_ssize_t __pyx_v_length;
+ char *__pyx_v_data;
std::string __pyx_r;
__Pyx_RefNannyDeclarations
- char *__pyx_t_1;
- Py_ssize_t __pyx_t_2;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_convert_string_from_py_", 0);
- /* "string.from_py":13
- * @cname("__pyx_convert_string_from_py_")
+ /* "string.from_py":15
* cdef string __pyx_convert_string_from_py_(object o) except *:
- * return string(<char*>o, len(o)) # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t length
+ * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<<
+ * return string(data, length)
+ *
+ */
+ __pyx_v_data = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length));
+
+ /* "string.from_py":16
+ * cdef Py_ssize_t length
+ * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
+ * return string(data, length) # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_1 = PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = std::string(((char *)__pyx_t_1), __pyx_t_2);
+ __pyx_r = std::string(__pyx_v_data, __pyx_v_length);
goto __pyx_L0;
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+static PyObject *__pyx_tp_new_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_5_cdec_6Scorer_1__cinit__(o, a, k) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_5_cdec_DenseVector(PyObject *o) {
+static void __pyx_tp_dealloc_5_cdec_Scorer(PyObject *o) {
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_5_cdec_11DenseVector_3__dealloc__(o);
+ __pyx_pw_5_cdec_6Scorer_3__dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_5_cdec_DenseVector(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
-}
-static int __pyx_mp_ass_subscript_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) {
- if (v) {
- return __pyx_pw_5_cdec_11DenseVector_9__setitem__(o, i, v);
- }
- else {
- PyErr_Format(PyExc_NotImplementedError,
- "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
- return -1;
- }
-}
-
-static PyMethodDef __pyx_methods_5_cdec_DenseVector[] = {
- {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_11DenseVector_13dot)},
- {__Pyx_NAMESTR("tosparse"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_16tosparse, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_11DenseVector_15tosparse)},
+static PyMethodDef __pyx_methods_5_cdec_Scorer[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number_DenseVector = {
- 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*/
+static PyTypeObject __pyx_type_5_cdec_Scorer = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.Scorer"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_Scorer), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec_Scorer, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
- 0, /*nb_long*/
+ 0, /*tp_compare*/
#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*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ __pyx_pw_5_cdec_6Scorer_5__call__, /*tp_call*/
+ __pyx_pw_5_cdec_6Scorer_7__str__, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec_Scorer, /*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_5_cdec_Scorer, /*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 PySequenceMethods __pyx_tp_as_sequence_DenseVector = {
- __pyx_pw_5_cdec_11DenseVector_5__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_5_cdec_DenseVector, /*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 struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *__pyx_freelist_5_cdec___pyx_scope_struct_24___init__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_24___init__ = 0;
-static PyMappingMethods __pyx_tp_as_mapping_DenseVector = {
- __pyx_pw_5_cdec_11DenseVector_5__len__, /*mp_length*/
- __pyx_pw_5_cdec_11DenseVector_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_5_cdec_DenseVector, /*mp_ass_subscript*/
-};
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_24___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_24___init__[--__pyx_freecount_5_cdec___pyx_scope_struct_24___init__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o);
+ p->__pyx_v_config = 0;
+ return o;
+}
-static PyBufferProcs __pyx_tp_as_buffer_DenseVector = {
- #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 void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24___init__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_config);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_24___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_24___init__[__pyx_freecount_5_cdec___pyx_scope_struct_24___init__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_24___init__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o;
+ if (p->__pyx_v_config) {
+ e = (*v)(p->__pyx_v_config, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_24___init__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_config);
+ p->__pyx_v_config = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_24___init__[] = {
+ {0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_DenseVector = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24___init__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.DenseVector"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_DenseVector), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_24___init__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_DenseVector, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24___init__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -19825,24 +20221,24 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_DenseVector, /*tp_as_number*/
- &__pyx_tp_as_sequence_DenseVector, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_DenseVector, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer_DenseVector, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_24___init__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_24___init__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_5_cdec_11DenseVector_11__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_DenseVector, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_24___init__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -19850,9 +20246,9 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_11DenseVector_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_DenseVector, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_24___init__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -19866,153 +20262,46 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_SparseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_SparseVector(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_5_cdec_12SparseVector_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
- }
+static void __pyx_tp_dealloc_5_cdec_NTRef(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_5_cdec_SparseVector(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
+
+static PyObject *__pyx_getprop_5_cdec_5NTRef_ref(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_5NTRef_3ref_1__get__(o);
}
-static int __pyx_mp_ass_subscript_5_cdec_SparseVector(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_setprop_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_5_cdec_12SparseVector_9__setitem__(o, i, v);
+ return __pyx_pw_5_cdec_5NTRef_3ref_3__set__(o, v);
}
else {
- PyErr_Format(PyExc_NotImplementedError,
- "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
return -1;
}
}
-static PyMethodDef __pyx_methods_5_cdec_SparseVector[] = {
- {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_5copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_12SparseVector_4copy)},
- {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_12SparseVector_13dot)},
+static PyMethodDef __pyx_methods_5_cdec_NTRef[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number_SparseVector = {
- __pyx_pw_5_cdec_12SparseVector_32__add__, /*nb_add*/
- __pyx_pw_5_cdec_12SparseVector_34__sub__, /*nb_subtract*/
- __pyx_pw_5_cdec_12SparseVector_36__mul__, /*nb_multiply*/
- #if PY_MAJOR_VERSION < 3
- __pyx_pw_5_cdec_12SparseVector_38__div__, /*nb_divide*/
- #endif
- 0, /*nb_remainder*/
- 0, /*nb_divmod*/
- 0, /*nb_power*/
- __pyx_pw_5_cdec_12SparseVector_22__neg__, /*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
- __pyx_pw_5_cdec_12SparseVector_24__iadd__, /*nb_inplace_add*/
- __pyx_pw_5_cdec_12SparseVector_26__isub__, /*nb_inplace_subtract*/
- __pyx_pw_5_cdec_12SparseVector_28__imul__, /*nb_inplace_multiply*/
- #if PY_MAJOR_VERSION < 3
- __pyx_pw_5_cdec_12SparseVector_30__idiv__, /*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_SparseVector = {
- __pyx_pw_5_cdec_12SparseVector_18__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_5_cdec_SparseVector, /*sq_item*/
- 0, /*sq_slice*/
- 0, /*sq_ass_item*/
- 0, /*sq_ass_slice*/
- __pyx_pw_5_cdec_12SparseVector_20__contains__, /*sq_contains*/
- 0, /*sq_inplace_concat*/
- 0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_SparseVector = {
- __pyx_pw_5_cdec_12SparseVector_18__len__, /*mp_length*/
- __pyx_pw_5_cdec_12SparseVector_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_5_cdec_SparseVector, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_SparseVector = {
- #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 struct PyGetSetDef __pyx_getsets_5_cdec_NTRef[] = {
+ {(char *)"ref", __pyx_getprop_5_cdec_5NTRef_ref, __pyx_setprop_5_cdec_5NTRef_ref, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_SparseVector = {
+static PyTypeObject __pyx_type_5_cdec_NTRef = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.SparseVector"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_SparseVector), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.NTRef"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_NTRef), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_SparseVector, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_NTRef, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -20022,34 +20311,34 @@ static PyTypeObject __pyx_type_5_cdec_SparseVector = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_SparseVector, /*tp_as_number*/
- &__pyx_tp_as_sequence_SparseVector, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_SparseVector, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- 0, /*tp_str*/
+ __pyx_pw_5_cdec_5NTRef_3__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_SparseVector, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
- __pyx_pw_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_5_cdec_12SparseVector_11__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_SparseVector, /*tp_methods*/
+ __pyx_methods_5_cdec_NTRef, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_5_cdec_NTRef, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_12SparseVector_1__init__, /*tp_init*/
+ __pyx_pw_5_cdec_5NTRef_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_SparseVector, /*tp_new*/
+ __pyx_tp_new_5_cdec_NTRef, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -20063,182 +20352,65 @@ static PyTypeObject __pyx_type_5_cdec_SparseVector = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec_NT *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec_NT *)o);
- p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_22___iter__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_22___iter__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_22___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_22___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_22___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o);
+ p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_NT(PyObject *o) {
- struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->cat);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_22___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_22___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_22___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec_NT(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_22___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o;
- if (p->cat) {
- e = (*v)(p->cat, a); if (e) return e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___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_5_cdec_NT(PyObject *o) {
- struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->cat);
- p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_CandidateSet *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyObject *__pyx_getprop_5_cdec_2NT_cat(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_2NT_3cat_1__get__(o);
-}
-
-static int __pyx_setprop_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_2NT_3cat_3__set__(o, v);
- }
- else {
- return __pyx_pw_5_cdec_2NT_3cat_5__del__(o);
- }
-}
-
-static PyObject *__pyx_getprop_5_cdec_2NT_ref(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_2NT_3ref_1__get__(o);
-}
-
-static int __pyx_setprop_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_2NT_3ref_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
- }
-}
-
-static PyMethodDef __pyx_methods_5_cdec_NT[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_22___iter__[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_NT[] = {
- {(char *)"cat", __pyx_getprop_5_cdec_2NT_cat, __pyx_setprop_5_cdec_2NT_cat, 0, 0},
- {(char *)"ref", __pyx_getprop_5_cdec_2NT_ref, __pyx_setprop_5_cdec_2NT_ref, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_NT = {
- 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_NT = {
- 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_NT = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_NT = {
- #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_5_cdec_NT = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.NT"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_NT), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_22___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_NT, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -20248,34 +20420,34 @@ static PyTypeObject __pyx_type_5_cdec_NT = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_NT, /*tp_as_number*/
- &__pyx_tp_as_sequence_NT, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_NT, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_5_cdec_2NT_3__str__, /*tp_str*/
+ 0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_NT, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec_NT, /*tp_traverse*/
- __pyx_tp_clear_5_cdec_NT, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_22___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_22___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_NT, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_22___iter__, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_NT, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_2NT_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_NT, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -20289,23 +20461,33 @@ static PyTypeObject __pyx_type_5_cdec_NT = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+static PyObject *__pyx_tp_new_5_cdec_Grammar(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_NTRef(PyObject *o) {
+static void __pyx_tp_dealloc_5_cdec_Grammar(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_5_cdec_7Grammar_1__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_5NTRef_ref(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_5NTRef_3ref_1__get__(o);
+static PyObject *__pyx_getprop_5_cdec_7Grammar_name(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_7Grammar_4name_1__get__(o);
}
-static int __pyx_setprop_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_5_cdec_7Grammar_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_5_cdec_5NTRef_3ref_3__set__(o, v);
+ return __pyx_pw_5_cdec_7Grammar_4name_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -20313,119 +20495,21 @@ static int __pyx_setprop_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUS
}
}
-static PyMethodDef __pyx_methods_5_cdec_NTRef[] = {
+static PyMethodDef __pyx_methods_5_cdec_Grammar[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_NTRef[] = {
- {(char *)"ref", __pyx_getprop_5_cdec_5NTRef_ref, __pyx_setprop_5_cdec_5NTRef_ref, 0, 0},
+static struct PyGetSetDef __pyx_getsets_5_cdec_Grammar[] = {
+ {(char *)"name", __pyx_getprop_5_cdec_7Grammar_name, __pyx_setprop_5_cdec_7Grammar_name, 0, 0},
{0, 0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number_NTRef = {
- 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_NTRef = {
- 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_NTRef = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_NTRef = {
- #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_5_cdec_NTRef = {
+static PyTypeObject __pyx_type_5_cdec_Grammar = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.NTRef"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_NTRef), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.Grammar"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_Grammar), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_NTRef, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_Grammar, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -20435,34 +20519,34 @@ static PyTypeObject __pyx_type_5_cdec_NTRef = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_NTRef, /*tp_as_number*/
- &__pyx_tp_as_sequence_NTRef, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_NTRef, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_5_cdec_5NTRef_3__str__, /*tp_str*/
+ 0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_NTRef, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_5_cdec_7Grammar_3__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_NTRef, /*tp_methods*/
+ __pyx_methods_5_cdec_Grammar, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_NTRef, /*tp_getset*/
+ __pyx_getsets_5_cdec_Grammar, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_5NTRef_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_NTRef, /*tp_new*/
+ __pyx_tp_new_5_cdec_Grammar, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -20476,217 +20560,113 @@ static PyTypeObject __pyx_type_5_cdec_NTRef = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- return o;
-}
+static struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *__pyx_freelist_5_cdec___pyx_scope_struct_20_lines[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_20_lines = 0;
-static void __pyx_tp_dealloc_5_cdec_TRule(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_5_cdec_5TRule_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_20_lines > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_20_lines[--__pyx_freecount_5_cdec___pyx_scope_struct_20_lines];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
}
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_5TRule_arity(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_5TRule_5arity_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_5TRule_f(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_5TRule_1f_1__get__(o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o);
+ p->__pyx_outer_scope = 0;
+ p->__pyx_v_delta = 0;
+ p->__pyx_v_i = 0;
+ p->__pyx_v_label = 0;
+ p->__pyx_v_weight = 0;
+ p->__pyx_t_1 = 0;
+ p->__pyx_t_3 = 0;
+ return o;
}
-static int __pyx_setprop_5_cdec_5TRule_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_5TRule_1f_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_delta);
+ Py_CLEAR(p->__pyx_v_i);
+ Py_CLEAR(p->__pyx_v_label);
+ Py_CLEAR(p->__pyx_v_weight);
+ Py_CLEAR(p->__pyx_t_1);
+ Py_CLEAR(p->__pyx_t_3);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_20_lines < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_20_lines[__pyx_freecount_5_cdec___pyx_scope_struct_20_lines++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
}
-static PyObject *__pyx_getprop_5_cdec_5TRule_e(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_5TRule_1e_1__get__(o);
-}
-
-static int __pyx_setprop_5_cdec_5TRule_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_5TRule_1e_3__set__(o, v);
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_20_lines(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+ if (p->__pyx_v_delta) {
+ e = (*v)(p->__pyx_v_delta, a); if (e) return e;
}
-}
-
-static PyObject *__pyx_getprop_5_cdec_5TRule_a(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_5TRule_1a_1__get__(o);
-}
-
-static int __pyx_setprop_5_cdec_5TRule_a(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_5TRule_1a_4__set__(o, v);
+ if (p->__pyx_v_i) {
+ e = (*v)(p->__pyx_v_i, a); if (e) return e;
}
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+ if (p->__pyx_v_label) {
+ e = (*v)(p->__pyx_v_label, a); if (e) return e;
}
-}
-
-static PyObject *__pyx_getprop_5_cdec_5TRule_scores(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_5TRule_6scores_1__get__(o);
-}
-
-static int __pyx_setprop_5_cdec_5TRule_scores(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_5TRule_6scores_3__set__(o, v);
+ if (p->__pyx_v_weight) {
+ e = (*v)(p->__pyx_v_weight, a); if (e) return e;
}
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+ if (p->__pyx_t_1) {
+ e = (*v)(p->__pyx_t_1, a); if (e) return e;
}
+ if (p->__pyx_t_3) {
+ e = (*v)(p->__pyx_t_3, a); if (e) return e;
+ }
+ return 0;
}
-static PyObject *__pyx_getprop_5_cdec_5TRule_lhs(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_5TRule_3lhs_1__get__(o);
-}
-
-static int __pyx_setprop_5_cdec_5TRule_lhs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_5TRule_3lhs_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
- }
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_20_lines(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_delta);
+ p->__pyx_v_delta = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_i);
+ p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_label);
+ p->__pyx_v_label = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_weight);
+ p->__pyx_v_weight = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_1);
+ p->__pyx_t_1 = 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);
+ return 0;
}
-static PyMethodDef __pyx_methods_5_cdec_TRule[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_20_lines[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_TRule[] = {
- {(char *)"arity", __pyx_getprop_5_cdec_5TRule_arity, 0, 0, 0},
- {(char *)"f", __pyx_getprop_5_cdec_5TRule_f, __pyx_setprop_5_cdec_5TRule_f, 0, 0},
- {(char *)"e", __pyx_getprop_5_cdec_5TRule_e, __pyx_setprop_5_cdec_5TRule_e, 0, 0},
- {(char *)"a", __pyx_getprop_5_cdec_5TRule_a, __pyx_setprop_5_cdec_5TRule_a, 0, 0},
- {(char *)"scores", __pyx_getprop_5_cdec_5TRule_scores, __pyx_setprop_5_cdec_5TRule_scores, 0, 0},
- {(char *)"lhs", __pyx_getprop_5_cdec_5TRule_lhs, __pyx_setprop_5_cdec_5TRule_lhs, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_TRule = {
- 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_TRule = {
- 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_TRule = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_TRule = {
- #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_5_cdec_TRule = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.TRule"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_TRule), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_20_lines"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_TRule, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -20696,34 +20676,34 @@ static PyTypeObject __pyx_type_5_cdec_TRule = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_TRule, /*tp_as_number*/
- &__pyx_tp_as_sequence_TRule, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_TRule, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_5_cdec_5TRule_5__str__, /*tp_str*/
+ 0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_TRule, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_20_lines, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_20_lines, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_TRule, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_20_lines, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_TRule, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_5TRule_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_TRule, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_20_lines, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -20737,120 +20717,65 @@ static PyTypeObject __pyx_type_5_cdec_TRule = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k) {
- PyObject *o = __pyx_tp_new_5_cdec_TRule(t, a, k);
- if (!o) return 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *__pyx_freelist_5_cdec___pyx_scope_struct_12_sample_trees[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_12_sample_trees[--__pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o);
+ p->__pyx_v_self = 0;
return o;
}
-static PyMethodDef __pyx_methods_5_cdec_MRule[] = {
- {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_MRule = {
- 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 void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_12_sample_trees[__pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
+}
-static PySequenceMethods __pyx_tp_as_sequence_MRule = {
- 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 int __pyx_tp_traverse_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ return 0;
+}
-static PyMappingMethods __pyx_tp_as_mapping_MRule = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyBufferProcs __pyx_tp_as_buffer_MRule = {
- #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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_12_sample_trees[] = {
+ {0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_MRule = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.MRule"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_MRule), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_12_sample_trees"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_TRule, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -20860,28 +20785,24 @@ static PyTypeObject __pyx_type_5_cdec_MRule = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_MRule, /*tp_as_number*/
- &__pyx_tp_as_sequence_MRule, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_MRule, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- #if CYTHON_COMPILING_IN_PYPY
- __pyx_pw_5_cdec_5TRule_5__str__, /*tp_str*/
- #else
0, /*tp_str*/
- #endif
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_MRule, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_MRule, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -20889,9 +20810,9 @@ static PyTypeObject __pyx_type_5_cdec_MRule = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_5MRule_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_MRule, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -20905,152 +20826,65 @@ static PyTypeObject __pyx_type_5_cdec_MRule = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Grammar(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_13___get__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_13___get__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_13___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_13___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_13___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o);
+ p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_Grammar(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_5_cdec_7Grammar_1__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_13___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_13___get__[__pyx_freecount_5_cdec___pyx_scope_struct_13___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_7Grammar_name(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_7Grammar_4name_1__get__(o);
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_13___get__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ return 0;
}
-static int __pyx_setprop_5_cdec_7Grammar_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_7Grammar_4name_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
- }
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_13___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
}
-static PyMethodDef __pyx_methods_5_cdec_Grammar[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_13___get__[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_Grammar[] = {
- {(char *)"name", __pyx_getprop_5_cdec_7Grammar_name, __pyx_setprop_5_cdec_7Grammar_name, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_Grammar = {
- 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_Grammar = {
- 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_Grammar = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_Grammar = {
- #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_5_cdec_Grammar = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_13___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.Grammar"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_Grammar), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_13___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_Grammar, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21060,26 +20894,26 @@ static PyTypeObject __pyx_type_5_cdec_Grammar = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_Grammar, /*tp_as_number*/
- &__pyx_tp_as_sequence_Grammar, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Grammar, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer_Grammar, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_13___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_13___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_5_cdec_7Grammar_3__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_Grammar, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_13___get__, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_Grammar, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -21087,7 +20921,7 @@ static PyTypeObject __pyx_type_5_cdec_Grammar = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_Grammar, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_13___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21101,120 +20935,65 @@ static PyTypeObject __pyx_type_5_cdec_Grammar = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k) {
- PyObject *o = __pyx_tp_new_5_cdec_Grammar(t, a, k);
- if (!o) return 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *__pyx_freelist_5_cdec___pyx_scope_struct_2__phrase[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_2__phrase = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_2__phrase > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_2__phrase[--__pyx_freecount_5_cdec___pyx_scope_struct_2__phrase];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o);
+ p->__pyx_v_phrase = 0;
return o;
}
-static PyMethodDef __pyx_methods_5_cdec_TextGrammar[] = {
- {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_TextGrammar = {
- 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 void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_phrase);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_2__phrase < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_2__phrase[__pyx_freecount_5_cdec___pyx_scope_struct_2__phrase++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
+}
-static PySequenceMethods __pyx_tp_as_sequence_TextGrammar = {
- 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 int __pyx_tp_traverse_5_cdec___pyx_scope_struct_2__phrase(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o;
+ if (p->__pyx_v_phrase) {
+ e = (*v)(p->__pyx_v_phrase, a); if (e) return e;
+ }
+ return 0;
+}
-static PyMappingMethods __pyx_tp_as_mapping_TextGrammar = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_phrase);
+ p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyBufferProcs __pyx_tp_as_buffer_TextGrammar = {
- #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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_2__phrase[] = {
+ {0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_TextGrammar = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.TextGrammar"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_TextGrammar), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_2__phrase"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_Grammar, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_2__phrase, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21224,28 +21003,24 @@ static PyTypeObject __pyx_type_5_cdec_TextGrammar = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_TextGrammar, /*tp_as_number*/
- &__pyx_tp_as_sequence_TextGrammar, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_TextGrammar, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer_TextGrammar, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_2__phrase, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_2__phrase, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- #if CYTHON_COMPILING_IN_PYPY
- __pyx_pw_5_cdec_7Grammar_3__iter__, /*tp_iter*/
- #else
0, /*tp_iter*/
- #endif
0, /*tp_iternext*/
- __pyx_methods_5_cdec_TextGrammar, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_2__phrase, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -21253,9 +21028,9 @@ static PyTypeObject __pyx_type_5_cdec_TextGrammar = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_11TextGrammar_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_TextGrammar, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21268,137 +21043,47 @@ static PyTypeObject __pyx_type_5_cdec_TextGrammar = {
0, /*tp_version_tag*/
#endif
};
-static struct __pyx_vtabstruct_5_cdec_Hypergraph __pyx_vtable_5_cdec_Hypergraph;
-static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec_Hypergraph *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec_Hypergraph *)o);
- p->__pyx_vtab = __pyx_vtabptr_5_cdec_Hypergraph;
+static PyObject *__pyx_tp_new_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_5_cdec_12CandidateSet_1__cinit__(o, a, k) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_5_cdec_Hypergraph(PyObject *o) {
+static void __pyx_tp_dealloc_5_cdec_CandidateSet(PyObject *o) {
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_5_cdec_10Hypergraph_1__dealloc__(o);
+ __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-
-static PyObject *__pyx_getprop_5_cdec_10Hypergraph_edges(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_10Hypergraph_nodes(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_10Hypergraph_goal(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(o);
+static PyObject *__pyx_sq_item_5_cdec_CandidateSet(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
}
-static PyMethodDef __pyx_methods_5_cdec_Hypergraph[] = {
- {__Pyx_NAMESTR("viterbi"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_3viterbi, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_2viterbi)},
- {__Pyx_NAMESTR("viterbi_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_4viterbi_trees)},
- {__Pyx_NAMESTR("viterbi_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_7viterbi_features, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_6viterbi_features)},
- {__Pyx_NAMESTR("viterbi_forest"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_9viterbi_forest, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("viterbi_joshua"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_11viterbi_joshua, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_10viterbi_joshua)},
- {__Pyx_NAMESTR("kbest"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_13kbest, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_12kbest)},
- {__Pyx_NAMESTR("kbest_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_16kbest_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_15kbest_trees)},
- {__Pyx_NAMESTR("kbest_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_19kbest_features, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_18kbest_features)},
- {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_22sample, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_21sample)},
- {__Pyx_NAMESTR("sample_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_25sample_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_24sample_trees)},
- {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_28intersect, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_27intersect)},
- {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_30prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_29prune)},
- {__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_32lattice, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_31lattice)},
- {__Pyx_NAMESTR("plf"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_34plf, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_33plf)},
- {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_36reweight, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_35reweight)},
- {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_38inside_outside, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_37inside_outside)},
+static PyMethodDef __pyx_methods_5_cdec_CandidateSet[] = {
+ {__Pyx_NAMESTR("add_kbest"), (PyCFunction)__pyx_pw_5_cdec_12CandidateSet_12add_kbest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_12CandidateSet_11add_kbest)},
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_Hypergraph[] = {
- {(char *)"edges", __pyx_getprop_5_cdec_10Hypergraph_edges, 0, 0, 0},
- {(char *)"nodes", __pyx_getprop_5_cdec_10Hypergraph_nodes, 0, 0, 0},
- {(char *)"goal", __pyx_getprop_5_cdec_10Hypergraph_goal, 0, 0, 0},
- {(char *)"npaths", __pyx_getprop_5_cdec_10Hypergraph_npaths, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_Hypergraph = {
- 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_Hypergraph = {
- 0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_CandidateSet = {
+ __pyx_pw_5_cdec_12CandidateSet_5__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
- 0, /*sq_item*/
+ __pyx_sq_item_5_cdec_CandidateSet, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
@@ -21407,39 +21092,18 @@ static PySequenceMethods __pyx_tp_as_sequence_Hypergraph = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping_Hypergraph = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_CandidateSet = {
+ __pyx_pw_5_cdec_12CandidateSet_5__len__, /*mp_length*/
+ __pyx_pw_5_cdec_12CandidateSet_7__getitem__, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer_Hypergraph = {
- #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_5_cdec_Hypergraph = {
+static PyTypeObject __pyx_type_5_cdec_CandidateSet = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.Hypergraph"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_Hypergraph), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.CandidateSet"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_CandidateSet), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_Hypergraph, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_CandidateSet, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21449,26 +21113,26 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_Hypergraph, /*tp_as_number*/
- &__pyx_tp_as_sequence_Hypergraph, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Hypergraph, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ &__pyx_tp_as_sequence_CandidateSet, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_CandidateSet, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_Hypergraph, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_5_cdec_12CandidateSet_9__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_Hypergraph, /*tp_methods*/
+ __pyx_methods_5_cdec_CandidateSet, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_Hypergraph, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -21476,7 +21140,7 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_Hypergraph, /*tp_new*/
+ __pyx_tp_new_5_cdec_CandidateSet, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21489,200 +21153,66 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = {
0, /*tp_version_tag*/
#endif
};
-static struct __pyx_vtabstruct_5_cdec_HypergraphEdge __pyx_vtable_5_cdec_HypergraphEdge;
-static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec_HypergraphEdge *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec_HypergraphEdge *)o);
- p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphEdge;
- p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_14___get__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_14___get__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_14___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_14___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_14___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o);
+ p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_HypergraphEdge(PyObject *o) {
- struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_14___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->trule);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_14___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_14___get__[__pyx_freecount_5_cdec___pyx_scope_struct_14___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec_HypergraphEdge(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_14___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
- if (p->trule) {
- e = (*v)(((PyObject*)p->trule), a); if (e) return e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)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_5_cdec_HypergraphEdge(PyObject *o) {
- struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_14___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->trule);
- p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_head_node(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_src_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphEdge_8src_span_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_feature_values(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_prob(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_trule(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(o);
-}
-
-static int __pyx_setprop_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(o, v);
- }
- else {
- return __pyx_pw_5_cdec_14HypergraphEdge_5trule_5__del__(o);
- }
-}
-
-static PyMethodDef __pyx_methods_5_cdec_HypergraphEdge[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_14___get__[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_HypergraphEdge[] = {
- {(char *)"head_node", __pyx_getprop_5_cdec_14HypergraphEdge_head_node, 0, 0, 0},
- {(char *)"tail_nodes", __pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes, 0, 0, 0},
- {(char *)"span", __pyx_getprop_5_cdec_14HypergraphEdge_span, 0, 0, 0},
- {(char *)"src_span", __pyx_getprop_5_cdec_14HypergraphEdge_src_span, 0, 0, 0},
- {(char *)"feature_values", __pyx_getprop_5_cdec_14HypergraphEdge_feature_values, 0, 0, 0},
- {(char *)"prob", __pyx_getprop_5_cdec_14HypergraphEdge_prob, 0, 0, 0},
- {(char *)"trule", __pyx_getprop_5_cdec_14HypergraphEdge_trule, __pyx_setprop_5_cdec_14HypergraphEdge_trule, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_HypergraphEdge = {
- 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_HypergraphEdge = {
- __pyx_pw_5_cdec_14HypergraphEdge_1__len__, /*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_HypergraphEdge = {
- __pyx_pw_5_cdec_14HypergraphEdge_1__len__, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_HypergraphEdge = {
- #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_5_cdec_HypergraphEdge = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.HypergraphEdge"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_HypergraphEdge), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_14___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_HypergraphEdge, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_14___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21692,26 +21222,26 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_HypergraphEdge, /*tp_as_number*/
- &__pyx_tp_as_sequence_HypergraphEdge, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_HypergraphEdge, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer_HypergraphEdge, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec_HypergraphEdge, /*tp_traverse*/
- __pyx_tp_clear_5_cdec_HypergraphEdge, /*tp_clear*/
- __pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__, /*tp_richcompare*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_14___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_14___get__, /*tp_clear*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_HypergraphEdge, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_14___get__, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_HypergraphEdge, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -21719,7 +21249,7 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_HypergraphEdge, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_14___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21732,153 +21262,121 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = {
0, /*tp_version_tag*/
#endif
};
-static struct __pyx_vtabstruct_5_cdec_HypergraphNode __pyx_vtable_5_cdec_HypergraphNode;
-static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec_HypergraphNode *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec_HypergraphNode *)o);
- p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphNode;
+static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_HypergraphNode(PyObject *o) {
+static void __pyx_tp_dealloc_5_cdec_TRule(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_5_cdec_5TRule_3__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_in_edges(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(o);
+static PyObject *__pyx_getprop_5_cdec_5TRule_arity(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_5TRule_5arity_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_out_edges(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(o);
+static PyObject *__pyx_getprop_5_cdec_5TRule_f(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_5TRule_1f_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(o);
+static int __pyx_setprop_5_cdec_5TRule_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_5TRule_1f_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(o);
+static PyObject *__pyx_getprop_5_cdec_5TRule_e(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_5TRule_1e_1__get__(o);
}
-static PyMethodDef __pyx_methods_5_cdec_HypergraphNode[] = {
- {0, 0, 0, 0}
-};
+static int __pyx_setprop_5_cdec_5TRule_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_5TRule_1e_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
-static struct PyGetSetDef __pyx_getsets_5_cdec_HypergraphNode[] = {
- {(char *)"in_edges", __pyx_getprop_5_cdec_14HypergraphNode_in_edges, 0, 0, 0},
- {(char *)"out_edges", __pyx_getprop_5_cdec_14HypergraphNode_out_edges, 0, 0, 0},
- {(char *)"span", __pyx_getprop_5_cdec_14HypergraphNode_span, 0, 0, 0},
- {(char *)"cat", __pyx_getprop_5_cdec_14HypergraphNode_cat, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
+static PyObject *__pyx_getprop_5_cdec_5TRule_a(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_5TRule_1a_1__get__(o);
+}
-static PyNumberMethods __pyx_tp_as_number_HypergraphNode = {
- 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 int __pyx_setprop_5_cdec_5TRule_a(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_5TRule_1a_4__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
-static PySequenceMethods __pyx_tp_as_sequence_HypergraphNode = {
- 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 PyObject *__pyx_getprop_5_cdec_5TRule_scores(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_5TRule_6scores_1__get__(o);
+}
-static PyMappingMethods __pyx_tp_as_mapping_HypergraphNode = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
+static int __pyx_setprop_5_cdec_5TRule_scores(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_5TRule_6scores_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyObject *__pyx_getprop_5_cdec_5TRule_lhs(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_5TRule_3lhs_1__get__(o);
+}
+
+static int __pyx_setprop_5_cdec_5TRule_lhs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_5TRule_3lhs_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_5_cdec_TRule[] = {
+ {0, 0, 0, 0}
};
-static PyBufferProcs __pyx_tp_as_buffer_HypergraphNode = {
- #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 struct PyGetSetDef __pyx_getsets_5_cdec_TRule[] = {
+ {(char *)"arity", __pyx_getprop_5_cdec_5TRule_arity, 0, 0, 0},
+ {(char *)"f", __pyx_getprop_5_cdec_5TRule_f, __pyx_setprop_5_cdec_5TRule_f, 0, 0},
+ {(char *)"e", __pyx_getprop_5_cdec_5TRule_e, __pyx_setprop_5_cdec_5TRule_e, 0, 0},
+ {(char *)"a", __pyx_getprop_5_cdec_5TRule_a, __pyx_setprop_5_cdec_5TRule_a, 0, 0},
+ {(char *)"scores", __pyx_getprop_5_cdec_5TRule_scores, __pyx_setprop_5_cdec_5TRule_scores, 0, 0},
+ {(char *)"lhs", __pyx_getprop_5_cdec_5TRule_lhs, __pyx_setprop_5_cdec_5TRule_lhs, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_HypergraphNode = {
+static PyTypeObject __pyx_type_5_cdec_TRule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.HypergraphNode"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_HypergraphNode), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.TRule"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_TRule), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_HypergraphNode, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_TRule, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21888,34 +21386,34 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphNode = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_HypergraphNode, /*tp_as_number*/
- &__pyx_tp_as_sequence_HypergraphNode, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_HypergraphNode, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- 0, /*tp_str*/
+ __pyx_pw_5_cdec_5TRule_5__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_HypergraphNode, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
- __pyx_pw_5_cdec_14HypergraphNode_1__richcmp__, /*tp_richcompare*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_HypergraphNode, /*tp_methods*/
+ __pyx_methods_5_cdec_TRule, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_HypergraphNode, /*tp_getset*/
+ __pyx_getsets_5_cdec_TRule, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_5_cdec_5TRule_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_HypergraphNode, /*tp_new*/
+ __pyx_tp_new_5_cdec_TRule, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21929,157 +21427,81 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphNode = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- if (__pyx_pw_5_cdec_7Lattice_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) {
- Py_DECREF(o); o = 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *__pyx_freelist_5_cdec___pyx_scope_struct_3_genexpr[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_3_genexpr = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_3_genexpr[--__pyx_freecount_5_cdec___pyx_scope_struct_3_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
}
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o);
+ p->__pyx_outer_scope = 0;
+ p->__pyx_v_w = 0;
+ p->__pyx_t_0 = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_Lattice(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_5_cdec_7Lattice_5__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_w);
+ Py_CLEAR(p->__pyx_t_0);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_3_genexpr[__pyx_freecount_5_cdec___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
-}
-static PyObject *__pyx_sq_item_5_cdec_Lattice(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
}
-static int __pyx_mp_ass_subscript_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) {
- if (v) {
- return __pyx_pw_5_cdec_7Lattice_9__setitem__(o, i, v);
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
- else {
- PyErr_Format(PyExc_NotImplementedError,
- "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
- return -1;
+ if (p->__pyx_v_w) {
+ e = (*v)(p->__pyx_v_w, a); if (e) return e;
}
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ return 0;
}
-static PyMethodDef __pyx_methods_5_cdec_Lattice[] = {
- {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_15__unicode__, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("todot"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_20todot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Lattice_19todot)},
- {__Pyx_NAMESTR("as_hypergraph"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_22as_hypergraph, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Lattice_21as_hypergraph)},
- {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_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_Lattice = {
- __pyx_pw_5_cdec_7Lattice_11__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_5_cdec_Lattice, /*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_Lattice = {
- __pyx_pw_5_cdec_7Lattice_11__len__, /*mp_length*/
- __pyx_pw_5_cdec_7Lattice_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_5_cdec_Lattice, /*mp_ass_subscript*/
-};
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_w);
+ p->__pyx_v_w = 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 PyBufferProcs __pyx_tp_as_buffer_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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_3_genexpr[] = {
+ {0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_Lattice = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.Lattice"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_Lattice), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_3_genexpr"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_Lattice, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22089,24 +21511,24 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_Lattice, /*tp_as_number*/
- &__pyx_tp_as_sequence_Lattice, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Lattice, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_5_cdec_7Lattice_13__str__, /*tp_str*/
+ 0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_Lattice, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_3_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_3_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_5_cdec_7Lattice_17__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_Lattice, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_3_genexpr, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22114,9 +21536,9 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_7Lattice_3__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_Lattice, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22130,153 +21552,22 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Candidate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+static PyObject *__pyx_tp_new_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = __pyx_tp_new_5_cdec_TRule(t, a, k);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_Candidate(PyObject *o) {
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_9Candidate_words(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_9Candidate_5words_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_9Candidate_fmap(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_9Candidate_4fmap_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_5_cdec_9Candidate_score(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_9Candidate_5score_1__get__(o);
-}
-
-static int __pyx_setprop_5_cdec_9Candidate_score(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_5_cdec_9Candidate_5score_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
- }
-}
-
-static PyMethodDef __pyx_methods_5_cdec_Candidate[] = {
+static PyMethodDef __pyx_methods_5_cdec_MRule[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_Candidate[] = {
- {(char *)"words", __pyx_getprop_5_cdec_9Candidate_words, 0, 0, 0},
- {(char *)"fmap", __pyx_getprop_5_cdec_9Candidate_fmap, 0, 0, 0},
- {(char *)"score", __pyx_getprop_5_cdec_9Candidate_score, __pyx_setprop_5_cdec_9Candidate_score, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_Candidate = {
- 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_Candidate = {
- 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_Candidate = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_Candidate = {
- #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_5_cdec_Candidate = {
+static PyTypeObject __pyx_type_5_cdec_MRule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.Candidate"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_Candidate), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.MRule"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_MRule), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_Candidate, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_TRule, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22286,16 +21577,20 @@ static PyTypeObject __pyx_type_5_cdec_Candidate = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_Candidate, /*tp_as_number*/
- &__pyx_tp_as_sequence_Candidate, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Candidate, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
+ #if CYTHON_COMPILING_IN_PYPY
+ __pyx_pw_5_cdec_5TRule_5__str__, /*tp_str*/
+ #else
0, /*tp_str*/
+ #endif
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_Candidate, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
@@ -22303,17 +21598,17 @@ static PyTypeObject __pyx_type_5_cdec_Candidate = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_Candidate, /*tp_methods*/
+ __pyx_methods_5_cdec_MRule, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_Candidate, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_5_cdec_5MRule_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_Candidate, /*tp_new*/
+ __pyx_tp_new_5_cdec_MRule, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22327,154 +21622,38 @@ static PyTypeObject __pyx_type_5_cdec_Candidate = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_SufficientStats(PyObject *o) {
+static void __pyx_tp_dealloc_5_cdec_SegmentEvaluator(PyObject *o) {
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(o);
+ __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_5_cdec_SufficientStats(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
-}
-
-static PyObject *__pyx_getprop_5_cdec_15SufficientStats_score(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_15SufficientStats_5score_1__get__(o);
-}
-static PyObject *__pyx_getprop_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(o);
-}
-
-static PyMethodDef __pyx_methods_5_cdec_SufficientStats[] = {
+static PyMethodDef __pyx_methods_5_cdec_SegmentEvaluator[] = {
+ {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_16SegmentEvaluator_2evaluate)},
+ {__Pyx_NAMESTR("candidate_set"), (PyCFunction)__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_16SegmentEvaluator_4candidate_set)},
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_SufficientStats[] = {
- {(char *)"score", __pyx_getprop_5_cdec_15SufficientStats_score, 0, 0, 0},
- {(char *)"detail", __pyx_getprop_5_cdec_15SufficientStats_detail, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_SufficientStats = {
- __pyx_pw_5_cdec_15SufficientStats_12__add__, /*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
- __pyx_pw_5_cdec_15SufficientStats_10__iadd__, /*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_SufficientStats = {
- __pyx_pw_5_cdec_15SufficientStats_3__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_5_cdec_SufficientStats, /*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_SufficientStats = {
- __pyx_pw_5_cdec_15SufficientStats_3__len__, /*mp_length*/
- __pyx_pw_5_cdec_15SufficientStats_8__getitem__, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_SufficientStats = {
- #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_5_cdec_SufficientStats = {
+static PyTypeObject __pyx_type_5_cdec_SegmentEvaluator = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.SufficientStats"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_SufficientStats), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.SegmentEvaluator"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_SegmentEvaluator), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_SufficientStats, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_SegmentEvaluator, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22484,26 +21663,26 @@ static PyTypeObject __pyx_type_5_cdec_SufficientStats = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_SufficientStats, /*tp_as_number*/
- &__pyx_tp_as_sequence_SufficientStats, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_SufficientStats, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer_SufficientStats, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_5_cdec_15SufficientStats_5__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_SufficientStats, /*tp_methods*/
+ __pyx_methods_5_cdec_SegmentEvaluator, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_SufficientStats, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -22511,7 +21690,7 @@ static PyTypeObject __pyx_type_5_cdec_SufficientStats = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_SufficientStats, /*tp_new*/
+ __pyx_tp_new_5_cdec_SegmentEvaluator, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22525,144 +21704,81 @@ static PyTypeObject __pyx_type_5_cdec_SufficientStats = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- if (__pyx_pw_5_cdec_12CandidateSet_1__cinit__(o, a, k) < 0) {
- Py_DECREF(o); o = 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *__pyx_freelist_5_cdec___pyx_scope_struct_25_genexpr[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_25_genexpr[--__pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
}
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o);
+ p->__pyx_outer_scope = 0;
+ p->__pyx_v_kv = 0;
+ p->__pyx_t_0 = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_CandidateSet(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_kv);
+ Py_CLEAR(p->__pyx_t_0);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_25_genexpr[__pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
-}
-static PyObject *__pyx_sq_item_5_cdec_CandidateSet(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
}
-static PyMethodDef __pyx_methods_5_cdec_CandidateSet[] = {
- {__Pyx_NAMESTR("add_kbest"), (PyCFunction)__pyx_pw_5_cdec_12CandidateSet_12add_kbest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_12CandidateSet_11add_kbest)},
- {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_CandidateSet = {
- 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_CandidateSet = {
- __pyx_pw_5_cdec_12CandidateSet_5__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_5_cdec_CandidateSet, /*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 int __pyx_tp_traverse_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
+ }
+ if (p->__pyx_v_kv) {
+ e = (*v)(p->__pyx_v_kv, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ return 0;
+}
-static PyMappingMethods __pyx_tp_as_mapping_CandidateSet = {
- __pyx_pw_5_cdec_12CandidateSet_5__len__, /*mp_length*/
- __pyx_pw_5_cdec_12CandidateSet_7__getitem__, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_kv);
+ p->__pyx_v_kv = 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 PyBufferProcs __pyx_tp_as_buffer_CandidateSet = {
- #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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_25_genexpr[] = {
+ {0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_CandidateSet = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_25_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.CandidateSet"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_CandidateSet), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_25_genexpr"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_CandidateSet, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_25_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22672,24 +21788,24 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_CandidateSet, /*tp_as_number*/
- &__pyx_tp_as_sequence_CandidateSet, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_CandidateSet, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer_CandidateSet, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_25_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_25_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_5_cdec_12CandidateSet_9__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_CandidateSet, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_25_genexpr, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22699,7 +21815,7 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_CandidateSet, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22713,135 +21829,65 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *__pyx_freelist_5_cdec___pyx_scope_struct_19_todot[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_19_todot = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_19_todot > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_19_todot[--__pyx_freecount_5_cdec___pyx_scope_struct_19_todot];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o);
+ p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_SegmentEvaluator(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_19_todot < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_19_todot[__pyx_freecount_5_cdec___pyx_scope_struct_19_todot++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
}
-static PyMethodDef __pyx_methods_5_cdec_SegmentEvaluator[] = {
- {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_16SegmentEvaluator_2evaluate)},
- {__Pyx_NAMESTR("candidate_set"), (PyCFunction)__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_16SegmentEvaluator_4candidate_set)},
- {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_SegmentEvaluator = {
- 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_SegmentEvaluator = {
- 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 int __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_todot(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ return 0;
+}
-static PyMappingMethods __pyx_tp_as_mapping_SegmentEvaluator = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_19_todot(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyBufferProcs __pyx_tp_as_buffer_SegmentEvaluator = {
- #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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_19_todot[] = {
+ {0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_SegmentEvaluator = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_todot = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.SegmentEvaluator"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_SegmentEvaluator), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_19_todot"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_SegmentEvaluator, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22851,24 +21897,24 @@ static PyTypeObject __pyx_type_5_cdec_SegmentEvaluator = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_SegmentEvaluator, /*tp_as_number*/
- &__pyx_tp_as_sequence_SegmentEvaluator, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_SegmentEvaluator, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer_SegmentEvaluator, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_todot, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_19_todot, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_SegmentEvaluator, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_19_todot, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22878,7 +21924,7 @@ static PyTypeObject __pyx_type_5_cdec_SegmentEvaluator = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_SegmentEvaluator, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_19_todot, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22892,136 +21938,56 @@ static PyTypeObject __pyx_type_5_cdec_SegmentEvaluator = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) {
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- if (__pyx_pw_5_cdec_6Scorer_1__cinit__(o, a, k) < 0) {
- Py_DECREF(o); o = 0;
- }
+static PyObject *__pyx_tp_new_5_cdec_Candidate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_Scorer(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_5_cdec_6Scorer_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
- }
+static void __pyx_tp_dealloc_5_cdec_Candidate(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static PyMethodDef __pyx_methods_5_cdec_Scorer[] = {
- {0, 0, 0, 0}
-};
+static PyObject *__pyx_getprop_5_cdec_9Candidate_words(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_9Candidate_5words_1__get__(o);
+}
-static PyNumberMethods __pyx_tp_as_number_Scorer = {
- 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 PyObject *__pyx_getprop_5_cdec_9Candidate_fmap(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_9Candidate_4fmap_1__get__(o);
+}
-static PySequenceMethods __pyx_tp_as_sequence_Scorer = {
- 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 PyObject *__pyx_getprop_5_cdec_9Candidate_score(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_9Candidate_5score_1__get__(o);
+}
-static PyMappingMethods __pyx_tp_as_mapping_Scorer = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
+static int __pyx_setprop_5_cdec_9Candidate_score(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_9Candidate_5score_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_5_cdec_Candidate[] = {
+ {0, 0, 0, 0}
};
-static PyBufferProcs __pyx_tp_as_buffer_Scorer = {
- #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 struct PyGetSetDef __pyx_getsets_5_cdec_Candidate[] = {
+ {(char *)"words", __pyx_getprop_5_cdec_9Candidate_words, 0, 0, 0},
+ {(char *)"fmap", __pyx_getprop_5_cdec_9Candidate_fmap, 0, 0, 0},
+ {(char *)"score", __pyx_getprop_5_cdec_9Candidate_score, __pyx_setprop_5_cdec_9Candidate_score, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec_Scorer = {
+static PyTypeObject __pyx_type_5_cdec_Candidate = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.Scorer"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_Scorer), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.Candidate"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_Candidate), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_Scorer, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_Candidate, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23031,16 +21997,16 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_Scorer, /*tp_as_number*/
- &__pyx_tp_as_sequence_Scorer, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Scorer, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
- __pyx_pw_5_cdec_6Scorer_5__call__, /*tp_call*/
- __pyx_pw_5_cdec_6Scorer_7__str__, /*tp_str*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_Scorer, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
@@ -23048,9 +22014,9 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_Scorer, /*tp_methods*/
+ __pyx_methods_5_cdec_Candidate, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_5_cdec_Candidate, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -23058,7 +22024,7 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_Scorer, /*tp_new*/
+ __pyx_tp_new_5_cdec_Candidate, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23072,154 +22038,81 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec_Metric *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec_Metric *)o);
- p->scorer = ((struct __pyx_obj_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
- if (__pyx_pw_5_cdec_6Metric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) {
- Py_DECREF(o); o = 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *__pyx_freelist_5_cdec___pyx_scope_struct_6_genexpr[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_6_genexpr[--__pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
}
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o);
+ p->__pyx_outer_scope = 0;
+ p->__pyx_v_feat = 0;
+ p->__pyx_t_0 = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec_Metric(PyObject *o) {
- struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->scorer);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_feat);
+ Py_CLEAR(p->__pyx_t_0);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_6_genexpr[__pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec_Metric(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o;
- if (p->scorer) {
- e = (*v)(((PyObject*)p->scorer), a); if (e) return e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___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_feat) {
+ e = (*v)(p->__pyx_v_feat, 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_5_cdec_Metric(PyObject *o) {
- struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->scorer);
- p->scorer = ((struct __pyx_obj_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5___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);
+ 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_5_cdec_Metric[] = {
- {__Pyx_NAMESTR("score"), (PyCFunction)__pyx_pw_5_cdec_6Metric_5score, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_5_cdec_6Metric_7evaluate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_6_genexpr[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number_Metric = {
- 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_Metric = {
- 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_Metric = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_Metric = {
- #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_5_cdec_Metric = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.Metric"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_Metric), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_6_genexpr"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_Metric, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23229,24 +22122,24 @@ static PyTypeObject __pyx_type_5_cdec_Metric = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_Metric, /*tp_as_number*/
- &__pyx_tp_as_sequence_Metric, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Metric, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
- __pyx_pw_5_cdec_6Metric_3__call__, /*tp_call*/
+ 0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_Metric, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec_Metric, /*tp_traverse*/
- __pyx_tp_clear_5_cdec_Metric, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_6_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_6_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_Metric, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_6_genexpr, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23256,7 +22149,7 @@ static PyTypeObject __pyx_type_5_cdec_Metric = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_Metric, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23270,184 +22163,84 @@ static PyTypeObject __pyx_type_5_cdec_Metric = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Decoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec_Decoder *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec_Decoder *)o);
- p->weights = ((struct __pyx_obj_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec_NT *p;
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_5_cdec_NT *)o);
+ p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_5_cdec_Decoder(PyObject *o) {
- struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o;
+static void __pyx_tp_dealloc_5_cdec_NT(PyObject *o) {
+ struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o;
PyObject_GC_UnTrack(o);
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_5_cdec_7Decoder_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
- }
- Py_CLEAR(p->weights);
- PyObject_GC_Track(o);
+ Py_CLEAR(p->cat);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec_Decoder(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec_NT(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o;
- if (p->weights) {
- e = (*v)(((PyObject*)p->weights), a); if (e) return e;
+ struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o;
+ if (p->cat) {
+ e = (*v)(p->cat, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec_Decoder(PyObject *o) {
- struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o;
+static int __pyx_tp_clear_5_cdec_NT(PyObject *o) {
+ struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->weights);
- p->weights = ((struct __pyx_obj_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->cat);
+ p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyObject *__pyx_getprop_5_cdec_7Decoder_weights(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_7Decoder_7weights_1__get__(o);
+static PyObject *__pyx_getprop_5_cdec_2NT_cat(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_2NT_3cat_1__get__(o);
}
-static int __pyx_setprop_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_5_cdec_7Decoder_7weights_3__set__(o, v);
+ return __pyx_pw_5_cdec_2NT_3cat_3__set__(o, v);
}
else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+ return __pyx_pw_5_cdec_2NT_3cat_5__del__(o);
}
}
-static PyObject *__pyx_getprop_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_5_cdec_7Decoder_9formalism_1__get__(o);
+static PyObject *__pyx_getprop_5_cdec_2NT_ref(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_2NT_3ref_1__get__(o);
}
-static PyMethodDef __pyx_methods_5_cdec_Decoder[] = {
- {__Pyx_NAMESTR("read_weights"), (PyCFunction)__pyx_pw_5_cdec_7Decoder_5read_weights, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Decoder_4read_weights)},
- {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_5_cdec_7Decoder_7translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Decoder_6translate)},
+static int __pyx_setprop_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_2NT_3ref_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_5_cdec_NT[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_5_cdec_Decoder[] = {
- {(char *)"weights", __pyx_getprop_5_cdec_7Decoder_weights, __pyx_setprop_5_cdec_7Decoder_weights, 0, 0},
- {(char *)"formalism", __pyx_getprop_5_cdec_7Decoder_formalism, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets_5_cdec_NT[] = {
+ {(char *)"cat", __pyx_getprop_5_cdec_2NT_cat, __pyx_setprop_5_cdec_2NT_cat, 0, 0},
+ {(char *)"ref", __pyx_getprop_5_cdec_2NT_ref, __pyx_setprop_5_cdec_2NT_ref, 0, 0},
{0, 0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number_Decoder = {
- 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_Decoder = {
- 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_Decoder = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_Decoder = {
- #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_5_cdec_Decoder = {
+static PyTypeObject __pyx_type_5_cdec_NT = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.Decoder"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec_Decoder), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.NT"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_NT), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec_Decoder, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_NT, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23457,34 +22250,34 @@ static PyTypeObject __pyx_type_5_cdec_Decoder = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_Decoder, /*tp_as_number*/
- &__pyx_tp_as_sequence_Decoder, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Decoder, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- 0, /*tp_str*/
+ __pyx_pw_5_cdec_2NT_3__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer_Decoder, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec_Decoder, /*tp_traverse*/
- __pyx_tp_clear_5_cdec_Decoder, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec_NT, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec_NT, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec_Decoder, /*tp_methods*/
+ __pyx_methods_5_cdec_NT, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_5_cdec_Decoder, /*tp_getset*/
+ __pyx_getsets_5_cdec_NT, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_5_cdec_7Decoder_1__init__, /*tp_init*/
+ __pyx_pw_5_cdec_2NT_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec_Decoder, /*tp_new*/
+ __pyx_tp_new_5_cdec_NT, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23497,106 +22290,98 @@ static PyTypeObject __pyx_type_5_cdec_Decoder = {
0, /*tp_version_tag*/
#endif
};
+static struct __pyx_vtabstruct_5_cdec_HypergraphEdge __pyx_vtable_5_cdec_HypergraphEdge;
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o);
- p->__pyx_v_self = 0;
+static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec_HypergraphEdge *p;
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_5_cdec_HypergraphEdge *)o);
+ p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphEdge;
+ p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o;
+static void __pyx_tp_dealloc_5_cdec_HypergraphEdge(PyObject *o) {
+ struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
+ Py_CLEAR(p->trule);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec_HypergraphEdge(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
+ if (p->trule) {
+ e = (*v)(((PyObject*)p->trule), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o;
+static int __pyx_tp_clear_5_cdec_HypergraphEdge(PyObject *o) {
+ struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->trule);
+ p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct____iter__[] = {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_head_node(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_src_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_8src_span_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_feature_values(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_prob(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_trule(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(o);
+}
+
+static int __pyx_setprop_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_5_cdec_14HypergraphEdge_5trule_5__del__(o);
+ }
+}
+
+static PyMethodDef __pyx_methods_5_cdec_HypergraphEdge[] = {
{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 struct PyGetSetDef __pyx_getsets_5_cdec_HypergraphEdge[] = {
+ {(char *)"head_node", __pyx_getprop_5_cdec_14HypergraphEdge_head_node, 0, 0, 0},
+ {(char *)"tail_nodes", __pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes, 0, 0, 0},
+ {(char *)"span", __pyx_getprop_5_cdec_14HypergraphEdge_span, 0, 0, 0},
+ {(char *)"src_span", __pyx_getprop_5_cdec_14HypergraphEdge_src_span, 0, 0, 0},
+ {(char *)"feature_values", __pyx_getprop_5_cdec_14HypergraphEdge_feature_values, 0, 0, 0},
+ {(char *)"prob", __pyx_getprop_5_cdec_14HypergraphEdge_prob, 0, 0, 0},
+ {(char *)"trule", __pyx_getprop_5_cdec_14HypergraphEdge_trule, __pyx_setprop_5_cdec_14HypergraphEdge_trule, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct____iter__ = {
- 0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_HypergraphEdge = {
+ __pyx_pw_5_cdec_14HypergraphEdge_1__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
@@ -23608,39 +22393,18 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct____iter__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct____iter__ = {
- 0, /*mp_length*/
+static PyMappingMethods __pyx_tp_as_mapping_HypergraphEdge = {
+ __pyx_pw_5_cdec_14HypergraphEdge_1__len__, /*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_5_cdec___pyx_scope_struct____iter__ = {
+static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct____iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.HypergraphEdge"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_HypergraphEdge), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct____iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_HypergraphEdge, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23650,26 +22414,26 @@ static PyTypeObject __pyx_type_5_cdec___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*/
+ 0, /*tp_as_number*/
+ &__pyx_tp_as_sequence_HypergraphEdge, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_HypergraphEdge, /*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_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct____iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct____iter__, /*tp_clear*/
- 0, /*tp_richcompare*/
+ __pyx_tp_traverse_5_cdec_HypergraphEdge, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec_HypergraphEdge, /*tp_clear*/
+ __pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct____iter__, /*tp_methods*/
+ __pyx_methods_5_cdec_HypergraphEdge, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_5_cdec_HypergraphEdge, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -23677,7 +22441,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct____iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct____iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec_HypergraphEdge, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23691,10 +22455,21 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct____iter__ = {
#endif
};
+static struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_1___iter__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_1___iter__ = 0;
+
static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_1___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_1___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_1___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)o);
p->__pyx_v_self = 0;
return o;
@@ -23704,8 +22479,11 @@ static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_1___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_1___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) {
@@ -23730,104 +22508,6 @@ static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_1___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1___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_1___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_1___iter__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1___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_5_cdec___pyx_scope_struct_1___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("_cdec.__pyx_scope_struct_1___iter__"), /*tp_name*/
@@ -23843,16 +22523,16 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_1___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_1___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_1___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_1___iter__, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_1___iter__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_5_cdec___pyx_scope_struct_1___iter__, /*tp_traverse*/
__pyx_tp_clear_5_cdec___pyx_scope_struct_1___iter__, /*tp_clear*/
@@ -23884,149 +22564,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_1___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o);
- p->__pyx_v_phrase = 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_16___get__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_16___get__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_16___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_16___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_16___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o);
+ p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_phrase);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_16___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_16___get__[__pyx_freecount_5_cdec___pyx_scope_struct_16___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_2__phrase(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_16___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o;
- if (p->__pyx_v_phrase) {
- e = (*v)(p->__pyx_v_phrase, a); if (e) return e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)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_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_phrase);
- p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_2__phrase[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_16___get__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_2__phrase = {
- 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_2__phrase = {
- 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_2__phrase = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_2__phrase = {
- #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_5_cdec___pyx_scope_struct_2__phrase = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_2__phrase"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_16___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_2__phrase, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24036,24 +22632,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_2__phrase, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_2__phrase, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_2__phrase, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_2__phrase, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_2__phrase, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_2__phrase, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_16___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_16___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_2__phrase, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_16___get__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24063,7 +22659,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_16___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24077,165 +22673,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_w = 0;
- p->__pyx_t_0 = 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_4___get__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_4___get__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_4___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_4___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_4___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o);
+ p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_w);
- Py_CLEAR(p->__pyx_t_0);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_4___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_4___get__[__pyx_freecount_5_cdec___pyx_scope_struct_4___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o;
- if (p->__pyx_outer_scope) {
- e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
- }
- if (p->__pyx_v_w) {
- e = (*v)(p->__pyx_v_w, a); if (e) return e;
- }
- if (p->__pyx_t_0) {
- e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)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_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_w);
- p->__pyx_v_w = 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);
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_3_genexpr[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_4___get__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_3_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_3_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_3_genexpr = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_3_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_5_cdec___pyx_scope_struct_3_genexpr = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_3_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_4___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_4___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24245,24 +22741,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_3_genexpr, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_3_genexpr, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_3_genexpr, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_3_genexpr, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_3_genexpr, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_3_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_4___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_4___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_3_genexpr, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_4___get__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24272,7 +22768,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_4___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24286,149 +22782,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_18___iter__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_18___iter__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_18___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_18___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_18___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_18___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_18___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_18___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_18___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___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_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_4___get__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_18___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_4___get__ = {
- 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_4___get__ = {
- 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_4___get__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_4___get__ = {
- #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_5_cdec___pyx_scope_struct_4___get__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_4___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_18___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_4___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24438,24 +22850,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_4___get__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_4___get__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_4___get__, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_4___get__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_4___get__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_4___get__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_18___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_18___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_4___get__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_18___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24465,7 +22877,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_4___get__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24479,149 +22891,86 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o);
- p->__pyx_v_self = 0;
+static PyObject *__pyx_tp_new_5_cdec_Decoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec_Decoder *p;
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_5_cdec_Decoder *)o);
+ p->weights = ((struct __pyx_obj_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o;
+static void __pyx_tp_dealloc_5_cdec_Decoder(PyObject *o) {
+ struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_5_cdec_7Decoder_3__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ Py_CLEAR(p->weights);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_5___str__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec_Decoder(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o;
+ if (p->weights) {
+ e = (*v)(((PyObject*)p->weights), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o;
+static int __pyx_tp_clear_5_cdec_Decoder(PyObject *o) {
+ struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->weights);
+ p->weights = ((struct __pyx_obj_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_5___str__[] = {
- {0, 0, 0, 0}
-};
+static PyObject *__pyx_getprop_5_cdec_7Decoder_weights(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_7Decoder_7weights_1__get__(o);
+}
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_5___str__ = {
- 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 int __pyx_setprop_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_7Decoder_7weights_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_5___str__ = {
- 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 PyObject *__pyx_getprop_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_7Decoder_9formalism_1__get__(o);
+}
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_5___str__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
+static PyMethodDef __pyx_methods_5_cdec_Decoder[] = {
+ {__Pyx_NAMESTR("read_weights"), (PyCFunction)__pyx_pw_5_cdec_7Decoder_5read_weights, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Decoder_4read_weights)},
+ {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_5_cdec_7Decoder_7translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Decoder_6translate)},
+ {0, 0, 0, 0}
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_5___str__ = {
- #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 struct PyGetSetDef __pyx_getsets_5_cdec_Decoder[] = {
+ {(char *)"weights", __pyx_getprop_5_cdec_7Decoder_weights, __pyx_setprop_5_cdec_7Decoder_weights, 0, 0},
+ {(char *)"formalism", __pyx_getprop_5_cdec_7Decoder_formalism, 0, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5___str__ = {
+static PyTypeObject __pyx_type_5_cdec_Decoder = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_5___str__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.Decoder"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_Decoder), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_5___str__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_Decoder, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24631,34 +22980,34 @@ static PyTypeObject __pyx_type_5_cdec___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*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_5___str__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_5___str__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_5___str__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec_Decoder, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec_Decoder, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_5___str__, /*tp_methods*/
+ __pyx_methods_5_cdec_Decoder, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_5_cdec_Decoder, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_5_cdec_7Decoder_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_5___str__, /*tp_new*/
+ __pyx_tp_new_5_cdec_Decoder, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24671,166 +23020,56 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5___str__ = {
0, /*tp_version_tag*/
#endif
};
+static struct __pyx_vtabstruct_5_cdec_HypergraphNode __pyx_vtable_5_cdec_HypergraphNode;
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_feat = 0;
- p->__pyx_t_0 = 0;
+static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec_HypergraphNode *p;
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_5_cdec_HypergraphNode *)o);
+ p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphNode;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_feat);
- Py_CLEAR(p->__pyx_t_0);
- PyObject_GC_Track(o);
+static void __pyx_tp_dealloc_5_cdec_HypergraphNode(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___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_feat) {
- e = (*v)(p->__pyx_v_feat, a); if (e) return e;
- }
- if (p->__pyx_t_0) {
- e = (*v)(p->__pyx_t_0, a); if (e) return e;
- }
- return 0;
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_in_edges(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(o);
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5___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);
- 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 PyObject *__pyx_getprop_5_cdec_14HypergraphNode_out_edges(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(o);
}
-static PyMethodDef __pyx_methods_5_cdec___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 PyObject *__pyx_getprop_5_cdec_14HypergraphNode_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(o);
+}
-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 PyObject *__pyx_getprop_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(o);
+}
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_6_genexpr = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
+static PyMethodDef __pyx_methods_5_cdec_HypergraphNode[] = {
+ {0, 0, 0, 0}
};
-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 struct PyGetSetDef __pyx_getsets_5_cdec_HypergraphNode[] = {
+ {(char *)"in_edges", __pyx_getprop_5_cdec_14HypergraphNode_in_edges, 0, 0, 0},
+ {(char *)"out_edges", __pyx_getprop_5_cdec_14HypergraphNode_out_edges, 0, 0, 0},
+ {(char *)"span", __pyx_getprop_5_cdec_14HypergraphNode_span, 0, 0, 0},
+ {(char *)"cat", __pyx_getprop_5_cdec_14HypergraphNode_cat, 0, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = {
+static PyTypeObject __pyx_type_5_cdec_HypergraphNode = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_6_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.HypergraphNode"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_HypergraphNode), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_HypergraphNode, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24840,26 +23079,26 @@ static PyTypeObject __pyx_type_5_cdec___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*/
+ 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*/
- &__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_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_6_genexpr, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_6_genexpr, /*tp_clear*/
- 0, /*tp_richcompare*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ __pyx_pw_5_cdec_14HypergraphNode_1__richcmp__, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_6_genexpr, /*tp_methods*/
+ __pyx_methods_5_cdec_HypergraphNode, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_5_cdec_HypergraphNode, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -24867,7 +23106,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr, /*tp_new*/
+ __pyx_tp_new_5_cdec_HypergraphNode, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24881,64 +23120,61 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o);
- p->__pyx_v_self = 0;
- p->__pyx_v_trule = 0;
+static PyObject *__pyx_tp_new_5_cdec_SparseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_trule);
- PyObject_GC_Track(o);
+static void __pyx_tp_dealloc_5_cdec_SparseVector(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_5_cdec_12SparseVector_3__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
(*Py_TYPE(o)->tp_free)(o);
}
+static PyObject *__pyx_sq_item_5_cdec_SparseVector(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
+}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+static int __pyx_mp_ass_subscript_5_cdec_SparseVector(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_5_cdec_12SparseVector_9__setitem__(o, i, v);
}
- if (p->__pyx_v_trule) {
- e = (*v)(((PyObject*)p->__pyx_v_trule), a); if (e) return e;
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+ return -1;
}
- return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Grammar *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_trule);
- p->__pyx_v_trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
-}
-
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_7___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec_SparseVector[] = {
+ {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_5copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_12SparseVector_4copy)},
+ {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_12SparseVector_13dot)},
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7___iter__ = {
- 0, /*nb_add*/
- 0, /*nb_subtract*/
- 0, /*nb_multiply*/
+static PyNumberMethods __pyx_tp_as_number_SparseVector = {
+ __pyx_pw_5_cdec_12SparseVector_32__add__, /*nb_add*/
+ __pyx_pw_5_cdec_12SparseVector_34__sub__, /*nb_subtract*/
+ __pyx_pw_5_cdec_12SparseVector_36__mul__, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
- 0, /*nb_divide*/
+ __pyx_pw_5_cdec_12SparseVector_38__div__, /*nb_divide*/
#endif
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
- 0, /*nb_negative*/
+ __pyx_pw_5_cdec_12SparseVector_22__neg__, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
@@ -24964,11 +23200,11 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7___iter__ = {
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
- 0, /*nb_inplace_add*/
- 0, /*nb_inplace_subtract*/
- 0, /*nb_inplace_multiply*/
+ __pyx_pw_5_cdec_12SparseVector_24__iadd__, /*nb_inplace_add*/
+ __pyx_pw_5_cdec_12SparseVector_26__isub__, /*nb_inplace_subtract*/
+ __pyx_pw_5_cdec_12SparseVector_28__imul__, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
- 0, /*nb_inplace_divide*/
+ __pyx_pw_5_cdec_12SparseVector_30__idiv__, /*nb_inplace_divide*/
#endif
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
@@ -24986,52 +23222,31 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7___iter__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_7___iter__ = {
- 0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_SparseVector = {
+ __pyx_pw_5_cdec_12SparseVector_18__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
- 0, /*sq_item*/
+ __pyx_sq_item_5_cdec_SparseVector, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
- 0, /*sq_contains*/
+ __pyx_pw_5_cdec_12SparseVector_20__contains__, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_7___iter__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_7___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 PyMappingMethods __pyx_tp_as_mapping_SparseVector = {
+ __pyx_pw_5_cdec_12SparseVector_18__len__, /*mp_length*/
+ __pyx_pw_5_cdec_12SparseVector_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_5_cdec_SparseVector, /*mp_ass_subscript*/
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = {
+static PyTypeObject __pyx_type_5_cdec_SparseVector = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_7___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.SparseVector"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_SparseVector), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_SparseVector, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25041,24 +23256,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_7___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_7___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_7___iter__, /*tp_as_mapping*/
+ &__pyx_tp_as_number_SparseVector, /*tp_as_number*/
+ &__pyx_tp_as_sequence_SparseVector, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_SparseVector, /*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___iter__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_7___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_7___iter__, /*tp_clear*/
- 0, /*tp_richcompare*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ __pyx_pw_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_5_cdec_12SparseVector_11__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_7___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec_SparseVector, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25066,9 +23281,9 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_5_cdec_12SparseVector_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec_SparseVector, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25082,157 +23297,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_17___get__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_17___get__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_17___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_17___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_17___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o);
p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_17___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_17___get__[__pyx_freecount_5_cdec___pyx_scope_struct_17___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_8_kbest(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
- }
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_size);
- p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_8_kbest[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_17___get__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_8_kbest = {
- 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_8_kbest = {
- 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_8_kbest = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_8_kbest = {
- #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_5_cdec___pyx_scope_struct_8_kbest = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_8_kbest"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_17___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_kbest, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25242,24 +23365,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_8_kbest, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_8_kbest, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_8_kbest, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_8_kbest, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_8_kbest, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_8_kbest, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_17___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_8_kbest, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_17___get__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25269,7 +23392,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_17___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25283,173 +23406,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o);
- p->__pyx_v_e_tree = 0;
- p->__pyx_v_f_tree = 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *__pyx_freelist_5_cdec___pyx_scope_struct____iter__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct____iter__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct____iter__[--__pyx_freecount_5_cdec___pyx_scope_struct____iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o);
p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_e_tree);
- Py_CLEAR(p->__pyx_v_f_tree);
Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct____iter__[__pyx_freecount_5_cdec___pyx_scope_struct____iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
- if (p->__pyx_v_e_tree) {
- e = (*v)(p->__pyx_v_e_tree, a); if (e) return e;
- }
- if (p->__pyx_v_f_tree) {
- e = (*v)(p->__pyx_v_f_tree, a); if (e) return e;
- }
+ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
- }
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_e_tree);
- p->__pyx_v_e_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_f_tree);
- p->__pyx_v_f_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_size);
- p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_9_kbest_trees[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct____iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_9_kbest_trees = {
- 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_kbest_trees = {
- 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_kbest_trees = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_9_kbest_trees = {
- #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_5_cdec___pyx_scope_struct_9_kbest_trees = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct____iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_9_kbest_trees"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct____iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct____iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25459,24 +23474,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_9_kbest_trees, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_9_kbest_trees, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_9_kbest_trees, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_9_kbest_trees, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct____iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct____iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct____iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25486,7 +23501,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct____iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25500,165 +23515,81 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o);
- p->__pyx_v_fmap = 0;
+static struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_21___iter__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_21___iter__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_21___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_21___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_21___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o);
+ p->__pyx_v_i = 0;
p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
+ p->__pyx_t_1 = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_fmap);
+ Py_CLEAR(p->__pyx_v_i);
Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_t_1);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_21___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_21___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_21___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o;
- if (p->__pyx_v_fmap) {
- e = (*v)(((PyObject*)p->__pyx_v_fmap), a); if (e) return e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
+ if (p->__pyx_v_i) {
+ e = (*v)(p->__pyx_v_i, 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_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ if (p->__pyx_t_1) {
+ e = (*v)(p->__pyx_t_1, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_fmap);
- p->__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_i);
+ p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_SufficientStats *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_size);
- p->__pyx_v_size = 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);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_10_kbest_features[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_21___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_10_kbest_features = {
- 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_kbest_features = {
- 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_kbest_features = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_10_kbest_features = {
- #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_5_cdec___pyx_scope_struct_10_kbest_features = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_10_kbest_features"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_21___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25668,24 +23599,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_10_kbest_features, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_10_kbest_features, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_10_kbest_features, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_10_kbest_features, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_21___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25695,7 +23626,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25709,108 +23640,55 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o);
- p->__pyx_v_self = 0;
+static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_sample(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
+static void __pyx_tp_dealloc_5_cdec_DenseVector(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_5_cdec_11DenseVector_3__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
(*Py_TYPE(o)->tp_free)(o);
}
-
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_11_sample(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
- }
- return 0;
+static PyObject *__pyx_sq_item_5_cdec_DenseVector(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_11_sample(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static int __pyx_mp_ass_subscript_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_5_cdec_11DenseVector_9__setitem__(o, i, v);
+ }
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+ return -1;
+ }
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_11_sample[] = {
+static PyMethodDef __pyx_methods_5_cdec_DenseVector[] = {
+ {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_11DenseVector_13dot)},
+ {__Pyx_NAMESTR("tosparse"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_16tosparse, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_11DenseVector_15tosparse)},
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_11_sample = {
- 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_11_sample = {
- 0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_DenseVector = {
+ __pyx_pw_5_cdec_11DenseVector_5__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
- 0, /*sq_item*/
+ __pyx_sq_item_5_cdec_DenseVector, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
@@ -25819,39 +23697,18 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_11_sample = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_11_sample = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_11_sample = {
- #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 PyMappingMethods __pyx_tp_as_mapping_DenseVector = {
+ __pyx_pw_5_cdec_11DenseVector_5__len__, /*mp_length*/
+ __pyx_pw_5_cdec_11DenseVector_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_5_cdec_DenseVector, /*mp_ass_subscript*/
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = {
+static PyTypeObject __pyx_type_5_cdec_DenseVector = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_11_sample"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.DenseVector"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_DenseVector), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_sample, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_DenseVector, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25861,24 +23718,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_11_sample, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_11_sample, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_11_sample, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ &__pyx_tp_as_sequence_DenseVector, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_DenseVector, /*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_sample, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_11_sample, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_11_sample, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_5_cdec_11DenseVector_11__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_11_sample, /*tp_methods*/
+ __pyx_methods_5_cdec_DenseVector, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25886,9 +23743,9 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_5_cdec_11DenseVector_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_11_sample, /*tp_new*/
+ __pyx_tp_new_5_cdec_DenseVector, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25902,149 +23759,73 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_7___iter__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_7___iter__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_7___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_7___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o);
p->__pyx_v_self = 0;
+ p->__pyx_v_trule = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_v_trule);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_7___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
+ if (p->__pyx_v_trule) {
+ e = (*v)(((PyObject*)p->__pyx_v_trule), a); if (e) return e;
+ }
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Grammar *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_trule);
+ p->__pyx_v_trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_12_sample_trees[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_7___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_12_sample_trees = {
- 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_12_sample_trees = {
- 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_12_sample_trees = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_12_sample_trees = {
- #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_5_cdec___pyx_scope_struct_12_sample_trees = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_12_sample_trees"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_7___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26054,24 +23835,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_12_sample_trees, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_12_sample_trees, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_12_sample_trees, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_12_sample_trees, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_7___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_7___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_7___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26081,7 +23862,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26095,149 +23876,56 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o);
- p->__pyx_v_self = 0;
+static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec_Metric *p;
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_5_cdec_Metric *)o);
+ p->scorer = ((struct __pyx_obj_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
+ if (unlikely(__pyx_pw_5_cdec_6Metric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o;
+static void __pyx_tp_dealloc_5_cdec_Metric(PyObject *o) {
+ struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
+ Py_CLEAR(p->scorer);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_13___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec_Metric(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o;
+ if (p->scorer) {
+ e = (*v)(((PyObject*)p->scorer), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_13___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o;
+static int __pyx_tp_clear_5_cdec_Metric(PyObject *o) {
+ struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->scorer);
+ p->scorer = ((struct __pyx_obj_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_13___get__[] = {
+static PyMethodDef __pyx_methods_5_cdec_Metric[] = {
+ {__Pyx_NAMESTR("score"), (PyCFunction)__pyx_pw_5_cdec_6Metric_5score, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_5_cdec_6Metric_7evaluate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_13___get__ = {
- 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_13___get__ = {
- 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_13___get__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_13___get__ = {
- #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_5_cdec___pyx_scope_struct_13___get__ = {
+static PyTypeObject __pyx_type_5_cdec_Metric = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_13___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.Metric"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_Metric), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_Metric, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26247,24 +23935,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_13___get__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_13___get__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_13___get__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_13___get__, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
- 0, /*tp_call*/
+ __pyx_pw_5_cdec_6Metric_3__call__, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_13___get__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_13___get__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_13___get__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec_Metric, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec_Metric, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_13___get__, /*tp_methods*/
+ __pyx_methods_5_cdec_Metric, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26274,7 +23962,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_13___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_13___get__, /*tp_new*/
+ __pyx_tp_new_5_cdec_Metric, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26288,47 +23976,53 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_13___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o);
- p->__pyx_v_self = 0;
+static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_14___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
+static void __pyx_tp_dealloc_5_cdec_SufficientStats(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
(*Py_TYPE(o)->tp_free)(o);
}
+static PyObject *__pyx_sq_item_5_cdec_SufficientStats(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
+}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_14___get__(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
- }
- return 0;
+static PyObject *__pyx_getprop_5_cdec_15SufficientStats_score(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_15SufficientStats_5score_1__get__(o);
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_14___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static PyObject *__pyx_getprop_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(o);
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_14___get__[] = {
+static PyMethodDef __pyx_methods_5_cdec_SufficientStats[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_14___get__ = {
- 0, /*nb_add*/
+static struct PyGetSetDef __pyx_getsets_5_cdec_SufficientStats[] = {
+ {(char *)"score", __pyx_getprop_5_cdec_15SufficientStats_score, 0, 0, 0},
+ {(char *)"detail", __pyx_getprop_5_cdec_15SufficientStats_detail, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_SufficientStats = {
+ __pyx_pw_5_cdec_15SufficientStats_12__add__, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
@@ -26363,7 +24057,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_14___get__ = {
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
- 0, /*nb_inplace_add*/
+ __pyx_pw_5_cdec_15SufficientStats_10__iadd__, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
@@ -26385,11 +24079,11 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_14___get__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_14___get__ = {
- 0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_SufficientStats = {
+ __pyx_pw_5_cdec_15SufficientStats_3__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
- 0, /*sq_item*/
+ __pyx_sq_item_5_cdec_SufficientStats, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
@@ -26398,39 +24092,18 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_14___get__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_14___get__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_SufficientStats = {
+ __pyx_pw_5_cdec_15SufficientStats_3__len__, /*mp_length*/
+ __pyx_pw_5_cdec_15SufficientStats_8__getitem__, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_14___get__ = {
- #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_5_cdec___pyx_scope_struct_14___get__ = {
+static PyTypeObject __pyx_type_5_cdec_SufficientStats = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_14___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.SufficientStats"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_SufficientStats), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_14___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_SufficientStats, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26440,26 +24113,26 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_14___get__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_14___get__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_14___get__, /*tp_as_mapping*/
+ &__pyx_tp_as_number_SufficientStats, /*tp_as_number*/
+ &__pyx_tp_as_sequence_SufficientStats, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_SufficientStats, /*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_14___get__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_14___get__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_14___get__, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_5_cdec_15SufficientStats_5__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_14___get__, /*tp_methods*/
+ __pyx_methods_5_cdec_SufficientStats, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_5_cdec_SufficientStats, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -26467,7 +24140,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_14___get__, /*tp_new*/
+ __pyx_tp_new_5_cdec_SufficientStats, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26481,149 +24154,73 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *__pyx_freelist_5_cdec___pyx_scope_struct_8_kbest[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_8_kbest = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_8_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_8_kbest[--__pyx_freecount_5_cdec___pyx_scope_struct_8_kbest];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o);
p->__pyx_v_self = 0;
+ p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_v_size);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_8_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_8_kbest[__pyx_freecount_5_cdec___pyx_scope_struct_8_kbest++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_15___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_8_kbest(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
+ if (p->__pyx_v_size) {
+ e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ }
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_15___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_size);
+ p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_15___get__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_8_kbest[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_15___get__ = {
- 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_15___get__ = {
- 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_15___get__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_15___get__ = {
- #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_5_cdec___pyx_scope_struct_15___get__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_15___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_8_kbest"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_kbest, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26633,24 +24230,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_15___get__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_15___get__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_15___get__, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_15___get__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_15___get__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_15___get__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_8_kbest, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_8_kbest, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_15___get__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_8_kbest, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26660,7 +24257,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_15___get__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26674,149 +24271,81 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_freelist_5_cdec___pyx_scope_struct_10_kbest_features[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_10_kbest_features[--__pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o);
+ p->__pyx_v_fmap = 0;
p->__pyx_v_self = 0;
+ p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o;
PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_fmap);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_v_size);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_10_kbest_features[__pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_16___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+ if (p->__pyx_v_fmap) {
+ e = (*v)(((PyObject*)p->__pyx_v_fmap), 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_size) {
+ e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ }
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o;
PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_fmap);
+ p->__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_size);
+ p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_16___get__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_10_kbest_features[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_16___get__ = {
- 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_16___get__ = {
- 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_16___get__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_16___get__ = {
- #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_5_cdec___pyx_scope_struct_16___get__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_16___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_10_kbest_features"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26826,24 +24355,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_16___get__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_16___get__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_16___get__, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_16___get__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_16___get__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_16___get__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_16___get__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26853,7 +24382,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_16___get__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26867,149 +24396,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_15___get__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_15___get__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_15___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_15___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_15___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_15___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_15___get__[__pyx_freecount_5_cdec___pyx_scope_struct_15___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_15___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)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_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_15___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_17___get__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_15___get__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_17___get__ = {
- 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_17___get__ = {
- 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_17___get__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_17___get__ = {
- #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_5_cdec___pyx_scope_struct_17___get__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_17___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_15___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -27019,24 +24464,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_17___get__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_17___get__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_17___get__, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_17___get__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___get__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_17___get__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_15___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_15___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_17___get__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_15___get__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -27046,7 +24491,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_17___get__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_15___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -27060,149 +24505,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *__pyx_freelist_5_cdec___pyx_scope_struct_5___str__[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_5___str__ = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_5___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_5___str__[--__pyx_freecount_5_cdec___pyx_scope_struct_5___str__];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_5___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_5___str__[__pyx_freecount_5_cdec___pyx_scope_struct_5___str__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_18___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_5___str__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___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_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_18___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_5___str__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_18___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_18___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_18___iter__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_18___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_5_cdec___pyx_scope_struct_18___iter__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5___str__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_18___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_5___str__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_5___str__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -27212,24 +24573,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_18___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_18___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_18___iter__, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_18___iter__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_18___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_18___iter__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_5___str__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_5___str__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_18___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_5___str__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -27239,7 +24600,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_5___str__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -27253,149 +24614,89 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_freelist_5_cdec___pyx_scope_struct_9_kbest_trees[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_9_kbest_trees[--__pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o);
+ p->__pyx_v_e_tree = 0;
+ p->__pyx_v_f_tree = 0;
p->__pyx_v_self = 0;
+ p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_e_tree);
+ Py_CLEAR(p->__pyx_v_f_tree);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ Py_CLEAR(p->__pyx_v_size);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_9_kbest_trees[__pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_todot(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
+ if (p->__pyx_v_e_tree) {
+ e = (*v)(p->__pyx_v_e_tree, a); if (e) return e;
+ }
+ if (p->__pyx_v_f_tree) {
+ e = (*v)(p->__pyx_v_f_tree, 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_size) {
+ e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ }
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_19_todot(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_e_tree);
+ p->__pyx_v_e_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_f_tree);
+ p->__pyx_v_f_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_size);
+ p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_19_todot[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_9_kbest_trees[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_19_todot = {
- 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_19_todot = {
- 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_19_todot = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_19_todot = {
- #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_5_cdec___pyx_scope_struct_19_todot = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_19_todot"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_9_kbest_trees"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -27405,24 +24706,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_todot = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_19_todot, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_19_todot, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_19_todot, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_19_todot, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_todot, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_19_todot, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_19_todot, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -27432,7 +24733,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_todot = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_19_todot, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -27445,198 +24746,81 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_todot = {
0, /*tp_version_tag*/
#endif
};
+static struct __pyx_vtabstruct_5_cdec_Hypergraph __pyx_vtable_5_cdec_Hypergraph;
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_delta = 0;
- p->__pyx_v_i = 0;
- p->__pyx_v_label = 0;
- p->__pyx_v_weight = 0;
- p->__pyx_t_1 = 0;
- p->__pyx_t_3 = 0;
+static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec_Hypergraph *p;
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_5_cdec_Hypergraph *)o);
+ p->__pyx_vtab = __pyx_vtabptr_5_cdec_Hypergraph;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_delta);
- Py_CLEAR(p->__pyx_v_i);
- Py_CLEAR(p->__pyx_v_label);
- Py_CLEAR(p->__pyx_v_weight);
- Py_CLEAR(p->__pyx_t_1);
- Py_CLEAR(p->__pyx_t_3);
- PyObject_GC_Track(o);
+static void __pyx_tp_dealloc_5_cdec_Hypergraph(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_5_cdec_10Hypergraph_1__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_20_lines(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
- if (p->__pyx_outer_scope) {
- e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
- }
- if (p->__pyx_v_delta) {
- e = (*v)(p->__pyx_v_delta, a); if (e) return e;
- }
- if (p->__pyx_v_i) {
- e = (*v)(p->__pyx_v_i, a); if (e) return e;
- }
- if (p->__pyx_v_label) {
- e = (*v)(p->__pyx_v_label, 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_1) {
- e = (*v)(p->__pyx_t_1, a); if (e) return e;
- }
- if (p->__pyx_t_3) {
- e = (*v)(p->__pyx_t_3, a); if (e) return e;
- }
- return 0;
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_edges(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(o);
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_20_lines(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_delta);
- p->__pyx_v_delta = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_i);
- p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_label);
- p->__pyx_v_label = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_weight);
- p->__pyx_v_weight = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_1);
- p->__pyx_t_1 = 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);
- return 0;
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_nodes(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(o);
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_20_lines[] = {
- {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_20_lines = {
- 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 PyObject *__pyx_getprop_5_cdec_10Hypergraph_goal(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(o);
+}
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_20_lines = {
- 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 PyObject *__pyx_getprop_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(o);
+}
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_20_lines = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
+static PyMethodDef __pyx_methods_5_cdec_Hypergraph[] = {
+ {__Pyx_NAMESTR("viterbi"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_3viterbi, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_2viterbi)},
+ {__Pyx_NAMESTR("viterbi_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_4viterbi_trees)},
+ {__Pyx_NAMESTR("viterbi_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_7viterbi_features, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_6viterbi_features)},
+ {__Pyx_NAMESTR("viterbi_forest"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_9viterbi_forest, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("viterbi_joshua"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_11viterbi_joshua, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_10viterbi_joshua)},
+ {__Pyx_NAMESTR("kbest"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_13kbest, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_12kbest)},
+ {__Pyx_NAMESTR("kbest_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_16kbest_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_15kbest_trees)},
+ {__Pyx_NAMESTR("kbest_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_19kbest_features, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_18kbest_features)},
+ {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_22sample, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_21sample)},
+ {__Pyx_NAMESTR("sample_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_25sample_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_24sample_trees)},
+ {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_28intersect, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_27intersect)},
+ {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_30prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_29prune)},
+ {__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_32lattice, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_31lattice)},
+ {__Pyx_NAMESTR("plf"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_34plf, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_33plf)},
+ {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_36reweight, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_35reweight)},
+ {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_38inside_outside, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_37inside_outside)},
+ {0, 0, 0, 0}
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_20_lines = {
- #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 struct PyGetSetDef __pyx_getsets_5_cdec_Hypergraph[] = {
+ {(char *)"edges", __pyx_getprop_5_cdec_10Hypergraph_edges, 0, 0, 0},
+ {(char *)"nodes", __pyx_getprop_5_cdec_10Hypergraph_nodes, 0, 0, 0},
+ {(char *)"goal", __pyx_getprop_5_cdec_10Hypergraph_goal, 0, 0, 0},
+ {(char *)"npaths", __pyx_getprop_5_cdec_10Hypergraph_npaths, 0, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = {
+static PyTypeObject __pyx_type_5_cdec_Hypergraph = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_20_lines"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.Hypergraph"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_Hypergraph), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_Hypergraph, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -27646,26 +24830,26 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_20_lines, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_20_lines, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_20_lines, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_20_lines, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_20_lines, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_20_lines, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_20_lines, /*tp_methods*/
+ __pyx_methods_5_cdec_Hypergraph, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_5_cdec_Hypergraph, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -27673,7 +24857,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_20_lines, /*tp_new*/
+ __pyx_tp_new_5_cdec_Hypergraph, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -27687,124 +24871,59 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o);
- p->__pyx_v_i = 0;
- p->__pyx_v_self = 0;
- p->__pyx_t_1 = 0;
+static PyObject *__pyx_tp_new_5_cdec_Lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_5_cdec_7Lattice_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_i);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_t_1);
- PyObject_GC_Track(o);
+static void __pyx_tp_dealloc_5_cdec_Lattice(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_5_cdec_7Lattice_5__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
(*Py_TYPE(o)->tp_free)(o);
}
+static PyObject *__pyx_sq_item_5_cdec_Lattice(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
+}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
- if (p->__pyx_v_i) {
- e = (*v)(p->__pyx_v_i, a); if (e) return e;
- }
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+static int __pyx_mp_ass_subscript_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_5_cdec_7Lattice_9__setitem__(o, i, v);
}
- if (p->__pyx_t_1) {
- e = (*v)(p->__pyx_t_1, a); if (e) return e;
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+ return -1;
}
- return 0;
-}
-
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_i);
- p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_SufficientStats *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_1);
- p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_21___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec_Lattice[] = {
+ {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_15__unicode__, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("todot"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_20todot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Lattice_19todot)},
+ {__Pyx_NAMESTR("as_hypergraph"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_22as_hypergraph, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Lattice_21as_hypergraph)},
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_21___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_21___iter__ = {
- 0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_Lattice = {
+ __pyx_pw_5_cdec_7Lattice_11__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
- 0, /*sq_item*/
+ __pyx_sq_item_5_cdec_Lattice, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
@@ -27813,39 +24932,18 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_21___iter__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_21___iter__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_21___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 PyMappingMethods __pyx_tp_as_mapping_Lattice = {
+ __pyx_pw_5_cdec_7Lattice_11__len__, /*mp_length*/
+ __pyx_pw_5_cdec_7Lattice_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_5_cdec_Lattice, /*mp_ass_subscript*/
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
+static PyTypeObject __pyx_type_5_cdec_Lattice = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_21___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.Lattice"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_Lattice), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_Lattice, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -27855,24 +24953,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_21___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_21___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_21___iter__, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ &__pyx_tp_as_sequence_Lattice, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_Lattice, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- 0, /*tp_str*/
+ __pyx_pw_5_cdec_7Lattice_13__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_21___iter__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_5_cdec_7Lattice_17__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_21___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec_Lattice, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -27880,9 +24978,9 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_5_cdec_7Lattice_3__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec_Lattice, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -27896,149 +24994,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o);
+static struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *__pyx_freelist_5_cdec___pyx_scope_struct_11_sample[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_11_sample = 0;
+
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_11_sample > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_11_sample[--__pyx_freecount_5_cdec___pyx_scope_struct_11_sample];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_sample(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_11_sample < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_11_sample[__pyx_freecount_5_cdec___pyx_scope_struct_11_sample++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_22___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_11_sample(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)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_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_11_sample(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_CandidateSet *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_22___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_11_sample[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_22___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_22___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_22___iter__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_22___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_5_cdec___pyx_scope_struct_22___iter__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_22___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_11_sample"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_sample, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -28048,24 +25062,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_22___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_22___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_22___iter__, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_22___iter__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_22___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_22___iter__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_11_sample, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_11_sample, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_22___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_11_sample, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -28075,7 +25089,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_11_sample, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -28089,10 +25103,21 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22___iter__ = {
#endif
};
+static struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *__pyx_freelist_5_cdec___pyx_scope_struct_23__make_config[8];
+static int __pyx_freecount_5_cdec___pyx_scope_struct_23__make_config = 0;
+
static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
+ PyObject *o;
+ if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_23__make_config > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config)))) {
+ o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_23__make_config[--__pyx_freecount_5_cdec___pyx_scope_struct_23__make_config];
+ memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config));
+ PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o);
p->__pyx_v_config = 0;
p->__pyx_v_info = 0;
@@ -28114,8 +25139,11 @@ static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_23__make_config(PyObject
Py_CLEAR(p->__pyx_v_value);
Py_CLEAR(p->__pyx_t_0);
Py_CLEAR(p->__pyx_t_1);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
+ if ((__pyx_freecount_5_cdec___pyx_scope_struct_23__make_config < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config))) {
+ __pyx_freelist_5_cdec___pyx_scope_struct_23__make_config[__pyx_freecount_5_cdec___pyx_scope_struct_23__make_config++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_23__make_config(PyObject *o, visitproc v, void *a) {
@@ -28176,104 +25204,6 @@ static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_23__make_config[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_23__make_config = {
- 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_23__make_config = {
- 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_23__make_config = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_23__make_config = {
- #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_5_cdec___pyx_scope_struct_23__make_config = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("_cdec.__pyx_scope_struct_23__make_config"), /*tp_name*/
@@ -28289,16 +25219,16 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23__make_config = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_23__make_config, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_23__make_config, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_23__make_config, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_23__make_config, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_5_cdec___pyx_scope_struct_23__make_config, /*tp_traverse*/
__pyx_tp_clear_5_cdec___pyx_scope_struct_23__make_config, /*tp_clear*/
@@ -28330,149 +25260,22 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23__make_config = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o);
- p->__pyx_v_config = 0;
+static PyObject *__pyx_tp_new_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = __pyx_tp_new_5_cdec_Grammar(t, a, k);
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24___init__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_config);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_24___init__(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o;
- if (p->__pyx_v_config) {
- e = (*v)(p->__pyx_v_config, a); if (e) return e;
- }
- return 0;
-}
-
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_24___init__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_config);
- p->__pyx_v_config = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
-}
-
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_24___init__[] = {
+static PyMethodDef __pyx_methods_5_cdec_TextGrammar[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_24___init__ = {
- 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_24___init__ = {
- 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_24___init__ = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_24___init__ = {
- #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_5_cdec___pyx_scope_struct_24___init__ = {
+static PyTypeObject __pyx_type_5_cdec_TextGrammar = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_24___init__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.TextGrammar"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_TextGrammar), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24___init__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec_Grammar, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -28482,233 +25285,28 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24___init__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_24___init__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_24___init__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_24___init__, /*tp_as_mapping*/
+ 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*/
- &__pyx_tp_as_buffer___pyx_scope_struct_24___init__, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_24___init__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_24___init__, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_24___init__, /*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_5_cdec___pyx_scope_struct_24___init__, /*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_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_kv = 0;
- p->__pyx_t_0 = 0;
- return o;
-}
-
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_kv);
- Py_CLEAR(p->__pyx_t_0);
- PyObject_GC_Track(o);
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
- if (p->__pyx_outer_scope) {
- e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
- }
- if (p->__pyx_v_kv) {
- e = (*v)(p->__pyx_v_kv, 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_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_kv);
- p->__pyx_v_kv = 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_5_cdec___pyx_scope_struct_25_genexpr[] = {
- {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_25_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_25_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_25_genexpr = {
- 0, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_25_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_5_cdec___pyx_scope_struct_25_genexpr = {
- PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_25_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_25_genexpr, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- #if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
+ #if CYTHON_COMPILING_IN_PYPY
+ __pyx_pw_5_cdec_7Grammar_3__iter__, /*tp_iter*/
#else
- 0, /*reserved*/
- #endif
- 0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_25_genexpr, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_25_genexpr, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_25_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_25_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_5_cdec___pyx_scope_struct_25_genexpr, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_25_genexpr, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
0, /*tp_iter*/
+ #endif
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_25_genexpr, /*tp_methods*/
+ __pyx_methods_5_cdec_TextGrammar, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -28716,9 +25314,9 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_25_genexpr = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_5_cdec_11TextGrammar_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr, /*tp_new*/
+ __pyx_tp_new_5_cdec_TextGrammar, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -28810,11 +25408,17 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
{&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
+ {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1},
{&__pyx_n_s____enter__, __pyx_k____enter__, sizeof(__pyx_k____enter__), 0, 0, 1, 1},
{&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1},
+ {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
{&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
+ {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1},
+ {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1},
{&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
+ {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
+ {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1},
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
{&__pyx_n_s___cdec, __pyx_k___cdec, sizeof(__pyx_k___cdec), 0, 0, 1, 1},
{&__pyx_n_s___make_config, __pyx_k___make_config, sizeof(__pyx_k___make_config), 0, 0, 1, 1},
@@ -28822,9 +25426,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s___sa, __pyx_k___sa, sizeof(__pyx_k___sa), 0, 0, 1, 1},
{&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
{&__pyx_n_s__alignments, __pyx_k__alignments, sizeof(__pyx_k__alignments), 0, 0, 1, 1},
- {&__pyx_n_s__basestring, __pyx_k__basestring, sizeof(__pyx_k__basestring), 0, 0, 1, 1},
+ {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
+ {&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1},
{&__pyx_n_s__beam_alpha, __pyx_k__beam_alpha, sizeof(__pyx_k__beam_alpha), 0, 0, 1, 1},
{&__pyx_n_s__cat, __pyx_k__cat, sizeof(__pyx_k__cat), 0, 0, 1, 1},
+ {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
{&__pyx_n_s__config, __pyx_k__config, sizeof(__pyx_k__config), 0, 0, 1, 1},
{&__pyx_n_s__config_str, __pyx_k__config_str, sizeof(__pyx_k__config_str), 0, 0, 1, 1},
{&__pyx_n_s__csplit, __pyx_k__csplit, sizeof(__pyx_k__csplit), 0, 0, 1, 1},
@@ -28843,6 +25449,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
{&__pyx_n_s__fst, __pyx_k__fst, sizeof(__pyx_k__fst), 0, 0, 1, 1},
{&__pyx_n_s__genexpr, __pyx_k__genexpr, sizeof(__pyx_k__genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
{&__pyx_n_s__grammar, __pyx_k__grammar, sizeof(__pyx_k__grammar), 0, 0, 1, 1},
{&__pyx_n_s__hyp, __pyx_k__hyp, sizeof(__pyx_k__hyp), 0, 0, 1, 1},
{&__pyx_n_s__hypergraph, __pyx_k__hypergraph, sizeof(__pyx_k__hypergraph), 0, 0, 1, 1},
@@ -28874,6 +25481,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__score, __pyx_k__score, sizeof(__pyx_k__score), 0, 0, 1, 1},
{&__pyx_n_s__scores, __pyx_k__scores, sizeof(__pyx_k__scores), 0, 0, 1, 1},
{&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
+ {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1},
{&__pyx_n_s__sentence, __pyx_k__sentence, sizeof(__pyx_k__sentence), 0, 0, 1, 1},
{&__pyx_n_s__set_silent, __pyx_k__set_silent, sizeof(__pyx_k__set_silent), 0, 0, 1, 1},
{&__pyx_n_s__span, __pyx_k__span, sizeof(__pyx_k__span), 0, 0, 1, 1},
@@ -28882,6 +25490,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1},
{&__pyx_n_s__super, __pyx_k__super, sizeof(__pyx_k__super), 0, 0, 1, 1},
{&__pyx_n_s__tagger, __pyx_k__tagger, sizeof(__pyx_k__tagger), 0, 0, 1, 1},
+ {&__pyx_n_s__throw, __pyx_k__throw, sizeof(__pyx_k__throw), 0, 0, 1, 1},
{&__pyx_n_s__utf8, __pyx_k__utf8, sizeof(__pyx_k__utf8), 0, 0, 1, 1},
{&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
{&__pyx_n_s__weight, __pyx_k__weight, sizeof(__pyx_k__weight), 0, 0, 1, 1},
@@ -28889,18 +25498,17 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_NotImplemented = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_super = __Pyx_GetName(__pyx_b, __pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_basestring = __Pyx_GetName(__pyx_b, __pyx_n_s__basestring); if (!__pyx_builtin_basestring) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_eval = __Pyx_GetName(__pyx_b, __pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_eval = __Pyx_GetBuiltinName(__pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
@@ -28921,7 +25529,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_2);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
- /* "/usr0/home/cdyer/cdec-merge/python/src/vectors.pxi":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":95
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<<
@@ -28932,7 +25540,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_5);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":6
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -28943,7 +25551,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_6);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":226
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":226
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
@@ -28953,7 +25561,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_14);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":244
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":244
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
@@ -28964,7 +25572,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_19);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
- /* "/usr0/home/cdyer/cdec-merge/python/src/hypergraph.pxi":281
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":281
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
@@ -28973,7 +25581,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_21);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":26
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
@@ -28984,7 +25592,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_24);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
@@ -28995,7 +25603,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_25);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":69
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":69
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
@@ -29006,7 +25614,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_32);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
* def todot(self):
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines(): # <<<<<<<<<<<<<<
@@ -29018,7 +25626,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
__pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_37, __pyx_n_s__lines, 63, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/lattice.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":72
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
@@ -29029,7 +25637,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_40);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":50
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":50
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<<
@@ -29040,7 +25648,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_42);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":84
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
@@ -29051,29 +25659,29 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_44);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
- /* "_cdec.pyx":93
+ /* "_cdec.pyx":92
* with open(weights) as fp:
* for line in fp:
* if line.strip().startswith('#'): continue # <<<<<<<<<<<<<<
* fname, value = line.split()
* self.weights[fname.strip()] = float(value)
*/
- __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_50);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
- /* "_cdec.pyx":91
+ /* "_cdec.pyx":90
* def read_weights(self, weights):
* """decoder.read_weights(filename): Read decoder weights from a file."""
* with open(weights) as fp: # <<<<<<<<<<<<<<
* for line in fp:
* if line.strip().startswith('#'): continue
*/
- __pyx_k_tuple_51 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_51 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_51);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":5
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -29085,7 +25693,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
__pyx_k_codeobj_56 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_57, __pyx_n_s___phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":194
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":194
* return []
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
@@ -29096,7 +25704,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_58);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":195
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":195
*
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<<
@@ -29107,7 +25715,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_59);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":196
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":196
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
@@ -29118,7 +25726,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_60);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":197
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":197
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
@@ -29128,7 +25736,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_tuple_61);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":198
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":198
* TER = Scorer('TER')
* CER = Scorer('CER')
* SSK = Scorer('SSK') # <<<<<<<<<<<<<<
@@ -29188,6 +25796,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
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_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -29225,6 +25836,8 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
#if PY_MAJOR_VERSION >= 3
{
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -29240,6 +25853,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
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;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
if (__pyx_module_is_main__cdec) {
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
@@ -29251,45 +25867,11 @@ PyMODINIT_FUNC PyInit__cdec(void)
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
- if (PyType_Ready(&__pyx_type_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if CYTHON_COMPILING_IN_CPYTHON
- {
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_DenseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_5_cdec_11DenseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_5_cdec_11DenseVector___init__.doc = __pyx_doc_5_cdec_11DenseVector___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_11DenseVector___init__;
- }
- }
- #endif
- if (__Pyx_SetAttrString(__pyx_m, "DenseVector", (PyObject *)&__pyx_type_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_DenseVector = &__pyx_type_5_cdec_DenseVector;
- if (PyType_Ready(&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if CYTHON_COMPILING_IN_CPYTHON
- {
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_SparseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_5_cdec_12SparseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_5_cdec_12SparseVector___init__.doc = __pyx_doc_5_cdec_12SparseVector___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_12SparseVector___init__;
- }
- }
- #endif
- if (__Pyx_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_SparseVector = &__pyx_type_5_cdec_SparseVector;
- if (PyType_Ready(&__pyx_type_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if CYTHON_COMPILING_IN_CPYTHON
- {
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_NT, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_5_cdec_2NT___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_5_cdec_2NT___init__.doc = __pyx_doc_5_cdec_2NT___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_2NT___init__;
- }
- }
- #endif
- if (__Pyx_SetAttrString(__pyx_m, "NT", (PyObject *)&__pyx_type_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_NT = &__pyx_type_5_cdec_NT;
+ if (PyType_Ready(&__pyx_type_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_Scorer = &__pyx_type_5_cdec_Scorer;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_24___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_24___init__ = &__pyx_type_5_cdec___pyx_scope_struct_24___init__;
if (PyType_Ready(&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_CPYTHON
{
@@ -29303,6 +25885,24 @@ PyMODINIT_FUNC PyInit__cdec(void)
#endif
if (__Pyx_SetAttrString(__pyx_m, "NTRef", (PyObject *)&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_NTRef = &__pyx_type_5_cdec_NTRef;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_22___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_22___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_22___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_Grammar = &__pyx_type_5_cdec_Grammar;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_20_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_20_lines = &__pyx_type_5_cdec___pyx_scope_struct_20_lines;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = &__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = &__pyx_type_5_cdec___pyx_scope_struct_13___get__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_2__phrase) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_2__phrase = &__pyx_type_5_cdec___pyx_scope_struct_2__phrase;
+ if (PyType_Ready(&__pyx_type_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "CandidateSet", (PyObject *)&__pyx_type_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_CandidateSet = &__pyx_type_5_cdec_CandidateSet;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_14___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = &__pyx_type_5_cdec___pyx_scope_struct_14___get__;
if (PyType_Ready(&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_CPYTHON
{
@@ -29316,6 +25916,8 @@ PyMODINIT_FUNC PyInit__cdec(void)
#endif
if (__Pyx_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_TRule = &__pyx_type_5_cdec_TRule;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_3_genexpr;
__pyx_type_5_cdec_MRule.tp_base = __pyx_ptype_5_cdec_TRule;
if (PyType_Ready(&__pyx_type_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_CPYTHON
@@ -29330,146 +25932,160 @@ PyMODINIT_FUNC PyInit__cdec(void)
#endif
if (__Pyx_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_MRule = &__pyx_type_5_cdec_MRule;
- if (PyType_Ready(&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_Grammar = &__pyx_type_5_cdec_Grammar;
- __pyx_type_5_cdec_TextGrammar.tp_base = __pyx_ptype_5_cdec_Grammar;
- if (PyType_Ready(&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "SegmentEvaluator", (PyObject *)&__pyx_type_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_SegmentEvaluator = &__pyx_type_5_cdec_SegmentEvaluator;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_25_genexpr;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_19_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_19_todot = &__pyx_type_5_cdec___pyx_scope_struct_19_todot;
+ if (PyType_Ready(&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Candidate", (PyObject *)&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_Candidate = &__pyx_type_5_cdec_Candidate;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_6_genexpr;
+ if (PyType_Ready(&__pyx_type_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_TextGrammar, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_NT, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_5_cdec_11TextGrammar___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_5_cdec_11TextGrammar___init__.doc = __pyx_doc_5_cdec_11TextGrammar___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_11TextGrammar___init__;
+ __pyx_wrapperbase_5_cdec_2NT___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_5_cdec_2NT___init__.doc = __pyx_doc_5_cdec_2NT___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_2NT___init__;
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_TextGrammar = &__pyx_type_5_cdec_TextGrammar;
- __pyx_vtabptr_5_cdec_Hypergraph = &__pyx_vtable_5_cdec_Hypergraph;
- __pyx_vtable_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_5_cdec_Hypergraph *))__pyx_f_5_cdec_10Hypergraph__rng;
- if (PyType_Ready(&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_5_cdec_Hypergraph.tp_dict, __pyx_vtabptr_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Hypergraph", (PyObject *)&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_Hypergraph = &__pyx_type_5_cdec_Hypergraph;
+ if (__Pyx_SetAttrString(__pyx_m, "NT", (PyObject *)&__pyx_type_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_NT = &__pyx_type_5_cdec_NT;
__pyx_vtabptr_5_cdec_HypergraphEdge = &__pyx_vtable_5_cdec_HypergraphEdge;
__pyx_vtable_5_cdec_HypergraphEdge.init = (PyObject *(*)(struct __pyx_obj_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int))__pyx_f_5_cdec_14HypergraphEdge_init;
if (PyType_Ready(&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_HypergraphEdge = &__pyx_type_5_cdec_HypergraphEdge;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_1___iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_1___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_5_cdec___pyx_scope_struct_16___get__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_4___get__ = &__pyx_type_5_cdec___pyx_scope_struct_4___get__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_18___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_Decoder, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_5_cdec_7Decoder___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_5_cdec_7Decoder___init__.doc = __pyx_doc_5_cdec_7Decoder___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_7Decoder___init__;
+ }
+ }
+ #endif
+ if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_Decoder = &__pyx_type_5_cdec_Decoder;
__pyx_vtabptr_5_cdec_HypergraphNode = &__pyx_vtable_5_cdec_HypergraphNode;
__pyx_vtable_5_cdec_HypergraphNode.init = (PyObject *(*)(struct __pyx_obj_5_cdec_HypergraphNode *, Hypergraph *, unsigned int))__pyx_f_5_cdec_14HypergraphNode_init;
if (PyType_Ready(&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_HypergraphNode = &__pyx_type_5_cdec_HypergraphNode;
- if (PyType_Ready(&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_Lattice, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_SparseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_5_cdec_7Lattice_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_5_cdec_7Lattice_2__init__.doc = __pyx_doc_5_cdec_7Lattice_2__init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_7Lattice_2__init__;
+ __pyx_wrapperbase_5_cdec_12SparseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_5_cdec_12SparseVector___init__.doc = __pyx_doc_5_cdec_12SparseVector___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_12SparseVector___init__;
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_Lattice = &__pyx_type_5_cdec_Lattice;
- if (PyType_Ready(&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Candidate", (PyObject *)&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_Candidate = &__pyx_type_5_cdec_Candidate;
- if (PyType_Ready(&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "SufficientStats", (PyObject *)&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_SufficientStats = &__pyx_type_5_cdec_SufficientStats;
- if (PyType_Ready(&__pyx_type_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "CandidateSet", (PyObject *)&__pyx_type_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_CandidateSet = &__pyx_type_5_cdec_CandidateSet;
- if (PyType_Ready(&__pyx_type_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "SegmentEvaluator", (PyObject *)&__pyx_type_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_SegmentEvaluator = &__pyx_type_5_cdec_SegmentEvaluator;
- if (PyType_Ready(&__pyx_type_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_Scorer = &__pyx_type_5_cdec_Scorer;
- if (PyType_Ready(&__pyx_type_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Metric", (PyObject *)&__pyx_type_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_Metric = &__pyx_type_5_cdec_Metric;
- if (PyType_Ready(&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_SparseVector = &__pyx_type_5_cdec_SparseVector;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_5_cdec___pyx_scope_struct_17___get__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_5_cdec___pyx_scope_struct____iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_21___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_21___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_Decoder, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_DenseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_5_cdec_7Decoder___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_5_cdec_7Decoder___init__.doc = __pyx_doc_5_cdec_7Decoder___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_7Decoder___init__;
+ __pyx_wrapperbase_5_cdec_11DenseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_5_cdec_11DenseVector___init__.doc = __pyx_doc_5_cdec_11DenseVector___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_11DenseVector___init__;
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec_Decoder = &__pyx_type_5_cdec_Decoder;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_5_cdec___pyx_scope_struct____iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_1___iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_1___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_2__phrase) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_2__phrase = &__pyx_type_5_cdec___pyx_scope_struct_2__phrase;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_3_genexpr;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_4___get__ = &__pyx_type_5_cdec___pyx_scope_struct_4___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_5___str__ = &__pyx_type_5_cdec___pyx_scope_struct_5___str__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_6_genexpr;
+ if (__Pyx_SetAttrString(__pyx_m, "DenseVector", (PyObject *)&__pyx_type_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_DenseVector = &__pyx_type_5_cdec_DenseVector;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_7___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Metric", (PyObject *)&__pyx_type_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_Metric = &__pyx_type_5_cdec_Metric;
+ if (PyType_Ready(&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "SufficientStats", (PyObject *)&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_SufficientStats = &__pyx_type_5_cdec_SufficientStats;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_5_cdec___pyx_scope_struct_8_kbest;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees = &__pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_10_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features = &__pyx_type_5_cdec___pyx_scope_struct_10_kbest_features;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_11_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_11_sample = &__pyx_type_5_cdec___pyx_scope_struct_11_sample;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = &__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = &__pyx_type_5_cdec___pyx_scope_struct_13___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_14___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = &__pyx_type_5_cdec___pyx_scope_struct_14___get__;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_15___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_15___get__ = &__pyx_type_5_cdec___pyx_scope_struct_15___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_5_cdec___pyx_scope_struct_16___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_5_cdec___pyx_scope_struct_17___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_18___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_19_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_19_todot = &__pyx_type_5_cdec___pyx_scope_struct_19_todot;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_20_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_20_lines = &__pyx_type_5_cdec___pyx_scope_struct_20_lines;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_21___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_21___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_22___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_22___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_22___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_5___str__ = &__pyx_type_5_cdec___pyx_scope_struct_5___str__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees = &__pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees;
+ __pyx_vtabptr_5_cdec_Hypergraph = &__pyx_vtable_5_cdec_Hypergraph;
+ __pyx_vtable_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_5_cdec_Hypergraph *))__pyx_f_5_cdec_10Hypergraph__rng;
+ if (PyType_Ready(&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetVtable(__pyx_type_5_cdec_Hypergraph.tp_dict, __pyx_vtabptr_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Hypergraph", (PyObject *)&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_Hypergraph = &__pyx_type_5_cdec_Hypergraph;
+ if (PyType_Ready(&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_Lattice, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_5_cdec_7Lattice_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_5_cdec_7Lattice_2__init__.doc = __pyx_doc_5_cdec_7Lattice_2__init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_7Lattice_2__init__;
+ }
+ }
+ #endif
+ if (__Pyx_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_Lattice = &__pyx_type_5_cdec_Lattice;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_11_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_11_sample = &__pyx_type_5_cdec___pyx_scope_struct_11_sample;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_23__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config = &__pyx_type_5_cdec___pyx_scope_struct_23__make_config;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_24___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_24___init__ = &__pyx_type_5_cdec___pyx_scope_struct_24___init__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_25_genexpr;
+ __pyx_type_5_cdec_TextGrammar.tp_base = __pyx_ptype_5_cdec_Grammar;
+ if (PyType_Ready(&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_TextGrammar, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_5_cdec_11TextGrammar___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_5_cdec_11TextGrammar___init__.doc = __pyx_doc_5_cdec_11TextGrammar___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_11TextGrammar___init__;
+ }
+ }
+ #endif
+ if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_TextGrammar = &__pyx_type_5_cdec_TextGrammar;
/*--- Type import code ---*/
- __pyx_ptype_4cdec_2sa_3_sa_FloatList = __Pyx_ImportType("cdec.sa._sa", "FloatList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FloatList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_4cdec_2sa_3_sa_FloatList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_FloatList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_IntList = __Pyx_ImportType("cdec.sa._sa", "IntList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_IntList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_4cdec_2sa_3_sa_IntList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_IntList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_FeatureVector = __Pyx_ImportType("cdec.sa._sa", "FeatureVector", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FeatureVector)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_Phrase = __Pyx_ImportType("cdec.sa._sa", "Phrase", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_FloatList = __Pyx_ImportType("cdec.sa._sa", "FloatList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FloatList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_FloatList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_FloatList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_IntList = __Pyx_ImportType("cdec.sa._sa", "IntList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_IntList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_IntList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_IntList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_FeatureVector = __Pyx_ImportType("cdec.sa._sa", "FeatureVector", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FeatureVector)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_Phrase = __Pyx_ImportType("cdec.sa._sa", "Phrase", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Variable import code ---*/
/*--- Function import code ---*/
__pyx_t_1 = __Pyx_ImportModule("cdec.sa._sa"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -29480,7 +26096,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*--- Execution code ---*/
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":3
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":3
* cimport grammar
* cimport cdec.sa._sa as _sa
* import cdec.sa._sa as _sa # <<<<<<<<<<<<<<
@@ -29495,10 +26111,10 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_53), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s___sa, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s___sa, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/grammar.pxi":5
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -29507,10 +26123,10 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_1_phrase, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s___phrase, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s___phrase, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":194
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":194
* return []
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
@@ -29519,10 +26135,10 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLEU, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__BLEU, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":195
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":195
*
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<<
@@ -29531,10 +26147,10 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__QCRI, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__QCRI, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":196
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":196
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
@@ -29543,10 +26159,10 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__TER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":197
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":197
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
@@ -29554,17 +26170,17 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__CER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/cdyer/cdec-merge/python/src/mteval.pxi":198
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":198
* TER = Scorer('TER')
* CER = Scorer('CER')
* SSK = Scorer('SSK') # <<<<<<<<<<<<<<
*/
__pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SSK, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__SSK, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "_cdec.pyx":22
@@ -29602,7 +26218,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__InvalidConfig, __pyx_n_s__InvalidConfig, __pyx_n_s___cdec); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__InvalidConfig, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__InvalidConfig, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
@@ -29623,7 +26239,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__ParseFailed, __pyx_n_s__ParseFailed, __pyx_n_s___cdec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ParseFailed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__ParseFailed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
@@ -29636,7 +26252,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_3set_silent, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_silent, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__set_silent, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "_cdec.pyx":32
@@ -29648,7 +26264,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_5_make_config, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s___make_config, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s___make_config, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "_cdec.pyx":1
@@ -29658,15 +26274,15 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- /* "string.from_py":12
+ /* "string.from_py":13
*
* @cname("__pyx_convert_string_from_py_")
* cdef string __pyx_convert_string_from_py_(object o) except *: # <<<<<<<<<<<<<<
- * return string(<char*>o, len(o))
- *
+ * cdef Py_ssize_t length
+ * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
*/
goto __pyx_L0;
__pyx_L1_error:;
@@ -29706,17 +26322,15 @@ end:
}
#endif /* CYTHON_REFNANNY */
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
- PyObject *result;
- result = PyObject_GetAttr(dict, name);
- if (!result) {
- if (dict != __pyx_b) {
- PyErr_Clear();
- result = PyObject_GetAttr(__pyx_b, name);
- }
- if (!result) {
- PyErr_SetObject(PyExc_NameError, name);
- }
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
}
return result;
}
@@ -29790,24 +26404,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
}
value = type;
#if PY_VERSION_HEX < 0x02050000
- if (PyInstance_Check(type)) {
- type = (PyObject*) ((PyInstanceObject*)type)->in_class;
- Py_INCREF(type);
- }
- else {
- type = 0;
- PyErr_SetString(PyExc_TypeError,
- "raise: exception must be an old-style class or instance");
- goto raise_error;
- }
- #else
- type = (PyObject*) Py_TYPE(type);
+ if (PyInstance_Check(type)) {
+ type = (PyObject*) ((PyInstanceObject*)type)->in_class;
Py_INCREF(type);
- if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
- PyErr_SetString(PyExc_TypeError,
- "raise: exception class must be a subclass of BaseException");
- goto raise_error;
- }
+ } else {
+ type = 0;
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception must be an old-style class or instance");
+ goto raise_error;
+ }
+ #else
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
#endif
}
__Pyx_ErrRestore(type, value, tb);
@@ -29845,8 +26458,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
else if (PyTuple_Check(value)) {
Py_INCREF(value);
args = value;
- }
- else
+ } else
args = PyTuple_Pack(1, value);
if (!args)
goto bad;
@@ -29867,18 +26479,22 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
"raise: exception class must be a subclass of BaseException");
goto bad;
}
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
if (cause && cause != Py_None) {
+#endif
PyObject *fixed_cause;
- if (PyExceptionClass_Check(cause)) {
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
fixed_cause = PyObject_CallObject(cause, NULL);
if (fixed_cause == NULL)
goto bad;
- }
- else if (PyExceptionInstance_Check(cause)) {
+ } else if (PyExceptionInstance_Check(cause)) {
fixed_cause = cause;
Py_INCREF(fixed_cause);
- }
- else {
+ } else {
PyErr_SetString(PyExc_TypeError,
"exception causes must derive from "
"BaseException");
@@ -30116,6 +26732,94 @@ bad:
return -1;
}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
+ if (likely(PyList_CheckExact(L))) {
+ if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return NULL;
+ Py_INCREF(Py_None);
+ return Py_None; /* this is just to have an accurate signature */
+ } else {
+ return __Pyx_PyObject_CallMethod1(L, __pyx_n_s__append, x);
+ }
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+ PyObject *r;
+ if (!j) return NULL;
+ r = PyObject_GetItem(o, j);
+ Py_DECREF(j);
+ return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+ if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+ PyObject *r = PyList_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (is_list || PyList_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+ if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+ PyObject *r = PyList_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ }
+ else if (PyTuple_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ } else {
+ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+ if (likely(m && m->sq_item)) {
+ if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+ Py_ssize_t l = m->sq_length(o);
+ if (likely(l >= 0)) {
+ i += l;
+ } else {
+ if (PyErr_ExceptionMatches(PyExc_OverflowError))
+ PyErr_Clear();
+ else
+ return NULL;
+ }
+ }
+ return m->sq_item(o, i);
+ }
+ }
+#else
+ if (is_list || PySequence_Check(o)) {
+ return PySequence_GetItem(o, i);
+ }
+#endif
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
@@ -30172,6 +26876,42 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
return 0;
}
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (result) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+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);
+ #if PY_MAJOR_VERSION < 3
+ ctx = PyString_FromString(name);
+ #else
+ ctx = PyUnicode_FromString(name);
+ #endif
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ if (!ctx) {
+ PyErr_WriteUnraisable(Py_None);
+ } else {
+ PyErr_WriteUnraisable(ctx);
+ Py_DECREF(ctx);
+ }
+}
+
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
PyObject* next;
iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
@@ -30209,356 +26949,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject*
return NULL;
}
-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)) {
-#if PY_MAJOR_VERSION >= 3
- float_value = PyFloat_FromString(obj);
-#else
- float_value = PyFloat_FromString(obj, 0);
-#endif
- } else {
- PyObject* args = PyTuple_New(1);
- if (unlikely(!args)) goto bad;
- PyTuple_SET_ITEM(args, 0, obj);
- float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
- 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);
- return value;
- }
-bad:
- return (double)-1;
-}
-
-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;
- local_value = tstate->curexc_value;
- local_tb = tstate->curexc_traceback;
- 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
- 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;
- tstate->exc_type = local_type;
- tstate->exc_value = local_value;
- tstate->exc_traceback = local_tb;
- /* Make sure tstate is in a consistent state when we XDECREF
- 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;
- *value = 0;
- *tb = 0;
- Py_XDECREF(local_type);
- Py_XDECREF(local_value);
- Py_XDECREF(local_tb);
- return -1;
-}
-
-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;
- *tb = tstate->exc_traceback;
- 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;
- tmp_value = tstate->exc_value;
- tmp_tb = tstate->exc_traceback;
- tstate->exc_type = type;
- tstate->exc_value = value;
- tstate->exc_traceback = 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, int level) {
- PyObject *empty_list = 0;
- PyObject *module = 0;
- PyObject *global_dict = 0;
- PyObject *empty_dict = 0;
- PyObject *list;
- #if PY_VERSION_HEX < 0x03030000
- PyObject *py_import = 0;
- py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
- if (!py_import)
- goto bad;
- #endif
- if (from_list)
- list = from_list;
- else {
- empty_list = PyList_New(0);
- if (!empty_list)
- goto bad;
- list = empty_list;
- }
- global_dict = PyModule_GetDict(__pyx_m);
- if (!global_dict)
- goto bad;
- empty_dict = PyDict_New();
- if (!empty_dict)
- goto bad;
- #if PY_VERSION_HEX >= 0x02050000
- {
- #if PY_MAJOR_VERSION >= 3
- if (level == -1) {
- if (strchr(__Pyx_MODULE_NAME, '.')) {
- #if PY_VERSION_HEX < 0x03030000
- PyObject *py_level = PyInt_FromLong(1);
- if (!py_level)
- goto bad;
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, py_level, NULL);
- Py_DECREF(py_level);
- #else
- module = PyImport_ImportModuleLevelObject(
- name, global_dict, empty_dict, list, 1);
- #endif
- if (!module) {
- if (!PyErr_ExceptionMatches(PyExc_ImportError))
- goto bad;
- PyErr_Clear();
- }
- }
- level = 0; /* try absolute import on failure */
- }
- #endif
- if (!module) {
- #if PY_VERSION_HEX < 0x03030000
- PyObject *py_level = PyInt_FromLong(level);
- if (!py_level)
- goto bad;
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, py_level, NULL);
- Py_DECREF(py_level);
- #else
- module = PyImport_ImportModuleLevelObject(
- name, global_dict, empty_dict, list, level);
- #endif
- }
- }
- #else
- if (level>0) {
- PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
- goto bad;
- }
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, NULL);
- #endif
-bad:
- #if PY_VERSION_HEX < 0x03030000
- Py_XDECREF(py_import);
- #endif
- Py_XDECREF(empty_list);
- Py_XDECREF(empty_dict);
- return module;
-}
-
-static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
- PyObject *metaclass;
-#if PY_MAJOR_VERSION < 3
- if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
- PyObject *base = PyTuple_GET_ITEM(bases, 0);
- metaclass = PyObject_GetAttrString(base, (char *)"__class__");
- if (!metaclass) {
- PyErr_Clear();
- metaclass = (PyObject*) Py_TYPE(base);
- }
- } else {
- metaclass = (PyObject *) &PyClass_Type;
- }
-#else
- if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
- PyObject *base = PyTuple_GET_ITEM(bases, 0);
- metaclass = (PyObject*) Py_TYPE(base);
- } else {
- metaclass = (PyObject *) &PyType_Type;
- }
-#endif
- Py_INCREF(metaclass);
- return metaclass;
-}
-
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
- PyObject *qualname, PyObject *modname) {
- PyObject *result;
- PyObject *metaclass;
- if (PyDict_SetItemString(dict, "__module__", modname) < 0)
- return NULL;
- if (PyDict_SetItemString(dict, "__qualname__", qualname) < 0)
- return NULL;
- metaclass = PyDict_GetItemString(dict, "__metaclass__");
- if (metaclass) {
- Py_INCREF(metaclass);
- } else {
- metaclass = __Pyx_FindPy2Metaclass(bases);
- }
- result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
- Py_DECREF(metaclass);
- return result;
-}
-
-static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject* x) {
- const WordID neg_one = (WordID)-1, const_zero = (WordID)0;
- const int is_unsigned = const_zero < neg_one;
- if (sizeof(WordID) == sizeof(char)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedChar(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedChar(x);
- } else if (sizeof(WordID) == sizeof(short)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedShort(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedShort(x);
- } else if (sizeof(WordID) == sizeof(int)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedInt(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedInt(x);
- } else if (sizeof(WordID) == sizeof(long)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedLong(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedLong(x);
- } else if (sizeof(WordID) == sizeof(PY_LONG_LONG)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedLongLong(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedLongLong(x);
- } else {
- #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
- PyErr_SetString(PyExc_RuntimeError,
- "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
- #else
- WordID val;
- PyObject *v = __Pyx_PyNumber_Int(x);
- #if PY_VERSION_HEX < 0x03000000
- if (likely(v) && !PyLong_Check(v)) {
- PyObject *tmp = v;
- v = PyNumber_Long(tmp);
- Py_DECREF(tmp);
- }
- #endif
- if (likely(v)) {
- int one = 1; int is_little = (int)*(unsigned char *)&one;
- unsigned char *bytes = (unsigned char *)&val;
- int ret = _PyLong_AsByteArray((PyLongObject *)v,
- bytes, sizeof(val),
- is_little, !is_unsigned);
- Py_DECREF(v);
- if (likely(!ret))
- return val;
- }
- #endif
- return (WordID)-1;
- }
-}
-
-static PyObject* __Pyx_Globals(void) {
- Py_ssize_t i;
- PyObject *names = NULL;
- PyObject *globals = PyObject_GetAttrString(__pyx_m, "__dict__");
- if (!globals) {
- PyErr_SetString(PyExc_TypeError,
- "current module must have __dict__ attribute");
- goto bad;
- }
- names = PyObject_Dir(__pyx_m);
- if (!names)
- goto bad;
- for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) {
-#if CYTHON_COMPILING_IN_PYPY
- PyObject* name = PySequence_GetItem(names, i);
- if (!name)
- goto bad;
-#else
- PyObject* name = PyList_GET_ITEM(names, i);
-#endif
- if (!PyDict_Contains(globals, name)) {
- PyObject* value = PyObject_GetAttr(__pyx_m, name);
- if (!value) {
-#if CYTHON_COMPILING_IN_PYPY
- Py_DECREF(name);
-#endif
- goto bad;
- }
- if (PyDict_SetItem(globals, name, value) < 0) {
-#if CYTHON_COMPILING_IN_PYPY
- Py_DECREF(name);
-#endif
- Py_DECREF(value);
- goto bad;
- }
- }
-#if CYTHON_COMPILING_IN_PYPY
- Py_DECREF(name);
-#endif
- }
- Py_DECREF(names);
- return globals;
-bad:
- Py_XDECREF(names);
- Py_XDECREF(globals);
- return NULL;
-}
-
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
@@ -30710,23 +27100,104 @@ __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
Py_INCREF(result);
return result;
}
+static int
+__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
+ PyObject *res = op->defaults_getter((PyObject *) op);
+ if (unlikely(!res))
+ return -1;
+ op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
+ Py_INCREF(op->defaults_tuple);
+ op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
+ Py_INCREF(op->defaults_kwdict);
+ Py_DECREF(res);
+ return 0;
+}
+static int
+__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
+ PyObject* tmp;
+ if (!value) {
+ value = Py_None;
+ } else if (value != Py_None && !PyTuple_Check(value)) {
+ PyErr_SetString(PyExc_TypeError,
+ "__defaults__ must be set to a tuple object");
+ return -1;
+ }
+ Py_INCREF(value);
+ tmp = op->defaults_tuple;
+ op->defaults_tuple = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
static PyObject *
-__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
-{
- if (op->defaults_tuple) {
- Py_INCREF(op->defaults_tuple);
- return op->defaults_tuple;
+__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
+ PyObject* result = op->defaults_tuple;
+ if (unlikely(!result)) {
+ if (op->defaults_getter) {
+ if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
+ result = op->defaults_tuple;
+ } else {
+ result = Py_None;
+ }
}
- if (op->defaults_getter) {
- PyObject *res = op->defaults_getter((PyObject *) op);
- if (likely(res)) {
- Py_INCREF(res);
- op->defaults_tuple = res;
+ Py_INCREF(result);
+ return result;
+}
+static int
+__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
+ PyObject* tmp;
+ if (!value) {
+ value = Py_None;
+ } else if (value != Py_None && !PyDict_Check(value)) {
+ PyErr_SetString(PyExc_TypeError,
+ "__kwdefaults__ must be set to a dict object");
+ return -1;
+ }
+ Py_INCREF(value);
+ tmp = op->defaults_kwdict;
+ op->defaults_kwdict = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
+static PyObject *
+__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
+ PyObject* result = op->defaults_kwdict;
+ if (unlikely(!result)) {
+ if (op->defaults_getter) {
+ if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
+ result = op->defaults_kwdict;
+ } else {
+ result = Py_None;
}
- return res;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF(result);
+ return result;
+}
+static int
+__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
+ PyObject* tmp;
+ if (!value || value == Py_None) {
+ value = NULL;
+ } else if (!PyDict_Check(value)) {
+ PyErr_SetString(PyExc_TypeError,
+ "__annotations__ must be set to a dict object");
+ return -1;
+ }
+ Py_XINCREF(value);
+ tmp = op->func_annotations;
+ op->func_annotations = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
+static PyObject *
+__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
+ PyObject* result = op->func_annotations;
+ if (unlikely(!result)) {
+ result = PyDict_New();
+ if (unlikely(!result)) return NULL;
+ op->func_annotations = result;
+ }
+ Py_INCREF(result);
+ return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
@@ -30743,8 +27214,10 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
{(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},
+ {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
+ {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
+ {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
+ {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
{0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
@@ -30791,7 +27264,9 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f
op->defaults_pyobjects = 0;
op->defaults = NULL;
op->defaults_tuple = NULL;
+ op->defaults_kwdict = NULL;
op->defaults_getter = NULL;
+ op->func_annotations = NULL;
PyObject_GC_Track(op);
return (PyObject *) op;
}
@@ -30807,6 +27282,8 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
Py_CLEAR(m->func_code);
Py_CLEAR(m->func_classobj);
Py_CLEAR(m->defaults_tuple);
+ Py_CLEAR(m->defaults_kwdict);
+ Py_CLEAR(m->func_annotations);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
@@ -30836,6 +27313,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
Py_VISIT(m->func_code);
Py_VISIT(m->func_classobj);
Py_VISIT(m->defaults_tuple);
+ Py_VISIT(m->defaults_kwdict);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
@@ -30991,7 +27469,7 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t
m->defaults = PyMem_Malloc(size);
if (!m->defaults)
return PyErr_NoMemory();
- memset(m->defaults, 0, sizeof(size));
+ memset(m->defaults, 0, size);
m->defaults_pyobjects = pyobjects;
return m->defaults;
}
@@ -31000,6 +27478,437 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyOb
m->defaults_tuple = tuple;
Py_INCREF(tuple);
}
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
+ __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+ m->defaults_kwdict = dict;
+ Py_INCREF(dict);
+}
+static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
+ __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+ m->func_annotations = dict;
+ Py_INCREF(dict);
+}
+
+static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
+ PyObject* value;
+#if PY_MAJOR_VERSION >= 3
+ value = PyDict_GetItemWithError(d, key);
+ if (unlikely(!value)) {
+ if (unlikely(PyErr_Occurred()))
+ return NULL;
+ value = default_value;
+ }
+ Py_INCREF(value);
+#else
+ if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
+ value = PyDict_GetItem(d, key);
+ if (unlikely(!value)) {
+ value = default_value;
+ }
+ Py_INCREF(value);
+ } else {
+ if (default_value == Py_None)
+ default_value = NULL;
+ value = PyObject_CallMethodObjArgs(
+ d, __pyx_n_s__get, key, default_value, NULL);
+ }
+#endif
+ return value;
+}
+
+static double __Pyx__PyObject_AsDouble(PyObject* obj) {
+ PyObject* float_value;
+#if CYTHON_COMPILING_IN_PYPY
+ float_value = PyNumber_Float(obj);
+#else
+ PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
+ if (likely(nb) && likely(nb->nb_float)) {
+ float_value = nb->nb_float(obj);
+ if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
+ PyErr_Format(PyExc_TypeError,
+ "__float__ returned non-float (type %.200s)",
+ Py_TYPE(float_value)->tp_name);
+ Py_DECREF(float_value);
+ goto bad;
+ }
+ } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
+#if PY_MAJOR_VERSION >= 3
+ float_value = PyFloat_FromString(obj);
+#else
+ float_value = PyFloat_FromString(obj, 0);
+#endif
+ } else {
+ PyObject* args = PyTuple_New(1);
+ if (unlikely(!args)) goto bad;
+ PyTuple_SET_ITEM(args, 0, obj);
+ float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
+ 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);
+ return value;
+ }
+bad:
+ return (double)-1;
+}
+
+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;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ 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
+ 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;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ /* Make sure tstate is in a consistent state when we XDECREF
+ 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;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+ PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+ PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+ if (!ob)
+ goto bad;
+ if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+ goto bad;
+ Py_DECREF(ob);
+ return 0;
+bad:
+ Py_XDECREF(ob);
+ return -1;
+}
+
+static void* __Pyx_GetVtable(PyObject *dict) {
+ void* ptr;
+ PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__);
+ if (!ob)
+ goto bad;
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+ ptr = PyCapsule_GetPointer(ob, 0);
+#else
+ ptr = PyCObject_AsVoidPtr(ob);
+#endif
+ if (!ptr && !PyErr_Occurred())
+ PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
+ Py_DECREF(ob);
+ return ptr;
+bad:
+ Py_XDECREF(ob);
+ return NULL;
+}
+
+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;
+ *tb = tstate->exc_traceback;
+ 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;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = 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, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ #if PY_VERSION_HEX >= 0x02050000
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0; /* try absolute import on failure */
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+ #else
+ if (level>0) {
+ PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
+ goto bad;
+ }
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, NULL);
+ #endif
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
+ PyObject *metaclass;
+#if PY_MAJOR_VERSION < 3
+ if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+ PyObject *base = PyTuple_GET_ITEM(bases, 0);
+ metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__);
+ if (!metaclass) {
+ PyErr_Clear();
+ metaclass = (PyObject*) Py_TYPE(base);
+ }
+ } else {
+ metaclass = (PyObject *) &PyClass_Type;
+ }
+#else
+ if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+ PyObject *base = PyTuple_GET_ITEM(bases, 0);
+ metaclass = (PyObject*) Py_TYPE(base);
+ } else {
+ metaclass = (PyObject *) &PyType_Type;
+ }
+#endif
+ Py_INCREF(metaclass);
+ return metaclass;
+}
+
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+ PyObject *qualname, PyObject *modname) {
+ PyObject *result;
+ PyObject *metaclass;
+ if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0)
+ return NULL;
+ if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0)
+ return NULL;
+ metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__);
+ if (metaclass) {
+ Py_INCREF(metaclass);
+ } else {
+ metaclass = __Pyx_FindPy2Metaclass(bases);
+ }
+ result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
+ Py_DECREF(metaclass);
+ return result;
+}
+
+static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject* x) {
+ const WordID neg_one = (WordID)-1, const_zero = (WordID)0;
+ const int is_unsigned = const_zero < neg_one;
+ if (sizeof(WordID) == sizeof(char)) {
+ if (is_unsigned)
+ return (WordID)__Pyx_PyInt_AsUnsignedChar(x);
+ else
+ return (WordID)__Pyx_PyInt_AsSignedChar(x);
+ } else if (sizeof(WordID) == sizeof(short)) {
+ if (is_unsigned)
+ return (WordID)__Pyx_PyInt_AsUnsignedShort(x);
+ else
+ return (WordID)__Pyx_PyInt_AsSignedShort(x);
+ } else if (sizeof(WordID) == sizeof(int)) {
+ if (is_unsigned)
+ return (WordID)__Pyx_PyInt_AsUnsignedInt(x);
+ else
+ return (WordID)__Pyx_PyInt_AsSignedInt(x);
+ } else if (sizeof(WordID) == sizeof(long)) {
+ if (is_unsigned)
+ return (WordID)__Pyx_PyInt_AsUnsignedLong(x);
+ else
+ return (WordID)__Pyx_PyInt_AsSignedLong(x);
+ } else if (sizeof(WordID) == sizeof(PY_LONG_LONG)) {
+ if (is_unsigned)
+ return (WordID)__Pyx_PyInt_AsUnsignedLongLong(x);
+ else
+ return (WordID)__Pyx_PyInt_AsSignedLongLong(x);
+ } else {
+ #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+ #else
+ WordID val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+ #endif
+ return (WordID)-1;
+ }
+}
+
+static PyObject* __Pyx_Globals(void) {
+ Py_ssize_t i;
+ PyObject *names = NULL;
+ PyObject *globals = PyObject_GetAttr(__pyx_m, __pyx_n_s____dict__);
+ if (!globals) {
+ PyErr_SetString(PyExc_TypeError,
+ "current module must have __dict__ attribute");
+ goto bad;
+ }
+ names = PyObject_Dir(__pyx_m);
+ if (!names)
+ goto bad;
+ for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject* name = PySequence_GetItem(names, i);
+ if (!name)
+ goto bad;
+#else
+ PyObject* name = PyList_GET_ITEM(names, i);
+#endif
+ if (!PyDict_Contains(globals, name)) {
+ PyObject* value = PyObject_GetAttr(__pyx_m, name);
+ if (!value) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ goto bad;
+ }
+ if (PyDict_SetItem(globals, name, value) < 0) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ Py_DECREF(value);
+ goto bad;
+ }
+ }
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ }
+ Py_DECREF(names);
+ return globals;
+bad:
+ Py_XDECREF(names);
+ Py_XDECREF(globals);
+ return NULL;
+}
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
@@ -31191,10 +28100,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
return (int)__Pyx_PyInt_AsLong(x);
}
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
@@ -31207,6 +28121,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(unsigned long)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
@@ -31214,6 +28138,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
}
return (unsigned long)PyLong_AsUnsignedLong(x);
} else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(unsigned long)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+ case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
return (unsigned long)PyLong_AsLong(x);
}
} else {
@@ -31226,10 +28161,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
}
}
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
@@ -31242,6 +28182,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
@@ -31249,6 +28199,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
}
return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
@@ -31261,10 +28222,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
}
}
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
const long neg_one = (long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
@@ -31277,6 +28243,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(long)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return (long) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
@@ -31284,6 +28260,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
}
return (long)PyLong_AsUnsignedLong(x);
} else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(long)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+ case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
return (long)PyLong_AsLong(x);
}
} else {
@@ -31296,10 +28283,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
}
}
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
@@ -31312,6 +28304,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
@@ -31319,6 +28321,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
}
return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
return (PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
@@ -31331,10 +28344,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
}
}
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
const signed long neg_one = (signed long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
@@ -31347,6 +28365,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(signed long)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
@@ -31354,6 +28382,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
}
return (signed long)PyLong_AsUnsignedLong(x);
} else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(signed long)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+ case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
return (signed long)PyLong_AsLong(x);
}
} else {
@@ -31366,10 +28405,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
}
}
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
@@ -31382,6 +28426,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
@@ -31389,6 +28443,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
}
return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+ if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+ }
+ }
+#endif
+#endif
return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
@@ -31469,7 +28534,7 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
Py_DECREF(ev);
#else
{
- PyObject* args = PyObject_GetAttrString(ev, "args");
+ PyObject* args = PyObject_GetAttr(ev, __pyx_n_s__args);
Py_DECREF(ev);
if (likely(args)) {
value = PyObject_GetItem(args, 0);
@@ -31605,7 +28670,7 @@ static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
if (value == Py_None)
ret = PyIter_Next(yf);
else
- ret = PyObject_CallMethod(yf, (char*)"send", (char*)"O", value);
+ ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s__send, value);
}
gen->is_running = 0;
if (likely(ret)) {
@@ -31625,7 +28690,7 @@ static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
} else {
PyObject *meth;
gen->is_running = 1;
- meth = PyObject_GetAttrString(yf, "close");
+ meth = PyObject_GetAttr(yf, __pyx_n_s__close);
if (unlikely(!meth)) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_WriteUnraisable(yf);
@@ -31710,7 +28775,7 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
if (__Pyx_Generator_CheckExact(yf)) {
ret = __Pyx_Generator_Throw(yf, args);
} else {
- PyObject *meth = PyObject_GetAttrString(yf, "throw");
+ PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s__throw);
if (unlikely(!meth)) {
Py_DECREF(yf);
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
@@ -31800,7 +28865,7 @@ static void __Pyx_Generator_del(PyObject *self) {
_Py_NewReference(self);
self->ob_refcnt = refcnt;
}
-#if CYTHON_COMPILING_FOR_CPYTHON
+#if CYTHON_COMPILING_IN_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
@@ -31921,25 +28986,6 @@ static int __pyx_Generator_init(void) {
return 0;
}
-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);
- #if PY_MAJOR_VERSION < 3
- ctx = PyString_FromString(name);
- #else
- ctx = PyUnicode_FromString(name);
- #endif
- __Pyx_ErrRestore(old_exc, old_val, old_tb);
- if (!ctx) {
- PyErr_WriteUnraisable(Py_None);
- } else {
- PyErr_WriteUnraisable(ctx);
- Py_DECREF(ctx);
- }
-}
-
static int __Pyx_check_binary_version(void) {
char ctversion[4], rtversion[4];
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -31959,23 +29005,6 @@ static int __Pyx_check_binary_version(void) {
return 0;
}
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
- PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
- PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
- if (!ob)
- goto bad;
- if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
- goto bad;
- Py_DECREF(ob);
- return 0;
-bad:
- Py_XDECREF(ob);
- return -1;
-}
-
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
@@ -32061,25 +29090,6 @@ bad:
}
#endif
-static void* __Pyx_GetVtable(PyObject *dict) {
- void* ptr;
- PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
- if (!ob)
- goto bad;
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
- ptr = PyCapsule_GetPointer(ob, 0);
-#else
- ptr = PyCObject_AsVoidPtr(ob);
-#endif
- if (!ptr && !PyErr_Occurred())
- PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
- Py_DECREF(ob);
- return ptr;
-bad:
- Py_XDECREF(ob);
- return NULL;
-}
-
#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
@@ -32325,6 +29335,65 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
return 0;
}
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+ if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_DATA_SIZE(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+ } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (r < 0) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
int is_true = x == Py_True;
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
@@ -32334,14 +29403,14 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
PyNumberMethods *m;
const char *name = NULL;
PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (PyInt_Check(x) || PyLong_Check(x))
#else
if (PyLong_Check(x))
#endif
return Py_INCREF(x), x;
m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (m && m->nb_int) {
name = "int";
res = PyNumber_Int(x);
@@ -32357,7 +29426,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
}
#endif
if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
if (!PyLong_Check(res)) {
@@ -32398,11 +29467,10 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
- if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
- return (size_t)-1;
- } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
- PyErr_SetString(PyExc_OverflowError,
- "value too large to convert to size_t");
+ if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+ if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to size_t");
return (size_t)-1;
}
return (size_t)val;