summaryrefslogtreecommitdiff
path: root/python/cdec/_cdec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'python/cdec/_cdec.cpp')
-rw-r--r--python/cdec/_cdec.cpp20979
1 files changed, 11732 insertions, 9247 deletions
diff --git a/python/cdec/_cdec.cpp b/python/cdec/_cdec.cpp
index 03b22bb1..c6ad8035 100644
--- a/python/cdec/_cdec.cpp
+++ b/python/cdec/_cdec.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.19.1 on Sat May 17 14:41:25 2014 */
+/* Generated by Cython 0.21 */
#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
@@ -16,10 +16,11 @@
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
-#elif PY_VERSION_HEX < 0x02040000
- #error Cython requires Python 2.4+.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
#else
-#include <stddef.h> /* For offsetof */
+#define CYTHON_ABI "0_21"
+#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
@@ -53,83 +54,31 @@
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
-#if PY_VERSION_HEX < 0x02050000
- typedef int Py_ssize_t;
- #define PY_SSIZE_T_MAX INT_MAX
- #define PY_SSIZE_T_MIN INT_MIN
- #define PY_FORMAT_SIZE_T ""
- #define CYTHON_FORMAT_SSIZE_T ""
- #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
- #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
- #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
- (PyErr_Format(PyExc_TypeError, \
- "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
- (PyObject*)0))
- #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
- !PyComplex_Check(o))
- #define PyIndex_Check __Pyx_PyIndex_Check
- #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
- #define __PYX_BUILD_PY_SSIZE_T "i"
-#else
- #define __PYX_BUILD_PY_SSIZE_T "n"
- #define CYTHON_FORMAT_SSIZE_T "z"
- #define __Pyx_PyIndex_Check PyIndex_Check
-#endif
-#if PY_VERSION_HEX < 0x02060000
- #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
- #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
- #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
- #define PyVarObject_HEAD_INIT(type, size) \
- PyObject_HEAD_INIT(type) size,
- #define PyType_Modified(t)
- typedef struct {
- void *buf;
- PyObject *obj;
- Py_ssize_t len;
- Py_ssize_t itemsize;
- int readonly;
- int ndim;
- char *format;
- Py_ssize_t *shape;
- Py_ssize_t *strides;
- Py_ssize_t *suboffsets;
- void *internal;
- } Py_buffer;
- #define PyBUF_SIMPLE 0
- #define PyBUF_WRITABLE 0x0001
- #define PyBUF_FORMAT 0x0004
- #define PyBUF_ND 0x0008
- #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
- #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
- #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
- #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
- #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
- #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
- #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
- typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
- typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
+#define Py_OptimizeFlag 0
#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
- PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
-#endif
-#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
- #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
+ #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
-#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
-#if PY_VERSION_HEX < 0x02060000
- #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
@@ -137,13 +86,32 @@
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
- #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
@@ -152,35 +120,12 @@
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
-#if PY_VERSION_HEX < 0x02060000
- #define PyBytesObject PyStringObject
- #define PyBytes_Type PyString_Type
- #define PyBytes_Check PyString_Check
- #define PyBytes_CheckExact PyString_CheckExact
- #define PyBytes_FromString PyString_FromString
- #define PyBytes_FromStringAndSize PyString_FromStringAndSize
- #define PyBytes_FromFormat PyString_FromFormat
- #define PyBytes_DecodeEscape PyString_DecodeEscape
- #define PyBytes_AsString PyString_AsString
- #define PyBytes_AsStringAndSize PyString_AsStringAndSize
- #define PyBytes_Size PyString_Size
- #define PyBytes_AS_STRING PyString_AS_STRING
- #define PyBytes_GET_SIZE PyString_GET_SIZE
- #define PyBytes_Repr PyString_Repr
- #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)
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
@@ -201,11 +146,12 @@
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
-#if PY_VERSION_HEX < 0x03020000
+#if PY_VERSION_HEX < 0x030200A4
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
@@ -213,43 +159,9 @@
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
-#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
- #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
- #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
- #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
-#else
- #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
- #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
- #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
-#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
-#if PY_VERSION_HEX < 0x02050000
- #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
- #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
- #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
-#else
- #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
- #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
- #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
-#endif
-#if PY_VERSION_HEX < 0x02050000
- #define __Pyx_NAMESTR(n) ((char *)(n))
- #define __Pyx_DOCSTR(n) ((char *)(n))
-#else
- #define __Pyx_NAMESTR(n) (n)
- #define __Pyx_DOCSTR(n) (n)
-#endif
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
@@ -264,7 +176,7 @@
#ifndef CYTHON_RESTRICT
#if defined(__GNUC__)
#define CYTHON_RESTRICT __restrict__
- #elif defined(_MSC_VER)
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
#define CYTHON_RESTRICT __restrict
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_RESTRICT restrict
@@ -284,6 +196,12 @@ static CYTHON_INLINE float __PYX_NAN() {
return value;
}
#endif
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+#endif
#if PY_MAJOR_VERSION >= 3
@@ -369,18 +287,30 @@ static CYTHON_INLINE float __PYX_NAN() {
# endif
#endif
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*/
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
#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
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
-static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
@@ -388,17 +318,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
#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)
+#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const 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;
+ return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
@@ -412,7 +344,6 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
-static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
@@ -421,19 +352,22 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#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;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
PyObject* default_encoding = NULL;
PyObject* ascii_chars_u = NULL;
PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
sys = PyImport_ImportModule("sys");
- if (sys == NULL) goto bad;
+ if (!sys) 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) {
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "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++) {
@@ -441,23 +375,21 @@ static int __Pyx_init_sys_getdefaultencoding_params() {
}
__Pyx_sys_getdefaultencoding_not_ascii = 1;
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
- if (ascii_chars_u == NULL) goto bad;
+ if (!ascii_chars_u) 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) {
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(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.",
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
default_encoding_c);
goto bad;
}
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
}
- Py_XDECREF(sys);
- Py_XDECREF(default_encoding);
- Py_XDECREF(ascii_chars_u);
- Py_XDECREF(ascii_chars_b);
+ Py_DECREF(default_encoding);
return 0;
bad:
- Py_XDECREF(sys);
Py_XDECREF(default_encoding);
Py_XDECREF(ascii_chars_u);
Py_XDECREF(ascii_chars_b);
@@ -470,22 +402,23 @@ bad:
#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;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
PyObject* default_encoding = NULL;
char* default_encoding_c;
sys = PyImport_ImportModule("sys");
- if (sys == NULL) goto bad;
+ if (!sys) 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);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
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;
}
@@ -493,16 +426,11 @@ bad:
#endif
-#ifdef __GNUC__
- /* Test for GCC > 2.95 */
- #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
- #define likely(x) __builtin_expect(!!(x), 1)
- #define unlikely(x) __builtin_expect(!!(x), 0)
- #else /* __GNUC__ > 2 ... */
- #define likely(x) (x)
- #define unlikely(x) (x)
- #endif /* __GNUC__ > 2 ... */
-#else /* __GNUC__ */
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
@@ -519,69 +447,70 @@ static const char *__pyx_filename;
static const char *__pyx_f[] = {
- "_cdec.pyx",
- "vectors.pxi",
- "grammar.pxi",
- "hypergraph.pxi",
- "lattice.pxi",
- "mteval.pxi",
- "_sa.pxd",
+ "cdec/_cdec.pyx",
+ "cdec/vectors.pxi",
+ "cdec/grammar.pxi",
+ "cdec/hypergraph.pxi",
+ "cdec/lattice.pxi",
+ "cdec/mteval.pxi",
+ "cdec/stringsource",
+ "cdec/sa/_sa.pxd",
};
/*--- Type declarations ---*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__;
+struct __pyx_obj_4cdec_2sa_3_sa_FloatList;
+struct __pyx_obj_4cdec_2sa_3_sa_IntList;
struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector;
+struct __pyx_obj_4cdec_2sa_3_sa_Phrase;
+struct __pyx_obj_4cdec_2sa_3_sa_Rule;
struct __pyx_obj_4cdec_5_cdec_DenseVector;
-struct __pyx_obj_4cdec_5_cdec_SufficientStats;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines;
-struct __pyx_obj_4cdec_5_cdec_TRule;
-struct __pyx_obj_4cdec_5_cdec_MRule;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__;
-struct __pyx_obj_4cdec_5_cdec_Metric;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest;
-struct __pyx_obj_4cdec_2sa_3_sa_IntList;
struct __pyx_obj_4cdec_5_cdec_SparseVector;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config;
struct __pyx_obj_4cdec_5_cdec_NT;
-struct __pyx_obj_4cdec_5_cdec_Lattice;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees;
-struct __pyx_obj_4cdec_5_cdec_HypergraphEdge;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase;
-struct __pyx_obj_4cdec_2sa_3_sa_Rule;
-struct __pyx_obj_4cdec_5_cdec_Scorer;
-struct __pyx_obj_4cdec_5_cdec_HypergraphNode;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features;
struct __pyx_obj_4cdec_5_cdec_NTRef;
+struct __pyx_obj_4cdec_5_cdec_TRule;
+struct __pyx_obj_4cdec_5_cdec_MRule;
struct __pyx_obj_4cdec_5_cdec_Grammar;
+struct __pyx_obj_4cdec_5_cdec_TextGrammar;
struct __pyx_obj_4cdec_5_cdec_Hypergraph;
+struct __pyx_obj_4cdec_5_cdec_HypergraphEdge;
+struct __pyx_obj_4cdec_5_cdec_HypergraphNode;
+struct __pyx_obj_4cdec_5_cdec_Lattice;
+struct __pyx_obj_4cdec_5_cdec_Candidate;
+struct __pyx_obj_4cdec_5_cdec_SufficientStats;
struct __pyx_obj_4cdec_5_cdec_CandidateSet;
-struct __pyx_obj_4cdec_2sa_3_sa_FloatList;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__;
struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr;
+struct __pyx_obj_4cdec_5_cdec_Scorer;
+struct __pyx_obj_4cdec_5_cdec_Metric;
+struct __pyx_obj_4cdec_5_cdec_Decoder;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest;
-struct __pyx_obj_4cdec_2sa_3_sa_Phrase;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__;
-struct __pyx_obj_4cdec_5_cdec_TextGrammar;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__;
-struct __pyx_obj_4cdec_5_cdec_Decoder;
-struct __pyx_obj_4cdec_5_cdec_Candidate;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr;
struct __pyx_opt_args_4cdec_5_cdec_as_str;
/* "cdec/_cdec.pyx":6
@@ -596,20 +525,37 @@ struct __pyx_opt_args_4cdec_5_cdec_as_str {
char *error_msg;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":44
- * return self.stats.size()
+/* "cdec/sa/_sa.pxd":3
+ * from libc.stdio cimport FILE
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * for i in range(len(self)):
- * yield self[i]
+ * cdef class FloatList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ {
+struct __pyx_obj_4cdec_2sa_3_sa_FloatList {
PyObject_HEAD
- PyObject *__pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self;
- Py_ssize_t __pyx_t_0;
- PyObject *__pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
+ struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtab;
+ int size;
+ int increment;
+ int len;
+ float *arr;
+};
+
+
+/* "cdec/sa/_sa.pxd":12
+ * cdef void read_handle(self, FILE* f)
+ *
+ * cdef class IntList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
+ */
+struct __pyx_obj_4cdec_2sa_3_sa_IntList {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtab;
+ int size;
+ int increment;
+ int len;
+ int *arr;
};
@@ -627,7 +573,42 @@ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector {
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":3
+/* "cdec/sa/_sa.pxd":29
+ * cdef FloatList values
+ *
+ * cdef class Phrase: # <<<<<<<<<<<<<<
+ * cdef int *syms
+ * cdef int n,
+ */
+struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtab;
+ int *syms;
+ int n;
+ int *varpos;
+ PyObject *n_vars;
+};
+
+
+/* "cdec/sa/_sa.pxd":37
+ * cdef public int chunklen(self, int k)
+ *
+ * cdef class Rule: # <<<<<<<<<<<<<<
+ * cdef int lhs
+ * cdef readonly Phrase f, e
+ */
+struct __pyx_obj_4cdec_2sa_3_sa_Rule {
+ PyObject_HEAD
+ int lhs;
+ struct __pyx_obj_4cdec_2sa_3_sa_Phrase *f;
+ struct __pyx_obj_4cdec_2sa_3_sa_Phrase *e;
+ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *scores;
+ int n_scores;
+ PyObject *word_alignments;
+};
+
+
+/* "vectors.pxi":3
* from cython.operator cimport preincrement as pinc
*
* cdef class DenseVector: # <<<<<<<<<<<<<<
@@ -636,49 +617,52 @@ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector {
*/
struct __pyx_obj_4cdec_5_cdec_DenseVector {
PyObject_HEAD
- std::vector<weight_t> *vector;
+ std::vector<weight_t> *vector;
int owned;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":26
- * return fmap
+/* "vectors.pxi":48
+ * return sparse
+ *
+ * cdef class SparseVector: # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t]* vector
*
- * cdef class SufficientStats: # <<<<<<<<<<<<<<
- * cdef mteval.SufficientStats* stats
- * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec_SufficientStats {
+struct __pyx_obj_4cdec_5_cdec_SparseVector {
PyObject_HEAD
- SufficientStats *stats;
- EvaluationMetric *metric;
+ FastSparseVector<weight_t> *vector;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":63
- * def todot(self):
- * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
- * def lines(): # <<<<<<<<<<<<<<
- * yield 'digraph lattice {'
- * yield 'rankdir = LR;'
+/* "grammar.pxi":8
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+ *
+ * cdef class NT: # <<<<<<<<<<<<<<
+ * cdef public bytes cat
+ * cdef public unsigned ref
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines {
+struct __pyx_obj_4cdec_5_cdec_NT {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *__pyx_outer_scope;
- PyObject *__pyx_v_delta;
- PyObject *__pyx_v_i;
- PyObject *__pyx_v_label;
- PyObject *__pyx_v_weight;
- Py_ssize_t __pyx_t_0;
- PyObject *__pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
- PyObject *__pyx_t_3;
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
+ PyObject *cat;
+ unsigned int ref;
+};
+
+
+/* "grammar.pxi":21
+ * return '[%s]' % self.cat
+ *
+ * cdef class NTRef: # <<<<<<<<<<<<<<
+ * cdef public unsigned ref
+ * def __init__(self, unsigned ref):
+ */
+struct __pyx_obj_4cdec_5_cdec_NTRef {
+ PyObject_HEAD
+ unsigned int ref;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":49
+/* "grammar.pxi":49
* return TRule(lhs, f, e, scores, a)
*
* cdef class TRule: # <<<<<<<<<<<<<<
@@ -687,11 +671,11 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines {
*/
struct __pyx_obj_4cdec_5_cdec_TRule {
PyObject_HEAD
- boost::shared_ptr<TRule> *rule;
+ boost::shared_ptr<TRule> *rule;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":183
+/* "grammar.pxi":183
* _phrase(self.f), _phrase(self.e), scores)
*
* cdef class MRule(TRule): # <<<<<<<<<<<<<<
@@ -703,348 +687,337 @@ struct __pyx_obj_4cdec_5_cdec_MRule {
};
-/* "cdec/_cdec.pyx":47
- * cdef DenseVector weights
+/* "grammar.pxi":199
+ * super(MRule, self).__init__(lhs, rhs, e, scores, None)
+ *
+ * cdef class Grammar: # <<<<<<<<<<<<<<
+ * cdef shared_ptr[grammar.Grammar]* grammar
*
- * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
- * """Decoder('formalism = scfg') -> initialize from configuration string
- * Decoder(formalism='scfg') -> initialize from named parameters
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ {
+struct __pyx_obj_4cdec_5_cdec_Grammar {
PyObject_HEAD
- PyObject *__pyx_v_config;
+ boost::shared_ptr<Grammar> *grammar;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":56
- * return unicode(str(self), 'utf8')
+/* "grammar.pxi":223
+ * self.grammar.get().SetGrammarName(name)
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(len(self)):
+ * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<<
+ * def __init__(self, rules):
+ * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ {
- PyObject_HEAD
- unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self;
- Py_ssize_t __pyx_t_0;
- unsigned int __pyx_t_1;
+struct __pyx_obj_4cdec_5_cdec_TextGrammar {
+ struct __pyx_obj_4cdec_5_cdec_Grammar __pyx_base;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":176
- * out.fields[i] = ss[i]
+/* "hypergraph.pxi":4
+ * cimport kbest
*
- * cdef class Metric: # <<<<<<<<<<<<<<
- * cdef Scorer scorer
- * def __cinit__(self):
+ * cdef class Hypergraph: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef MT19937* rng
*/
-struct __pyx_obj_4cdec_5_cdec_Metric {
+struct __pyx_obj_4cdec_5_cdec_Hypergraph {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec_Scorer *scorer;
+ struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtab;
+ Hypergraph *hg;
+ MT19937 *rng;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":97
- * del derivations
+/* "hypergraph.pxi":244
+ * return vector
*
- * def unique_kbest(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
+ * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest {
+struct __pyx_obj_4cdec_5_cdec_HypergraphEdge {
PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::FilterUnique>::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::FilterUnique> *__pyx_v_derivations;
- unsigned int __pyx_v_k;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
+ struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtab;
+ Hypergraph *hg;
+ Hypergraph::Edge *edge;
+ struct __pyx_obj_4cdec_5_cdec_TRule *trule;
};
-/* "cdec/sa/_sa.pxd":12
- * cdef void read_handle(self, FILE* f)
+/* "hypergraph.pxi":294
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
*
- * cdef class IntList: # <<<<<<<<<<<<<<
- * cdef int size
- * cdef int increment
+ * cdef class HypergraphNode: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphNode* node
*/
-struct __pyx_obj_4cdec_2sa_3_sa_IntList {
+struct __pyx_obj_4cdec_5_cdec_HypergraphNode {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtab;
- int size;
- int increment;
- int len;
- int *arr;
+ struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtab;
+ Hypergraph *hg;
+ Hypergraph::Node *node;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":48
- * return sparse
+/* "lattice.pxi":3
+ * cimport lattice
*
- * cdef class SparseVector: # <<<<<<<<<<<<<<
- * cdef FastSparseVector[weight_t]* vector
+ * cdef class Lattice: # <<<<<<<<<<<<<<
+ * cdef lattice.Lattice* lattice
*
*/
-struct __pyx_obj_4cdec_5_cdec_SparseVector {
+struct __pyx_obj_4cdec_5_cdec_Lattice {
PyObject_HEAD
- FastSparseVector<weight_t> *vector;
+ Lattice *lattice;
};
-/* "cdec/_cdec.pyx":32
- * SetSilent(yn)
+/* "mteval.pxi":12
+ * return stats
*
- * def _make_config(config): # <<<<<<<<<<<<<<
- * for key, value in config.items():
- * if isinstance(value, dict):
+ * cdef class Candidate: # <<<<<<<<<<<<<<
+ * cdef mteval.const_Candidate* candidate
+ * cdef public float score
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config {
+struct __pyx_obj_4cdec_5_cdec_Candidate {
PyObject_HEAD
- PyObject *__pyx_v_config;
- PyObject *__pyx_v_info;
- PyObject *__pyx_v_key;
- PyObject *__pyx_v_name;
- PyObject *__pyx_v_value;
- PyObject *__pyx_t_0;
- PyObject *__pyx_t_1;
- Py_ssize_t __pyx_t_2;
- PyObject *(*__pyx_t_3)(PyObject *);
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
+ const training::Candidate *candidate;
+ float score;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":8
- * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+/* "mteval.pxi":26
+ * return fmap
*
- * cdef class NT: # <<<<<<<<<<<<<<
- * cdef public bytes cat
- * cdef public unsigned ref
+ * cdef class SufficientStats: # <<<<<<<<<<<<<<
+ * cdef mteval.SufficientStats* stats
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec_NT {
+struct __pyx_obj_4cdec_5_cdec_SufficientStats {
PyObject_HEAD
- PyObject *cat;
- unsigned int ref;
+ SufficientStats *stats;
+ EvaluationMetric *metric;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":3
- * cimport lattice
- *
- * cdef class Lattice: # <<<<<<<<<<<<<<
- * cdef lattice.Lattice* lattice
+/* "mteval.pxi":68
+ * return result
*
+ * cdef class CandidateSet: # <<<<<<<<<<<<<<
+ * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec_Lattice {
+struct __pyx_obj_4cdec_5_cdec_CandidateSet {
PyObject_HEAD
- Lattice *lattice;
+ boost::shared_ptr<SegmentEvaluator> *scorer;
+ EvaluationMetric *metric;
+ training::CandidateSet *cs;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":156
- * del hypos
+/* "mteval.pxi":103
+ * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get())
*
- * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
- * """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
- * cdef vector[string]* trees = new vector[string]()
+ * cdef class SegmentEvaluator: # <<<<<<<<<<<<<<
+ * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees {
+struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator {
PyObject_HEAD
- unsigned int __pyx_v_k;
- unsigned int __pyx_v_n;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- std::vector<std::string> *__pyx_v_trees;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ boost::shared_ptr<SegmentEvaluator> *scorer;
+ EvaluationMetric *metric;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":244
- * return vector
+/* "mteval.pxi":124
+ * return CandidateSet(self)
*
- * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphEdge* edge
+ * cdef class Scorer: # <<<<<<<<<<<<<<
+ * cdef string* name
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec_HypergraphEdge {
+struct __pyx_obj_4cdec_5_cdec_Scorer {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtab;
- Hypergraph *hg;
- Hypergraph::Edge *edge;
- struct __pyx_obj_4cdec_5_cdec_TRule *trule;
+ std::string *name;
+ EvaluationMetric *metric;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":5
- * import cdec.sa._sa as _sa
- *
- * def _phrase(phrase): # <<<<<<<<<<<<<<
- * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+/* "mteval.pxi":179
+ * out.fields[i] = ss[i]
*
+ * cdef class Metric: # <<<<<<<<<<<<<<
+ * cdef Scorer scorer
+ * def __cinit__(self):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase {
+struct __pyx_obj_4cdec_5_cdec_Metric {
PyObject_HEAD
- PyObject *__pyx_v_phrase;
+ struct __pyx_obj_4cdec_5_cdec_Scorer *scorer;
};
-/* "cdec/sa/_sa.pxd":35
- * cdef public int chunklen(self, int k)
+/* "cdec/_cdec.pyx":43
+ * yield key, str(value)
*
- * cdef class Rule: # <<<<<<<<<<<<<<
- * cdef int lhs
- * cdef readonly Phrase f, e
+ * cdef class Decoder: # <<<<<<<<<<<<<<
+ * cdef decoder.Decoder* dec
+ * cdef DenseVector weights
*/
-struct __pyx_obj_4cdec_2sa_3_sa_Rule {
+struct __pyx_obj_4cdec_5_cdec_Decoder {
PyObject_HEAD
- int lhs;
- struct __pyx_obj_4cdec_2sa_3_sa_Phrase *f;
- struct __pyx_obj_4cdec_2sa_3_sa_Phrase *e;
- struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *scores;
- int n_scores;
- PyObject *word_alignments;
+ Decoder *dec;
+ struct __pyx_obj_4cdec_5_cdec_DenseVector *weights;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":121
- * return CandidateSet(self)
+/* "vectors.pxi":32
+ * self.vector[0][fid] = value
*
- * cdef class Scorer: # <<<<<<<<<<<<<<
- * cdef string* name
- * cdef mteval.EvaluationMetric* metric
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned fid
+ * for fid in range(1, self.vector.size()):
*/
-struct __pyx_obj_4cdec_5_cdec_Scorer {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ {
PyObject_HEAD
- std::string *name;
- EvaluationMetric *metric;
+ unsigned int __pyx_v_fid;
+ struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":294
- * raise NotImplemented('comparison not implemented for HypergraphEdge')
+/* "vectors.pxi":72
+ * self.vector.set_value(fid, value)
*
- * cdef class HypergraphNode: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphNode* node
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
+ * cdef unsigned i
*/
-struct __pyx_obj_4cdec_5_cdec_HypergraphNode {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtab;
- Hypergraph *hg;
- Hypergraph::Node *node;
+ unsigned int __pyx_v_i;
+ FastSparseVector<weight_t> ::const_iterator *__pyx_v_it;
+ struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":81
- * del e_derivations
+/* "grammar.pxi":5
+ * import cdec.sa._sa as _sa
+ *
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
- * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase {
PyObject_HEAD
- KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > >::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > *__pyx_v_derivations;
- struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap;
- unsigned int __pyx_v_k;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
+ PyObject *__pyx_v_phrase;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":21
- * return '[%s]' % self.cat
+/* "grammar.pxi":6
*
- * cdef class NTRef: # <<<<<<<<<<<<<<
- * cdef public unsigned ref
- * def __init__(self, unsigned ref):
+ * def _phrase(phrase):
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
+ *
+ * cdef class NT:
*/
-struct __pyx_obj_4cdec_5_cdec_NTRef {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr {
PyObject_HEAD
- unsigned int ref;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_outer_scope;
+ PyObject *__pyx_v_w;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":199
- * super(MRule, self).__init__(lhs, rhs, e, scores, None)
- *
- * cdef class Grammar: # <<<<<<<<<<<<<<
- * cdef shared_ptr[grammar.Grammar]* grammar
+/* "grammar.pxi":137
*
+ * property a:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
*/
-struct __pyx_obj_4cdec_5_cdec_Grammar {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ {
PyObject_HEAD
- boost::shared_ptr<Grammar> *grammar;
+ std::vector<AlignmentPoint> *__pyx_v_a;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":4
- * cimport kbest
+/* "grammar.pxi":178
+ * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
*
- * cdef class Hypergraph: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef MT19937* rng
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
*/
-struct __pyx_obj_4cdec_5_cdec_Hypergraph {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtab;
- Hypergraph *hg;
- MT19937 *rng;
+ struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":65
- * return result
+/* "grammar.pxi":179
*
- * cdef class CandidateSet: # <<<<<<<<<<<<<<
- * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
- * cdef mteval.EvaluationMetric* metric
+ * 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)
*/
-struct __pyx_obj_4cdec_5_cdec_CandidateSet {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr {
PyObject_HEAD
- boost::shared_ptr<SegmentEvaluator> *scorer;
- EvaluationMetric *metric;
- training::CandidateSet *cs;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_outer_scope;
+ PyObject *__pyx_v_feat;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
};
-/* "cdec/sa/_sa.pxd":3
- * from libc.stdio cimport FILE
+/* "grammar.pxi":205
+ * del self.grammar
*
- * cdef class FloatList: # <<<<<<<<<<<<<<
- * cdef int size
- * cdef int increment
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
+ * cdef grammar.const_RuleBin* rbin = root.GetRules()
*/
-struct __pyx_obj_4cdec_2sa_3_sa_FloatList {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtab;
- int size;
- int increment;
- int len;
- float *arr;
+ unsigned int __pyx_v_i;
+ const RuleBin *__pyx_v_rbin;
+ const GrammarIter *__pyx_v_root;
+ struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self;
+ struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_trule;
+ int __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":61
- * yield self[i]
+/* "hypergraph.pxi":49
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
- * def todot(self): # <<<<<<<<<<<<<<
- * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
- * def lines():
+ * def kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self;
+ KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::NoFilter<std::vector<int> > > ::Derivation *__pyx_v_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_derivations;
+ unsigned int __pyx_v_k;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":62
+/* "hypergraph.pxi":62
* del derivations
*
* def kbest_trees(self, size): # <<<<<<<<<<<<<<
@@ -1053,11 +1026,11 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot {
*/
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees {
PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::NoFilter<std::vector<int> > >::Derivation *__pyx_v_e_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_e_derivations;
+ KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::NoFilter<std::vector<int> > > ::Derivation *__pyx_v_e_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_e_derivations;
PyObject *__pyx_v_e_tree;
- KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::NoFilter<std::vector<int> > >::Derivation *__pyx_v_f_derivation;
- KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_f_derivations;
+ KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::NoFilter<std::vector<int> > > ::Derivation *__pyx_v_f_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_f_derivations;
PyObject *__pyx_v_f_tree;
unsigned int __pyx_v_k;
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
@@ -1067,66 +1040,69 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees {
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":178
- * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * scores = ' '.join('%s=%s' % feat for feat in self.scores)
- * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
- */
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ {
- PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self;
-};
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":100
- * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get())
+/* "hypergraph.pxi":81
+ * del e_derivations
*
- * cdef class SegmentEvaluator: # <<<<<<<<<<<<<<
- * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
- * cdef mteval.EvaluationMetric* metric
+ * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features {
PyObject_HEAD
- boost::shared_ptr<SegmentEvaluator> *scorer;
- EvaluationMetric *metric;
+ KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > ::Derivation *__pyx_v_derivation;
+ KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > *__pyx_v_derivations;
+ struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap;
+ unsigned int __pyx_v_k;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":209
+/* "hypergraph.pxi":97
+ * del derivations
*
- * property edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.edges_.size()):
+ * def unique_kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest {
PyObject_HEAD
- unsigned int __pyx_v_i;
+ KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::FilterUnique> ::Derivation *__pyx_v_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::FilterUnique> *__pyx_v_derivations;
+ unsigned int __pyx_v_k;
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":314
+/* "hypergraph.pxi":110
+ * del derivations
*
- * property out_edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.node.out_edges_.size()):
+ * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees {
PyObject_HEAD
- unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::FilterUnique> ::Derivation *__pyx_v_e_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::FilterUnique> *__pyx_v_e_derivations;
+ PyObject *__pyx_v_e_tree;
+ KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::FilterUnique> ::Derivation *__pyx_v_f_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::FilterUnique> *__pyx_v_f_derivations;
+ PyObject *__pyx_v_f_tree;
+ unsigned int __pyx_v_k;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":129
+/* "hypergraph.pxi":129
* del e_derivations
*
* def unique_kbest_features(self, size): # <<<<<<<<<<<<<<
@@ -1135,8 +1111,8 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ {
*/
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features {
PyObject_HEAD
- KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > >::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > *__pyx_v_derivations;
+ KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > ::Derivation *__pyx_v_derivation;
+ KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > *__pyx_v_derivations;
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap;
unsigned int __pyx_v_k;
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
@@ -1146,77 +1122,75 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features {
};
-/* "cdec/_cdec.pyx":56
- * 'csplit', 'tagger', 'lexalign'):
- * raise InvalidConfig('formalism "%s" unknown' % formalism)
- * config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
- * cdef istringstream* config_stream = new istringstream(config_str)
- * self.dec = new decoder.Decoder(config_stream)
+/* "hypergraph.pxi":145
+ * del derivations
+ *
+ * def sample(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *__pyx_outer_scope;
- PyObject *__pyx_v_kv;
- PyObject *__pyx_t_0;
- Py_ssize_t __pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
+ std::vector<HypergraphSampler::Hypothesis> *__pyx_v_hypos;
+ unsigned int __pyx_v_k;
+ unsigned int __pyx_v_n;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":6
- *
- * def _phrase(phrase):
- * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
+/* "hypergraph.pxi":156
+ * del hypos
*
- * cdef class NT:
+ * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
+ * cdef vector[string]* trees = new vector[string]()
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_outer_scope;
- PyObject *__pyx_v_w;
- PyObject *__pyx_t_0;
- Py_ssize_t __pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
+ unsigned int __pyx_v_k;
+ unsigned int __pyx_v_n;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ std::vector<std::string> *__pyx_v_trees;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":49
- * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+/* "hypergraph.pxi":209
*
- * def kbest(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ {
PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::NoFilter<std::vector<int> > >::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_derivations;
- unsigned int __pyx_v_k;
+ unsigned int __pyx_v_i;
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "cdec/sa/_sa.pxd":29
- * cdef FloatList values
+/* "hypergraph.pxi":215
*
- * cdef class Phrase: # <<<<<<<<<<<<<<
- * cdef int *syms
- * cdef int n, *varpos, n_vars
+ * property nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.nodes_.size()):
*/
-struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtab;
- int *syms;
- int n;
- int *varpos;
- int n_vars;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":264
+/* "hypergraph.pxi":264
*
* property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -1232,26 +1206,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ {
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":205
- * del self.grammar
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
- * cdef grammar.const_RuleBin* rbin = root.GetRules()
- */
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ {
- PyObject_HEAD
- unsigned int __pyx_v_i;
- const RuleBin *__pyx_v_rbin;
- const GrammarIter *__pyx_v_root;
- struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self;
- struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_trule;
- int __pyx_t_0;
- unsigned int __pyx_t_1;
-};
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":308
+/* "hypergraph.pxi":308
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -1267,213 +1222,174 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ {
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":223
- * self.grammar.get().SetGrammarName(name)
+/* "hypergraph.pxi":314
*
- * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<<
- * def __init__(self, rules):
- * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
*/
-struct __pyx_obj_4cdec_5_cdec_TextGrammar {
- struct __pyx_obj_4cdec_5_cdec_Grammar __pyx_base;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ {
+ PyObject_HEAD
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":90
- * return candidate
+/* "lattice.pxi":56
+ * return unicode(str(self), 'utf8')
*
* def __iter__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(len(self)):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ {
PyObject_HEAD
unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self;
+ struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self;
Py_ssize_t __pyx_t_0;
unsigned int __pyx_t_1;
};
-/* "cdec/_cdec.pyx":43
- * yield key, str(value)
- *
- * cdef class Decoder: # <<<<<<<<<<<<<<
- * cdef decoder.Decoder* dec
- * cdef DenseVector weights
- */
-struct __pyx_obj_4cdec_5_cdec_Decoder {
- PyObject_HEAD
- Decoder *dec;
- struct __pyx_obj_4cdec_5_cdec_DenseVector *weights;
-};
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":12
- * return stats
+/* "lattice.pxi":61
+ * yield self[i]
*
- * cdef class Candidate: # <<<<<<<<<<<<<<
- * cdef mteval.const_Candidate* candidate
- * cdef public float score
+ * def todot(self): # <<<<<<<<<<<<<<
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines():
*/
-struct __pyx_obj_4cdec_5_cdec_Candidate {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot {
PyObject_HEAD
- const training::Candidate *candidate;
- float score;
+ struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":145
- * del derivations
- *
- * def sample(self, unsigned n): # <<<<<<<<<<<<<<
- * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
- * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+/* "lattice.pxi":63
+ * def todot(self):
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines(): # <<<<<<<<<<<<<<
+ * yield 'digraph lattice {'
+ * yield 'rankdir = LR;'
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines {
PyObject_HEAD
- std::vector<HypergraphSampler::Hypothesis> *__pyx_v_hypos;
- unsigned int __pyx_v_k;
- unsigned int __pyx_v_n;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *__pyx_outer_scope;
+ PyObject *__pyx_v_delta;
+ PyObject *__pyx_v_i;
+ PyObject *__pyx_v_label;
+ PyObject *__pyx_v_weight;
+ Py_ssize_t __pyx_t_0;
+ PyObject *__pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
+ PyObject *__pyx_t_3;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":215
+/* "mteval.pxi":47
+ * return self.stats.size()
*
- * property nodes:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.nodes_.size()):
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * for i in range(len(self)):
+ * yield self[i]
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ {
PyObject_HEAD
- unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ Py_ssize_t __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self;
+ Py_ssize_t __pyx_t_0;
+ Py_ssize_t __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":32
- * self.vector[0][fid] = value
+/* "mteval.pxi":93
+ * return candidate
*
* def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned fid
- * for fid in range(1, self.vector.size()):
+ * cdef unsigned i
+ * for i in range(len(self)):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ {
PyObject_HEAD
- unsigned int __pyx_v_fid;
- struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self;
- size_t __pyx_t_0;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self;
+ Py_ssize_t __pyx_t_0;
unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":179
+/* "cdec/_cdec.pyx":32
+ * SetSilent(yn)
*
- * 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)
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_outer_scope;
- PyObject *__pyx_v_feat;
+ PyObject *__pyx_v_config;
+ PyObject *__pyx_v_info;
+ PyObject *__pyx_v_key;
+ PyObject *__pyx_v_name;
+ PyObject *__pyx_v_value;
PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
PyObject *(*__pyx_t_2)(PyObject *);
+ PyObject *__pyx_t_3;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":110
- * del derivations
- *
- * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
- */
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees {
- PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::FilterUnique>::Derivation *__pyx_v_e_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::FilterUnique> *__pyx_v_e_derivations;
- PyObject *__pyx_v_e_tree;
- KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::FilterUnique>::Derivation *__pyx_v_f_derivation;
- KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::FilterUnique> *__pyx_v_f_derivations;
- PyObject *__pyx_v_f_tree;
- unsigned int __pyx_v_k;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
-};
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":137
+/* "cdec/_cdec.pyx":47
+ * cdef DenseVector weights
*
- * property a:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
+ * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """Decoder('formalism = scfg') -> initialize from configuration string
+ * Decoder(formalism='scfg') -> initialize from named parameters
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ {
PyObject_HEAD
- std::vector<AlignmentPoint> *__pyx_v_a;
- unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ PyObject *__pyx_v_config;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":72
- * self.vector.set_value(fid, value)
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
- * cdef unsigned i
+/* "cdec/_cdec.pyx":56
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
+ * raise InvalidConfig('formalism "%s" unknown' % formalism)
+ * config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
+ * cdef istringstream* config_stream = new istringstream(config_str)
+ * self.dec = new decoder.Decoder(config_stream)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr {
PyObject_HEAD
- unsigned int __pyx_v_i;
- FastSparseVector<weight_t>::const_iterator *__pyx_v_it;
- struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *__pyx_outer_scope;
+ PyObject *__pyx_v_kv;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":294
- * raise NotImplemented('comparison not implemented for HypergraphEdge')
- *
- * cdef class HypergraphNode: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphNode* node
- */
-
-struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode {
- PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int);
-};
-static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtabptr_4cdec_5_cdec_HypergraphNode;
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":244
- * return vector
+/* "cdec/sa/_sa.pxd":3
+ * from libc.stdio cimport FILE
*
- * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphEdge* edge
+ * cdef class FloatList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
*/
-struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge {
- PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int);
+struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList {
+ void (*set)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, int, float);
+ void (*write_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
+ void (*read_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
};
-static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtabptr_4cdec_5_cdec_HypergraphEdge;
+static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtabptr_4cdec_2sa_3_sa_FloatList;
/* "cdec/sa/_sa.pxd":12
@@ -1496,28 +1412,12 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtabptr_4cdec_2sa_3_sa_IntList;
-/* "cdec/sa/_sa.pxd":3
- * from libc.stdio cimport FILE
- *
- * cdef class FloatList: # <<<<<<<<<<<<<<
- * cdef int size
- * cdef int increment
- */
-
-struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList {
- void (*set)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, int, float);
- void (*write_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
- void (*read_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
-};
-static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtabptr_4cdec_2sa_3_sa_FloatList;
-
-
/* "cdec/sa/_sa.pxd":29
* cdef FloatList values
*
* cdef class Phrase: # <<<<<<<<<<<<<<
* cdef int *syms
- * cdef int n, *varpos, n_vars
+ * cdef int n,
*/
struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase {
@@ -1527,7 +1427,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/austinma/git/cdec/python/cdec/hypergraph.pxi":4
+/* "hypergraph.pxi":4
* cimport kbest
*
* cdef class Hypergraph: # <<<<<<<<<<<<<<
@@ -1539,6 +1439,34 @@ struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph {
MT19937 *(*_rng)(struct __pyx_obj_4cdec_5_cdec_Hypergraph *);
};
static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtabptr_4cdec_5_cdec_Hypergraph;
+
+
+/* "hypergraph.pxi":244
+ * return vector
+ *
+ * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
+ */
+
+struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge {
+ PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int);
+};
+static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtabptr_4cdec_5_cdec_HypergraphEdge;
+
+
+/* "hypergraph.pxi":294
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
+ *
+ * cdef class HypergraphNode: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphNode* node
+ */
+
+struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode {
+ PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int);
+};
+static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtabptr_4cdec_5_cdec_HypergraphNode;
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
@@ -1552,7 +1480,7 @@ static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtabptr_4cdec_5_cd
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
- static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
@@ -1589,7 +1517,15 @@ static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtabptr_4cdec_5_cd
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
-#endif /* CYTHON_REFNANNY */
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
#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)
@@ -1608,30 +1544,66 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif
-static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
-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*/
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
- Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
+
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact);
-static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
- const char *name, int exact); /*proto*/
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
-static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
-static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
+#if PY_MAJOR_VERSION < 3
+#define __Pyx_PyString_Join __Pyx_PyBytes_Join
+#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
+#else
+#define __Pyx_PyString_Join PyUnicode_Join
+#define __Pyx_PyBaseString_Join PyUnicode_Join
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+ #if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyBytes_Join _PyString_Join
+ #else
+ #define __Pyx_PyBytes_Join _PyBytes_Join
+ #endif
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
+#endif
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
- const char* function_name); /*proto*/
+ const char* function_name);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
@@ -1650,6 +1622,12 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
#endif
#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
#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);
@@ -1666,42 +1644,25 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif
-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 PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
+
+static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
+
+#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
+ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i))))
+#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
+ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
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)))
+#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
+ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
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);
@@ -1712,14 +1673,15 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
-static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
+static CYTHON_INLINE int __Pyx_IterFinish(void);
-static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
-static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
static void __Pyx_WriteUnraisable(const char *name, int clineno,
- int lineno, const char *filename); /*proto*/
+ int lineno, const char *filename,
+ int full_traceback);
static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) {
int result = PyDict_Contains(dict, item);
@@ -1727,7 +1689,9 @@ 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 CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
+
+static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
@@ -1744,28 +1708,32 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*pro
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
PyCFunctionObject func;
- int flags;
- PyObject *func_dict;
+#if PY_VERSION_HEX < 0x030500A0
PyObject *func_weakreflist;
+#endif
+ PyObject *func_dict;
PyObject *func_name;
PyObject *func_qualname;
PyObject *func_doc;
+ PyObject *func_globals;
PyObject *func_code;
PyObject *func_closure;
- PyObject *func_classobj; /* No-args super() class cell */
+ PyObject *func_classobj;
void *defaults;
int defaults_pyobjects;
- PyObject *defaults_tuple; /* Const defaults tuple */
- PyObject *defaults_kwdict; /* Const kwonly defaults dict */
+ int flags;
+ PyObject *defaults_tuple;
+ PyObject *defaults_kwdict;
PyObject *(*defaults_getter)(PyObject *);
- PyObject *func_annotations; /* function annotations dict */
+ PyObject *func_annotations;
} __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)
+#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
+ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
int flags, PyObject* qualname,
- PyObject *self, PyObject *module,
+ PyObject *self,
+ PyObject *module, PyObject *globals,
PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
size_t size,
@@ -1778,9 +1746,46 @@ 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 PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
+
+#include <string.h>
+
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
-static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
+static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
+ PyObject *res;
+ PyTypeObject *tp = Py_TYPE(obj);
+#if PY_MAJOR_VERSION < 3
+ if (unlikely(PyInstance_Check(obj)))
+ return __Pyx_PyObject_GetAttrStr(obj, attr_name);
+#endif
+ res = _PyType_Lookup(tp, attr_name);
+ if (likely(res)) {
+ descrgetfunc f = Py_TYPE(res)->tp_descr_get;
+ if (!f) {
+ Py_INCREF(res);
+ } else {
+ res = f(res, obj, (PyObject *)tp);
+ }
+ } else {
+ PyErr_SetObject(PyExc_AttributeError, attr_name);
+ }
+ return res;
+}
+#else
+#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
+#endif
+
+static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj) \
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
@@ -1792,23 +1797,41 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif
-static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static int __Pyx_SetVtable(PyObject *dict, void *vtable);
-#include <string.h>
+static void* __Pyx_GetVtable(PyObject *dict);
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
+
+static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
+ PyObject *mkw, PyObject *modname, PyObject *doc);
+static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
+ PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
-static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
-static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);
-static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
- PyObject *qualname, PyObject *modname); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
#ifndef __Pyx_CppExn2PyErr
#include <new>
@@ -1849,43 +1872,19 @@ static void __Pyx_CppExn2PyErr() {
}
#endif
-static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject *);
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
-static PyObject* __Pyx_Globals(void); /*proto*/
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
-static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
+static CYTHON_INLINE WordID __Pyx_PyInt_As_WordID(PyObject *);
-static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);
-static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
-static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
+static PyObject* __Pyx_Globals(void);
-static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
-
-static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
-
-static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
-
-static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
-
-static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
-
-static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
-
-static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
-
-static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
-
-static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
-
-static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
-
-static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
-
-static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
-
-static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
#define __Pyx_Generator_USED
#include <structmember.h>
@@ -1901,11 +1900,13 @@ typedef struct {
PyObject *gi_weakreflist;
PyObject *classobj;
PyObject *yieldfrom;
+ PyObject *gi_name;
+ PyObject *gi_qualname;
int resume_label;
- char is_running; // using T_BOOL for property below requires char value
+ char is_running;
} __pyx_GeneratorObject;
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
- PyObject *closure);
+ PyObject *closure, PyObject *name, PyObject *qualname);
static int __pyx_Generator_init(void);
static int __Pyx_Generator_clear(PyObject* self);
#if 1 || PY_VERSION_HEX < 0x030300B0
@@ -1924,31 +1925,17 @@ static int __Pyx_check_binary_version(void);
#endif
#endif
-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 int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/
+static PyObject *__Pyx_ImportModule(const char *name);
-typedef struct {
- int code_line;
- PyCodeObject* code_object;
-} __Pyx_CodeObjectCacheEntry;
-struct __Pyx_CodeObjectCache {
- int count;
- int max_count;
- __Pyx_CodeObjectCacheEntry* entries;
-};
-static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
-static PyCodeObject *__pyx_find_code_object(int code_line);
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
- int py_line, const char *filename); /*proto*/
+static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
-static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto*/
+static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self, Hypergraph *__pyx_v_hg, unsigned int __pyx_v_i); /* proto*/
+static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self, Hypergraph *__pyx_v_hg, unsigned int __pyx_v_i); /* proto*/
/* Module declarations from 'libc.string' */
@@ -1988,59 +1975,59 @@ static int (*__pyx_f_4cdec_2sa_3_sa_sym_getindex)(int); /*proto*/
/* Module declarations from 'cdec.mteval' */
/* Module declarations from 'cdec._cdec' */
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TRule = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_MRule = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_DenseVector = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_SufficientStats = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_lines = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27___init__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Metric = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Candidate = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_SparseVector = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26__make_config = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_NT = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Lattice = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_HypergraphEdge = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_2__phrase = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Scorer = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_HypergraphNode = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_NTRef = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TRule = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_MRule = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Grammar = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TextGrammar = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Hypergraph = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_HypergraphEdge = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_HypergraphNode = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Lattice = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Candidate = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_SufficientStats = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_CandidateSet = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22_todot = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_SegmentEvaluator = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Scorer = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Metric = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Decoder = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct____iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_1___iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_2__phrase = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_3_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_6_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_8_kbest = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14_sample = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16___get__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TextGrammar = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22_todot = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_lines = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___iter__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25___iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Decoder = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct____iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14_sample = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_6_genexpr = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_1___iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26__make_config = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27___init__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28_genexpr = 0;
static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *, struct __pyx_opt_args_4cdec_5_cdec_as_str *__pyx_optional_args); /*proto*/
static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *); /*proto*/
static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_stats(PyObject *, PyObject *); /*proto*/
static float __pyx_f_4cdec_5_cdec__compute_score(void *, SufficientStats *); /*proto*/
-static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *, std::string *, std::vector<std::string> *, SufficientStats *); /*proto*/
+static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *, std::string *, std::vector<std::string> *, SufficientStats *); /*proto*/
static std::string __pyx_convert_string_from_py_(PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "cdec._cdec"
int __pyx_module_is_main_cdec___cdec = 0;
@@ -2066,7 +2053,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(struct __pyx_obj
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_12SparseVector___init__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */
-static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */
static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value); /* proto */
@@ -2102,7 +2089,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_
static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_a, PyObject *__pyx_v_text); /* proto */
-static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
@@ -2117,7 +2104,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_MRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_rhs, PyObject *__pyx_v_scores); /* proto */
-static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
@@ -2165,7 +2152,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_y, int __pyx_v_op); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
-static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs); /* proto */
static Py_ssize_t __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */
@@ -2179,25 +2166,26 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
-static void __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
+static int __pyx_pf_4cdec_5_cdec_15SufficientStats___cinit__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_15SufficientStats_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
-static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_other); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
+static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_4__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6__iter__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__getitem__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__iadd__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_other); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_13__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_evaluator); /* proto */
-static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, int __pyx_v_k); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_hypergraph, unsigned int __pyx_v_k); /* proto */
-static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self, PyObject *__pyx_v_sentence); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
-static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_refs); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self); /* proto */
@@ -2208,376 +2196,442 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx
static PyObject *__pyx_pf_4cdec_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_config_str, PyObject *__pyx_v_config); /* proto */
-static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_sentence, PyObject *__pyx_v_grammar); /* proto */
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_TRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_DenseVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Metric(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Candidate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_SparseVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_NT(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Lattice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_NTRef(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_TRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_Grammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_Hypergraph(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Lattice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Candidate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_SegmentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Metric(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Decoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Decoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(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";
-static char __pyx_k_7[] = " ";
-static char __pyx_k_8[] = "[%s,%d]";
-static char __pyx_k_9[] = "[%s]";
-static char __pyx_k_10[] = "[%d]";
-static char __pyx_k_11[] = "%s=%s";
-static char __pyx_k_12[] = "%s ||| %s ||| %s ||| %s";
-static char __pyx_k_13[] = "the grammar should contain TRule objects";
-static char __pyx_k_15[] = "cannot intersect hypergraph with %s";
-static char __pyx_k_16[] = "csplit_preserve_full_word";
-static char __pyx_k_17[] = "cannot reweight hypergraph with %s";
-static char __pyx_k_18[] = "comparison not implemented for HypergraphEdge";
-static char __pyx_k_20[] = "comparison not implemented for HypergraphNode";
-static char __pyx_k_22[] = "cannot create lattice from %s";
-static char __pyx_k_23[] = "lattice index out of range";
-static char __pyx_k_26[] = "digraph lattice {";
- static char __pyx_k_27[] = "rankdir = LR;";
- static char __pyx_k_28[] = "node [shape=circle];";
- static char __pyx_k_29[] = "%d -> %d [label=\"%s\"];";
- static char __pyx_k_30[] = "\"";
- 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/austinma/git/cdec/python/cdec/lattice.pxi";
-static char __pyx_k_38[] = "Lattice.todot.<locals>.lines";
-static char __pyx_k_39[] = "cdec._cdec";
-static char __pyx_k_40[] = "\n";
-static char __pyx_k_42[] = "sufficient stats vector index out of range";
-static char __pyx_k_44[] = "candidate set index out of range";
-static char __pyx_k_46[] = "%s %s";
-static char __pyx_k_47[] = "%s = %s";
-static char __pyx_k_48[] = "formalism \"%s\" unknown";
-static char __pyx_k_49[] = "cannot initialize weights with %s";
-static char __pyx_k_50[] = "#";
-static char __pyx_k_53[] = "Cannot translate input type %s";
-static char __pyx_k_54[] = "cdec.sa._sa";
-static char __pyx_k_55[] = "*";
-static char __pyx_k_58[] = "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi";
-static char __pyx_k_66[] = "/usr0/home/austinma/git/cdec/python/cdec/_cdec.pyx";
-static char __pyx_k__a[] = "a";
-static char __pyx_k__e[] = "e";
-static char __pyx_k__f[] = "f";
-static char __pyx_k__i[] = "i";
-static char __pyx_k__k[] = "k";
-static char __pyx_k__pb[] = "pb";
-static char __pyx_k__yn[] = "yn";
-static char __pyx_k__CER[] = "CER";
-static char __pyx_k__SSK[] = "SSK";
-static char __pyx_k__TER[] = "TER";
-static char __pyx_k___sa[] = "_sa";
-static char __pyx_k__cat[] = "cat";
-static char __pyx_k__dot[] = "dot";
-static char __pyx_k__fst[] = "fst";
-static char __pyx_k__get[] = "get";
-static char __pyx_k__hyp[] = "hyp";
-static char __pyx_k__inp[] = "inp";
-static char __pyx_k__key[] = "key";
-static char __pyx_k__lhs[] = "lhs";
-static char __pyx_k__plf[] = "plf";
-static char __pyx_k__ref[] = "ref";
-static char __pyx_k__rhs[] = "rhs";
-static char __pyx_k__BLEU[] = "BLEU";
-static char __pyx_k__QCRI[] = "QCRI";
-static char __pyx_k__args[] = "args";
-static char __pyx_k__eval[] = "eval";
-static char __pyx_k__info[] = "info";
-static char __pyx_k__join[] = "join";
-static char __pyx_k__name[] = "name";
-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__text[] = "text";
-static char __pyx_k__utf8[] = "utf8";
-static char __pyx_k__close[] = "close";
-static char __pyx_k__delta[] = "delta";
-static char __pyx_k__items[] = "items";
-static char __pyx_k__label[] = "label";
-static char __pyx_k__lines[] = "lines";
-static char __pyx_k__range[] = "range";
-static char __pyx_k__rules[] = "rules";
-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";
-static char __pyx_k__format[] = "format";
-static char __pyx_k__phrase[] = "phrase";
-static char __pyx_k__scores[] = "scores";
-static char __pyx_k__tagger[] = "tagger";
-static char __pyx_k__weight[] = "weight";
-static char __pyx_k___phrase[] = "_phrase";
-static char __pyx_k__density[] = "density";
-static char __pyx_k__genexpr[] = "genexpr";
-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__";
-static char __pyx_k____name__[] = "__name__";
-static char __pyx_k____test__[] = "__test__";
-static char __pyx_k__encoding[] = "encoding";
-static char __pyx_k__evaluate[] = "evaluate";
-static char __pyx_k__in_edges[] = "in_edges";
-static char __pyx_k__lexalign[] = "lexalign";
-static char __pyx_k__lextrans[] = "lextrans";
-static char __pyx_k__sentence[] = "sentence";
-static char __pyx_k__Exception[] = "Exception";
-static char __pyx_k__QCRI_BLEU[] = "QCRI_BLEU";
-static char __pyx_k__TypeError[] = "TypeError";
-static char __pyx_k____class__[] = "__class__";
-static char __pyx_k____enter__[] = "__enter__";
-static char __pyx_k__enumerate[] = "enumerate";
-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__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;
-static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_15;
-static PyObject *__pyx_n_s_16;
-static PyObject *__pyx_kp_s_17;
-static PyObject *__pyx_kp_s_18;
-static PyObject *__pyx_kp_s_20;
-static PyObject *__pyx_kp_s_22;
-static PyObject *__pyx_kp_s_23;
-static PyObject *__pyx_kp_s_26;
-static PyObject *__pyx_kp_s_27;
-static PyObject *__pyx_kp_s_28;
-static PyObject *__pyx_kp_s_29;
-static PyObject *__pyx_kp_s_3;
-static PyObject *__pyx_kp_s_30;
-static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_kp_s_33;
-static PyObject *__pyx_kp_s_34;
-static PyObject *__pyx_kp_s_37;
-static PyObject *__pyx_n_s_38;
-static PyObject *__pyx_n_s_39;
-static PyObject *__pyx_kp_s_4;
-static PyObject *__pyx_kp_s_40;
-static PyObject *__pyx_kp_s_42;
-static PyObject *__pyx_kp_s_44;
-static PyObject *__pyx_kp_s_46;
-static PyObject *__pyx_kp_s_47;
-static PyObject *__pyx_kp_s_48;
-static PyObject *__pyx_kp_s_49;
-static PyObject *__pyx_kp_s_50;
-static PyObject *__pyx_kp_s_53;
-static PyObject *__pyx_n_s_54;
-static PyObject *__pyx_n_s_55;
-static PyObject *__pyx_kp_s_58;
-static PyObject *__pyx_kp_s_66;
-static PyObject *__pyx_kp_s_7;
-static PyObject *__pyx_kp_s_8;
-static PyObject *__pyx_kp_s_9;
-static PyObject *__pyx_n_s__BLEU;
-static PyObject *__pyx_n_s__CER;
-static PyObject *__pyx_n_s__Exception;
-static PyObject *__pyx_n_s__IBM_BLEU;
-static PyObject *__pyx_n_s__IndexError;
-static PyObject *__pyx_n_s__InvalidConfig;
-static PyObject *__pyx_n_s__KeyError;
-static PyObject *__pyx_n_s__NotImplemented;
-static PyObject *__pyx_n_s__ParseFailed;
-static PyObject *__pyx_n_s__QCRI;
-static PyObject *__pyx_n_s__QCRI_BLEU;
-static PyObject *__pyx_n_s__SSK;
-static PyObject *__pyx_n_s__TER;
-static PyObject *__pyx_n_s__TypeError;
-static PyObject *__pyx_n_s__ValueError;
-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___make_config;
-static PyObject *__pyx_n_s___phrase;
-static PyObject *__pyx_n_s___sa;
-static PyObject *__pyx_n_s__a;
-static PyObject *__pyx_n_s__alignments;
-static PyObject *__pyx_n_s__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;
-static PyObject *__pyx_n_s__delta;
-static PyObject *__pyx_n_s__density;
-static PyObject *__pyx_n_s__dot;
-static PyObject *__pyx_n_s__e;
-static PyObject *__pyx_n_s__encode;
-static PyObject *__pyx_n_s__encoding;
-static PyObject *__pyx_n_s__enumerate;
-static PyObject *__pyx_n_s__eval;
-static PyObject *__pyx_n_s__evaluate;
-static PyObject *__pyx_n_s__evaluator;
-static PyObject *__pyx_n_s__f;
-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;
-static PyObject *__pyx_n_s__i;
-static PyObject *__pyx_n_s__in_edges;
-static PyObject *__pyx_n_s__info;
-static PyObject *__pyx_n_s__inp;
-static PyObject *__pyx_n_s__items;
-static PyObject *__pyx_n_s__join;
-static PyObject *__pyx_n_s__k;
-static PyObject *__pyx_n_s__key;
-static PyObject *__pyx_n_s__label;
-static PyObject *__pyx_n_s__lexalign;
-static PyObject *__pyx_n_s__lextrans;
-static PyObject *__pyx_n_s__lhs;
-static PyObject *__pyx_n_s__lines;
-static PyObject *__pyx_n_s__name;
-static PyObject *__pyx_n_s__open;
-static PyObject *__pyx_n_s__pb;
-static PyObject *__pyx_n_s__phrase;
-static PyObject *__pyx_n_s__plf;
-static PyObject *__pyx_n_s__range;
-static PyObject *__pyx_n_s__ref;
-static PyObject *__pyx_n_s__refs;
-static PyObject *__pyx_n_s__replace;
-static PyObject *__pyx_n_s__rhs;
-static PyObject *__pyx_n_s__rules;
-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;
-static PyObject *__pyx_n_s__split;
-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__text;
-static PyObject *__pyx_n_s__throw;
-static PyObject *__pyx_n_s__utf8;
-static PyObject *__pyx_n_s__value;
-static PyObject *__pyx_n_s__weight;
-static PyObject *__pyx_n_s__yn;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_a[] = "a";
+static char __pyx_k_d[] = "[%d]";
+static char __pyx_k_e[] = "e";
+static char __pyx_k_f[] = "f";
+static char __pyx_k_i[] = "i";
+static char __pyx_k_k[] = "k";
+static char __pyx_k_s[] = "[%s]";
+static char __pyx_k__4[] = " ";
+static char __pyx_k_pb[] = "pb";
+static char __pyx_k_sa[] = "_sa";
+static char __pyx_k_yn[] = "yn";
+static char __pyx_k_CER[] = "CER";
+static char __pyx_k_SSK[] = "SSK";
+static char __pyx_k_TER[] = "TER";
+static char __pyx_k__10[] = "\"";
+static char __pyx_k__11[] = "\\\"";
+static char __pyx_k__13[] = "}";
+static char __pyx_k__16[] = "\n";
+static char __pyx_k__20[] = "#";
+static char __pyx_k__23[] = "*";
+static char __pyx_k_cat[] = "cat";
+static char __pyx_k_doc[] = "__doc__";
+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";
+static char __pyx_k_lhs[] = "lhs";
+static char __pyx_k_plf[] = "plf";
+static char __pyx_k_ref[] = "ref";
+static char __pyx_k_rhs[] = "rhs";
+static char __pyx_k_s_d[] = "[%s,%d]";
+static char __pyx_k_s_s[] = "%s=%s";
+static char __pyx_k_t2s[] = "t2s";
+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_exit[] = "__exit__";
+static char __pyx_k_info[] = "info";
+static char __pyx_k_init[] = "__init__";
+static char __pyx_k_iter[] = "__iter__";
+static char __pyx_k_join[] = "join";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_name[] = "name";
+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_test[] = "__test__";
+static char __pyx_k_text[] = "text";
+static char __pyx_k_utf8[] = "utf8";
+static char __pyx_k_class[] = "__class__";
+static char __pyx_k_close[] = "close";
+static char __pyx_k_delta[] = "delta";
+static char __pyx_k_enter[] = "__enter__";
+static char __pyx_k_get_2[] = "get";
+static char __pyx_k_items[] = "items";
+static char __pyx_k_kbest[] = "kbest";
+static char __pyx_k_label[] = "label";
+static char __pyx_k_lines[] = "lines";
+static char __pyx_k_range[] = "range";
+static char __pyx_k_rules[] = "rules";
+static char __pyx_k_s_s_2[] = "%s %s";
+static char __pyx_k_s_s_3[] = "%s = %s";
+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";
+static char __pyx_k_format[] = "format";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_module[] = "__module__";
+static char __pyx_k_name_2[] = "__name__";
+static char __pyx_k_phrase[] = "_phrase";
+static char __pyx_k_sample[] = "sample";
+static char __pyx_k_scores[] = "scores";
+static char __pyx_k_tagger[] = "tagger";
+static char __pyx_k_weight[] = "weight";
+static char __pyx_k_density[] = "density";
+static char __pyx_k_genexpr[] = "genexpr";
+static char __pyx_k_grammar[] = "grammar";
+static char __pyx_k_prepare[] = "__prepare__";
+static char __pyx_k_replace[] = "replace";
+static char __pyx_k_s_s_s_s[] = "%s ||| %s ||| %s ||| %s";
+static char __pyx_k_IBM_BLEU[] = "IBM_BLEU";
+static char __pyx_k_KeyError[] = "KeyError";
+static char __pyx_k_encoding[] = "encoding";
+static char __pyx_k_evaluate[] = "evaluate";
+static char __pyx_k_in_edges[] = "in_edges";
+static char __pyx_k_lexalign[] = "lexalign";
+static char __pyx_k_lextrans[] = "lextrans";
+static char __pyx_k_phrase_2[] = "phrase";
+static char __pyx_k_qualname[] = "__qualname__";
+static char __pyx_k_sentence[] = "sentence";
+static char __pyx_k_Exception[] = "Exception";
+static char __pyx_k_QCRI_BLEU[] = "QCRI_BLEU";
+static char __pyx_k_TypeError[] = "TypeError";
+static char __pyx_k_enumerate[] = "enumerate";
+static char __pyx_k_evaluator[] = "evaluator";
+static char __pyx_k_formalism[] = "formalism";
+static char __pyx_k_metaclass[] = "__metaclass__";
+static char __pyx_k_IndexError[] = "IndexError";
+static char __pyx_k_ValueError[] = "ValueError";
+static char __pyx_k_alignments[] = "alignments";
+static char __pyx_k_beam_alpha[] = "beam_alpha";
+static char __pyx_k_cdec__cdec[] = "cdec._cdec";
+static char __pyx_k_config_str[] = "config_str";
+static char __pyx_k_hypergraph[] = "hypergraph";
+static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static char __pyx_k_rankdir_LR[] = "rankdir = LR;";
+static char __pyx_k_set_silent[] = "set_silent";
+static char __pyx_k_startswith[] = "startswith";
+static char __pyx_k_ParseFailed[] = "ParseFailed";
+static char __pyx_k_TRule___get[] = "TRule.__get__";
+static char __pyx_k_cdec_sa__sa[] = "cdec.sa._sa";
+static char __pyx_k_d_d_label_s[] = "%d -> %d [label=\"%s\"];";
+static char __pyx_k_kbest_trees[] = "kbest_trees";
+static char __pyx_k_make_config[] = "_make_config";
+static char __pyx_k_sample_trees[] = "sample_trees";
+static char __pyx_k_unique_kbest[] = "unique_kbest";
+static char __pyx_k_InvalidConfig[] = "InvalidConfig";
+static char __pyx_k_Grammar___iter[] = "Grammar.__iter__";
+static char __pyx_k_Lattice___iter[] = "Lattice.__iter__";
+static char __pyx_k_NotImplemented[] = "NotImplemented";
+static char __pyx_k_kbest_features[] = "kbest_features";
+static char __pyx_k_digraph_lattice[] = "digraph lattice {";
+static char __pyx_k_Hypergraph___get[] = "Hypergraph.__get__";
+static char __pyx_k_Hypergraph_kbest[] = "Hypergraph.kbest";
+static char __pyx_k_Hypergraph_sample[] = "Hypergraph.sample";
+static char __pyx_k_node_shape_circle[] = "node [shape=circle];";
+static char __pyx_k_DenseVector___iter[] = "DenseVector.__iter__";
+static char __pyx_k_todot_locals_lines[] = "todot.<locals>.lines";
+static char __pyx_k_unique_kbest_trees[] = "unique_kbest_trees";
+static char __pyx_k_CandidateSet___iter[] = "CandidateSet.__iter__";
+static char __pyx_k_SparseVector___iter[] = "SparseVector.__iter__";
+static char __pyx_k_formalism_s_unknown[] = "formalism \"%s\" unknown";
+static char __pyx_k_HypergraphEdge___get[] = "HypergraphEdge.__get__";
+static char __pyx_k_HypergraphNode___get[] = "HypergraphNode.__get__";
+static char __pyx_k_d_shape_doublecircle[] = "%d [shape=doublecircle]";
+static char __pyx_k_str___locals_genexpr[] = "__str__.<locals>.genexpr";
+static char __pyx_k_init___locals_genexpr[] = "__init__.<locals>.genexpr";
+static char __pyx_k_phrase_locals_genexpr[] = "_phrase.<locals>.genexpr";
+static char __pyx_k_unique_kbest_features[] = "unique_kbest_features";
+static char __pyx_k_Hypergraph_kbest_trees[] = "Hypergraph.kbest_trees";
+static char __pyx_k_SufficientStats___iter[] = "SufficientStats.__iter__";
+static char __pyx_k_Hypergraph_sample_trees[] = "Hypergraph.sample_trees";
+static char __pyx_k_Hypergraph_unique_kbest[] = "Hypergraph.unique_kbest";
+static char __pyx_k_Hypergraph_kbest_features[] = "Hypergraph.kbest_features";
+static char __pyx_k_csplit_preserve_full_word[] = "csplit_preserve_full_word";
+static char __pyx_k_lattice_index_out_of_range[] = "lattice index out of range";
+static char __pyx_k_Cannot_convert_type_s_to_str[] = "Cannot convert type %s to str";
+static char __pyx_k_cannot_create_lattice_from_s[] = "cannot create lattice from %s";
+static char __pyx_k_Cannot_translate_input_type_s[] = "Cannot translate input type %s";
+static char __pyx_k_Hypergraph_unique_kbest_trees[] = "Hypergraph.unique_kbest_trees";
+static char __pyx_k_cannot_reweight_hypergraph_with[] = "cannot reweight hypergraph with %s";
+static char __pyx_k_usr0_home_cdyer_cdec_python_cde[] = "/usr0/home/cdyer/cdec/python/cdec/lattice.pxi";
+static char __pyx_k_Hypergraph_unique_kbest_features[] = "Hypergraph.unique_kbest_features";
+static char __pyx_k_candidate_set_index_out_of_range[] = "candidate set index out of range";
+static char __pyx_k_cannot_initialize_weights_with_s[] = "cannot initialize weights with %s";
+static char __pyx_k_cannot_intersect_hypergraph_with[] = "cannot intersect hypergraph with %s";
+static char __pyx_k_cannot_take_the_dot_product_of_s[] = "cannot take the dot product of %s and SparseVector";
+static char __pyx_k_comparison_not_implemented_for_H[] = "comparison not implemented for HypergraphEdge";
+static char __pyx_k_comparison_not_implemented_for_S[] = "comparison not implemented for SparseVector";
+static char __pyx_k_sufficient_stats_vector_index_ou[] = "sufficient stats vector index out of range";
+static char __pyx_k_the_grammar_should_contain_TRule[] = "the grammar should contain TRule objects";
+static char __pyx_k_usr0_home_cdyer_cdec_python_cde_2[] = "/usr0/home/cdyer/cdec/python/cdec/grammar.pxi";
+static char __pyx_k_usr0_home_cdyer_cdec_python_cde_3[] = "/usr0/home/cdyer/cdec/python/cdec/_cdec.pyx";
+static char __pyx_k_comparison_not_implemented_for_H_2[] = "comparison not implemented for HypergraphNode";
+static PyObject *__pyx_n_s_BLEU;
+static PyObject *__pyx_n_s_CER;
+static PyObject *__pyx_n_s_CandidateSet___iter;
+static PyObject *__pyx_kp_s_Cannot_translate_input_type_s;
+static PyObject *__pyx_n_s_DenseVector___iter;
+static PyObject *__pyx_n_s_Exception;
+static PyObject *__pyx_n_s_Grammar___iter;
+static PyObject *__pyx_n_s_HypergraphEdge___get;
+static PyObject *__pyx_n_s_HypergraphNode___get;
+static PyObject *__pyx_n_s_Hypergraph___get;
+static PyObject *__pyx_n_s_Hypergraph_kbest;
+static PyObject *__pyx_n_s_Hypergraph_kbest_features;
+static PyObject *__pyx_n_s_Hypergraph_kbest_trees;
+static PyObject *__pyx_n_s_Hypergraph_sample;
+static PyObject *__pyx_n_s_Hypergraph_sample_trees;
+static PyObject *__pyx_n_s_Hypergraph_unique_kbest;
+static PyObject *__pyx_n_s_Hypergraph_unique_kbest_features;
+static PyObject *__pyx_n_s_Hypergraph_unique_kbest_trees;
+static PyObject *__pyx_n_s_IBM_BLEU;
+static PyObject *__pyx_n_s_IndexError;
+static PyObject *__pyx_n_s_InvalidConfig;
+static PyObject *__pyx_n_s_KeyError;
+static PyObject *__pyx_n_s_Lattice___iter;
+static PyObject *__pyx_n_s_NotImplemented;
+static PyObject *__pyx_n_s_ParseFailed;
+static PyObject *__pyx_n_s_QCRI;
+static PyObject *__pyx_n_s_QCRI_BLEU;
+static PyObject *__pyx_n_s_SSK;
+static PyObject *__pyx_n_s_SparseVector___iter;
+static PyObject *__pyx_n_s_SufficientStats___iter;
+static PyObject *__pyx_n_s_TER;
+static PyObject *__pyx_n_s_TRule___get;
+static PyObject *__pyx_n_s_TypeError;
+static PyObject *__pyx_n_s_ValueError;
+static PyObject *__pyx_kp_s__10;
+static PyObject *__pyx_kp_s__11;
+static PyObject *__pyx_kp_s__13;
+static PyObject *__pyx_kp_s__16;
+static PyObject *__pyx_kp_s__20;
+static PyObject *__pyx_n_s__23;
+static PyObject *__pyx_kp_s__4;
+static PyObject *__pyx_n_s_a;
+static PyObject *__pyx_n_s_alignments;
+static PyObject *__pyx_n_s_append;
+static PyObject *__pyx_n_s_args;
+static PyObject *__pyx_n_s_beam_alpha;
+static PyObject *__pyx_kp_s_candidate_set_index_out_of_range;
+static PyObject *__pyx_kp_s_cannot_create_lattice_from_s;
+static PyObject *__pyx_kp_s_cannot_initialize_weights_with_s;
+static PyObject *__pyx_kp_s_cannot_intersect_hypergraph_with;
+static PyObject *__pyx_kp_s_cannot_reweight_hypergraph_with;
+static PyObject *__pyx_kp_s_cannot_take_the_dot_product_of_s;
+static PyObject *__pyx_n_s_cat;
+static PyObject *__pyx_n_s_cdec__cdec;
+static PyObject *__pyx_n_s_cdec_sa__sa;
+static PyObject *__pyx_n_s_class;
+static PyObject *__pyx_n_s_close;
+static PyObject *__pyx_kp_s_comparison_not_implemented_for_H;
+static PyObject *__pyx_kp_s_comparison_not_implemented_for_H_2;
+static PyObject *__pyx_kp_s_comparison_not_implemented_for_S;
+static PyObject *__pyx_n_s_config;
+static PyObject *__pyx_n_s_config_str;
+static PyObject *__pyx_n_s_csplit;
+static PyObject *__pyx_n_s_csplit_preserve_full_word;
+static PyObject *__pyx_kp_s_d;
+static PyObject *__pyx_kp_s_d_d_label_s;
+static PyObject *__pyx_kp_s_d_shape_doublecircle;
+static PyObject *__pyx_n_s_delta;
+static PyObject *__pyx_n_s_density;
+static PyObject *__pyx_kp_s_digraph_lattice;
+static PyObject *__pyx_n_s_doc;
+static PyObject *__pyx_n_s_dot;
+static PyObject *__pyx_n_s_e;
+static PyObject *__pyx_n_s_encode;
+static PyObject *__pyx_n_s_encoding;
+static PyObject *__pyx_n_s_enter;
+static PyObject *__pyx_n_s_enumerate;
+static PyObject *__pyx_n_s_eval;
+static PyObject *__pyx_n_s_evaluate;
+static PyObject *__pyx_n_s_evaluator;
+static PyObject *__pyx_n_s_exit;
+static PyObject *__pyx_n_s_f;
+static PyObject *__pyx_n_s_formalism;
+static PyObject *__pyx_kp_s_formalism_s_unknown;
+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_get_2;
+static PyObject *__pyx_n_s_grammar;
+static PyObject *__pyx_n_s_hyp;
+static PyObject *__pyx_n_s_hypergraph;
+static PyObject *__pyx_n_s_i;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_in_edges;
+static PyObject *__pyx_n_s_info;
+static PyObject *__pyx_n_s_init;
+static PyObject *__pyx_n_s_init___locals_genexpr;
+static PyObject *__pyx_n_s_inp;
+static PyObject *__pyx_n_s_items;
+static PyObject *__pyx_n_s_iter;
+static PyObject *__pyx_n_s_join;
+static PyObject *__pyx_n_s_k;
+static PyObject *__pyx_n_s_kbest;
+static PyObject *__pyx_n_s_kbest_features;
+static PyObject *__pyx_n_s_kbest_trees;
+static PyObject *__pyx_n_s_key;
+static PyObject *__pyx_n_s_label;
+static PyObject *__pyx_kp_s_lattice_index_out_of_range;
+static PyObject *__pyx_n_s_lexalign;
+static PyObject *__pyx_n_s_lextrans;
+static PyObject *__pyx_n_s_lhs;
+static PyObject *__pyx_n_s_lines;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_make_config;
+static PyObject *__pyx_n_s_metaclass;
+static PyObject *__pyx_n_s_module;
+static PyObject *__pyx_n_s_name;
+static PyObject *__pyx_n_s_name_2;
+static PyObject *__pyx_kp_s_node_shape_circle;
+static PyObject *__pyx_n_s_open;
+static PyObject *__pyx_n_s_pb;
+static PyObject *__pyx_n_s_phrase;
+static PyObject *__pyx_n_s_phrase_2;
+static PyObject *__pyx_n_s_phrase_locals_genexpr;
+static PyObject *__pyx_n_s_plf;
+static PyObject *__pyx_n_s_prepare;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_n_s_qualname;
+static PyObject *__pyx_n_s_range;
+static PyObject *__pyx_kp_s_rankdir_LR;
+static PyObject *__pyx_n_s_ref;
+static PyObject *__pyx_n_s_refs;
+static PyObject *__pyx_n_s_replace;
+static PyObject *__pyx_n_s_rhs;
+static PyObject *__pyx_n_s_rules;
+static PyObject *__pyx_kp_s_s;
+static PyObject *__pyx_kp_s_s_d;
+static PyObject *__pyx_kp_s_s_s;
+static PyObject *__pyx_kp_s_s_s_2;
+static PyObject *__pyx_kp_s_s_s_3;
+static PyObject *__pyx_kp_s_s_s_s_s;
+static PyObject *__pyx_n_s_sa;
+static PyObject *__pyx_n_s_sample;
+static PyObject *__pyx_n_s_sample_trees;
+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;
+static PyObject *__pyx_n_s_split;
+static PyObject *__pyx_n_s_startswith;
+static PyObject *__pyx_n_s_str___locals_genexpr;
+static PyObject *__pyx_n_s_strip;
+static PyObject *__pyx_kp_s_sufficient_stats_vector_index_ou;
+static PyObject *__pyx_n_s_super;
+static PyObject *__pyx_n_s_t2s;
+static PyObject *__pyx_n_s_tagger;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_text;
+static PyObject *__pyx_kp_s_the_grammar_should_contain_TRule;
+static PyObject *__pyx_n_s_throw;
+static PyObject *__pyx_n_s_todot_locals_lines;
+static PyObject *__pyx_n_s_unique_kbest;
+static PyObject *__pyx_n_s_unique_kbest_features;
+static PyObject *__pyx_n_s_unique_kbest_trees;
+static PyObject *__pyx_kp_s_usr0_home_cdyer_cdec_python_cde;
+static PyObject *__pyx_kp_s_usr0_home_cdyer_cdec_python_cde_2;
+static PyObject *__pyx_kp_s_usr0_home_cdyer_cdec_python_cde_3;
+static PyObject *__pyx_n_s_utf8;
+static PyObject *__pyx_n_s_value;
+static PyObject *__pyx_n_s_weight;
+static PyObject *__pyx_n_s_yn;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
-static PyObject *__pyx_k_tuple_2;
-static PyObject *__pyx_k_tuple_5;
-static PyObject *__pyx_k_tuple_6;
-static PyObject *__pyx_k_tuple_14;
-static PyObject *__pyx_k_tuple_19;
-static PyObject *__pyx_k_tuple_21;
-static PyObject *__pyx_k_tuple_24;
-static PyObject *__pyx_k_tuple_25;
-static PyObject *__pyx_k_tuple_32;
-static PyObject *__pyx_k_tuple_35;
-static PyObject *__pyx_k_tuple_41;
-static PyObject *__pyx_k_tuple_43;
-static PyObject *__pyx_k_tuple_45;
-static PyObject *__pyx_k_tuple_51;
-static PyObject *__pyx_k_tuple_52;
-static PyObject *__pyx_k_tuple_56;
-static PyObject *__pyx_k_tuple_59;
-static PyObject *__pyx_k_tuple_60;
-static PyObject *__pyx_k_tuple_61;
-static PyObject *__pyx_k_tuple_62;
-static PyObject *__pyx_k_tuple_63;
-static PyObject *__pyx_k_tuple_64;
-static PyObject *__pyx_k_tuple_67;
-static PyObject *__pyx_k_codeobj_36;
-static PyObject *__pyx_k_codeobj_57;
-static PyObject *__pyx_k_codeobj_65;
-static PyObject *__pyx_k_codeobj_68;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__2;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__5;
+static PyObject *__pyx_tuple__6;
+static PyObject *__pyx_tuple__7;
+static PyObject *__pyx_tuple__8;
+static PyObject *__pyx_tuple__9;
+static PyObject *__pyx_tuple__12;
+static PyObject *__pyx_tuple__14;
+static PyObject *__pyx_tuple__17;
+static PyObject *__pyx_tuple__18;
+static PyObject *__pyx_tuple__19;
+static PyObject *__pyx_tuple__21;
+static PyObject *__pyx_tuple__22;
+static PyObject *__pyx_tuple__24;
+static PyObject *__pyx_tuple__26;
+static PyObject *__pyx_tuple__27;
+static PyObject *__pyx_tuple__28;
+static PyObject *__pyx_tuple__29;
+static PyObject *__pyx_tuple__30;
+static PyObject *__pyx_tuple__31;
+static PyObject *__pyx_tuple__33;
+static PyObject *__pyx_codeobj__15;
+static PyObject *__pyx_codeobj__25;
+static PyObject *__pyx_codeobj__32;
+static PyObject *__pyx_codeobj__34;
/* "cdec/_cdec.pyx":6
* cimport decoder
@@ -2588,7 +2642,7 @@ static PyObject *__pyx_k_codeobj_68;
*/
static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args_4cdec_5_cdec_as_str *__pyx_optional_args) {
- char *__pyx_v_error_msg = ((char *)__pyx_k_1);
+ char *__pyx_v_error_msg = ((char *)__pyx_k_Cannot_convert_type_s_to_str);
PyObject *__pyx_v_ret = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -2597,6 +2651,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -2625,12 +2680,12 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
* elif isinstance(data, str):
* ret = data
*/
- __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_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_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_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple_, 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;}
+ if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", 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;
@@ -2654,9 +2709,11 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
* else:
* raise TypeError(error_msg.format(type(data)))
*/
- if (!(likely(PyBytes_CheckExact(__pyx_v_data))||((__pyx_v_data) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_data)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_INCREF(__pyx_v_data);
- __pyx_v_ret = ((PyObject*)__pyx_v_data);
+ if (!(likely(PyBytes_CheckExact(__pyx_v_data))||((__pyx_v_data) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_data)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __pyx_v_data;
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v_ret = ((PyObject*)__pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
@@ -2668,30 +2725,46 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
* return ret
*
*/
- __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_t_3 = __Pyx_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(__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_4, 0, ((PyObject *)Py_TYPE(__pyx_v_data)));
- __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data)));
- __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_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_format); 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);
- 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_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_data))); 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);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data)));
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)Py_TYPE(__pyx_v_data)));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data)));
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, 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_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); 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);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, 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_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[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -2703,17 +2776,25 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
*
* include "vectors.pxi"
*/
- __Pyx_XDECREF(((PyObject *)__pyx_r));
- __Pyx_INCREF(((PyObject *)__pyx_v_ret));
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ret);
__pyx_r = __pyx_v_ret;
goto __pyx_L0;
- __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/_cdec.pyx":6
+ * cimport decoder
+ *
+ * cdef bytes as_str(data, char* error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<<
+ * cdef bytes ret
+ * if isinstance(data, unicode):
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("cdec._cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -2723,6 +2804,14 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
return __pyx_r;
}
+/* "vectors.pxi":7
+ * cdef bint owned # if True, do not manage memory
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * """DenseVector() -> Dense weight/feature vector."""
+ * self.vector = new vector[weight_t]()
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_11DenseVector___init__[] = "DenseVector() -> Dense weight/feature vector.";
@@ -2737,28 +2826,22 @@ static int __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self,
__Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector___init__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":7
- * cdef bint owned # if True, do not manage memory
- *
- * def __init__(self): # <<<<<<<<<<<<<<
- * """DenseVector() -> Dense weight/feature vector."""
- * self.vector = new vector[weight_t]()
- */
-
static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
- std::vector<weight_t> *__pyx_t_1;
+ std::vector<weight_t> *__pyx_t_1;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":9
+ /* "vectors.pxi":9
* def __init__(self):
* """DenseVector() -> Dense weight/feature vector."""
* self.vector = new vector[weight_t]() # <<<<<<<<<<<<<<
@@ -2766,14 +2849,14 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5
*
*/
try {
- __pyx_t_1 = new std::vector<weight_t>();
+ __pyx_t_1 = new std::vector<weight_t> ();
} catch(...) {
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->vector = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":10
+ /* "vectors.pxi":10
* """DenseVector() -> Dense weight/feature vector."""
* self.vector = new vector[weight_t]()
* self.owned = False # <<<<<<<<<<<<<<
@@ -2782,6 +2865,15 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5
*/
__pyx_v_self->owned = 0;
+ /* "vectors.pxi":7
+ * cdef bint owned # if True, do not manage memory
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * """DenseVector() -> Dense weight/feature vector."""
+ * self.vector = new vector[weight_t]()
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -2792,29 +2884,31 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5
return __pyx_r;
}
+/* "vectors.pxi":12
+ * self.owned = False
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * if not self.owned:
+ * del self.vector
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":12
- * self.owned = False
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * if not self.owned:
- * del self.vector
- */
-
static void __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":13
+ /* "vectors.pxi":13
*
* def __dealloc__(self):
* if not self.owned: # <<<<<<<<<<<<<<
@@ -2824,7 +2918,7 @@ static void __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_4c
__pyx_t_1 = ((!(__pyx_v_self->owned != 0)) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":14
+ /* "vectors.pxi":14
* def __dealloc__(self):
* if not self.owned:
* del self.vector # <<<<<<<<<<<<<<
@@ -2836,9 +2930,26 @@ static void __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_4c
}
__pyx_L3:;
+ /* "vectors.pxi":12
+ * self.owned = False
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * if not self.owned:
+ * del self.vector
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "vectors.pxi":16
+ * del self.vector
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.vector.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self) {
@@ -2846,24 +2957,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":16
- * del self.vector
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.vector.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":17
+ /* "vectors.pxi":17
*
* def __len__(self):
* return self.vector.size() # <<<<<<<<<<<<<<
@@ -2873,12 +2978,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(struct __pyx_obj_
__pyx_r = __pyx_v_self->vector->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "vectors.pxi":16
+ * del self.vector
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.vector.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "vectors.pxi":19
+ * return self.vector.size()
+ *
+ * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if 0 <= fid < self.vector.size():
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
@@ -2899,18 +3020,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__(PyObject *__py
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":19
- * return self.vector.size()
- *
- * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
- * cdef int fid = FDConvert(fname)
- * if 0 <= fid < self.vector.size():
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname) {
int __pyx_v_fid;
PyObject *__pyx_r = NULL;
@@ -2924,7 +3039,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":20
+ /* "vectors.pxi":20
*
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -2933,7 +3048,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":21
+ /* "vectors.pxi":21
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname)
* if 0 <= fid < self.vector.size(): # <<<<<<<<<<<<<<
@@ -2947,7 +3062,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":22
+ /* "vectors.pxi":22
* cdef int fid = FDConvert(fname)
* if 0 <= fid < self.vector.size():
* return self.vector[0][fid] # <<<<<<<<<<<<<<
@@ -2960,11 +3075,9 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":23
+ /* "vectors.pxi":23
* if 0 <= fid < self.vector.size():
* return self.vector[0][fid]
* raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -2972,21 +3085,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
* def __setitem__(self, char* fname, float value):
*/
__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_GOTREF(__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));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__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_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __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);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__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;
+ /* "vectors.pxi":19
+ * return self.vector.size()
+ *
+ * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if 0 <= fid < self.vector.size():
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
@@ -2998,6 +3118,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
return __pyx_r;
}
+/* "vectors.pxi":25
+ * raise KeyError(fname)
+ *
+ * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) {
@@ -3022,18 +3150,12 @@ static int __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_se
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname), ((float)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":25
- * raise KeyError(fname)
- *
- * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
- * cdef int fid = FDConvert(fname)
- * if fid < 0: raise KeyError(fname)
- */
-
static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value) {
int __pyx_v_fid;
int __pyx_r;
@@ -3046,7 +3168,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":26
+ /* "vectors.pxi":26
*
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3055,7 +3177,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":27
+ /* "vectors.pxi":27
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -3065,23 +3187,21 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
__pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__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[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":28
+ /* "vectors.pxi":28
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* if self.vector.size() <= fid: # <<<<<<<<<<<<<<
@@ -3091,7 +3211,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
__pyx_t_1 = ((__pyx_v_self->vector->size() <= __pyx_v_fid) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":29
+ /* "vectors.pxi":29
* if fid < 0: raise KeyError(fname)
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1) # <<<<<<<<<<<<<<
@@ -3103,7 +3223,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
}
__pyx_L4:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":30
+ /* "vectors.pxi":30
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1)
* self.vector[0][fid] = value # <<<<<<<<<<<<<<
@@ -3112,6 +3232,15 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
*/
((__pyx_v_self->vector[0])[__pyx_v_fid]) = __pyx_v_value;
+ /* "vectors.pxi":25
+ * raise KeyError(fname)
+ *
+ * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -3125,6 +3254,14 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
}
static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "vectors.pxi":32
+ * self.vector[0][fid] = value
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned fid
+ * for fid in range(1, self.vector.size()):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self) {
@@ -3132,18 +3269,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":32
- * self.vector[0][fid] = value
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned fid
- * for fid in range(1, self.vector.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -3162,18 +3293,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(struct __pyx_obj
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_11DenseVector_12generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_11DenseVector_12generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_DenseVector___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.DenseVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -3204,7 +3333,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
__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/austinma/git/cdec/python/cdec/vectors.pxi":34
+ /* "vectors.pxi":34
* def __iter__(self):
* cdef unsigned fid
* for fid in range(1, self.vector.size()): # <<<<<<<<<<<<<<
@@ -3215,7 +3344,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
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/austinma/git/cdec/python/cdec/vectors.pxi":35
+ /* "vectors.pxi":35
* cdef unsigned fid
* for fid in range(1, self.vector.size()):
* yield str(FDConvert(fid).c_str()), self.vector[0][fid] # <<<<<<<<<<<<<<
@@ -3223,15 +3352,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
* def dot(self, SparseVector other):
*/
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyFloat_FromDouble(((__pyx_cur_scope->__pyx_v_self->vector[0])[__pyx_cur_scope->__pyx_v_fid])); 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);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3242,7 +3371,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
+ __pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
@@ -3256,6 +3385,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "vectors.pxi":32
+ * self.vector[0][fid] = value
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned fid
+ * for fid in range(1, self.vector.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -3271,6 +3410,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
return NULL;
}
+/* "vectors.pxi":37
+ * yield str(FDConvert(fid).c_str()), self.vector[0][fid]
+ *
+ * def dot(self, SparseVector other): # <<<<<<<<<<<<<<
+ * """vector.dot(SparseVector other) -> Dot product of the two vectors."""
+ * return other.dot(self)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_4cdec_5_cdec_11DenseVector_13dot[] = "vector.dot(SparseVector other) -> Dot product of the two vectors.";
@@ -3283,6 +3430,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_sel
__Pyx_RefNannySetupContext("dot (wrapper)", 0);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_13dot(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_other));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -3291,26 +3440,19 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":37
- * yield str(FDConvert(fid).c_str()), self.vector[0][fid]
- *
- * def dot(self, SparseVector other): # <<<<<<<<<<<<<<
- * """vector.dot(SparseVector other) -> Dot product of the two vectors."""
- * return other.dot(self)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":39
+ /* "vectors.pxi":39
* def dot(self, SparseVector other):
* """vector.dot(SparseVector other) -> Dot product of the two vectors."""
* return other.dot(self) # <<<<<<<<<<<<<<
@@ -3318,27 +3460,51 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cde
* def tosparse(self):
*/
__Pyx_XDECREF(__pyx_r);
- __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_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_n_s_dot); 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);
- __Pyx_INCREF(((PyObject *)__pyx_v_self));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self)); 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);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_self));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":37
+ * yield str(FDConvert(fid).c_str()), self.vector[0][fid]
+ *
+ * def dot(self, SparseVector other): # <<<<<<<<<<<<<<
+ * """vector.dot(SparseVector other) -> Dot product of the two vectors."""
+ * return other.dot(self)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec._cdec.DenseVector.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -3347,6 +3513,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cde
return __pyx_r;
}
+/* "vectors.pxi":41
+ * return other.dot(self)
+ *
+ * def tosparse(self): # <<<<<<<<<<<<<<
+ * """vector.tosparse() -> Equivalent SparseVector."""
+ * cdef SparseVector sparse = SparseVector.__new__(SparseVector)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_11DenseVector_15tosparse[] = "vector.tosparse() -> Equivalent SparseVector.";
@@ -3355,18 +3529,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("tosparse (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":41
- * return other.dot(self)
- *
- * def tosparse(self): # <<<<<<<<<<<<<<
- * """vector.tosparse() -> Equivalent SparseVector."""
- * cdef SparseVector sparse = SparseVector.__new__(SparseVector)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_sparse = 0;
PyObject *__pyx_r = NULL;
@@ -3377,29 +3545,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("tosparse", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":43
+ /* "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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __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_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_sparse = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":44
+ /* "vectors.pxi":44
* """vector.tosparse() -> Equivalent SparseVector."""
* cdef SparseVector sparse = SparseVector.__new__(SparseVector)
* sparse.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<<
* InitSparseVector(self.vector[0], sparse.vector)
* return sparse
*/
- __pyx_v_sparse->vector = new FastSparseVector<weight_t>();
+ __pyx_v_sparse->vector = new FastSparseVector<weight_t> ();
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":45
+ /* "vectors.pxi":45
* cdef SparseVector sparse = SparseVector.__new__(SparseVector)
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector) # <<<<<<<<<<<<<<
@@ -3408,7 +3576,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj
*/
Weights::InitSparseVector((__pyx_v_self->vector[0]), __pyx_v_sparse->vector);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":46
+ /* "vectors.pxi":46
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector)
* return sparse # <<<<<<<<<<<<<<
@@ -3420,8 +3588,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_sparse);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":41
+ * return other.dot(self)
+ *
+ * def tosparse(self): # <<<<<<<<<<<<<<
+ * """vector.tosparse() -> Equivalent SparseVector."""
+ * cdef SparseVector sparse = SparseVector.__new__(SparseVector)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.DenseVector.tosparse", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -3433,6 +3608,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj
return __pyx_r;
}
+/* "vectors.pxi":51
+ * cdef FastSparseVector[weight_t]* vector
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * """SparseVector() -> Sparse feature/weight vector."""
+ * self.vector = new FastSparseVector[weight_t]()
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_12SparseVector___init__[] = "SparseVector() -> Sparse feature/weight vector.";
@@ -3447,59 +3630,64 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self
__Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector___init__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":51
- * cdef FastSparseVector[weight_t]* vector
- *
- * def __init__(self): # <<<<<<<<<<<<<<
- * """SparseVector() -> Sparse feature/weight vector."""
- * self.vector = new FastSparseVector[weight_t]()
- */
-
static int __pyx_pf_4cdec_5_cdec_12SparseVector___init__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":53
+ /* "vectors.pxi":53
* def __init__(self):
* """SparseVector() -> Sparse feature/weight vector."""
* self.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __pyx_v_self->vector = new FastSparseVector<weight_t>();
+ __pyx_v_self->vector = new FastSparseVector<weight_t> ();
+
+ /* "vectors.pxi":51
+ * cdef FastSparseVector[weight_t]* vector
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * """SparseVector() -> Sparse feature/weight vector."""
+ * self.vector = new FastSparseVector[weight_t]()
+ */
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "vectors.pxi":55
+ * self.vector = new FastSparseVector[weight_t]()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.vector
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":55
- * self.vector = new FastSparseVector[weight_t]()
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.vector
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":56
+ /* "vectors.pxi":56
*
* def __dealloc__(self):
* del self.vector # <<<<<<<<<<<<<<
@@ -3508,9 +3696,26 @@ static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED stru
*/
delete __pyx_v_self->vector;
+ /* "vectors.pxi":55
+ * self.vector = new FastSparseVector[weight_t]()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.vector
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "vectors.pxi":58
+ * del self.vector
+ *
+ * def copy(self): # <<<<<<<<<<<<<<
+ * """vector.copy() -> SparseVector copy."""
+ * return self * 1
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_12SparseVector_4copy[] = "vector.copy() -> SparseVector copy.";
@@ -3519,18 +3724,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("copy (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_4copy(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":58
- * del self.vector
- *
- * def copy(self): # <<<<<<<<<<<<<<
- * """vector.copy() -> SparseVector copy."""
- * return self * 1
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -3540,7 +3739,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":60
+ /* "vectors.pxi":60
* def copy(self):
* """vector.copy() -> SparseVector copy."""
* return self * 1 # <<<<<<<<<<<<<<
@@ -3554,8 +3753,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cd
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":58
+ * del self.vector
+ *
+ * def copy(self): # <<<<<<<<<<<<<<
+ * """vector.copy() -> SparseVector copy."""
+ * return self * 1
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -3566,6 +3772,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "vectors.pxi":62
+ * return self * 1
+ *
+ * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
@@ -3586,18 +3800,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__(PyObject *__p
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":62
- * return self * 1
- *
- * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
- * cdef int fid = FDConvert(fname)
- * if fid < 0: raise KeyError(fname)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname) {
int __pyx_v_fid;
PyObject *__pyx_r = NULL;
@@ -3610,7 +3818,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":63
+ /* "vectors.pxi":63
*
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3619,7 +3827,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":64
+ /* "vectors.pxi":64
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -3629,23 +3837,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
__pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__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[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":65
+ /* "vectors.pxi":65
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* return self.vector.value(fid) # <<<<<<<<<<<<<<
@@ -3659,8 +3865,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":62
+ * return self * 1
+ *
+ * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
@@ -3672,6 +3885,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
return __pyx_r;
}
+/* "vectors.pxi":67
+ * return self.vector.value(fid)
+ *
+ * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) {
@@ -3696,18 +3917,12 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_s
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname), ((float)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":67
- * return self.vector.value(fid)
- *
- * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
- * cdef int fid = FDConvert(fname)
- * if fid < 0: raise KeyError(fname)
- */
-
static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value) {
int __pyx_v_fid;
int __pyx_r;
@@ -3720,7 +3935,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":68
+ /* "vectors.pxi":68
*
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3729,7 +3944,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":69
+ /* "vectors.pxi":69
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -3739,23 +3954,21 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
__pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__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[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":70
+ /* "vectors.pxi":70
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* self.vector.set_value(fid, value) # <<<<<<<<<<<<<<
@@ -3764,6 +3977,15 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
*/
__pyx_v_self->vector->set_value(__pyx_v_fid, __pyx_v_value);
+ /* "vectors.pxi":67
+ * return self.vector.value(fid)
+ *
+ * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -3777,6 +3999,14 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
}
static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "vectors.pxi":72
+ * self.vector.set_value(fid, value)
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
+ * cdef unsigned i
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_self) {
@@ -3784,18 +4014,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__(PyObject *__pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_10__iter__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":72
- * self.vector.set_value(fid, value)
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
- * cdef unsigned i
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -3814,18 +4038,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_10__iter__(struct __pyx_ob
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_12SparseVector_12generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_12SparseVector_12generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SparseVector___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.SparseVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -3841,6 +4063,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -3856,16 +4087,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
__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/austinma/git/cdec/python/cdec/vectors.pxi":73
+ /* "vectors.pxi":73
*
* def __iter__(self):
* cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) # <<<<<<<<<<<<<<
* cdef unsigned i
* try:
*/
- __pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t>::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0);
+ __pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t> ::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":75
+ /* "vectors.pxi":75
* cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
* cdef unsigned i
* try: # <<<<<<<<<<<<<<
@@ -3874,7 +4105,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":76
+ /* "vectors.pxi":76
* cdef unsigned i
* try:
* for i in range(self.vector.size()): # <<<<<<<<<<<<<<
@@ -3885,26 +4116,26 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
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/austinma/git/cdec/python/cdec/vectors.pxi":77
+ /* "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 = __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_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_error;}
+ __Pyx_GOTREF(__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_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_it[0]).operator->()->second); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_it[0]).operator->()->second); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
@@ -3912,7 +4143,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
+ __pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
@@ -3924,9 +4155,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
__pyx_L9_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":78
+ /* "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 # <<<<<<<<<<<<<<
@@ -3937,7 +4168,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
}
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":80
+ /* "vectors.pxi":80
* pinc(it[0]) # ++it
* finally:
* del it # <<<<<<<<<<<<<<
@@ -3945,33 +4176,54 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
* def dot(self, other):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_it;
+ goto __pyx_L6;
+ }
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
- goto __pyx_L6;
- }
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_it;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_it;
}
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
+ }
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "vectors.pxi":72
+ * self.vector.set_value(fid, value)
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
+ * cdef unsigned i
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -3987,6 +4239,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
return NULL;
}
+/* "vectors.pxi":82
+ * del it
+ *
+ * def dot(self, other): # <<<<<<<<<<<<<<
+ * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
+ * if isinstance(other, DenseVector):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_4cdec_5_cdec_12SparseVector_13dot[] = "vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors.";
@@ -3995,18 +4255,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dot (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_13dot(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((PyObject *)__pyx_v_other));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":82
- * del it
- *
- * def dot(self, other): # <<<<<<<<<<<<<<
- * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
- * if isinstance(other, DenseVector):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -4019,7 +4273,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":84
+ /* "vectors.pxi":84
* def dot(self, other):
* """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
* if isinstance(other, DenseVector): # <<<<<<<<<<<<<<
@@ -4030,7 +4284,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":85
+ /* "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]) # <<<<<<<<<<<<<<
@@ -4043,10 +4297,9 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":86
+ /* "vectors.pxi":86
* if isinstance(other, DenseVector):
* return self.vector.dot((<DenseVector> other).vector[0])
* elif isinstance(other, SparseVector): # <<<<<<<<<<<<<<
@@ -4057,7 +4310,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":87
+ /* "vectors.pxi":87
* return self.vector.dot((<DenseVector> other).vector[0])
* elif isinstance(other, SparseVector):
* return self.vector.dot((<SparseVector> other).vector[0]) # <<<<<<<<<<<<<<
@@ -4070,33 +4323,38 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":88
+ /* "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_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_3 = __Pyx_PyString_Format(__pyx_kp_s_cannot_take_the_dot_product_of_s, ((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(__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));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__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_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __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);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__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;
+ /* "vectors.pxi":82
+ * del it
+ *
+ * def dot(self, other): # <<<<<<<<<<<<<<
+ * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
+ * if isinstance(other, DenseVector):
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
@@ -4108,6 +4366,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "vectors.pxi":90
+ * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other))
+ *
+ * def __richcmp__(SparseVector x, SparseVector y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.vector[0] == y.vector[0]
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
@@ -4120,6 +4386,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "y", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_y), ((int)__pyx_v_op));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4128,14 +4396,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":90
- * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other))
- *
- * def __richcmp__(SparseVector x, SparseVector y, int op): # <<<<<<<<<<<<<<
- * if op == 2: # ==
- * return x.vector[0] == y.vector[0]
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_y, int __pyx_v_op) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -4146,7 +4406,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":93
+ /* "vectors.pxi":93
* if op == 2: # ==
* return x.vector[0] == y.vector[0]
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -4155,7 +4415,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
*/
switch (__pyx_v_op) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":91
+ /* "vectors.pxi":91
*
* def __richcmp__(SparseVector x, SparseVector y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -4164,7 +4424,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
*/
case 2:
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":92
+ /* "vectors.pxi":92
* def __richcmp__(SparseVector x, SparseVector y, int op):
* if op == 2: # ==
* return x.vector[0] == y.vector[0] # <<<<<<<<<<<<<<
@@ -4179,7 +4439,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
goto __pyx_L0;
break;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":93
+ /* "vectors.pxi":93
* if op == 2: # ==
* return x.vector[0] == y.vector[0]
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -4188,7 +4448,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
*/
case 3:
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":94
+ /* "vectors.pxi":94
* return x.vector[0] == y.vector[0]
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -4205,23 +4465,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
__pyx_t_1 = 0;
goto __pyx_L0;
break;
+ default: break;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":95
+ /* "vectors.pxi":95
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<<
*
* def __len__(self):
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplemented, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":90
+ * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other))
+ *
+ * def __richcmp__(SparseVector x, SparseVector y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.vector[0] == y.vector[0]
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4232,6 +4500,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
return __pyx_r;
}
+/* "vectors.pxi":97
+ * raise NotImplemented('comparison not implemented for SparseVector')
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.vector.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_self) {
@@ -4239,24 +4515,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__(PyObject *__pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":97
- * raise NotImplemented('comparison not implemented for SparseVector')
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.vector.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":98
+ /* "vectors.pxi":98
*
* def __len__(self):
* return self.vector.size() # <<<<<<<<<<<<<<
@@ -4266,12 +4536,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(struct __pyx_ob
__pyx_r = __pyx_v_self->vector->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "vectors.pxi":97
+ * raise NotImplemented('comparison not implemented for SparseVector')
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.vector.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "vectors.pxi":100
+ * return self.vector.size()
+ *
+ * def __contains__(self, char* fname): # <<<<<<<<<<<<<<
+ * return self.vector.nonzero(FDConvert(fname))
+ *
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static int __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
@@ -4292,24 +4578,18 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":100
- * return self.vector.size()
- *
- * def __contains__(self, char* fname): # <<<<<<<<<<<<<<
- * return self.vector.nonzero(FDConvert(fname))
- *
- */
-
static int __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__contains__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":101
+ /* "vectors.pxi":101
*
* def __contains__(self, char* fname):
* return self.vector.nonzero(FDConvert(fname)) # <<<<<<<<<<<<<<
@@ -4319,12 +4599,28 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_
__pyx_r = __pyx_v_self->vector->nonzero(FD::Convert(__pyx_v_fname));
goto __pyx_L0;
- __pyx_r = 0;
+ /* "vectors.pxi":100
+ * return self.vector.size()
+ *
+ * def __contains__(self, char* fname): # <<<<<<<<<<<<<<
+ * return self.vector.nonzero(FDConvert(fname))
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "vectors.pxi":103
+ * return self.vector.nonzero(FDConvert(fname))
+ *
+ * def __neg__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](self.vector[0])
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self) {
@@ -4332,18 +4628,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":103
- * return self.vector.nonzero(FDConvert(fname))
- *
- * def __neg__(self): # <<<<<<<<<<<<<<
- * cdef SparseVector result = SparseVector.__new__(SparseVector)
- * result.vector = new FastSparseVector[weight_t](self.vector[0])
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
@@ -4354,29 +4644,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__neg__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":104
+ /* "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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __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_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":105
+ /* "vectors.pxi":105
* def __neg__(self):
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](self.vector[0]) # <<<<<<<<<<<<<<
* result.vector[0] *= -1.0
* return result
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>((__pyx_v_self->vector[0]));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> ((__pyx_v_self->vector[0]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":106
+ /* "vectors.pxi":106
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0 # <<<<<<<<<<<<<<
@@ -4385,7 +4675,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj
*/
(__pyx_v_result->vector[0]) *= -1.0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":107
+ /* "vectors.pxi":107
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0
* return result # <<<<<<<<<<<<<<
@@ -4397,8 +4687,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":103
+ * return self.vector.nonzero(FDConvert(fname))
+ *
+ * def __neg__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](self.vector[0])
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4410,6 +4707,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj
return __pyx_r;
}
+/* "vectors.pxi":109
+ * return result
+ *
+ * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
+ * self.vector[0] += other.vector[0]
+ * return self
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
@@ -4421,6 +4726,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx
__Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_other));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4429,20 +4736,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":109
- * return result
- *
- * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
- * self.vector[0] += other.vector[0]
- * return self
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":110
+ /* "vectors.pxi":110
*
* def __iadd__(SparseVector self, SparseVector other):
* self.vector[0] += other.vector[0] # <<<<<<<<<<<<<<
@@ -4451,7 +4750,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(struct __pyx_ob
*/
(__pyx_v_self->vector[0]) += (__pyx_v_other->vector[0]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":111
+ /* "vectors.pxi":111
* def __iadd__(SparseVector self, SparseVector other):
* self.vector[0] += other.vector[0]
* return self # <<<<<<<<<<<<<<
@@ -4463,13 +4762,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "vectors.pxi":109
+ * return result
+ *
+ * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
+ * self.vector[0] += other.vector[0]
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "vectors.pxi":113
+ * return self
+ *
+ * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
+ * self.vector[0] -= other.vector[0]
+ * return self
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
@@ -4481,6 +4796,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx
__Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_other));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4489,20 +4806,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":113
- * return self
- *
- * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
- * self.vector[0] -= other.vector[0]
- * return self
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__isub__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":114
+ /* "vectors.pxi":114
*
* def __isub__(SparseVector self, SparseVector other):
* self.vector[0] -= other.vector[0] # <<<<<<<<<<<<<<
@@ -4511,7 +4820,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(struct __pyx_ob
*/
(__pyx_v_self->vector[0]) -= (__pyx_v_other->vector[0]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":115
+ /* "vectors.pxi":115
* def __isub__(SparseVector self, SparseVector other):
* self.vector[0] -= other.vector[0]
* return self # <<<<<<<<<<<<<<
@@ -4523,13 +4832,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "vectors.pxi":113
+ * return self
+ *
+ * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
+ * self.vector[0] -= other.vector[0]
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "vectors.pxi":117
+ * return self
+ *
+ * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
+ * self.vector[0] *= scalar
+ * return self
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) {
@@ -4550,24 +4875,18 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__(PyObject *__pyx
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":117
- * return self
- *
- * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
- * self.vector[0] *= scalar
- * return self
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__imul__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":118
+ /* "vectors.pxi":118
*
* def __imul__(SparseVector self, float scalar):
* self.vector[0] *= scalar # <<<<<<<<<<<<<<
@@ -4576,7 +4895,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_ob
*/
(__pyx_v_self->vector[0]) *= __pyx_v_scalar;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":119
+ /* "vectors.pxi":119
* def __imul__(SparseVector self, float scalar):
* self.vector[0] *= scalar
* return self # <<<<<<<<<<<<<<
@@ -4588,13 +4907,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "vectors.pxi":117
+ * return self
+ *
+ * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
+ * self.vector[0] *= scalar
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "vectors.pxi":121
+ * return self
+ *
+ * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
+ * self.vector[0] /= scalar
+ * return self
+ */
+
/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/
@@ -4616,26 +4951,20 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":121
- * return self
- *
- * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
- * self.vector[0] /= scalar
- * return self
- */
-
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__idiv__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":122
+ /* "vectors.pxi":122
*
* def __idiv__(SparseVector self, float scalar):
* self.vector[0] /= scalar # <<<<<<<<<<<<<<
@@ -4644,7 +4973,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_ob
*/
(__pyx_v_self->vector[0]) /= __pyx_v_scalar;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":123
+ /* "vectors.pxi":123
* def __idiv__(SparseVector self, float scalar):
* self.vector[0] /= scalar
* return self # <<<<<<<<<<<<<<
@@ -4656,7 +4985,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "vectors.pxi":121
+ * return self
+ *
+ * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
+ * self.vector[0] /= scalar
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -4664,6 +5001,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_ob
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
+/* "vectors.pxi":125
+ * return self
+ *
+ * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
@@ -4676,6 +5021,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "y", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_y));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4684,14 +5031,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":125
- * return self
- *
- * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
- * cdef SparseVector result = SparseVector.__new__(SparseVector)
- * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
@@ -4702,29 +5041,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":126
+ /* "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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __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_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":127
+ /* "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]) # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0])));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> (((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":128
+ /* "vectors.pxi":128
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
* return result # <<<<<<<<<<<<<<
@@ -4736,8 +5075,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":125
+ * return self
+ *
+ * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4749,6 +5095,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj
return __pyx_r;
}
+/* "vectors.pxi":130
+ * return result
+ *
+ * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
@@ -4761,6 +5115,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "y", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_y));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4769,14 +5125,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":130
- * return result
- *
- * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
- * cdef SparseVector result = SparseVector.__new__(SparseVector)
- * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
@@ -4787,29 +5135,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__sub__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":131
+ /* "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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __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_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":132
+ /* "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]) # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0])));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> (((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":133
+ /* "vectors.pxi":133
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
* return result # <<<<<<<<<<<<<<
@@ -4821,8 +5169,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":130
+ * return result
+ *
+ * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4834,6 +5189,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj
return __pyx_r;
}
+/* "vectors.pxi":135
+ * return result
+ *
+ * def __mul__(x, y): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector
+ * cdef float scalar
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
@@ -4841,18 +5204,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":135
- * return result
- *
- * def __mul__(x, y): # <<<<<<<<<<<<<<
- * cdef SparseVector vector
- * cdef float scalar
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0;
float __pyx_v_scalar;
@@ -4868,7 +5225,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__mul__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":138
+ /* "vectors.pxi":138
* cdef SparseVector vector
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<<
@@ -4889,7 +5246,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":139
+ /* "vectors.pxi":139
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x # <<<<<<<<<<<<<<
@@ -4906,29 +5263,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":140
+ /* "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_3 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_3 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __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_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":141
+ /* "vectors.pxi":141
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) * __pyx_v_scalar));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> (((__pyx_v_vector->vector[0]) * __pyx_v_scalar));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":142
+ /* "vectors.pxi":142
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar)
* return result # <<<<<<<<<<<<<<
@@ -4940,8 +5297,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":135
+ * return result
+ *
+ * def __mul__(x, y): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector
+ * cdef float scalar
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4954,6 +5318,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
return __pyx_r;
}
+/* "vectors.pxi":144
+ * return result
+ *
+ * def __div__(x, y): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector
+ * cdef float scalar
+ */
+
/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
@@ -4962,19 +5334,13 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_38__div__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":144
- * return result
- *
- * def __div__(x, y): # <<<<<<<<<<<<<<
- * cdef SparseVector vector
- * cdef float scalar
- */
-
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0;
@@ -4991,7 +5357,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__div__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":147
+ /* "vectors.pxi":147
* cdef SparseVector vector
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<<
@@ -5012,7 +5378,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":148
+ /* "vectors.pxi":148
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x # <<<<<<<<<<<<<<
@@ -5029,28 +5395,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":149
+ /* "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_3 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_3 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __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_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":150
+ /* "vectors.pxi":150
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) # <<<<<<<<<<<<<<
* return result
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) / __pyx_v_scalar));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> (((__pyx_v_vector->vector[0]) / __pyx_v_scalar));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":151
+ /* "vectors.pxi":151
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar)
* return result # <<<<<<<<<<<<<<
@@ -5060,8 +5426,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "vectors.pxi":144
+ * return result
+ *
+ * def __div__(x, y): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector
+ * cdef float scalar
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -5075,20 +5448,30 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
+/* "grammar.pxi":5
+ * import cdec.sa._sa as _sa
+ *
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_v_phrase); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_5_cdec_1_phrase = {__Pyx_NAMESTR("_phrase"), (PyCFunction)__pyx_pw_4cdec_5_cdec_1_phrase, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_5_cdec_1_phrase = {"_phrase", (PyCFunction)__pyx_pw_4cdec_5_cdec_1_phrase, METH_O, 0};
static PyObject *__pyx_pw_4cdec_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_v_phrase) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_phrase (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec__phrase(__pyx_self, ((PyObject *)__pyx_v_phrase));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":6
+/* "grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -5114,18 +5497,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) {
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7_phrase_2generator21, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7_phrase_2generator21, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_phrase_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec._phrase.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -5158,34 +5539,37 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) { __Pyx_RaiseClosureNameError("phrase"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase); 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_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
@@ -5193,15 +5577,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
__Pyx_GOTREF(__pyx_t_4);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_w);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_w);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_w, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
- __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 != 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_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_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_4 = __pyx_t_7;
@@ -5212,9 +5595,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_w);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_cur_scope->__pyx_v_w);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_w);
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
}
@@ -5238,6 +5621,8 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -5254,7 +5639,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
return NULL;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":5
+/* "grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -5268,7 +5653,6 @@ static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_sel
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -5283,7 +5667,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_sel
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":6
+ /* "grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -5291,29 +5675,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_sel
* cdef class NT:
*/
__Pyx_XDECREF(__pyx_r);
- __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_t_1 = __pyx_pf_4cdec_5_cdec_7_phrase_genexpr(((PyObject*)__pyx_cur_scope)); 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_4cdec_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);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__4, __pyx_t_1); 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);
__Pyx_DECREF(__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;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":5
+ * import cdec.sa._sa as _sa
+ *
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec._phrase", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -5323,6 +5705,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_sel
return __pyx_r;
}
+/* "grammar.pxi":11
+ * cdef public bytes cat
+ * cdef public unsigned ref
+ * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<<
+ * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
+ * self.cat = cat
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_2NT___init__[] = "NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.";
@@ -5339,7 +5729,7 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cat,&__pyx_n_s__ref,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cat,&__pyx_n_s_ref,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -5353,11 +5743,11 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cat)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cat)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ref);
if (value) { values[1] = value; kw_args--; }
}
}
@@ -5374,7 +5764,7 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
}
__pyx_v_cat = ((PyObject*)values[0]);
if (values[1]) {
- __pyx_v_ref = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_ref == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_ref = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_ref == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_ref = ((unsigned int)0);
}
@@ -5389,6 +5779,8 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cat), (&PyBytes_Type), 1, "cat", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT___init__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self), __pyx_v_cat, __pyx_v_ref);
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -5397,33 +5789,25 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":11
- * cdef public bytes cat
- * cdef public unsigned ref
- * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<<
- * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
- * self.cat = cat
- */
-
static int __pyx_pf_4cdec_5_cdec_2NT___init__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_cat, unsigned int __pyx_v_ref) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":13
+ /* "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 # <<<<<<<<<<<<<<
* self.ref = ref
*
*/
- __Pyx_INCREF(((PyObject *)__pyx_v_cat));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_cat));
+ __Pyx_INCREF(__pyx_v_cat);
+ __Pyx_GIVEREF(__pyx_v_cat);
__Pyx_GOTREF(__pyx_v_self->cat);
- __Pyx_DECREF(((PyObject *)__pyx_v_self->cat));
+ __Pyx_DECREF(__pyx_v_self->cat);
__pyx_v_self->cat = __pyx_v_cat;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":14
+ /* "grammar.pxi":14
* """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
* self.cat = cat
* self.ref = ref # <<<<<<<<<<<<<<
@@ -5432,11 +5816,28 @@ static int __pyx_pf_4cdec_5_cdec_2NT___init__(struct __pyx_obj_4cdec_5_cdec_NT *
*/
__pyx_v_self->ref = __pyx_v_ref;
+ /* "grammar.pxi":11
+ * cdef public bytes cat
+ * cdef public unsigned ref
+ * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<<
+ * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
+ * self.cat = cat
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "grammar.pxi":16
+ * self.ref = ref
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * if self.ref > 0:
+ * return '[%s,%d]' % (self.cat, self.ref)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) {
@@ -5444,18 +5845,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_2__str__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":16
- * self.ref = ref
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * if self.ref > 0:
- * return '[%s,%d]' % (self.cat, self.ref)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5467,7 +5862,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":17
+ /* "grammar.pxi":17
*
* def __str__(self):
* if self.ref > 0: # <<<<<<<<<<<<<<
@@ -5477,7 +5872,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde
__pyx_t_1 = ((__pyx_v_self->ref > 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":18
+ /* "grammar.pxi":18
* def __str__(self):
* if self.ref > 0:
* return '[%s,%d]' % (self.cat, self.ref) # <<<<<<<<<<<<<<
@@ -5485,27 +5880,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_v_self->cat));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->cat));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_self->cat));
+ __Pyx_INCREF(__pyx_v_self->cat);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->cat);
+ __Pyx_GIVEREF(__pyx_v_self->cat);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_r = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_d, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":19
+ /* "grammar.pxi":19
* if self.ref > 0:
* return '[%s,%d]' % (self.cat, self.ref)
* return '[%s]' % self.cat # <<<<<<<<<<<<<<
@@ -5513,14 +5906,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde
* cdef class NTRef:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)__pyx_v_self->cat)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_r = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_v_self->cat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":16
+ * self.ref = ref
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * if self.ref > 0:
+ * return '[%s,%d]' % (self.cat, self.ref)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
@@ -5532,6 +5932,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde
return __pyx_r;
}
+/* "grammar.pxi":9
+ *
+ * cdef class NT:
+ * cdef public bytes cat # <<<<<<<<<<<<<<
+ * cdef public unsigned ref
+ * def __init__(self, bytes cat, unsigned ref=0):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) {
@@ -5539,28 +5947,22 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3cat___get__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":9
- *
- * cdef class NT:
- * cdef public bytes cat # <<<<<<<<<<<<<<
- * cdef public unsigned ref
- * def __init__(self, bytes cat, unsigned ref=0):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_2NT_3cat___get__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_self->cat));
- __pyx_r = ((PyObject *)__pyx_v_self->cat);
+ __Pyx_INCREF(__pyx_v_self->cat);
+ __pyx_r = __pyx_v_self->cat;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -5574,6 +5976,8 @@ static int __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(PyObject *__pyx_v_self, PyObj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3cat_2__set__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -5581,20 +5985,25 @@ static int __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(PyObject *__pyx_v_self, PyObj
static int __pyx_pf_4cdec_5_cdec_2NT_3cat_2__set__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- if (!(likely(PyBytes_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_INCREF(__pyx_v_value);
- __Pyx_GIVEREF(__pyx_v_value);
+ if (!(likely(PyBytes_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->cat);
- __Pyx_DECREF(((PyObject *)__pyx_v_self->cat));
- __pyx_v_self->cat = ((PyObject*)__pyx_v_value);
+ __Pyx_DECREF(__pyx_v_self->cat);
+ __pyx_v_self->cat = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.NT.cat.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -5609,6 +6018,8 @@ static int __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3cat_4__del__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -5620,14 +6031,23 @@ static int __pyx_pf_4cdec_5_cdec_2NT_3cat_4__del__(struct __pyx_obj_4cdec_5_cdec
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->cat);
- __Pyx_DECREF(((PyObject *)__pyx_v_self->cat));
+ __Pyx_DECREF(__pyx_v_self->cat);
__pyx_v_self->cat = ((PyObject*)Py_None);
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "grammar.pxi":10
+ * cdef class NT:
+ * cdef public bytes cat
+ * cdef public unsigned ref # <<<<<<<<<<<<<<
+ * def __init__(self, bytes cat, unsigned ref=0):
+ * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) {
@@ -5635,18 +6055,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3ref___get__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":10
- * cdef class NT:
- * cdef public bytes cat
- * cdef public unsigned ref # <<<<<<<<<<<<<<
- * def __init__(self, bytes cat, unsigned ref=0):
- * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_2NT_3ref___get__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5656,14 +6070,13 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_3ref___get__(struct __pyx_obj_4cdec_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.NT.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -5681,6 +6094,8 @@ static int __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(PyObject *__pyx_v_self, PyObj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3ref_2__set__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -5693,9 +6108,10 @@ static int __pyx_pf_4cdec_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_4cdec_5_cdec
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->ref = __pyx_t_1;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -5706,6 +6122,14 @@ static int __pyx_pf_4cdec_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_4cdec_5_cdec
return __pyx_r;
}
+/* "grammar.pxi":23
+ * cdef class NTRef:
+ * cdef public unsigned ref
+ * def __init__(self, unsigned ref): # <<<<<<<<<<<<<<
+ * """NTRef(int ref) -> Non-terminal reference."""
+ * self.ref = ref
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_5NTRef___init__[] = "NTRef(int ref) -> Non-terminal reference.";
@@ -5721,7 +6145,7 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ref,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -5734,7 +6158,7 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ref)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -5745,7 +6169,7 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
}
- __pyx_v_ref = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_ref == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_ref = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_ref == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
@@ -5756,24 +6180,18 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef___init__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self), __pyx_v_ref);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":23
- * cdef class NTRef:
- * cdef public unsigned ref
- * def __init__(self, unsigned ref): # <<<<<<<<<<<<<<
- * """NTRef(int ref) -> Non-terminal reference."""
- * self.ref = ref
- */
-
static int __pyx_pf_4cdec_5_cdec_5NTRef___init__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self, unsigned int __pyx_v_ref) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":25
+ /* "grammar.pxi":25
* def __init__(self, unsigned ref):
* """NTRef(int ref) -> Non-terminal reference."""
* self.ref = ref # <<<<<<<<<<<<<<
@@ -5782,11 +6200,28 @@ static int __pyx_pf_4cdec_5_cdec_5NTRef___init__(struct __pyx_obj_4cdec_5_cdec_N
*/
__pyx_v_self->ref = __pyx_v_ref;
+ /* "grammar.pxi":23
+ * cdef class NTRef:
+ * cdef public unsigned ref
+ * def __init__(self, unsigned ref): # <<<<<<<<<<<<<<
+ * """NTRef(int ref) -> Non-terminal reference."""
+ * self.ref = ref
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "grammar.pxi":27
+ * self.ref = ref
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return '[%d]' % self.ref
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) {
@@ -5794,18 +6229,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef_2__str__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":27
- * self.ref = ref
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * return '[%d]' % self.ref
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5816,7 +6245,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":28
+ /* "grammar.pxi":28
*
* def __str__(self):
* return '[%d]' % self.ref # <<<<<<<<<<<<<<
@@ -5824,17 +6253,24 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_
* cdef TRule convert_rule(_sa.Rule rule):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_r = ((PyObject *)__pyx_t_2);
+ __pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":27
+ * self.ref = ref
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return '[%d]' % self.ref
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -5846,6 +6282,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_
return __pyx_r;
}
+/* "grammar.pxi":22
+ *
+ * cdef class NTRef:
+ * cdef public unsigned ref # <<<<<<<<<<<<<<
+ * def __init__(self, unsigned ref):
+ * """NTRef(int ref) -> Non-terminal reference."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self) {
@@ -5853,18 +6297,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":22
- *
- * cdef class NTRef:
- * cdef public unsigned ref # <<<<<<<<<<<<<<
- * def __init__(self, unsigned ref):
- * """NTRef(int ref) -> Non-terminal reference."""
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5874,14 +6312,13 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.NTRef.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -5899,6 +6336,8 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_3ref_3__set__(PyObject *__pyx_v_self, Py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -5911,9 +6350,10 @@ static int __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_4cdec_5_c
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->ref = __pyx_t_1;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -5924,7 +6364,7 @@ static int __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_4cdec_5_c
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":30
+/* "grammar.pxi":30
* return '[%d]' % self.ref
*
* cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<<
@@ -5950,12 +6390,13 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
int __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_rule", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":31
+ /* "grammar.pxi":31
*
* cdef TRule convert_rule(_sa.Rule rule):
* lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<<
@@ -5964,7 +6405,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
*/
__pyx_v_lhs = __pyx_f_4cdec_2sa_3_sa_sym_tocat(__pyx_v_rule->lhs);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":32
+ /* "grammar.pxi":32
* cdef TRule convert_rule(_sa.Rule rule):
* lhs = _sa.sym_tocat(rule.lhs)
* scores = dict(rule.scores) # <<<<<<<<<<<<<<
@@ -5976,13 +6417,13 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
__Pyx_INCREF(((PyObject *)__pyx_v_rule->scores));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_rule->scores));
__Pyx_GIVEREF(((PyObject *)__pyx_v_rule->scores));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_scores = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":33
+ /* "grammar.pxi":33
* lhs = _sa.sym_tocat(rule.lhs)
* scores = dict(rule.scores)
* f, e = [], [] # <<<<<<<<<<<<<<
@@ -5998,7 +6439,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
__pyx_v_e = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":34
+ /* "grammar.pxi":34
* scores = dict(rule.scores)
* f, e = [], []
* cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<<
@@ -6008,7 +6449,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
__pyx_t_3 = __pyx_v_rule->f->syms;
__pyx_v_fsyms = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":35
+ /* "grammar.pxi":35
* f, e = [], []
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n): # <<<<<<<<<<<<<<
@@ -6019,7 +6460,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
__pyx_v_i = __pyx_t_5;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":36
+ /* "grammar.pxi":36
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]): # <<<<<<<<<<<<<<
@@ -6029,7 +6470,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
__pyx_t_6 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i])) != 0);
if (__pyx_t_6) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":37
+ /* "grammar.pxi":37
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]):
* f.append(NT(_sa.sym_tocat(fsyms[i]))) # <<<<<<<<<<<<<<
@@ -6037,22 +6478,22 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
* f.append(_sa.sym_tostring(fsyms[i]))
*/
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__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/austinma/git/cdec/python/cdec/grammar.pxi":39
+ /* "grammar.pxi":39
* f.append(NT(_sa.sym_tocat(fsyms[i])))
* else:
* f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<<
@@ -6060,14 +6501,14 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
* for i in range(rule.e.n):
*/
__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 = __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_GOTREF(__pyx_t_1);
+ __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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L5:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":40
+ /* "grammar.pxi":40
* else:
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms # <<<<<<<<<<<<<<
@@ -6077,7 +6518,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
__pyx_t_3 = __pyx_v_rule->e->syms;
__pyx_v_esyms = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":41
+ /* "grammar.pxi":41
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n): # <<<<<<<<<<<<<<
@@ -6088,7 +6529,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
__pyx_v_i = __pyx_t_5;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":42
+ /* "grammar.pxi":42
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]): # <<<<<<<<<<<<<<
@@ -6098,30 +6539,30 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
__pyx_t_6 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i])) != 0);
if (__pyx_t_6) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":43
+ /* "grammar.pxi":43
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]):
* e.append(NTRef(_sa.sym_getindex(esyms[i]))) # <<<<<<<<<<<<<<
* else:
* e.append(_sa.sym_tostring(esyms[i]))
*/
- __pyx_t_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __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[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__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/austinma/git/cdec/python/cdec/grammar.pxi":45
+ /* "grammar.pxi":45
* e.append(NTRef(_sa.sym_getindex(esyms[i])))
* else:
* e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<<
@@ -6129,37 +6570,52 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
* return TRule(lhs, f, e, scores, a)
*/
__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 = __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_GOTREF(__pyx_t_1);
+ __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L8:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":46
+ /* "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 = __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_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rule), __pyx_n_s_alignments); 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);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_8) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); 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);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); 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);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_v_a = ((PyObject*)__pyx_t_2);
- __pyx_t_2 = 0;
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_a = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":47
+ /* "grammar.pxi":47
* e.append(_sa.sym_tostring(esyms[i]))
* a = list(rule.alignments())
* return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<<
@@ -6167,37 +6623,45 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
* cdef class TRule:
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
- __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_t_1 = __Pyx_PyBytes_FromString(__pyx_v_lhs); 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);
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(((PyObject *)__pyx_v_f));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_f));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_f));
- __Pyx_INCREF(((PyObject *)__pyx_v_e));
- PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_e));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e));
- __Pyx_INCREF(((PyObject *)__pyx_v_scores));
- PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_scores));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_scores));
- __Pyx_INCREF(((PyObject *)__pyx_v_a));
- PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_a));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_a));
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_2);
- __pyx_t_2 = 0;
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_f);
+ __Pyx_GIVEREF(__pyx_v_f);
+ __Pyx_INCREF(__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_e);
+ __Pyx_GIVEREF(__pyx_v_e);
+ __Pyx_INCREF(__pyx_v_scores);
+ PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_scores);
+ __Pyx_GIVEREF(__pyx_v_scores);
+ __Pyx_INCREF(__pyx_v_a);
+ PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_a);
+ __Pyx_GIVEREF(__pyx_v_a);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_1);
+ __pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":30
+ * return '[%d]' % self.ref
+ *
+ * cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<<
+ * lhs = _sa.sym_tocat(rule.lhs)
+ * scores = dict(rule.scores)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("cdec._cdec.convert_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -6210,6 +6674,14 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
return __pyx_r;
}
+/* "grammar.pxi":52
+ * cdef shared_ptr[grammar.TRule]* rule
+ *
+ * def __init__(self, lhs, f, e, scores, a=None, text=None): # <<<<<<<<<<<<<<
+ * """TRule(lhs, f, e, scores, a=None) -> Translation rule.
+ * lhs: left hand side non-terminal
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_5TRule___init__[] = "TRule(lhs, f, e, scores, a=None) -> Translation rule.\n lhs: left hand side non-terminal\n f: source phrase (list of words/NT)\n e: target phrase (list of words/NTRef)\n scores: dictionary of feature scores\n a: optional list of alignment points";
@@ -6230,16 +6702,8 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObje
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,&__pyx_n_s__text,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_f,&__pyx_n_s_e,&__pyx_n_s_scores,&__pyx_n_s_a,&__pyx_n_s_text,0};
PyObject* values[6] = {0,0,0,0,0,0};
-
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":52
- * cdef shared_ptr[grammar.TRule]* rule
- *
- * def __init__(self, lhs, f, e, scores, a=None, text=None): # <<<<<<<<<<<<<<
- * """TRule(lhs, f, e, scores, a=None) -> Translation rule.
- * lhs: left hand side non-terminal
- */
values[4] = ((PyObject *)Py_None);
values[5] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
@@ -6258,31 +6722,31 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObje
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e)) != 0)) kw_args--;
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
- if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--;
+ if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a);
if (value) { values[4] = value; kw_args--; }
}
case 5:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text);
if (value) { values[5] = value; kw_args--; }
}
}
@@ -6317,6 +6781,8 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObje
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule___init__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_f, __pyx_v_e, __pyx_v_scores, __pyx_v_a, __pyx_v_text);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -6332,7 +6798,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":59
+ /* "grammar.pxi":59
* scores: dictionary of feature scores
* a: optional list of alignment points"""
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) # <<<<<<<<<<<<<<
@@ -6345,9 +6811,9 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_v_self->rule = new boost::shared_ptr<TRule>(__pyx_t_1);
+ __pyx_v_self->rule = new boost::shared_ptr<TRule> (__pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":60
+ /* "grammar.pxi":60
* a: optional list of alignment points"""
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* if lhs: # <<<<<<<<<<<<<<
@@ -6357,19 +6823,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_lhs); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":61
+ /* "grammar.pxi":61
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* if lhs:
* self.lhs = lhs # <<<<<<<<<<<<<<
* if e:
* self.e = e
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 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_lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":62
+ /* "grammar.pxi":62
* if lhs:
* self.lhs = lhs
* if e: # <<<<<<<<<<<<<<
@@ -6379,19 +6845,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_e); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":63
+ /* "grammar.pxi":63
* self.lhs = lhs
* if e:
* self.e = e # <<<<<<<<<<<<<<
* if f:
* self.f = f
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 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_e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":64
+ /* "grammar.pxi":64
* if e:
* self.e = e
* if f: # <<<<<<<<<<<<<<
@@ -6401,19 +6867,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_f); 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/austinma/git/cdec/python/cdec/grammar.pxi":65
+ /* "grammar.pxi":65
* self.e = e
* if f:
* self.f = f # <<<<<<<<<<<<<<
* if scores:
* self.scores = scores
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 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_f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":66
+ /* "grammar.pxi":66
* if f:
* self.f = f
* if scores: # <<<<<<<<<<<<<<
@@ -6423,19 +6889,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_scores); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":67
+ /* "grammar.pxi":67
* self.f = f
* if scores:
* self.scores = scores # <<<<<<<<<<<<<<
* if a:
* self.a = a
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __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 = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":68
+ /* "grammar.pxi":68
* if scores:
* self.scores = scores
* if a: # <<<<<<<<<<<<<<
@@ -6445,19 +6911,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":69
+ /* "grammar.pxi":69
* self.scores = scores
* if a:
* self.a = a # <<<<<<<<<<<<<<
* if text:
* self.rule.get().ReadFromString(text, 0)
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":70
+ /* "grammar.pxi":70
* if a:
* self.a = a
* if text: # <<<<<<<<<<<<<<
@@ -6467,7 +6933,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":71
+ /* "grammar.pxi":71
* self.a = a
* if text:
* self.rule.get().ReadFromString(text, 0) # <<<<<<<<<<<<<<
@@ -6480,7 +6946,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
}
__pyx_L8:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":72
+ /* "grammar.pxi":72
* if text:
* self.rule.get().ReadFromString(text, 0)
* self.rule.get().ComputeArity() # <<<<<<<<<<<<<<
@@ -6489,6 +6955,15 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
*/
__pyx_v_self->rule->get()->ComputeArity();
+ /* "grammar.pxi":52
+ * cdef shared_ptr[grammar.TRule]* rule
+ *
+ * def __init__(self, lhs, f, e, scores, a=None, text=None): # <<<<<<<<<<<<<<
+ * """TRule(lhs, f, e, scores, a=None) -> Translation rule.
+ * lhs: left hand side non-terminal
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -6499,28 +6974,30 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
return __pyx_r;
}
+/* "grammar.pxi":74
+ * self.rule.get().ComputeArity()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.rule
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":74
- * self.rule.get().ComputeArity()
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.rule
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":75
+ /* "grammar.pxi":75
*
* def __dealloc__(self):
* del self.rule # <<<<<<<<<<<<<<
@@ -6529,9 +7006,26 @@ static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx
*/
delete __pyx_v_self->rule;
+ /* "grammar.pxi":74
+ * self.rule.get().ComputeArity()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.rule
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "grammar.pxi":78
+ *
+ * property arity:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.rule.get().arity_
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self) {
@@ -6539,18 +7033,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":78
- *
- * property arity:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.rule.get().arity_
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -6560,7 +7048,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":79
+ /* "grammar.pxi":79
* property arity:
* def __get__(self):
* return self.rule.get().arity_ # <<<<<<<<<<<<<<
@@ -6568,14 +7056,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4c
* property f:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->rule->get()->arity_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->rule->get()->arity_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":78
+ *
+ * property arity:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.rule.get().arity_
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.TRule.arity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -6586,6 +7081,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4c
return __pyx_r;
}
+/* "grammar.pxi":82
+ *
+ * property f:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f_ = &self.rule.get().f_
+ * cdef WordID w
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) {
@@ -6593,20 +7096,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1f___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":82
- *
- * property f:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef vector[WordID]* f_ = &self.rule.get().f_
- * cdef WordID w
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
- std::vector<WordID> *__pyx_v_f_;
+ std::vector<WordID> *__pyx_v_f_;
WordID __pyx_v_w;
PyObject *__pyx_v_f = 0;
unsigned int __pyx_v_i;
@@ -6619,12 +7116,13 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":83
+ /* "grammar.pxi":83
* property f:
* def __get__(self):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6633,7 +7131,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":85
+ /* "grammar.pxi":85
* cdef vector[WordID]* f_ = &self.rule.get().f_
* cdef WordID w
* cdef f = [] # <<<<<<<<<<<<<<
@@ -6642,10 +7140,10 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_v_f = ((PyObject *)__pyx_t_1);
+ __pyx_v_f = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":87
+ /* "grammar.pxi":87
* cdef f = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6654,7 +7152,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_idx = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":88
+ /* "grammar.pxi":88
* cdef unsigned i
* cdef int idx = 0
* for i in range(f_.size()): # <<<<<<<<<<<<<<
@@ -6665,7 +7163,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":89
+ /* "grammar.pxi":89
* cdef int idx = 0
* for i in range(f_.size()):
* w = f_[0][i] # <<<<<<<<<<<<<<
@@ -6674,7 +7172,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_w = ((__pyx_v_f_[0])[__pyx_v_i]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":90
+ /* "grammar.pxi":90
* for i in range(f_.size()):
* w = f_[0][i]
* if w < 0: # <<<<<<<<<<<<<<
@@ -6684,7 +7182,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
__pyx_t_4 = ((__pyx_v_w < 0) != 0);
if (__pyx_t_4) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":91
+ /* "grammar.pxi":91
* w = f_[0][i]
* if w < 0:
* idx += 1 # <<<<<<<<<<<<<<
@@ -6693,7 +7191,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":92
+ /* "grammar.pxi":92
* if w < 0:
* idx += 1
* f.append(NT(TDConvert(-w).c_str(), idx)) # <<<<<<<<<<<<<<
@@ -6701,58 +7199,54 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
*/
__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 = 92; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_1 = 0;
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":94
+ /* "grammar.pxi":94
* f.append(NT(TDConvert(-w).c_str(), idx))
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<<
* return f
*
*/
- __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 = 94; __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 = 94; __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_encoding, __pyx_n_s_utf8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L5:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":95
+ /* "grammar.pxi":95
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
* return f # <<<<<<<<<<<<<<
@@ -6764,8 +7258,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
__pyx_r = __pyx_v_f;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":82
+ *
+ * property f:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f_ = &self.rule.get().f_
+ * cdef WordID w
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
@@ -6779,6 +7280,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "grammar.pxi":97
+ * return f
+ *
+ * def __set__(self, f): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f_ = &self.rule.get().f_
+ * f_.resize(len(f))
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
@@ -6786,20 +7295,14 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_f));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":97
- * return f
- *
- * def __set__(self, f): # <<<<<<<<<<<<<<
- * cdef vector[WordID]* f_ = &self.rule.get().f_
- * f_.resize(len(f))
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_f) {
- std::vector<WordID> *__pyx_v_f_;
+ std::vector<WordID> *__pyx_v_f_;
unsigned int __pyx_v_i;
CYTHON_UNUSED int __pyx_v_idx;
PyObject *__pyx_v_fi = NULL;
@@ -6817,7 +7320,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":98
+ /* "grammar.pxi":98
*
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6826,7 +7329,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":99
+ /* "grammar.pxi":99
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_
* f_.resize(len(f)) # <<<<<<<<<<<<<<
@@ -6836,7 +7339,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde
__pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f_->resize(__pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":101
+ /* "grammar.pxi":101
* f_.resize(len(f))
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6845,7 +7348,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde
*/
__pyx_v_idx = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":102
+ /* "grammar.pxi":102
* cdef unsigned i
* cdef int idx = 0
* for i in range(len(f)): # <<<<<<<<<<<<<<
@@ -6856,65 +7359,73 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":103
+ /* "grammar.pxi":103
* 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, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_4cdec_5_cdec_NT));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_5 = (__pyx_t_4 != 0);
if (__pyx_t_5) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":104
+ /* "grammar.pxi":104
* 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, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __Pyx_PyObject_AsString(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_t_3)->cat)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_6 = __Pyx_PyObject_AsString(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_t_3)->cat); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((__pyx_v_f_[0])[__pyx_v_i]) = (-TD::Convert(__pyx_t_6));
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":106
+ /* "grammar.pxi":106
* 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, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __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_7);
+ __Pyx_XDECREF_SET(__pyx_v_fi, ((PyObject*)__pyx_t_7));
__pyx_t_7 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":107
+ /* "grammar.pxi":107
* else:
* fi = as_str(f[i])
* f_[0][i] = TDConvert(fi) # <<<<<<<<<<<<<<
*
* property e:
*/
- __pyx_t_6 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_fi)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_fi); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_6);
}
__pyx_L5:;
}
+ /* "grammar.pxi":97
+ * return f
+ *
+ * def __set__(self, f): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f_ = &self.rule.get().f_
+ * f_.resize(len(f))
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -6928,6 +7439,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde
return __pyx_r;
}
+/* "grammar.pxi":110
+ *
+ * property e:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e_ = &self.rule.get().e_
+ * cdef WordID w
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) {
@@ -6935,20 +7454,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1e___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":110
- *
- * property e:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef vector[WordID]* e_ = &self.rule.get().e_
- * cdef WordID w
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
- std::vector<WordID> *__pyx_v_e_;
+ std::vector<WordID> *__pyx_v_e_;
WordID __pyx_v_w;
PyObject *__pyx_v_e = 0;
unsigned int __pyx_v_i;
@@ -6960,13 +7473,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
unsigned int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":111
+ /* "grammar.pxi":111
* property e:
* def __get__(self):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -6975,7 +7489,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":113
+ /* "grammar.pxi":113
* cdef vector[WordID]* e_ = &self.rule.get().e_
* cdef WordID w
* cdef e = [] # <<<<<<<<<<<<<<
@@ -6984,10 +7498,10 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_v_e = ((PyObject *)__pyx_t_1);
+ __pyx_v_e = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":115
+ /* "grammar.pxi":115
* cdef e = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6996,7 +7510,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_idx = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":116
+ /* "grammar.pxi":116
* cdef unsigned i
* cdef int idx = 0
* for i in range(e_.size()): # <<<<<<<<<<<<<<
@@ -7007,7 +7521,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":117
+ /* "grammar.pxi":117
* cdef int idx = 0
* for i in range(e_.size()):
* w = e_[0][i] # <<<<<<<<<<<<<<
@@ -7016,7 +7530,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_w = ((__pyx_v_e_[0])[__pyx_v_i]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":118
+ /* "grammar.pxi":118
* for i in range(e_.size()):
* w = e_[0][i]
* if w < 1: # <<<<<<<<<<<<<<
@@ -7026,7 +7540,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
__pyx_t_4 = ((__pyx_v_w < 1) != 0);
if (__pyx_t_4) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":119
+ /* "grammar.pxi":119
* w = e_[0][i]
* if w < 1:
* idx += 1 # <<<<<<<<<<<<<<
@@ -7035,61 +7549,57 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":120
+ /* "grammar.pxi":120
* if w < 1:
* idx += 1
* e.append(NTRef(1-w)) # <<<<<<<<<<<<<<
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
*/
- __pyx_t_1 = PyInt_FromLong((1 - __pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_long((1 - __pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":122
+ /* "grammar.pxi":122
* e.append(NTRef(1-w))
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<<
* return e
*
*/
- __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 = 122; __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 = 122; __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 = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
- __pyx_t_5 = 0;
- __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_encoding, __pyx_n_s_utf8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_7); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
__pyx_L5:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":123
+ /* "grammar.pxi":123
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
* return e # <<<<<<<<<<<<<<
@@ -7101,12 +7611,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
__pyx_r = __pyx_v_e;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":110
+ *
+ * property e:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e_ = &self.rule.get().e_
+ * cdef WordID w
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec._cdec.TRule.e.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -7116,6 +7633,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "grammar.pxi":125
+ * return e
+ *
+ * def __set__(self, e): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e_ = &self.rule.get().e_
+ * e_.resize(len(e))
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_e); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_e) {
@@ -7123,20 +7648,14 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_e));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":125
- * return e
- *
- * def __set__(self, e): # <<<<<<<<<<<<<<
- * cdef vector[WordID]* e_ = &self.rule.get().e_
- * e_.resize(len(e))
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_e) {
- std::vector<WordID> *__pyx_v_e_;
+ std::vector<WordID> *__pyx_v_e_;
unsigned int __pyx_v_i;
PyObject *__pyx_v_ei = NULL;
int __pyx_r;
@@ -7154,7 +7673,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":126
+ /* "grammar.pxi":126
*
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -7163,7 +7682,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":127
+ /* "grammar.pxi":127
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_
* e_.resize(len(e)) # <<<<<<<<<<<<<<
@@ -7173,7 +7692,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde
__pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_e_->resize(__pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":129
+ /* "grammar.pxi":129
* e_.resize(len(e))
* cdef unsigned i
* for i in range(len(e)): # <<<<<<<<<<<<<<
@@ -7184,71 +7703,79 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":130
+ /* "grammar.pxi":130
* 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, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_5 = (__pyx_t_4 != 0);
if (__pyx_t_5) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":131
+ /* "grammar.pxi":131
* 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, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 131; __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_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyInt_As_WordID(__pyx_t_3); if (unlikely((__pyx_t_7 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __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_7;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":133
+ /* "grammar.pxi":133
* 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, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF(((PyObject *)__pyx_v_ei));
- __pyx_v_ei = ((PyObject*)__pyx_t_6);
+ __Pyx_XDECREF_SET(__pyx_v_ei, ((PyObject*)__pyx_t_6));
__pyx_t_6 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":134
+ /* "grammar.pxi":134
* else:
* ei = as_str(e[i])
* e_[0][i] = TDConvert(ei) # <<<<<<<<<<<<<<
*
* property a:
*/
- __pyx_t_8 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_ei)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_ei); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((__pyx_v_e_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_8);
}
__pyx_L5:;
}
+ /* "grammar.pxi":125
+ * return e
+ *
+ * def __set__(self, e): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e_ = &self.rule.get().e_
+ * e_.resize(len(e))
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -7263,6 +7790,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde
}
static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "grammar.pxi":137
+ *
+ * property a:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self) {
@@ -7270,18 +7805,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1a___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":137
- *
- * property a:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1a___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -7300,18 +7829,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1a___get__(struct __pyx_obj_4cdec_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_TRule___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.TRule.a.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -7342,7 +7869,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":139
+ /* "grammar.pxi":139
* def __get__(self):
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -7351,7 +7878,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje
*/
__pyx_cur_scope->__pyx_v_a = (&__pyx_cur_scope->__pyx_v_self->rule->get()->a_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":140
+ /* "grammar.pxi":140
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()): # <<<<<<<<<<<<<<
@@ -7362,16 +7889,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__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/austinma/git/cdec/python/cdec/grammar.pxi":141
+ /* "grammar.pxi":141
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()):
* yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<<
*
* def __set__(self, a):
*/
- __pyx_t_3 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).s_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_short(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).s_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).t_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_short(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).t_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
@@ -7381,7 +7908,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
+ __pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
@@ -7395,6 +7922,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "grammar.pxi":137
+ *
+ * property a:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -7410,6 +7947,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje
return NULL;
}
+/* "grammar.pxi":143
+ * yield (a[0][i].s_, a[0][i].t_)
+ *
+ * def __set__(self, a): # <<<<<<<<<<<<<<
+ * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
+ * a_.resize(len(a))
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a) {
@@ -7417,20 +7962,14 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_a));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":143
- * yield (a[0][i].s_, a[0][i].t_)
- *
- * def __set__(self, a): # <<<<<<<<<<<<<<
- * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
- * a_.resize(len(a))
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_a) {
- std::vector<AlignmentPoint> *__pyx_v_a_;
+ std::vector<AlignmentPoint> *__pyx_v_a_;
unsigned int __pyx_v_i;
int __pyx_v_s;
int __pyx_v_t;
@@ -7450,7 +7989,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":144
+ /* "grammar.pxi":144
*
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -7459,7 +7998,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
*/
__pyx_v_a_ = (&__pyx_v_self->rule->get()->a_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":145
+ /* "grammar.pxi":145
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
* a_.resize(len(a)) # <<<<<<<<<<<<<<
@@ -7469,7 +8008,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
__pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_a_->resize(__pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":148
+ /* "grammar.pxi":148
* cdef unsigned i
* cdef int s, t
* for i in range(len(a)): # <<<<<<<<<<<<<<
@@ -7480,14 +8019,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":149
+ /* "grammar.pxi":149
* 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, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __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;
@@ -7518,8 +8057,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
__Pyx_GOTREF(__pyx_t_5);
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- } else
- {
+ } else {
Py_ssize_t index = -1;
__pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
@@ -7540,14 +8078,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
- __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_s = __pyx_t_8;
__pyx_v_t = __pyx_t_9;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":150
+ /* "grammar.pxi":150
* for i in range(len(a)):
* s, t = a[i]
* a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<<
@@ -7557,6 +8095,15 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
((__pyx_v_a_[0])[__pyx_v_i]) = AlignmentPoint(__pyx_v_s, __pyx_v_t);
}
+ /* "grammar.pxi":143
+ * yield (a[0][i].s_, a[0][i].t_)
+ *
+ * def __set__(self, a): # <<<<<<<<<<<<<<
+ * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
+ * a_.resize(len(a))
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -7571,6 +8118,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
return __pyx_r;
}
+/* "grammar.pxi":153
+ *
+ * property scores:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector scores = SparseVector.__new__(SparseVector)
+ * scores.vector = new FastSparseVector[double](self.rule.get().scores_)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self) {
@@ -7578,18 +8133,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":153
- *
- * property scores:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef SparseVector scores = SparseVector.__new__(SparseVector)
- * scores.vector = new FastSparseVector[double](self.rule.get().scores_)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_scores = 0;
PyObject *__pyx_r = NULL;
@@ -7600,29 +8149,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":154
+ /* "grammar.pxi":154
* 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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_scores = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":155
+ /* "grammar.pxi":155
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<<
* return scores
*
*/
- __pyx_v_scores->vector = new FastSparseVector<double>(__pyx_v_self->rule->get()->scores_);
+ __pyx_v_scores->vector = new FastSparseVector<double> (__pyx_v_self->rule->get()->scores_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":156
+ /* "grammar.pxi":156
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_)
* return scores # <<<<<<<<<<<<<<
@@ -7634,8 +8183,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4
__pyx_r = ((PyObject *)__pyx_v_scores);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":153
+ *
+ * property scores:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector scores = SparseVector.__new__(SparseVector)
+ * scores.vector = new FastSparseVector[double](self.rule.get().scores_)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.TRule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -7647,6 +8203,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4
return __pyx_r;
}
+/* "grammar.pxi":158
+ * return scores
+ *
+ * def __set__(self, scores): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
+ * scores_.clear()
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scores); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scores) {
@@ -7654,20 +8218,14 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_scores));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":158
- * return scores
- *
- * def __set__(self, scores): # <<<<<<<<<<<<<<
- * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
- * scores_.clear()
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_scores) {
- FastSparseVector<double> *__pyx_v_scores_;
+ FastSparseVector<double> *__pyx_v_scores_;
int __pyx_v_fid;
float __pyx_v_fval;
PyObject *__pyx_v_fname = NULL;
@@ -7676,9 +8234,9 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- Py_ssize_t __pyx_t_3;
- PyObject *(*__pyx_t_4)(PyObject *);
- PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
@@ -7690,7 +8248,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":159
+ /* "grammar.pxi":159
*
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<<
@@ -7699,7 +8257,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
*/
__pyx_v_scores_ = (&__pyx_v_self->rule->get()->scores_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":160
+ /* "grammar.pxi":160
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
* scores_.clear() # <<<<<<<<<<<<<<
@@ -7708,55 +8266,73 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
*/
__pyx_v_scores_->clear();
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":163
+ /* "grammar.pxi":163
* cdef int fid
* cdef float fval
* for fname, fval in scores.items(): # <<<<<<<<<<<<<<
* fn = as_str(fname)
* fid = FDConvert(fn)
*/
- __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 = 163; __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 = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_scores, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
- __pyx_t_4 = NULL;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+ __pyx_t_5 = NULL;
+ } else {
+ __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_1 = __pyx_t_5(__pyx_t_2);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
- PyObject* sequence = __pyx_t_2;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -7769,30 +8345,29 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else
- {
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
- index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_5);
+ index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -7808,35 +8383,33 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
}
__pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_XDECREF(__pyx_v_fname);
- __pyx_v_fname = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_fname, __pyx_t_3);
+ __pyx_t_3 = 0;
__pyx_v_fval = __pyx_t_9;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":164
+ /* "grammar.pxi":164
* cdef float fval
* for fname, fval in scores.items():
* fn = as_str(fname) # <<<<<<<<<<<<<<
* fid = FDConvert(fn)
* if fid < 0: raise KeyError(fname)
*/
- __pyx_t_2 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_v_fname, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_XDECREF(((PyObject *)__pyx_v_fn));
- __pyx_v_fn = ((PyObject*)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_1 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_fname, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_XDECREF_SET(__pyx_v_fn, ((PyObject*)__pyx_t_1));
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":165
+ /* "grammar.pxi":165
* 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 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_fn); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fid = FD::Convert(__pyx_t_10);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":166
+ /* "grammar.pxi":166
* fn = as_str(fname)
* fid = FDConvert(fn)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -7845,22 +8418,20 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
*/
__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 = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_fname);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fname);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fname);
__Pyx_GIVEREF(__pyx_v_fname);
- __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L7;
}
- __pyx_L7:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":167
+ /* "grammar.pxi":167
* fid = FDConvert(fn)
* if fid < 0: raise KeyError(fname)
* scores_.set_value(fid, fval) # <<<<<<<<<<<<<<
@@ -7868,15 +8439,32 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
* property lhs:
*/
__pyx_v_scores_->set_value(__pyx_v_fid, __pyx_v_fval);
+
+ /* "grammar.pxi":163
+ * cdef int fid
+ * cdef float fval
+ * for fname, fval in scores.items(): # <<<<<<<<<<<<<<
+ * fn = as_str(fname)
+ * fid = FDConvert(fn)
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ /* "grammar.pxi":158
+ * return scores
+ *
+ * def __set__(self, scores): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
+ * scores_.clear()
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec._cdec.TRule.scores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -7888,6 +8476,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "grammar.pxi":170
+ *
+ * property lhs:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return NT(TDConvert(-self.rule.get().lhs_).c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) {
@@ -7895,18 +8491,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":170
- *
- * property lhs:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return NT(TDConvert(-self.rule.get().lhs_).c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -7917,7 +8507,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":171
+ /* "grammar.pxi":171
* property lhs:
* def __get__(self):
* return NT(TDConvert(-self.rule.get().lhs_).c_str()) # <<<<<<<<<<<<<<
@@ -7926,21 +8516,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cde
*/
__Pyx_XDECREF(__pyx_r);
__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 = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __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));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":170
+ *
+ * property lhs:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return NT(TDConvert(-self.rule.get().lhs_).c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -7952,6 +8549,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cde
return __pyx_r;
}
+/* "grammar.pxi":173
+ * return NT(TDConvert(-self.rule.get().lhs_).c_str())
+ *
+ * def __set__(self, lhs): # <<<<<<<<<<<<<<
+ * if not isinstance(lhs, NT):
+ * lhs = NT(lhs)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lhs); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lhs) {
@@ -7959,18 +8564,12 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, Py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_lhs));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":173
- * return NT(TDConvert(-self.rule.get().lhs_).c_str())
- *
- * def __set__(self, lhs): # <<<<<<<<<<<<<<
- * if not isinstance(lhs, NT):
- * lhs = NT(lhs)
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs) {
int __pyx_r;
__Pyx_RefNannyDeclarations
@@ -7985,7 +8584,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_lhs);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":174
+ /* "grammar.pxi":174
*
* def __set__(self, lhs):
* if not isinstance(lhs, NT): # <<<<<<<<<<<<<<
@@ -7996,7 +8595,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":175
+ /* "grammar.pxi":175
* def __set__(self, lhs):
* if not isinstance(lhs, NT):
* lhs = NT(lhs) # <<<<<<<<<<<<<<
@@ -8008,26 +8607,34 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c
__Pyx_INCREF(__pyx_v_lhs);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lhs);
__Pyx_GIVEREF(__pyx_v_lhs);
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), __pyx_t_3, NULL); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_v_lhs);
- __pyx_v_lhs = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF_SET(__pyx_v_lhs, __pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":176
+ /* "grammar.pxi":176
* if not isinstance(lhs, NT):
* lhs = NT(lhs)
* self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
- __pyx_t_5 = __Pyx_PyObject_AsString(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_lhs)->cat)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_AsString(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_lhs)->cat); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->rule->get()->lhs_ = (-TD::Convert(__pyx_t_5));
+ /* "grammar.pxi":173
+ * return NT(TDConvert(-self.rule.get().lhs_).c_str())
+ *
+ * def __set__(self, lhs): # <<<<<<<<<<<<<<
+ * if not isinstance(lhs, NT):
+ * lhs = NT(lhs)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -8041,6 +8648,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c
return __pyx_r;
}
+/* "grammar.pxi":178
+ * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) {
@@ -8048,12 +8663,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_4__str__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":179
+/* "grammar.pxi":179
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -8079,18 +8696,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_s
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_str___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.TRule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -8120,37 +8735,40 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_Genera
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __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 = 179; __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 = 179; __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 = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_1)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
@@ -8158,13 +8776,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_Genera
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_feat);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_feat);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_feat, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_v_feat = __pyx_t_1;
__pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_r = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
__Pyx_XGIVEREF(__pyx_t_2);
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
@@ -8184,6 +8801,8 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_Genera
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -8198,7 +8817,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_Genera
return NULL;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":178
+/* "grammar.pxi":178
* self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -8216,6 +8835,8 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -8230,30 +8851,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":179
+ /* "grammar.pxi":179
*
* 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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_v_scores = __pyx_t_2;
+ __pyx_v_scores = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":180
+ /* "grammar.pxi":180
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<<
@@ -8261,71 +8874,122 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_
*
*/
__Pyx_XDECREF(__pyx_r);
- __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 = 180; __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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":181
+ /* "grammar.pxi":181
* 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_GetModuleGlobalName(__pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __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 = 181; __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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_phrase); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __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 = 181; __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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "grammar.pxi":180
+ * 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_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_scores);
- PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_scores);
+ PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_scores);
__Pyx_GIVEREF(__pyx_v_scores);
__pyx_t_2 = 0;
__pyx_t_1 = 0;
__pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_s_s_s_s, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "grammar.pxi":178
+ * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec._cdec.TRule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -8336,6 +9000,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_
return __pyx_r;
}
+/* "grammar.pxi":184
+ *
+ * cdef class MRule(TRule):
+ * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<<
+ * """MRule(lhs, rhs, scores, a=None) -> Monolingual rule.
+ * lhs: left hand side non-terminal
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_5MRule___init__[] = "MRule(lhs, rhs, scores, a=None) -> Monolingual rule.\n lhs: left hand side non-terminal\n rhs: right hand side phrase (list of words/NT)\n scores: dictionary of feature scores";
@@ -8353,7 +9025,7 @@ static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObje
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__scores,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_rhs,&__pyx_n_s_scores,0};
PyObject* values[3] = {0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -8368,15 +9040,15 @@ static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObje
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs)) != 0)) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--;
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
@@ -8404,18 +9076,12 @@ static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObje
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_5MRule___init__(((struct __pyx_obj_4cdec_5_cdec_MRule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_rhs, __pyx_v_scores);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":184
- *
- * cdef class MRule(TRule):
- * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<<
- * """MRule(lhs, rhs, scores, a=None) -> Monolingual rule.
- * lhs: left hand side non-terminal
- */
-
static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_MRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_rhs, PyObject *__pyx_v_scores) {
unsigned int __pyx_v_i;
PyObject *__pyx_v_e = NULL;
@@ -8430,12 +9096,13 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
int __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":189
+ /* "grammar.pxi":189
* rhs: right hand side phrase (list of words/NT)
* scores: dictionary of feature scores"""
* cdef unsigned i = 1 # <<<<<<<<<<<<<<
@@ -8444,7 +9111,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
*/
__pyx_v_i = 1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":190
+ /* "grammar.pxi":190
* scores: dictionary of feature scores"""
* cdef unsigned i = 1
* e = [] # <<<<<<<<<<<<<<
@@ -8456,52 +9123,54 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
__pyx_v_e = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":191
+ /* "grammar.pxi":191
* cdef unsigned i = 1
* e = []
* for s in rhs: # <<<<<<<<<<<<<<
* if isinstance(s, NT):
* e.append(NTRef(i))
*/
- if (PyList_CheckExact(__pyx_v_rhs) || PyTuple_CheckExact(__pyx_v_rhs)) {
+ if (likely(PyList_CheckExact(__pyx_v_rhs)) || PyTuple_CheckExact(__pyx_v_rhs)) {
__pyx_t_1 = __pyx_v_rhs; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF(__pyx_v_s);
- __pyx_v_s = __pyx_t_4;
+ __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":192
+ /* "grammar.pxi":192
* e = []
* for s in rhs:
* if isinstance(s, NT): # <<<<<<<<<<<<<<
@@ -8512,27 +9181,27 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
__pyx_t_6 = (__pyx_t_5 != 0);
if (__pyx_t_6) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":193
+ /* "grammar.pxi":193
* for s in rhs:
* if isinstance(s, NT):
* e.append(NTRef(i)) # <<<<<<<<<<<<<<
* i += 1
* else:
*/
- __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __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_4cdec_5_cdec_NTRef)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+ __Pyx_DECREF(__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 = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":194
+ /* "grammar.pxi":194
* if isinstance(s, NT):
* e.append(NTRef(i))
* i += 1 # <<<<<<<<<<<<<<
@@ -8544,7 +9213,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":196
+ /* "grammar.pxi":196
* i += 1
* else:
* e.append(s) # <<<<<<<<<<<<<<
@@ -8554,59 +9223,92 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
__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 = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L5:;
+
+ /* "grammar.pxi":191
+ * cdef unsigned i = 1
+ * e = []
+ * for s in rhs: # <<<<<<<<<<<<<<
+ * if isinstance(s, NT):
+ * e.append(NTRef(i))
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":197
+ /* "grammar.pxi":197
* else:
* e.append(s)
* super(MRule, self).__init__(lhs, rhs, e, scores, None) # <<<<<<<<<<<<<<
*
* cdef class Grammar:
*/
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_MRule)));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_MRule)));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_MRule)));
__Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_MRule)));
__Pyx_INCREF(((PyObject *)__pyx_v_self));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __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 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
__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 = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(5+__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_7) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ }
__Pyx_INCREF(__pyx_v_lhs);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lhs);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_2, __pyx_v_lhs);
__Pyx_GIVEREF(__pyx_v_lhs);
__Pyx_INCREF(__pyx_v_rhs);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_rhs);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_2, __pyx_v_rhs);
__Pyx_GIVEREF(__pyx_v_rhs);
- __Pyx_INCREF(((PyObject *)__pyx_v_e));
- PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_e));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e));
+ __Pyx_INCREF(__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_2, __pyx_v_e);
+ __Pyx_GIVEREF(__pyx_v_e);
__Pyx_INCREF(__pyx_v_scores);
- PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_scores);
+ PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_2, __pyx_v_scores);
__Pyx_GIVEREF(__pyx_v_scores);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_t_4, 4, Py_None);
+ PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_2, Py_None);
__Pyx_GIVEREF(Py_None);
- __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 = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ /* "grammar.pxi":184
+ *
+ * cdef class MRule(TRule):
+ * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<<
+ * """MRule(lhs, rhs, scores, a=None) -> Monolingual rule.
+ * lhs: left hand side non-terminal
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("cdec._cdec.MRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -8616,28 +9318,30 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
return __pyx_r;
}
+/* "grammar.pxi":202
+ * cdef shared_ptr[grammar.Grammar]* grammar
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.grammar
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":202
- * cdef shared_ptr[grammar.Grammar]* grammar
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.grammar
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":203
+ /* "grammar.pxi":203
*
* def __dealloc__(self):
* del self.grammar # <<<<<<<<<<<<<<
@@ -8646,10 +9350,27 @@ static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __py
*/
delete __pyx_v_self->grammar;
+ /* "grammar.pxi":202
+ * cdef shared_ptr[grammar.Grammar]* grammar
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.grammar
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "grammar.pxi":205
+ * del self.grammar
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
+ * cdef grammar.const_RuleBin* rbin = root.GetRules()
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) {
@@ -8657,18 +9378,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":205
- * del self.grammar
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
- * cdef grammar.const_RuleBin* rbin = root.GetRules()
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -8687,18 +9402,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(struct __pyx_obj_4cdec
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Grammar_4generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Grammar_4generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_Grammar___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Grammar.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -8727,7 +9440,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":206
+ /* "grammar.pxi":206
*
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<<
@@ -8736,7 +9449,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec
*/
__pyx_cur_scope->__pyx_v_root = __pyx_cur_scope->__pyx_v_self->grammar->get()->GetRoot();
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":207
+ /* "grammar.pxi":207
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
* cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<<
@@ -8745,7 +9458,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec
*/
__pyx_cur_scope->__pyx_v_rbin = __pyx_cur_scope->__pyx_v_root->GetRules();
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":210
+ /* "grammar.pxi":210
* cdef TRule trule
* cdef unsigned i
* for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<<
@@ -8756,32 +9469,31 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec
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/austinma/git/cdec/python/cdec/grammar.pxi":211
+ /* "grammar.pxi":211
* 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_4cdec_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_tp_new_4cdec_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_5_cdec_TRule)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_trule));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_trule));
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_trule, ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_3));
__Pyx_GIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":212
+ /* "grammar.pxi":212
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<<
* yield trule
*
*/
- __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));
+ __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/austinma/git/cdec/python/cdec/grammar.pxi":213
+ /* "grammar.pxi":213
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i))
* yield trule # <<<<<<<<<<<<<<
@@ -8802,6 +9514,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "grammar.pxi":205
+ * del self.grammar
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
+ * cdef grammar.const_RuleBin* rbin = root.GetRules()
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -8815,6 +9537,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec
return NULL;
}
+/* "grammar.pxi":216
+ *
+ * property name:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * str(self.grammar.get().GetGrammarName().c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self) {
@@ -8822,18 +9552,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":216
- *
- * property name:
- * def __get__(self): # <<<<<<<<<<<<<<
- * str(self.grammar.get().GetGrammarName().c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -8844,7 +9568,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":217
+ /* "grammar.pxi":217
* property name:
* def __get__(self):
* str(self.grammar.get().GetGrammarName().c_str()) # <<<<<<<<<<<<<<
@@ -8852,17 +9576,26 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4
* def __set__(self, name):
*/
__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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __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));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ /* "grammar.pxi":216
+ *
+ * property name:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * str(self.grammar.get().GetGrammarName().c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -8876,6 +9609,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4
return __pyx_r;
}
+/* "grammar.pxi":219
+ * str(self.grammar.get().GetGrammarName().c_str())
+ *
+ * def __set__(self, name): # <<<<<<<<<<<<<<
+ * name = as_str(name)
+ * self.grammar.get().SetGrammarName(name)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static int __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
@@ -8883,18 +9624,12 @@ static int __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self), ((PyObject *)__pyx_v_name));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":219
- * str(self.grammar.get().GetGrammarName().c_str())
- *
- * def __set__(self, name): # <<<<<<<<<<<<<<
- * name = as_str(name)
- * self.grammar.get().SetGrammarName(name)
- */
-
static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self, PyObject *__pyx_v_name) {
int __pyx_r;
__Pyx_RefNannyDeclarations
@@ -8906,20 +9641,19 @@ static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_name);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":220
+ /* "grammar.pxi":220
*
* def __set__(self, name):
* name = as_str(name) # <<<<<<<<<<<<<<
* self.grammar.get().SetGrammarName(name)
*
*/
- __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_v_name, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_name, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_v_name);
- __pyx_v_name = __pyx_t_1;
+ __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":221
+ /* "grammar.pxi":221
* def __set__(self, name):
* name = as_str(name)
* self.grammar.get().SetGrammarName(name) # <<<<<<<<<<<<<<
@@ -8929,6 +9663,15 @@ static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_
__pyx_t_2 = __pyx_convert_string_from_py_(__pyx_v_name); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->grammar->get()->SetGrammarName(__pyx_t_2);
+ /* "grammar.pxi":219
+ * str(self.grammar.get().GetGrammarName().c_str())
+ *
+ * def __set__(self, name): # <<<<<<<<<<<<<<
+ * name = as_str(name)
+ * self.grammar.get().SetGrammarName(name)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -8941,6 +9684,14 @@ static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "grammar.pxi":224
+ *
+ * cdef class TextGrammar(Grammar):
+ * def __init__(self, rules): # <<<<<<<<<<<<<<
+ * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
+ * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_11TextGrammar___init__[] = "TextGrammar(rules) -> SCFG Grammar containing the rules.";
@@ -8956,7 +9707,7 @@ static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rules,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rules,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -8969,7 +9720,7 @@ static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self,
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rules)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rules)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -8991,18 +9742,12 @@ static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self,
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(((struct __pyx_obj_4cdec_5_cdec_TextGrammar *)__pyx_v_self), __pyx_v_rules);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":224
- *
- * cdef class TextGrammar(Grammar):
- * def __init__(self, rules): # <<<<<<<<<<<<<<
- * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
- * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
- */
-
static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5_cdec_TextGrammar *__pyx_v_self, PyObject *__pyx_v_rules) {
TextGrammar *__pyx_v__g;
PyObject *__pyx_v_trule = NULL;
@@ -9019,16 +9764,16 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":226
+ /* "grammar.pxi":226
* def __init__(self, rules):
* """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()
* for trule in rules:
*/
- __pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar>(new TextGrammar());
+ __pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar> (new TextGrammar());
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":227
+ /* "grammar.pxi":227
* """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() # <<<<<<<<<<<<<<
@@ -9037,52 +9782,54 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
*/
__pyx_v__g = ((TextGrammar *)__pyx_v_self->__pyx_base.grammar->get());
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":228
+ /* "grammar.pxi":228
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules: # <<<<<<<<<<<<<<
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule)
*/
- if (PyList_CheckExact(__pyx_v_rules) || PyTuple_CheckExact(__pyx_v_rules)) {
+ if (likely(PyList_CheckExact(__pyx_v_rules)) || PyTuple_CheckExact(__pyx_v_rules)) {
__pyx_t_1 = __pyx_v_rules; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF(__pyx_v_trule);
- __pyx_v_trule = __pyx_t_4;
+ __Pyx_XDECREF_SET(__pyx_v_trule, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":229
+ /* "grammar.pxi":229
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules:
* if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<<
@@ -9093,7 +9840,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
__pyx_t_6 = (__pyx_t_5 != 0);
if (__pyx_t_6) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":230
+ /* "grammar.pxi":230
* for trule in rules:
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule) # <<<<<<<<<<<<<<
@@ -9103,13 +9850,12 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
if (!(likely(((__pyx_v_trule) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_trule, __pyx_ptype_4cdec_2sa_3_sa_Rule))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = ((PyObject *)__pyx_f_4cdec_5_cdec_convert_rule(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_trule))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_v_trule);
- __pyx_v_trule = __pyx_t_4;
+ __Pyx_DECREF_SET(__pyx_v_trule, __pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L5;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":231
+ /* "grammar.pxi":231
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule): # <<<<<<<<<<<<<<
@@ -9120,30 +9866,46 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
__pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":232
+ /* "grammar.pxi":232
* 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_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L5;
}
__pyx_L5:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":233
+ /* "grammar.pxi":233
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects')
* _g.AddRule((<TRule> trule).rule[0]) # <<<<<<<<<<<<<<
*/
__pyx_v__g->AddRule((((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_trule)->rule[0]));
+
+ /* "grammar.pxi":228
+ * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
+ * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
+ * for trule in rules: # <<<<<<<<<<<<<<
+ * if isinstance(trule, _sa.Rule):
+ * trule = convert_rule(trule)
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ /* "grammar.pxi":224
+ *
+ * cdef class TextGrammar(Grammar):
+ * def __init__(self, rules): # <<<<<<<<<<<<<<
+ * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
+ * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -9157,29 +9919,31 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
return __pyx_r;
}
+/* "hypergraph.pxi":8
+ * cdef MT19937* rng
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.hg
+ * if self.rng != NULL:
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":8
- * cdef MT19937* rng
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.hg
- * if self.rng != NULL:
- */
-
static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":9
+ /* "hypergraph.pxi":9
*
* def __dealloc__(self):
* del self.hg # <<<<<<<<<<<<<<
@@ -9188,7 +9952,7 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde
*/
delete __pyx_v_self->hg;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":10
+ /* "hypergraph.pxi":10
* def __dealloc__(self):
* del self.hg
* if self.rng != NULL: # <<<<<<<<<<<<<<
@@ -9198,7 +9962,7 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde
__pyx_t_1 = ((__pyx_v_self->rng != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":11
+ /* "hypergraph.pxi":11
* del self.hg
* if self.rng != NULL:
* del self.rng # <<<<<<<<<<<<<<
@@ -9210,10 +9974,19 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde
}
__pyx_L3:;
+ /* "hypergraph.pxi":8
+ * cdef MT19937* rng
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.hg
+ * if self.rng != NULL:
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":13
+/* "hypergraph.pxi":13
* del self.rng
*
* cdef MT19937* _rng(self): # <<<<<<<<<<<<<<
@@ -9231,7 +10004,7 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_rng", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":14
+ /* "hypergraph.pxi":14
*
* cdef MT19937* _rng(self):
* if self.rng == NULL: # <<<<<<<<<<<<<<
@@ -9241,7 +10014,7 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_
__pyx_t_1 = ((__pyx_v_self->rng == NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":15
+ /* "hypergraph.pxi":15
* cdef MT19937* _rng(self):
* if self.rng == NULL:
* self.rng = new MT19937() # <<<<<<<<<<<<<<
@@ -9259,7 +10032,7 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":16
+ /* "hypergraph.pxi":16
* if self.rng == NULL:
* self.rng = new MT19937()
* return self.rng # <<<<<<<<<<<<<<
@@ -9269,16 +10042,31 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_
__pyx_r = __pyx_v_self->rng;
goto __pyx_L0;
- __pyx_r = 0;
- goto __pyx_L0;
+ /* "hypergraph.pxi":13
+ * del self.rng
+ *
+ * cdef MT19937* _rng(self): # <<<<<<<<<<<<<<
+ * if self.rng == NULL:
+ * self.rng = new MT19937()
+ */
+
+ /* function exit code */
__pyx_L1_error:;
- __Pyx_WriteUnraisable("cdec._cdec.Hypergraph._rng", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_WriteUnraisable("cdec._cdec.Hypergraph._rng", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "hypergraph.pxi":18
+ * return self.rng
+ *
+ * def viterbi(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
+ * cdef vector[WordID] trans
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_2viterbi[] = "hg.viterbi() -> String for the best hypothesis in the hypergraph.";
@@ -9287,20 +10075,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":18
- * return self.rng
- *
- * def viterbi(self): # <<<<<<<<<<<<<<
- * """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
- * cdef vector[WordID] trans
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
- std::vector<WordID> __pyx_v_trans;
+ std::vector<WordID> __pyx_v_trans;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -9310,7 +10092,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":21
+ /* "hypergraph.pxi":21
* """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans) # <<<<<<<<<<<<<<
@@ -9319,7 +10101,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c
*/
ViterbiESentence((__pyx_v_self->hg[0]), (&__pyx_v_trans));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":22
+ /* "hypergraph.pxi":22
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans)
* return unicode(GetString(trans).c_str(), 'utf8') # <<<<<<<<<<<<<<
@@ -9328,24 +10110,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c
*/
__Pyx_XDECREF(__pyx_r);
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":18
+ * return self.rng
+ *
+ * def viterbi(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
+ * cdef vector[WordID] trans
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -9357,6 +10146,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c
return __pyx_r;
}
+/* "hypergraph.pxi":24
+ * return unicode(GetString(trans).c_str(), 'utf8')
+ *
+ * def viterbi_trees(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_trees() -> (f_tree, e_tree)
+ * f_tree: Source tree for the best hypothesis in the hypergraph.
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_4viterbi_trees[] = "hg.viterbi_trees() -> (f_tree, e_tree)\n f_tree: Source tree for the best hypothesis in the hypergraph.\n e_tree: Target tree for the best hypothesis in the hypergraph.\n ";
@@ -9365,18 +10162,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi_trees (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":24
- * return unicode(GetString(trans).c_str(), 'utf8')
- *
- * def viterbi_trees(self): # <<<<<<<<<<<<<<
- * """hg.viterbi_trees() -> (f_tree, e_tree)
- * f_tree: Source tree for the best hypothesis in the hypergraph.
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_v_f_tree = NULL;
PyObject *__pyx_v_e_tree = NULL;
@@ -9389,7 +10180,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_trees", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":29
+ /* "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') # <<<<<<<<<<<<<<
@@ -9397,22 +10188,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
* return (f_tree, e_tree)
*/
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_f_tree = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":30
+ /* "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') # <<<<<<<<<<<<<<
@@ -9420,22 +10211,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
*
*/
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_e_tree = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":31
+ /* "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) # <<<<<<<<<<<<<<
@@ -9445,18 +10236,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(((PyObject *)__pyx_v_f_tree));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_f_tree));
- __Pyx_INCREF(((PyObject *)__pyx_v_e_tree));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_e_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e_tree));
- __pyx_r = ((PyObject *)__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_f_tree);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f_tree);
+ __Pyx_GIVEREF(__pyx_v_f_tree);
+ __Pyx_INCREF(__pyx_v_e_tree);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_e_tree);
+ __Pyx_GIVEREF(__pyx_v_e_tree);
+ __pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":24
+ * return unicode(GetString(trans).c_str(), 'utf8')
+ *
+ * def viterbi_trees(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_trees() -> (f_tree, e_tree)
+ * f_tree: Source tree for the best hypothesis in the hypergraph.
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -9470,6 +10268,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
return __pyx_r;
}
+/* "hypergraph.pxi":33
+ * return (f_tree, e_tree)
+ *
+ * def viterbi_features(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_features() -> SparseVector with the features corresponding
+ * to the best derivation in the hypergraph."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_6viterbi_features[] = "hg.viterbi_features() -> SparseVector with the features corresponding\n to the best derivation in the hypergraph.";
@@ -9478,18 +10284,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features(PyObject *
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi_features (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":33
- * return (f_tree, e_tree)
- *
- * def viterbi_features(self): # <<<<<<<<<<<<<<
- * """hg.viterbi_features() -> SparseVector with the features corresponding
- * to the best derivation in the hypergraph."""
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap = 0;
PyObject *__pyx_r = NULL;
@@ -9500,29 +10300,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_features", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":36
+ /* "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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __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_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":37
+ /* "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])) # <<<<<<<<<<<<<<
* return fmap
*
*/
- __pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0])));
+ __pyx_v_fmap->vector = new FastSparseVector<weight_t> (ViterbiFeatures((__pyx_v_self->hg[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":38
+ /* "hypergraph.pxi":38
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
* return fmap # <<<<<<<<<<<<<<
@@ -9534,8 +10334,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p
__pyx_r = ((PyObject *)__pyx_v_fmap);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":33
+ * return (f_tree, e_tree)
+ *
+ * def viterbi_features(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_features() -> SparseVector with the features corresponding
+ * to the best derivation in the hypergraph."""
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -9547,6 +10354,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p
return __pyx_r;
}
+/* "hypergraph.pxi":40
+ * return fmap
+ *
+ * def viterbi_forest(self): # <<<<<<<<<<<<<<
+ * cdef Hypergraph hg = Hypergraph()
+ * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
@@ -9554,18 +10369,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi_forest (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":40
- * return fmap
- *
- * def viterbi_forest(self): # <<<<<<<<<<<<<<
- * cdef Hypergraph hg = Hypergraph()
- * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_hg = 0;
PyObject *__pyx_r = NULL;
@@ -9576,19 +10385,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_forest", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":41
+ /* "hypergraph.pxi":41
*
* def viterbi_forest(self):
* cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<<
* hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
* return hg
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_hg = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":42
+ /* "hypergraph.pxi":42
* def viterbi_forest(self):
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) # <<<<<<<<<<<<<<
@@ -9597,7 +10406,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx
*/
__pyx_v_hg->hg = new Hypergraph(((__pyx_v_self->hg[0]).CreateViterbiHypergraph(NULL).get()[0]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":43
+ /* "hypergraph.pxi":43
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
* return hg # <<<<<<<<<<<<<<
@@ -9609,8 +10418,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx
__pyx_r = ((PyObject *)__pyx_v_hg);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":40
+ * return fmap
+ *
+ * def viterbi_forest(self): # <<<<<<<<<<<<<<
+ * cdef Hypergraph hg = Hypergraph()
+ * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi_forest", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -9622,6 +10438,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx
return __pyx_r;
}
+/* "hypergraph.pxi":45
+ * return hg
+ *
+ * def viterbi_joshua(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_joshua() -> Joshua representation of the best derivation."""
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_10viterbi_joshua[] = "hg.viterbi_joshua() -> Joshua representation of the best derivation.";
@@ -9630,18 +10454,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi_joshua (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":45
- * return hg
- *
- * def viterbi_joshua(self): # <<<<<<<<<<<<<<
- * """hg.viterbi_joshua() -> Joshua representation of the best derivation."""
- * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -9652,7 +10470,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_joshua", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":47
+ /* "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') # <<<<<<<<<<<<<<
@@ -9661,24 +10479,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __py
*/
__Pyx_XDECREF(__pyx_r);
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":45
+ * return hg
+ *
+ * def viterbi_joshua(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_joshua() -> Joshua representation of the best derivation."""
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -9691,6 +10516,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __py
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":49
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+ *
+ * def kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_12kbest[] = "hg.kbest(size) -> List of k-best hypotheses in the hypergraph.";
@@ -9699,18 +10532,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("kbest (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_12kbest(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":49
- * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
- *
- * def kbest(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -9732,18 +10559,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_4cd
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_kbest, __pyx_n_s_Hypergraph_kbest); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -9759,6 +10584,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -9774,17 +10608,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":51
+ /* "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, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]].Derivation* derivation
* cdef unsigned k
*/
- __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,KBest::NoFilter<std::vector<int> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__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,KBest::NoFilter<std::vector<int> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":54
+ /* "hypergraph.pxi":54
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]].Derivation* derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -9793,18 +10627,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":55
+ /* "hypergraph.pxi":55
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
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/austinma/git/cdec/python/cdec/hypergraph.pxi":56
+ /* "hypergraph.pxi":56
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9813,7 +10647,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
*/
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":57
+ /* "hypergraph.pxi":57
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -9823,30 +10657,28 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":58
+ /* "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 = __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_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_error;}
+ __Pyx_GOTREF(__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_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
@@ -9859,12 +10691,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":60
+ /* "hypergraph.pxi":60
* yield unicode(GetString(derivation._yield).c_str(), 'utf8')
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -9872,32 +10704,53 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
* def kbest_trees(self, size):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_derivations;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
}
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "hypergraph.pxi":49
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+ *
+ * def kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -9913,6 +10766,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":62
+ * del derivations
+ *
+ * def kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_15kbest_trees[] = "hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter.";
@@ -9921,18 +10782,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("kbest_trees (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_15kbest_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":62
- * del derivations
- *
- * def kbest_trees(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -9954,18 +10809,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_o
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_kbest_trees, __pyx_n_s_Hypergraph_kbest_trees); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -9980,9 +10833,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
long __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
- int __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_7;
+ int __pyx_t_8;
+ char const *__pyx_t_9;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -9990,7 +10851,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
case 0: goto __pyx_L3_first_run;
- case 1: goto __pyx_L10_resume_from_yield;
+ case 1: goto __pyx_L12_resume_from_yield;
default: /* CPython raises the right error here */
__Pyx_RefNannyFinishContext();
return NULL;
@@ -9998,27 +10859,27 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":64
+ /* "hypergraph.pxi":64
* def kbest_trees(self, size):
* """hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter."""
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
*/
- __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,KBest::NoFilter<std::vector<int> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__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,KBest::NoFilter<std::vector<int> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":66
+ /* "hypergraph.pxi":66
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]].Derivation* e_derivation
* cdef unsigned k
*/
- __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,KBest::NoFilter<std::vector<int> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__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,KBest::NoFilter<std::vector<int> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":69
+ /* "hypergraph.pxi":69
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]].Derivation* e_derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10027,18 +10888,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":70
+ /* "hypergraph.pxi":70
* cdef unsigned k
* try:
* 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)
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
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/austinma/git/cdec/python/cdec/hypergraph.pxi":71
+ /* "hypergraph.pxi":71
* try:
* for k in range(size):
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -10047,7 +10908,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
*/
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":72
+ /* "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) # <<<<<<<<<<<<<<
@@ -10056,95 +10917,95 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
*/
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":73
+ /* "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)) != 0);
- if (!__pyx_t_3) {
- __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
- __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_f_derivation != 0)) != 0);
+ if (!__pyx_t_4) {
+ goto __pyx_L11_next_or;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L10_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L11_next_or:;
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L10_bool_binop_done:;
+ if (__pyx_t_3) {
goto __pyx_L8_break;
- goto __pyx_L9;
}
- __pyx_L9:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":74
+ /* "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 = __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);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f_tree, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":75
+ /* "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 = __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);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e_tree);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e_tree, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":76
+ /* "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) # <<<<<<<<<<<<<<
* finally:
* del f_derivations
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __pyx_r = ((PyObject *)__pyx_t_6);
- __pyx_t_6 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_tree);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_tree);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_e_tree);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_tree);
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
@@ -10152,15 +11013,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
- __pyx_L10_resume_from_yield:;
+ __pyx_L12_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":78
+ /* "hypergraph.pxi":78
* yield (f_tree, e_tree)
* finally:
* del f_derivations # <<<<<<<<<<<<<<
@@ -10168,46 +11029,84 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
*
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
+
+ /* "hypergraph.pxi":79
+ * finally:
+ * del f_derivations
+ * del e_derivations # <<<<<<<<<<<<<<
+ *
+ * def kbest_features(self, size):
+ */
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_f_derivations;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
+ {
+
+ /* "hypergraph.pxi":78
+ * yield (f_tree, e_tree)
+ * finally:
+ * del f_derivations # <<<<<<<<<<<<<<
+ * del e_derivations
+ *
+ */
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":79
+ /* "hypergraph.pxi":79
* finally:
* del f_derivations
* del e_derivations # <<<<<<<<<<<<<<
*
* def kbest_features(self, size):
*/
- delete __pyx_cur_scope->__pyx_v_e_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
}
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ }
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "hypergraph.pxi":62
+ * del derivations
+ *
+ * def kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -10218,6 +11117,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":81
+ * del e_derivations
+ *
+ * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_18kbest_features[] = "hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph.";
@@ -10226,18 +11133,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features(PyObject *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("kbest_features (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_18kbest_features(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":81
- * del e_derivations
- *
- * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -10259,18 +11160,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_18kbest_features(struct __py
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_kbest_features, __pyx_n_s_Hypergraph_kbest_features); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -10285,6 +11184,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
long __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ int __pyx_t_6;
+ char const *__pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -10300,17 +11208,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":83
+ /* "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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]].Derivation* derivation
* cdef SparseVector fmap
*/
- __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,KBest::NoFilter<FastSparseVector<double> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__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,KBest::NoFilter<FastSparseVector<double> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":87
+ /* "hypergraph.pxi":87
* cdef SparseVector fmap
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10319,18 +11227,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":88
+ /* "hypergraph.pxi":88
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
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/austinma/git/cdec/python/cdec/hypergraph.pxi":89
+ /* "hypergraph.pxi":89
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -10339,7 +11247,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
*/
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":90
+ /* "hypergraph.pxi":90
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -10349,36 +11257,33 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":91
+ /* "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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_4 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fmap, ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4));
__Pyx_GIVEREF(__pyx_t_4);
- __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":92
+ /* "hypergraph.pxi":92
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<<
* yield fmap
* finally:
*/
- __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield);
+ __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t> (__pyx_cur_scope->__pyx_v_derivation->yield);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":93
+ /* "hypergraph.pxi":93
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap # <<<<<<<<<<<<<<
@@ -10397,12 +11302,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":95
+ /* "hypergraph.pxi":95
* yield fmap
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -10410,31 +11315,52 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
* def unique_kbest(self, size):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_derivations;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
}
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
+ __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "hypergraph.pxi":81
+ * del e_derivations
+ *
+ * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -10449,6 +11375,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":97
+ * del derivations
+ *
+ * def unique_kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_22unique_kbest(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_21unique_kbest[] = "hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph.";
@@ -10457,18 +11391,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_22unique_kbest(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("unique_kbest (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_21unique_kbest(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":97
- * del derivations
- *
- * def unique_kbest(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_21unique_kbest(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -10490,18 +11418,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_21unique_kbest(struct __pyx_
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7, (PyObject *) __pyx_cur_scope, __pyx_n_s_unique_kbest, __pyx_n_s_Hypergraph_unique_kbest); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.unique_kbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -10517,6 +11443,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -10532,17 +11467,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":99
+ /* "hypergraph.pxi":99
* def unique_kbest(self, size):
* """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique].Derivation* derivation
* cdef unsigned k
*/
- __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::FilterUnique>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::FilterUnique> ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":102
+ /* "hypergraph.pxi":102
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique].Derivation* derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10551,18 +11486,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":103
+ /* "hypergraph.pxi":103
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
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/austinma/git/cdec/python/cdec/hypergraph.pxi":104
+ /* "hypergraph.pxi":104
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -10571,7 +11506,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
*/
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":105
+ /* "hypergraph.pxi":105
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -10581,30 +11516,28 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":106
+ /* "hypergraph.pxi":106
* 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 = __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 = 106; __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 = 106; __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 = 106; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
@@ -10617,12 +11550,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":108
+ /* "hypergraph.pxi":108
* yield unicode(GetString(derivation._yield).c_str(), 'utf8')
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -10630,32 +11563,53 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
* def unique_kbest_trees(self, size):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_derivations;
}
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
+ }
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "hypergraph.pxi":97
+ * del derivations
+ *
+ * def unique_kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -10671,6 +11625,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":110
+ * del derivations
+ *
+ * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_25unique_kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees[] = "hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph.";
@@ -10679,18 +11641,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_25unique_kbest_trees(PyObjec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("unique_kbest_trees (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":110
- * del derivations
- *
- * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -10712,18 +11668,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees(struct
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8, (PyObject *) __pyx_cur_scope, __pyx_n_s_unique_kbest_trees, __pyx_n_s_Hypergraph_unique_kbest_trees); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.unique_kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -10738,9 +11692,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
long __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
- int __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_7;
+ int __pyx_t_8;
+ char const *__pyx_t_9;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -10748,7 +11710,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
case 0: goto __pyx_L3_first_run;
- case 1: goto __pyx_L10_resume_from_yield;
+ case 1: goto __pyx_L12_resume_from_yield;
default: /* CPython raises the right error here */
__Pyx_RefNannyFinishContext();
return NULL;
@@ -10756,27 +11718,27 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":112
+ /* "hypergraph.pxi":112
* def unique_kbest_trees(self, size):
* """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique](self.hg[0], size)
*/
- __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::FilterUnique>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::FilterUnique> ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":114
+ /* "hypergraph.pxi":114
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique].Derivation* e_derivation
* cdef unsigned k
*/
- __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::FilterUnique>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::FilterUnique> ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":117
+ /* "hypergraph.pxi":117
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique].Derivation* e_derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10785,18 +11747,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":118
+ /* "hypergraph.pxi":118
* cdef unsigned k
* try:
* 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)
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
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/austinma/git/cdec/python/cdec/hypergraph.pxi":119
+ /* "hypergraph.pxi":119
* try:
* for k in range(size):
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -10805,7 +11767,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
*/
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":120
+ /* "hypergraph.pxi":120
* 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) # <<<<<<<<<<<<<<
@@ -10814,95 +11776,95 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
*/
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":121
+ /* "hypergraph.pxi":121
* 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)) != 0);
- if (!__pyx_t_3) {
- __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
- __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_f_derivation != 0)) != 0);
+ if (!__pyx_t_4) {
+ goto __pyx_L11_next_or;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L10_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L11_next_or:;
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L10_bool_binop_done:;
+ if (__pyx_t_3) {
goto __pyx_L8_break;
- goto __pyx_L9;
}
- __pyx_L9:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":122
+ /* "hypergraph.pxi":122
* 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 = __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 = 122; __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 = 122; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f_tree, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":123
+ /* "hypergraph.pxi":123
* 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 = __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 = 123; __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e_tree);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e_tree, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":124
+ /* "hypergraph.pxi":124
* 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:
* del f_derivations
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __pyx_r = ((PyObject *)__pyx_t_6);
- __pyx_t_6 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_tree);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_tree);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_e_tree);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_tree);
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
@@ -10910,15 +11872,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
- __pyx_L10_resume_from_yield:;
+ __pyx_L12_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":126
+ /* "hypergraph.pxi":126
* yield (f_tree, e_tree)
* finally:
* del f_derivations # <<<<<<<<<<<<<<
@@ -10926,46 +11888,84 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
*
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
+
+ /* "hypergraph.pxi":127
+ * finally:
+ * del f_derivations
+ * del e_derivations # <<<<<<<<<<<<<<
+ *
+ * def unique_kbest_features(self, size):
+ */
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_f_derivations;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
+ {
+
+ /* "hypergraph.pxi":126
+ * yield (f_tree, e_tree)
+ * finally:
+ * del f_derivations # <<<<<<<<<<<<<<
+ * del e_derivations
+ *
+ */
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":127
+ /* "hypergraph.pxi":127
* finally:
* del f_derivations
* del e_derivations # <<<<<<<<<<<<<<
*
* def unique_kbest_features(self, size):
*/
- delete __pyx_cur_scope->__pyx_v_e_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
}
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ }
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "hypergraph.pxi":110
+ * del derivations
+ *
+ * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("unique_kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -10976,6 +11976,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":129
+ * del e_derivations
+ *
+ * def unique_kbest_features(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph."""
+ * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_28unique_kbest_features(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_27unique_kbest_features[] = "hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph.";
@@ -10984,18 +11992,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_28unique_kbest_features(PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("unique_kbest_features (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_27unique_kbest_features(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":129
- * del e_derivations
- *
- * def unique_kbest_features(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph."""
- * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27unique_kbest_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -11017,18 +12019,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27unique_kbest_features(stru
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9, (PyObject *) __pyx_cur_scope, __pyx_n_s_unique_kbest_features, __pyx_n_s_Hypergraph_unique_kbest_features); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.unique_kbest_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -11043,6 +12043,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
long __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ int __pyx_t_6;
+ char const *__pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -11058,17 +12067,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":131
+ /* "hypergraph.pxi":131
* def unique_kbest_features(self, size):
* """hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph."""
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]].Derivation* derivation
* cdef SparseVector fmap
*/
- __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":135
+ /* "hypergraph.pxi":135
* cdef SparseVector fmap
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -11077,18 +12086,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":136
+ /* "hypergraph.pxi":136
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
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/austinma/git/cdec/python/cdec/hypergraph.pxi":137
+ /* "hypergraph.pxi":137
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -11097,7 +12106,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
*/
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":138
+ /* "hypergraph.pxi":138
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -11107,36 +12116,33 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
__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/austinma/git/cdec/python/cdec/hypergraph.pxi":139
+ /* "hypergraph.pxi":139
* 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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fmap, ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4));
__Pyx_GIVEREF(__pyx_t_4);
- __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":140
+ /* "hypergraph.pxi":140
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<<
* yield fmap
* finally:
*/
- __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield);
+ __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t> (__pyx_cur_scope->__pyx_v_derivation->yield);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":141
+ /* "hypergraph.pxi":141
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap # <<<<<<<<<<<<<<
@@ -11155,12 +12161,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":143
+ /* "hypergraph.pxi":143
* yield fmap
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -11168,31 +12174,52 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
* def sample(self, unsigned n):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_derivations;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
}
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
+ __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "hypergraph.pxi":129
+ * del e_derivations
+ *
+ * def unique_kbest_features(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph."""
+ * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -11207,6 +12234,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":145
+ * del derivations
+ *
+ * def sample(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_30sample[] = "hg.sample(n) -> Sample of n hypotheses from the hypergraph.";
@@ -11219,7 +12254,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sample (wrapper)", 0);
assert(__pyx_arg_n); {
- __pyx_v_n = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_n = __Pyx_PyInt_As_unsigned_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -11228,18 +12263,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample(PyObject *__pyx_v_s
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_30sample(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":145
- * del derivations
- *
- * def sample(self, unsigned n): # <<<<<<<<<<<<<<
- * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
- * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_30sample(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -11259,18 +12288,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_30sample(struct __pyx_obj_4c
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__pyx_cur_scope->__pyx_v_n = __pyx_v_n;
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10, (PyObject *) __pyx_cur_scope, __pyx_n_s_sample, __pyx_n_s_Hypergraph_sample); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -11281,11 +12308,20 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
{
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
- std::vector<HypergraphSampler::Hypothesis> *__pyx_t_1;
+ std::vector<HypergraphSampler::Hypothesis> *__pyx_t_1;
size_t __pyx_t_2;
unsigned int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -11301,7 +12337,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":147
+ /* "hypergraph.pxi":147
* def sample(self, unsigned n):
* """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<<
@@ -11309,14 +12345,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
* cdef unsigned k
*/
try {
- __pyx_t_1 = new std::vector<HypergraphSampler::Hypothesis>();
+ __pyx_t_1 = new std::vector<HypergraphSampler::Hypothesis> ();
} catch(...) {
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_cur_scope->__pyx_v_hypos = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":148
+ /* "hypergraph.pxi":148
* """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) # <<<<<<<<<<<<<<
@@ -11325,7 +12361,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
*/
HypergraphSampler::sample_hypotheses((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_4cdec_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/austinma/git/cdec/python/cdec/hypergraph.pxi":150
+ /* "hypergraph.pxi":150
* hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -11334,7 +12370,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":151
+ /* "hypergraph.pxi":151
* cdef unsigned k
* try:
* for k in range(hypos.size()): # <<<<<<<<<<<<<<
@@ -11345,26 +12381,26 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
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/austinma/git/cdec/python/cdec/hypergraph.pxi":152
+ /* "hypergraph.pxi":152
* try:
* for k in range(hypos.size()):
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del hypos
*/
- __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 = 152; __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 = 152; __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 = 152; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
@@ -11377,11 +12413,11 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
__pyx_L9_resume_from_yield:;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":154
+ /* "hypergraph.pxi":154
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
* finally:
* del hypos # <<<<<<<<<<<<<<
@@ -11389,32 +12425,53 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
* def sample_trees(self, unsigned n):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_hypos;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_hypos;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_hypos;
}
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
+ }
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "hypergraph.pxi":145
+ * del derivations
+ *
+ * def sample(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -11430,6 +12487,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":156
+ * del hypos
+ *
+ * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
+ * cdef vector[string]* trees = new vector[string]()
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_33sample_trees[] = "hg.sample_trees(n) -> Sample of n trees from the hypergraph.";
@@ -11442,7 +12507,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sample_trees (wrapper)", 0);
assert(__pyx_arg_n); {
- __pyx_v_n = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_n = __Pyx_PyInt_As_unsigned_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -11451,18 +12516,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees(PyObject *__p
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":156
- * del hypos
- *
- * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
- * """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
- * cdef vector[string]* trees = new vector[string]()
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -11482,18 +12541,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_trees(struct __pyx_
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__pyx_cur_scope->__pyx_v_n = __pyx_v_n;
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11, (PyObject *) __pyx_cur_scope, __pyx_n_s_sample_trees, __pyx_n_s_Hypergraph_sample_trees); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -11504,11 +12561,20 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
{
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
- std::vector<std::string> *__pyx_t_1;
+ std::vector<std::string> *__pyx_t_1;
size_t __pyx_t_2;
unsigned int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -11524,7 +12590,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":158
+ /* "hypergraph.pxi":158
* def sample_trees(self, unsigned n):
* """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
* cdef vector[string]* trees = new vector[string]() # <<<<<<<<<<<<<<
@@ -11532,14 +12598,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
* cdef unsigned k
*/
try {
- __pyx_t_1 = new std::vector<std::string>();
+ __pyx_t_1 = new std::vector<std::string> ();
} catch(...) {
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_cur_scope->__pyx_v_trees = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":159
+ /* "hypergraph.pxi":159
* """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) # <<<<<<<<<<<<<<
@@ -11548,7 +12614,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
*/
HypergraphSampler::sample_trees((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_4cdec_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/austinma/git/cdec/python/cdec/hypergraph.pxi":161
+ /* "hypergraph.pxi":161
* hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -11557,7 +12623,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":162
+ /* "hypergraph.pxi":162
* cdef unsigned k
* try:
* for k in range(trees.size()): # <<<<<<<<<<<<<<
@@ -11568,26 +12634,26 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
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/austinma/git/cdec/python/cdec/hypergraph.pxi":163
+ /* "hypergraph.pxi":163
* try:
* for k in range(trees.size()):
* yield unicode(trees[0][k].c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del trees
*/
- __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 = 163; __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 = 163; __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 = 163; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
@@ -11600,11 +12666,11 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
__pyx_L9_resume_from_yield:;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":165
+ /* "hypergraph.pxi":165
* yield unicode(trees[0][k].c_str(), 'utf8')
* finally:
* del trees # <<<<<<<<<<<<<<
@@ -11612,32 +12678,53 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
* def intersect(self, inp):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_trees;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_trees;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_trees;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
}
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "hypergraph.pxi":156
+ * del hypos
+ *
+ * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
+ * cdef vector[string]* trees = new vector[string]()
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -11652,6 +12739,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
return NULL;
}
+/* "hypergraph.pxi":167
+ * del trees
+ *
+ * def intersect(self, inp): # <<<<<<<<<<<<<<
+ * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
+ * cdef Lattice lat
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_37intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_36intersect[] = "hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference.";
@@ -11660,18 +12755,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_37intersect(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("intersect (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_inp));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":167
- * del trees
- *
- * def intersect(self, inp): # <<<<<<<<<<<<<<
- * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
- * cdef Lattice lat
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp) {
struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_lat = 0;
PyObject *__pyx_r = NULL;
@@ -11685,7 +12774,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("intersect", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":170
+ /* "hypergraph.pxi":170
* """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
* cdef Lattice lat
* if isinstance(inp, Lattice): # <<<<<<<<<<<<<<
@@ -11696,19 +12785,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":171
+ /* "hypergraph.pxi":171
* cdef Lattice lat
* if isinstance(inp, Lattice):
* lat = <Lattice> inp # <<<<<<<<<<<<<<
* elif isinstance(inp, basestring):
* lat = Lattice(inp)
*/
- __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_inp)));
- __pyx_v_lat = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_inp);
+ __pyx_t_3 = __pyx_v_inp;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_lat = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_t_3);
+ __pyx_t_3 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":172
+ /* "hypergraph.pxi":172
* if isinstance(inp, Lattice):
* lat = <Lattice> inp
* elif isinstance(inp, basestring): # <<<<<<<<<<<<<<
@@ -11719,7 +12810,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":173
+ /* "hypergraph.pxi":173
* lat = <Lattice> inp
* elif isinstance(inp, basestring):
* lat = Lattice(inp) # <<<<<<<<<<<<<<
@@ -11731,39 +12822,39 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
__Pyx_INCREF(__pyx_v_inp);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
__Pyx_GIVEREF(__pyx_v_inp);
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_lat = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":175
+ /* "hypergraph.pxi":175
* lat = Lattice(inp)
* else:
* raise TypeError('cannot intersect hypergraph with %s' % type(inp)) # <<<<<<<<<<<<<<
* return hypergraph.Intersect(lat.lattice[0], self.hg)
*
*/
- __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_cannot_intersect_hypergraph_with, ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ 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[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":176
+ /* "hypergraph.pxi":176
* else:
* raise TypeError('cannot intersect hypergraph with %s' % type(inp))
* return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<<
@@ -11777,8 +12868,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
__pyx_t_4 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":167
+ * del trees
+ *
+ * def intersect(self, inp): # <<<<<<<<<<<<<<
+ * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
+ * cdef Lattice lat
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
@@ -11791,6 +12889,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
return __pyx_r;
}
+/* "hypergraph.pxi":178
+ * return hypergraph.Intersect(lat.lattice[0], self.hg)
+ *
+ * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
+ * """hg.prune(beam_alpha=0, density=0): Prune the hypergraph.
+ * beam_alpha: use beam pruning
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_38prune[] = "hg.prune(beam_alpha=0, density=0): Prune the hypergraph.\n beam_alpha: use beam pruning\n density: use density pruning";
@@ -11807,7 +12913,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_se
__pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
__Pyx_GOTREF(__pyx_v_kwargs);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__beam_alpha,&__pyx_n_s__density,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_beam_alpha,&__pyx_n_s_density,0};
PyObject* values[2] = {0,0};
values[0] = ((PyObject *)__pyx_int_0);
values[1] = ((PyObject *)__pyx_int_0);
@@ -11824,12 +12930,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_se
switch (pos_args) {
case 0:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beam_alpha);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beam_alpha);
if (value) { values[0] = value; kw_args--; }
}
case 1:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__density);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_density);
if (value) { values[1] = value; kw_args--; }
}
}
@@ -11857,19 +12963,13 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_se
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), __pyx_v_beam_alpha, __pyx_v_density, __pyx_v_kwargs);
+
+ /* function exit code */
__Pyx_XDECREF(__pyx_v_kwargs);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":178
- * return hypergraph.Intersect(lat.lattice[0], self.hg)
- *
- * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
- * """hg.prune(beam_alpha=0, density=0): Prune the hypergraph.
- * beam_alpha: use beam pruning
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs) {
std::vector<bool> *__pyx_v_preserve_mask;
PyObject *__pyx_r = NULL;
@@ -11883,7 +12983,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("prune", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":182
+ /* "hypergraph.pxi":182
* beam_alpha: use beam pruning
* density: use density pruning"""
* cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<<
@@ -11892,18 +12992,18 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
*/
__pyx_v_preserve_mask = NULL;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":183
+ /* "hypergraph.pxi":183
* density: use density pruning"""
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs: # <<<<<<<<<<<<<<
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
*/
- __pyx_t_1 = (__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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = (__Pyx_PyDict_Contains(__pyx_n_s_csplit_preserve_full_word, __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":184
+ /* "hypergraph.pxi":184
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<<
@@ -11912,7 +13012,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
*/
__pyx_v_preserve_mask = new std::vector<bool>(__pyx_v_self->hg->edges_.size());
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":185
+ /* "hypergraph.pxi":185
* 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 # <<<<<<<<<<<<<<
@@ -11924,7 +13024,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":186
+ /* "hypergraph.pxi":186
* 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) # <<<<<<<<<<<<<<
@@ -11935,7 +13035,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
__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 = 186; __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/austinma/git/cdec/python/cdec/hypergraph.pxi":187
+ /* "hypergraph.pxi":187
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask: # <<<<<<<<<<<<<<
@@ -11945,7 +13045,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
__pyx_t_2 = (__pyx_v_preserve_mask != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":188
+ /* "hypergraph.pxi":188
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask:
* del preserve_mask # <<<<<<<<<<<<<<
@@ -11957,6 +13057,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
}
__pyx_L4:;
+ /* "hypergraph.pxi":178
+ * return hypergraph.Intersect(lat.lattice[0], self.hg)
+ *
+ * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
+ * """hg.prune(beam_alpha=0, density=0): Prune the hypergraph.
+ * beam_alpha: use beam pruning
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -11968,6 +13077,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "hypergraph.pxi":190
+ * del preserve_mask
+ *
+ * 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()
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_41lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_40lattice[] = "hg.lattice() -> Lattice corresponding to the hypergraph.";
@@ -11976,18 +13093,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_41lattice(PyObject *__pyx_v_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lattice (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":190
- * del preserve_mask
- *
- * 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()
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_v_plf = 0;
PyObject *__pyx_r = NULL;
@@ -12000,7 +13111,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lattice", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":192
+ /* "hypergraph.pxi":192
* 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() # <<<<<<<<<<<<<<
@@ -12008,11 +13119,11 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4
*
*/
__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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_v_plf = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":193
+ /* "hypergraph.pxi":193
* """hg.lattice() -> Lattice corresponding to the hypergraph."""
* cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str()
* return Lattice(eval(plf)) # <<<<<<<<<<<<<<
@@ -12023,41 +13134,48 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4
__pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- if (((PyObject *)__pyx_v_plf)) {
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__plf), ((PyObject *)__pyx_v_plf)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (__pyx_v_plf) {
+ if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_plf, __pyx_v_plf) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
if (((PyObject *)__pyx_v_self)) {
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_self, ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_v_plf));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_plf));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_plf));
- PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+ __Pyx_INCREF(__pyx_v_plf);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_plf);
+ __Pyx_GIVEREF(__pyx_v_plf);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_eval, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_eval, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":190
+ * del preserve_mask
+ *
+ * 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()
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -12071,6 +13189,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4
return __pyx_r;
}
+/* "hypergraph.pxi":195
+ * return Lattice(eval(plf))
+ *
+ * def plf(self): # <<<<<<<<<<<<<<
+ * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_43plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_42plf[] = "hg.plf() -> Lattice PLF representation corresponding to the hypergraph.";
@@ -12079,18 +13205,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_43plf(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("plf (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":195
- * return Lattice(eval(plf))
- *
- * def plf(self): # <<<<<<<<<<<<<<
- * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
- * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12101,7 +13221,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("plf", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":197
+ /* "hypergraph.pxi":197
* def plf(self):
* """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
* return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) # <<<<<<<<<<<<<<
@@ -12110,21 +13230,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec
*/
__Pyx_XDECREF(__pyx_r);
__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 = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":195
+ * return Lattice(eval(plf))
+ *
+ * def plf(self): # <<<<<<<<<<<<<<
+ * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -12136,6 +13263,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec
return __pyx_r;
}
+/* "hypergraph.pxi":199
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ *
+ * def reweight(self, weights): # <<<<<<<<<<<<<<
+ * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
+ * if isinstance(weights, SparseVector):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_45reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_44reweight[] = "hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.";
@@ -12144,18 +13279,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_45reweight(PyObject *__pyx_v
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("reweight (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":199
- * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
- *
- * def reweight(self, weights): # <<<<<<<<<<<<<<
- * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
- * if isinstance(weights, SparseVector):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12168,7 +13297,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("reweight", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":201
+ /* "hypergraph.pxi":201
* def reweight(self, weights):
* """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
* if isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -12179,7 +13308,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":202
+ /* "hypergraph.pxi":202
* """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -12190,7 +13319,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":203
+ /* "hypergraph.pxi":203
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
@@ -12201,7 +13330,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":204
+ /* "hypergraph.pxi":204
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector):
* self.hg.Reweight((<DenseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -12213,29 +13342,38 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":206
+ /* "hypergraph.pxi":206
* self.hg.Reweight((<DenseVector> weights).vector[0])
* else:
* raise TypeError('cannot reweight hypergraph with %s' % type(weights)) # <<<<<<<<<<<<<<
*
* property edges:
*/
- __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 = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_cannot_reweight_hypergraph_with, ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __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[3]; __pyx_lineno = 206; __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));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__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 = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__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 = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
+ /* "hypergraph.pxi":199
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ *
+ * def reweight(self, weights): # <<<<<<<<<<<<<<
+ * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
+ * if isinstance(weights, SparseVector):
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -12250,6 +13388,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":209
+ *
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self) {
@@ -12257,18 +13403,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_5edges___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":209
- *
- * property edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.edges_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -12287,18 +13427,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5edges___get__(struct __pyx_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_Hypergraph___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -12328,7 +13466,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_Ge
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":211
+ /* "hypergraph.pxi":211
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<<
@@ -12339,14 +13477,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_Ge
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/austinma/git/cdec/python/cdec/hypergraph.pxi":212
+ /* "hypergraph.pxi":212
* cdef unsigned i
* for i in range(self.hg.edges_.size()):
* yield HypergraphEdge().init(self.hg, i) # <<<<<<<<<<<<<<
*
* property nodes:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -12365,6 +13503,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_Ge
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "hypergraph.pxi":209
+ *
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -12380,6 +13528,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_Ge
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":215
+ *
+ * property nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.nodes_.size()):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self) {
@@ -12387,18 +13543,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_5nodes___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":215
- *
- * property nodes:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.nodes_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -12417,18 +13567,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_Hypergraph___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -12458,7 +13606,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_Ge
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":217
+ /* "hypergraph.pxi":217
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<<
@@ -12469,14 +13617,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_Ge
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/austinma/git/cdec/python/cdec/hypergraph.pxi":218
+ /* "hypergraph.pxi":218
* cdef unsigned i
* for i in range(self.hg.nodes_.size()):
* yield HypergraphNode().init(self.hg, i) # <<<<<<<<<<<<<<
*
* property goal:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -12495,6 +13643,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_Ge
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "hypergraph.pxi":215
+ *
+ * property nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.nodes_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -12509,6 +13667,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_Ge
return NULL;
}
+/* "hypergraph.pxi":221
+ *
+ * property goal:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.hg.GoalNode())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_self) {
@@ -12516,18 +13682,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":221
- *
- * property goal:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return HypergraphNode().init(self.hg, self.hg.GoalNode())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12538,7 +13698,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":222
+ /* "hypergraph.pxi":222
* property goal:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<<
@@ -12546,7 +13706,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_o
* property npaths:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->hg->GoalNode()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -12555,8 +13715,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_o
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":221
+ *
+ * property goal:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.hg.GoalNode())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -12568,6 +13735,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_o
return __pyx_r;
}
+/* "hypergraph.pxi":225
+ *
+ * property npaths:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.hg.NumberOfPaths()
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v_self) {
@@ -12575,18 +13750,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":225
- *
- * property npaths:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.hg.NumberOfPaths()
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12596,7 +13765,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":226
+ /* "hypergraph.pxi":226
* property npaths:
* def __get__(self):
* return self.hg.NumberOfPaths() # <<<<<<<<<<<<<<
@@ -12610,8 +13779,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":225
+ *
+ * property npaths:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.hg.NumberOfPaths()
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Hypergraph.npaths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -12622,6 +13798,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx
return __pyx_r;
}
+/* "hypergraph.pxi":228
+ * return self.hg.NumberOfPaths()
+ *
+ * def inside_outside(self): # <<<<<<<<<<<<<<
+ * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature."""
+ * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_47inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_46inside_outside[] = "hg.inside_outside() -> SparseVector with inside-outside scores for each feature.";
@@ -12630,23 +13814,17 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_47inside_outside(PyObject *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inside_outside (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":228
- * return self.hg.NumberOfPaths()
- *
- * def inside_outside(self): # <<<<<<<<<<<<<<
- * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature."""
- * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
- FastSparseVector<prob_t> *__pyx_v_result;
+ FastSparseVector<prob_t> *__pyx_v_result;
prob_t __pyx_v_z;
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0;
- FastSparseVector<prob_t>::const_iterator *__pyx_v_it;
+ FastSparseVector<prob_t> ::const_iterator *__pyx_v_it;
CYTHON_UNUSED unsigned int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12658,16 +13836,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("inside_outside", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":230
+ /* "hypergraph.pxi":230
* def inside_outside(self):
* """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)
* result[0] /= z
*/
- __pyx_v_result = new FastSparseVector<prob_t>();
+ __pyx_v_result = new FastSparseVector<prob_t> ();
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":231
+ /* "hypergraph.pxi":231
* """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) # <<<<<<<<<<<<<<
@@ -12676,7 +13854,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
__pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":232
+ /* "hypergraph.pxi":232
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z # <<<<<<<<<<<<<<
@@ -12685,38 +13863,38 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
(__pyx_v_result[0]) /= __pyx_v_z;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":233
+ /* "hypergraph.pxi":233
* 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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":234
+ /* "hypergraph.pxi":234
* 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)
* cdef unsigned i
*/
- __pyx_v_vector->vector = new FastSparseVector<double>();
+ __pyx_v_vector->vector = new FastSparseVector<double> ();
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":235
+ /* "hypergraph.pxi":235
* 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) # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(result.size()):
*/
- __pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0);
+ __pyx_v_it = new FastSparseVector<prob_t> ::const_iterator((__pyx_v_result[0]), 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":237
+ /* "hypergraph.pxi":237
* 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()): # <<<<<<<<<<<<<<
@@ -12727,7 +13905,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":238
+ /* "hypergraph.pxi":238
* cdef unsigned i
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) # <<<<<<<<<<<<<<
@@ -12736,7 +13914,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
__pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":239
+ /* "hypergraph.pxi":239
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it # <<<<<<<<<<<<<<
@@ -12746,7 +13924,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
(++(__pyx_v_it[0]));
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":240
+ /* "hypergraph.pxi":240
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it
* del it # <<<<<<<<<<<<<<
@@ -12755,7 +13933,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
delete __pyx_v_it;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":241
+ /* "hypergraph.pxi":241
* pinc(it[0]) # ++it
* del it
* del result # <<<<<<<<<<<<<<
@@ -12764,7 +13942,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
delete __pyx_v_result;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":242
+ /* "hypergraph.pxi":242
* del it
* del result
* return vector # <<<<<<<<<<<<<<
@@ -12776,8 +13954,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
__pyx_r = ((PyObject *)__pyx_v_vector);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":228
+ * return self.hg.NumberOfPaths()
+ *
+ * def inside_outside(self): # <<<<<<<<<<<<<<
+ * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature."""
+ * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Hypergraph.inside_outside", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -12789,7 +13974,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":249
+/* "hypergraph.pxi":249
* cdef public TRule trule
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -12806,7 +13991,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("init", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":250
+ /* "hypergraph.pxi":250
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -12815,7 +14000,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":251
+ /* "hypergraph.pxi":251
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.edge = &hg.edges_[i] # <<<<<<<<<<<<<<
@@ -12824,14 +14009,14 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
*/
__pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":252
+ /* "hypergraph.pxi":252
* 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_4cdec_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GIVEREF(__pyx_t_1);
@@ -12840,16 +14025,16 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
__pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":253
+ /* "hypergraph.pxi":253
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<<
* return self
*
*/
- __pyx_v_self->trule->rule = new boost::shared_ptr<TRule>(__pyx_v_self->edge->rule_);
+ __pyx_v_self->trule->rule = new boost::shared_ptr<TRule> (__pyx_v_self->edge->rule_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":254
+ /* "hypergraph.pxi":254
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self # <<<<<<<<<<<<<<
@@ -12861,8 +14046,15 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":249
+ * cdef public TRule trule
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
+ * self.hg = hg
+ * self.edge = &hg.edges_[i]
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -12873,6 +14065,14 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "hypergraph.pxi":256
+ * return self
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.edge.tail_nodes_.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_self) {
@@ -12880,24 +14080,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":256
- * return self
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.edge.tail_nodes_.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":257
+ /* "hypergraph.pxi":257
*
* def __len__(self):
* return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<<
@@ -12907,12 +14101,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(struct __pyx_ob
__pyx_r = __pyx_v_self->edge->tail_nodes_.size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "hypergraph.pxi":256
+ * return self
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.edge.tail_nodes_.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "hypergraph.pxi":260
+ *
+ * property head_node:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.edge.head_node_)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *__pyx_v_self) {
@@ -12920,18 +14130,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":260
- *
- * property head_node:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return HypergraphNode().init(self.hg, self.edge.head_node_)
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12942,7 +14146,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struc
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":261
+ /* "hypergraph.pxi":261
* property head_node:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<<
@@ -12950,7 +14154,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struc
* property tail_nodes:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->edge->head_node_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
@@ -12959,8 +14163,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struc
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":260
+ *
+ * property head_node:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.edge.head_node_)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -12973,6 +14184,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struc
}
static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":264
+ *
+ * property tail_nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.edge.tail_nodes_.size()):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self) {
@@ -12980,18 +14199,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(Py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_10tail_nodes___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":264
- *
- * property tail_nodes:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.edge.tail_nodes_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -13010,18 +14223,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_10tail_nodes___get__(str
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator14, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_HypergraphEdge___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.tail_nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -13051,7 +14262,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":266
+ /* "hypergraph.pxi":266
* def __get__(self):
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<<
@@ -13062,14 +14273,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1
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/austinma/git/cdec/python/cdec/hypergraph.pxi":267
+ /* "hypergraph.pxi":267
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()):
* yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i]) # <<<<<<<<<<<<<<
*
* property span:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->edge->tail_nodes_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -13088,6 +14299,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "hypergraph.pxi":264
+ *
+ * property tail_nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.edge.tail_nodes_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -13102,6 +14323,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1
return NULL;
}
+/* "hypergraph.pxi":270
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.i_, self.edge.j_)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx_v_self) {
@@ -13109,18 +14338,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":270
- *
- * property span:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return (self.edge.i_, self.edge.j_)
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13132,7 +14355,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":271
+ /* "hypergraph.pxi":271
* property span:
* def __get__(self):
* return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<<
@@ -13140,9 +14363,9 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p
* property src_span:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->edge->i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_short(__pyx_v_self->edge->i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_self->edge->j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_v_self->edge->j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -13152,12 +14375,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":270
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.i_, self.edge.j_)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -13170,6 +14400,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p
return __pyx_r;
}
+/* "hypergraph.pxi":274
+ *
+ * property src_span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.prev_i_, self.edge.prev_j_)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *__pyx_v_self) {
@@ -13177,18 +14415,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":274
- *
- * property src_span:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return (self.edge.prev_i_, self.edge.prev_j_)
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13200,7 +14432,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":275
+ /* "hypergraph.pxi":275
* property src_span:
* def __get__(self):
* return (self.edge.prev_i_, self.edge.prev_j_) # <<<<<<<<<<<<<<
@@ -13208,9 +14440,9 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct
* property feature_values:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->edge->prev_i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_short(__pyx_v_self->edge->prev_i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_self->edge->prev_j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_v_self->edge->prev_j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -13220,12 +14452,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":274
+ *
+ * property src_span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.prev_i_, self.edge.prev_j_)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -13238,6 +14477,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct
return __pyx_r;
}
+/* "hypergraph.pxi":278
+ *
+ * property feature_values:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector = SparseVector.__new__(SparseVector)
+ * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyObject *__pyx_v_self) {
@@ -13245,18 +14492,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":278
- *
- * property feature_values:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef SparseVector vector = SparseVector.__new__(SparseVector)
- * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0;
PyObject *__pyx_r = NULL;
@@ -13267,29 +14508,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":279
+ /* "hypergraph.pxi":279
* 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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":280
+ /* "hypergraph.pxi":280
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<<
* return vector
*
*/
- __pyx_v_vector->vector = new FastSparseVector<double>(__pyx_v_self->edge->feature_values_);
+ __pyx_v_vector->vector = new FastSparseVector<double> (__pyx_v_self->edge->feature_values_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":281
+ /* "hypergraph.pxi":281
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector # <<<<<<<<<<<<<<
@@ -13301,8 +14542,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__
__pyx_r = ((PyObject *)__pyx_v_vector);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":278
+ *
+ * property feature_values:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector = SparseVector.__new__(SparseVector)
+ * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.feature_values.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13314,6 +14562,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__
return __pyx_r;
}
+/* "hypergraph.pxi":284
+ *
+ * property prob:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.edge.edge_prob_.as_float()
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx_v_self) {
@@ -13321,18 +14577,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":284
- *
- * property prob:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.edge.edge_prob_.as_float()
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13342,7 +14592,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":285
+ /* "hypergraph.pxi":285
* property prob:
* def __get__(self):
* return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<<
@@ -13356,8 +14606,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __p
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":284
+ *
+ * property prob:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.edge.edge_prob_.as_float()
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.prob.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13368,6 +14625,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __p
return __pyx_r;
}
+/* "hypergraph.pxi":287
+ * return self.edge.edge_prob_.as_float()
+ *
+ * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.edge == y.edge
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
@@ -13380,6 +14645,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *_
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_HypergraphEdge, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_y), ((int)__pyx_v_op));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -13388,14 +14655,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *_
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":287
- * return self.edge.edge_prob_.as_float()
- *
- * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
- * if op == 2: # ==
- * return x.edge == y.edge
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_y, int __pyx_v_op) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13406,7 +14665,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":290
+ /* "hypergraph.pxi":290
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -13415,7 +14674,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
*/
switch (__pyx_v_op) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":288
+ /* "hypergraph.pxi":288
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -13424,7 +14683,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
*/
case 2:
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":289
+ /* "hypergraph.pxi":289
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # ==
* return x.edge == y.edge # <<<<<<<<<<<<<<
@@ -13439,7 +14698,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
goto __pyx_L0;
break;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":290
+ /* "hypergraph.pxi":290
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -13448,7 +14707,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
*/
case 3:
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":291
+ /* "hypergraph.pxi":291
* return x.edge == y.edge
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -13465,23 +14724,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
__pyx_t_1 = 0;
goto __pyx_L0;
break;
+ default: break;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":292
+ /* "hypergraph.pxi":292
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
*
* cdef class HypergraphNode:
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplemented, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":287
+ * return self.edge.edge_prob_.as_float()
+ *
+ * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.edge == y.edge
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13492,6 +14759,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
return __pyx_r;
}
+/* "hypergraph.pxi":247
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
+ * cdef public TRule trule # <<<<<<<<<<<<<<
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__pyx_v_self) {
@@ -13499,18 +14774,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":247
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphEdge* edge
- * cdef public TRule trule # <<<<<<<<<<<<<<
- *
- * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13520,7 +14789,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(struct __
__pyx_r = ((PyObject *)__pyx_v_self->trule);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -13534,6 +14803,8 @@ static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_2__set__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -13541,20 +14812,25 @@ static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__py
static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_INCREF(__pyx_v_value);
- __Pyx_GIVEREF(__pyx_v_value);
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->trule);
__Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
- __pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_value);
+ __pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_1);
+ __pyx_t_1 = 0;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.trule.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -13569,6 +14845,8 @@ static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_5__del__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -13583,12 +14861,13 @@ static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_o
__Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
__pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None);
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":298
+/* "hypergraph.pxi":298
* cdef hypergraph.HypergraphNode* node
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -13601,7 +14880,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("init", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":299
+ /* "hypergraph.pxi":299
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -13610,7 +14889,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":300
+ /* "hypergraph.pxi":300
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.node = &hg.nodes_[i] # <<<<<<<<<<<<<<
@@ -13619,7 +14898,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd
*/
__pyx_v_self->node = (&(__pyx_v_hg->nodes_[__pyx_v_i]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":301
+ /* "hypergraph.pxi":301
* self.hg = hg
* self.node = &hg.nodes_[i]
* return self # <<<<<<<<<<<<<<
@@ -13631,13 +14910,29 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "hypergraph.pxi":298
+ * cdef hypergraph.HypergraphNode* node
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
+ * self.hg = hg
+ * self.node = &hg.nodes_[i]
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "hypergraph.pxi":304
+ *
+ * property id:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.node.id_
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(PyObject *__pyx_v_self) {
@@ -13645,18 +14940,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(PyObject *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":304
- *
- * property id:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.node.id_
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13666,7 +14955,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":305
+ /* "hypergraph.pxi":305
* property id:
* def __get__(self):
* return self.node.id_ # <<<<<<<<<<<<<<
@@ -13674,14 +14963,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx
* property in_edges:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->node->id_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->node->id_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":304
+ *
+ * property id:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.node.id_
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphNode.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13693,6 +14989,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx
}
static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":308
+ *
+ * property in_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.in_edges_.size()):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self) {
@@ -13700,18 +15004,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":308
- *
- * property in_edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.node.in_edges_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -13730,18 +15028,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(struct
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_HypergraphNode___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.HypergraphNode.in_edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -13771,7 +15067,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(_
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":310
+ /* "hypergraph.pxi":310
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<<
@@ -13782,14 +15078,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(_
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/austinma/git/cdec/python/cdec/hypergraph.pxi":311
+ /* "hypergraph.pxi":311
* cdef unsigned i
* for i in range(self.node.in_edges_.size()):
* yield HypergraphEdge().init(self.hg, self.node.in_edges_[i]) # <<<<<<<<<<<<<<
*
* property out_edges:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -13808,6 +15104,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(_
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "hypergraph.pxi":308
+ *
+ * property in_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.in_edges_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -13823,6 +15129,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(_
}
static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "hypergraph.pxi":314
+ *
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self) {
@@ -13830,18 +15144,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":314
- *
- * property out_edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.node.out_edges_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -13860,18 +15168,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(struc
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_HypergraphNode___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.HypergraphNode.out_edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -13901,7 +15207,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":316
+ /* "hypergraph.pxi":316
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<<
@@ -13912,14 +15218,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(
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/austinma/git/cdec/python/cdec/hypergraph.pxi":317
+ /* "hypergraph.pxi":317
* cdef unsigned i
* for i in range(self.node.out_edges_.size()):
* yield HypergraphEdge().init(self.hg, self.node.out_edges_[i]) # <<<<<<<<<<<<<<
*
* property span:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -13938,6 +15244,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "hypergraph.pxi":314
+ *
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -13952,6 +15268,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(
return NULL;
}
+/* "hypergraph.pxi":320
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return next(self.in_edges).span
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx_v_self) {
@@ -13959,18 +15283,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":320
- *
- * property span:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return next(self.in_edges).span
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13981,7 +15299,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":321
+ /* "hypergraph.pxi":321
* property span:
* def __get__(self):
* return next(self.in_edges).span # <<<<<<<<<<<<<<
@@ -13989,20 +15307,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __p
* property cat:
*/
__Pyx_XDECREF(__pyx_r);
- __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 = 321; __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 = 321; __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 = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __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 = 321; __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 = 321; __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;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":320
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return next(self.in_edges).span
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -14014,6 +15339,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __p
return __pyx_r;
}
+/* "hypergraph.pxi":324
+ *
+ * property cat:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * if self.node.cat_:
+ * return str(TDConvert(-self.node.cat_).c_str())
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_v_self) {
@@ -14021,18 +15354,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":324
- *
- * property cat:
- * def __get__(self): # <<<<<<<<<<<<<<
- * if self.node.cat_:
- * return str(TDConvert(-self.node.cat_).c_str())
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -14044,7 +15371,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":325
+ /* "hypergraph.pxi":325
* property cat:
* def __get__(self):
* if self.node.cat_: # <<<<<<<<<<<<<<
@@ -14054,7 +15381,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py
__pyx_t_1 = (__pyx_v_self->node->cat_ != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":326
+ /* "hypergraph.pxi":326
* def __get__(self):
* if self.node.cat_:
* return str(TDConvert(-self.node.cat_).c_str()) # <<<<<<<<<<<<<<
@@ -14063,22 +15390,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py
*/
__Pyx_XDECREF(__pyx_r);
__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 = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 326; __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));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
+ /* "hypergraph.pxi":324
+ *
+ * property cat:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * if self.node.cat_:
+ * return str(TDConvert(-self.node.cat_).c_str())
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -14092,6 +15426,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py
return __pyx_r;
}
+/* "hypergraph.pxi":328
+ * return str(TDConvert(-self.node.cat_).c_str())
+ *
+ * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.node == y.node
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
@@ -14104,6 +15446,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *_
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_y), ((int)__pyx_v_op));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -14112,14 +15456,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *_
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":328
- * return str(TDConvert(-self.node.cat_).c_str())
- *
- * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
- * if op == 2: # ==
- * return x.node == y.node
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_y, int __pyx_v_op) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -14130,7 +15466,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":331
+ /* "hypergraph.pxi":331
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -14139,7 +15475,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
*/
switch (__pyx_v_op) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":329
+ /* "hypergraph.pxi":329
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -14148,7 +15484,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
*/
case 2:
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":330
+ /* "hypergraph.pxi":330
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # ==
* return x.node == y.node # <<<<<<<<<<<<<<
@@ -14163,7 +15499,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
goto __pyx_L0;
break;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":331
+ /* "hypergraph.pxi":331
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -14172,7 +15508,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
*/
case 3:
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":332
+ /* "hypergraph.pxi":332
* return x.node == y.node
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -14188,21 +15524,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
__pyx_t_1 = 0;
goto __pyx_L0;
break;
+ default: break;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":333
+ /* "hypergraph.pxi":333
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplemented, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "hypergraph.pxi":328
+ * return str(TDConvert(-self.node.cat_).c_str())
+ *
+ * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.node == y.node
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphNode.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -14213,6 +15557,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
return __pyx_r;
}
+/* "lattice.pxi":6
+ * cdef lattice.Lattice* lattice
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.lattice = new lattice.Lattice()
+ *
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -14223,24 +15575,18 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyO
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":6
- * cdef lattice.Lattice* lattice
- *
- * def __cinit__(self): # <<<<<<<<<<<<<<
- * self.lattice = new lattice.Lattice()
- *
- */
-
static int __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":7
+ /* "lattice.pxi":7
*
* def __cinit__(self):
* self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<<
@@ -14249,11 +15595,28 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(struct __pyx_obj_4cdec_5_cde
*/
__pyx_v_self->lattice = new Lattice();
+ /* "lattice.pxi":6
+ * cdef lattice.Lattice* lattice
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.lattice = new lattice.Lattice()
+ *
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "lattice.pxi":9
+ * self.lattice = new lattice.Lattice()
+ *
+ * def __init__(self, inp): # <<<<<<<<<<<<<<
+ * """Lattice(tuple) -> Lattice from node list.
+ * Lattice(string) -> Lattice from PLF representation."""
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Lattice_2__init__[] = "Lattice(tuple) -> Lattice from node list.\n Lattice(string) -> Lattice from PLF representation.";
@@ -14269,7 +15632,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__inp,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_inp,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -14282,7 +15645,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyOb
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__inp)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -14304,18 +15667,12 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyOb
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self), __pyx_v_inp);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":9
- * self.lattice = new lattice.Lattice()
- *
- * def __init__(self, inp): # <<<<<<<<<<<<<<
- * """Lattice(tuple) -> Lattice from node list.
- * Lattice(string) -> Lattice from PLF representation."""
- */
-
static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp) {
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_arcs = NULL;
@@ -14334,7 +15691,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":12
+ /* "lattice.pxi":12
* """Lattice(tuple) -> Lattice from node list.
* Lattice(string) -> Lattice from PLF representation."""
* if isinstance(inp, tuple): # <<<<<<<<<<<<<<
@@ -14345,7 +15702,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":13
+ /* "lattice.pxi":13
* Lattice(string) -> Lattice from PLF representation."""
* if isinstance(inp, tuple):
* self.lattice.resize(len(inp)) # <<<<<<<<<<<<<<
@@ -14355,7 +15712,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
__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/austinma/git/cdec/python/cdec/lattice.pxi":14
+ /* "lattice.pxi":14
* if isinstance(inp, tuple):
* self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp): # <<<<<<<<<<<<<<
@@ -14364,67 +15721,76 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_4 = __pyx_int_0;
- if (PyList_CheckExact(__pyx_v_inp) || PyTuple_CheckExact(__pyx_v_inp)) {
+ if (likely(PyList_CheckExact(__pyx_v_inp)) || PyTuple_CheckExact(__pyx_v_inp)) {
__pyx_t_5 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0;
__pyx_t_6 = NULL;
} else {
__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;
+ __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- 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_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_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_6 && PyTuple_CheckExact(__pyx_t_5)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __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_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
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_5))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __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_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_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __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_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_7 = __pyx_t_6(__pyx_t_5);
if (unlikely(!__pyx_t_7)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, 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_7);
}
- __Pyx_XDECREF(__pyx_v_arcs);
- __pyx_v_arcs = __pyx_t_7;
+ __Pyx_XDECREF_SET(__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_4;
+ __Pyx_XDECREF_SET(__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/austinma/git/cdec/python/cdec/lattice.pxi":15
+ /* "lattice.pxi":15
* self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp):
* self[i] = arcs # <<<<<<<<<<<<<<
* elif isinstance(inp, basestring):
* lattice.ConvertTextOrPLF(as_str(inp), self.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;}
+ if (unlikely(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;}
+
+ /* "lattice.pxi":14
+ * if isinstance(inp, tuple):
+ * self.lattice.resize(len(inp))
+ * for i, arcs in enumerate(inp): # <<<<<<<<<<<<<<
+ * self[i] = arcs
+ * elif isinstance(inp, basestring):
+ */
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":16
+ /* "lattice.pxi":16
* for i, arcs in enumerate(inp):
* self[i] = arcs
* elif isinstance(inp, basestring): # <<<<<<<<<<<<<<
@@ -14435,14 +15801,14 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":17
+ /* "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_4 = ((PyObject *)__pyx_f_4cdec_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_t_4 = __pyx_f_4cdec_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;
@@ -14451,29 +15817,38 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":19
+ /* "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_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_4 = __Pyx_PyString_Format(__pyx_kp_s_cannot_create_lattice_from_s, ((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(__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));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__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_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __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);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__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:;
+ /* "lattice.pxi":9
+ * self.lattice = new lattice.Lattice()
+ *
+ * def __init__(self, inp): # <<<<<<<<<<<<<<
+ * """Lattice(tuple) -> Lattice from node list.
+ * Lattice(string) -> Lattice from PLF representation."""
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -14489,28 +15864,30 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
return __pyx_r;
}
+/* "lattice.pxi":21
+ * raise TypeError('cannot create lattice from %s' % type(inp))
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.lattice
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":21
- * raise TypeError('cannot create lattice from %s' % type(inp))
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.lattice
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":22
+ /* "lattice.pxi":22
*
* def __dealloc__(self):
* del self.lattice # <<<<<<<<<<<<<<
@@ -14519,9 +15896,26 @@ static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __p
*/
delete __pyx_v_self->lattice;
+ /* "lattice.pxi":21
+ * raise TypeError('cannot create lattice from %s' % type(inp))
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.lattice
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "lattice.pxi":24
+ * del self.lattice
+ *
+ * def __getitem__(self, int index): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('lattice index out of range')
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
@@ -14533,7 +15927,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -14542,21 +15936,15 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_s
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":24
- * del self.lattice
- *
- * def __getitem__(self, int index): # <<<<<<<<<<<<<<
- * if not 0 <= index < len(self):
- * raise IndexError('lattice index out of range')
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index) {
PyObject *__pyx_v_arcs = NULL;
- std::vector<LatticeArc> __pyx_v_arc_vector;
+ std::vector<LatticeArc> __pyx_v_arc_vector;
LatticeArc *__pyx_v_arc;
unsigned int __pyx_v_i;
PyObject *__pyx_v_label = NULL;
@@ -14576,7 +15964,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":25
+ /* "lattice.pxi":25
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -14591,23 +15979,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
__pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":26
+ /* "lattice.pxi":26
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":27
+ /* "lattice.pxi":27
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range')
* arcs = [] # <<<<<<<<<<<<<<
@@ -14619,7 +16005,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
__pyx_v_arcs = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":28
+ /* "lattice.pxi":28
* raise IndexError('lattice index out of range')
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<<
@@ -14628,7 +16014,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
*/
__pyx_v_arc_vector = ((__pyx_v_self->lattice[0])[__pyx_v_index]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":31
+ /* "lattice.pxi":31
* cdef lattice.LatticeArc* arc
* cdef unsigned i
* for i in range(arc_vector.size()): # <<<<<<<<<<<<<<
@@ -14639,7 +16025,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i = __pyx_t_6;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":32
+ /* "lattice.pxi":32
* cdef unsigned i
* for i in range(arc_vector.size()):
* arc = &arc_vector[i] # <<<<<<<<<<<<<<
@@ -14648,7 +16034,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
*/
__pyx_v_arc = (&(__pyx_v_arc_vector[__pyx_v_i]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":33
+ /* "lattice.pxi":33
* for i in range(arc_vector.size()):
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label).c_str(), 'utf8') # <<<<<<<<<<<<<<
@@ -14656,23 +16042,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
* return tuple(arcs)
*/
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XDECREF(((PyObject *)__pyx_v_label));
- __pyx_v_label = ((PyObject*)__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_label, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":34
+ /* "lattice.pxi":34
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label).c_str(), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<<
@@ -14681,24 +16066,24 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
*/
__pyx_t_4 = PyFloat_FromDouble(__pyx_v_arc->cost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_7 = PyInt_FromLong(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_INCREF(((PyObject *)__pyx_v_label));
- PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_label));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_label));
+ __Pyx_INCREF(__pyx_v_label);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_label);
+ __Pyx_GIVEREF(__pyx_v_label);
PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_4 = 0;
__pyx_t_7 = 0;
- __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;
+ __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_arcs, __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(__pyx_t_8); __pyx_t_8 = 0;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":35
+ /* "lattice.pxi":35
* label = unicode(TDConvert(arc.label).c_str(), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs) # <<<<<<<<<<<<<<
@@ -14706,14 +16091,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
* def __setitem__(self, int index, tuple arcs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_8 = ((PyObject *)PyList_AsTuple(__pyx_v_arcs)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_8));
- __pyx_r = ((PyObject *)__pyx_t_8);
+ __pyx_t_8 = PyList_AsTuple(__pyx_v_arcs); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
__pyx_t_8 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "lattice.pxi":24
+ * del self.lattice
+ *
+ * def __getitem__(self, int index): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('lattice index out of range')
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
@@ -14728,6 +16120,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
return __pyx_r;
}
+/* "lattice.pxi":37
+ * return tuple(arcs)
+ *
+ * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('lattice index out of range')
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs); /*proto*/
static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs) {
@@ -14739,7 +16139,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, P
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -14749,6 +16149,8 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, P
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject*)__pyx_v_arcs));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -14757,14 +16159,6 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":37
- * return tuple(arcs)
- *
- * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
- * if not 0 <= index < len(self):
- * raise IndexError('lattice index out of range')
- */
-
static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs) {
LatticeArc *__pyx_v_arc;
PyObject *__pyx_v_label = NULL;
@@ -14791,7 +16185,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":38
+ /* "lattice.pxi":38
*
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -14806,34 +16200,32 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
__pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":39
+ /* "lattice.pxi":39
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":41
+ /* "lattice.pxi":41
* raise IndexError('lattice index out of range')
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<<
* label_str = as_str(label)
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
*/
- if (unlikely(((PyObject *)__pyx_v_arcs) == Py_None)) {
+ if (unlikely(__pyx_v_arcs == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = ((PyObject *)__pyx_v_arcs); __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
+ __pyx_t_4 = __pyx_v_arcs; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
@@ -14875,8 +16267,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
__Pyx_GOTREF(__pyx_t_8);
#endif
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- } else
- {
+ } else {
Py_ssize_t index = -1;
__pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
@@ -14899,42 +16290,38 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
- __Pyx_XDECREF(__pyx_v_label);
- __pyx_v_label = __pyx_t_6;
+ __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_6);
__pyx_t_6 = 0;
- __Pyx_XDECREF(__pyx_v_cost);
- __pyx_v_cost = __pyx_t_7;
+ __Pyx_XDECREF_SET(__pyx_v_cost, __pyx_t_7);
__pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_v_dist2next);
- __pyx_v_dist2next = __pyx_t_8;
+ __Pyx_XDECREF_SET(__pyx_v_dist2next, __pyx_t_8);
__pyx_t_8 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":42
+ /* "lattice.pxi":42
* cdef lattice.LatticeArc* arc
* 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])
*/
- __pyx_t_5 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_v_label, NULL)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_label, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_XDECREF(((PyObject *)__pyx_v_label_str));
- __pyx_v_label_str = ((PyObject*)__pyx_t_5);
+ __Pyx_XDECREF_SET(__pyx_v_label_str, ((PyObject*)__pyx_t_5));
__pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":43
+ /* "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 = __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_11 = __Pyx_PyObject_AsString(__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_t_13 = __Pyx_PyInt_As_int(__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/austinma/git/cdec/python/cdec/lattice.pxi":44
+ /* "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]) # <<<<<<<<<<<<<<
@@ -14943,7 +16330,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
*/
((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":45
+ /* "lattice.pxi":45
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
* del arc # <<<<<<<<<<<<<<
@@ -14951,9 +16338,26 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
* def __len__(self):
*/
delete __pyx_v_arc;
+
+ /* "lattice.pxi":41
+ * raise IndexError('lattice index out of range')
+ * cdef lattice.LatticeArc* arc
+ * for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<<
+ * label_str = as_str(label)
+ * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
+ */
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ /* "lattice.pxi":37
+ * return tuple(arcs)
+ *
+ * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('lattice index out of range')
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -14974,6 +16378,14 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
return __pyx_r;
}
+/* "lattice.pxi":47
+ * del arc
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.lattice.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self) {
@@ -14981,24 +16393,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":47
- * del arc
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.lattice.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":48
+ /* "lattice.pxi":48
*
* def __len__(self):
* return self.lattice.size() # <<<<<<<<<<<<<<
@@ -15008,12 +16414,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(struct __pyx_obj_4cde
__pyx_r = __pyx_v_self->lattice->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "lattice.pxi":47
+ * del arc
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.lattice.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "lattice.pxi":50
+ * return self.lattice.size()
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self) {
@@ -15021,18 +16443,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_12__str__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":50
- * return self.lattice.size()
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -15043,7 +16459,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":51
+ /* "lattice.pxi":51
*
* def __str__(self):
* return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) # <<<<<<<<<<<<<<
@@ -15052,21 +16468,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec
*/
__Pyx_XDECREF(__pyx_r);
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "lattice.pxi":50
+ * return self.lattice.size()
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -15078,6 +16501,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec
return __pyx_r;
}
+/* "lattice.pxi":53
+ * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+ *
+ * def __unicode__(self): # <<<<<<<<<<<<<<
+ * return unicode(str(self), 'utf8')
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
@@ -15085,18 +16516,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__unicode__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":53
- * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
- *
- * def __unicode__(self): # <<<<<<<<<<<<<<
- * return unicode(str(self), 'utf8')
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -15107,7 +16532,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__unicode__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":54
+ /* "lattice.pxi":54
*
* def __unicode__(self):
* return unicode(str(self), 'utf8') # <<<<<<<<<<<<<<
@@ -15120,26 +16545,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "lattice.pxi":53
+ * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+ *
+ * def __unicode__(self): # <<<<<<<<<<<<<<
+ * return unicode(str(self), 'utf8')
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -15152,6 +16584,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4
}
static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "lattice.pxi":56
+ * return unicode(str(self), 'utf8')
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self) {
@@ -15159,18 +16599,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_16__iter__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":56
- * return unicode(str(self), 'utf8')
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(len(self)):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_16__iter__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -15189,18 +16623,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_16__iter__(struct __pyx_obj_4cde
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Lattice_18generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Lattice_18generator17, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_Lattice___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Lattice.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -15229,7 +16661,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__pyx_GeneratorObj
__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/austinma/git/cdec/python/cdec/lattice.pxi":58
+ /* "lattice.pxi":58
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -15240,14 +16672,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__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/austinma/git/cdec/python/cdec/lattice.pxi":59
+ /* "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, 0, 0, 1); 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, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__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;
@@ -15263,6 +16695,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__pyx_GeneratorObj
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "lattice.pxi":56
+ * return unicode(str(self), 'utf8')
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -15276,6 +16718,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__pyx_GeneratorObj
return NULL;
}
+/* "lattice.pxi":61
+ * yield self[i]
+ *
+ * def todot(self): # <<<<<<<<<<<<<<
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines():
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Lattice_19todot[] = "lattice.todot() -> Representation of the lattice in GraphViz dot format.";
@@ -15284,31 +16734,35 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("todot (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_19todot(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "lattice.pxi":63
+ * def todot(self):
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines(): # <<<<<<<<<<<<<<
+ * yield 'digraph lattice {'
+ * yield 'rankdir = LR;'
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_5_cdec_7Lattice_5todot_1lines = {__Pyx_NAMESTR("lines"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines, METH_NOARGS, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_5_cdec_7Lattice_5todot_1lines = {"lines", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines, METH_NOARGS, 0};
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lines (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(__pyx_self);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":63
- * def todot(self):
- * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
- * def lines(): # <<<<<<<<<<<<<<
- * yield 'digraph lattice {'
- * yield 'rankdir = LR;'
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -15327,18 +16781,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_sel
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23, (PyObject *) __pyx_cur_scope, __pyx_n_s_lines, __pyx_n_s_todot_locals_lines); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Lattice.todot.lines", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -15381,15 +16833,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__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/austinma/git/cdec/python/cdec/lattice.pxi":64
+ /* "lattice.pxi":64
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines():
* yield 'digraph lattice {' # <<<<<<<<<<<<<<
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_26));
- __pyx_r = ((PyObject *)__pyx_kp_s_26);
+ __Pyx_INCREF(__pyx_kp_s_digraph_lattice);
+ __pyx_r = __pyx_kp_s_digraph_lattice;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -15398,15 +16850,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__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/austinma/git/cdec/python/cdec/lattice.pxi":65
+ /* "lattice.pxi":65
* def lines():
* yield 'digraph lattice {'
* yield 'rankdir = LR;' # <<<<<<<<<<<<<<
* yield 'node [shape=circle];'
* for i in range(len(self)):
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
- __pyx_r = ((PyObject *)__pyx_kp_s_27);
+ __Pyx_INCREF(__pyx_kp_s_rankdir_LR);
+ __pyx_r = __pyx_kp_s_rankdir_LR;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -15415,15 +16867,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__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/austinma/git/cdec/python/cdec/lattice.pxi":66
+ /* "lattice.pxi":66
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
* yield 'node [shape=circle];' # <<<<<<<<<<<<<<
* for i in range(len(self)):
* for label, weight, delta in self[i]:
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
- __pyx_r = ((PyObject *)__pyx_kp_s_28);
+ __Pyx_INCREF(__pyx_kp_s_node_shape_circle);
+ __pyx_r = __pyx_kp_s_node_shape_circle;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -15432,7 +16884,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__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/austinma/git/cdec/python/cdec/lattice.pxi":67
+ /* "lattice.pxi":67
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -15451,38 +16903,41 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_4 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_3);
if (unlikely(!__pyx_t_1)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
@@ -15490,49 +16945,52 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_v_i = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":68
+ /* "lattice.pxi":68
* yield 'node [shape=circle];'
* for i in range(len(self)):
* for label, weight, delta in self[i]: # <<<<<<<<<<<<<<
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
*/
- __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
- if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
- if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_7)) {
+ if (likely(PyList_CheckExact(__pyx_t_5))) {
+ if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_7(__pyx_t_5);
if (unlikely(!__pyx_t_1)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
@@ -15573,8 +17031,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__Pyx_GOTREF(__pyx_t_10);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- } else
- {
+ } else {
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
@@ -15598,22 +17055,19 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__pyx_L12_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_label);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_label);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_label, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
- __pyx_cur_scope->__pyx_v_label = __pyx_t_8;
__pyx_t_8 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_weight);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_weight);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_weight, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
- __pyx_cur_scope->__pyx_v_weight = __pyx_t_9;
__pyx_t_9 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_delta);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_delta);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_delta, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
- __pyx_cur_scope->__pyx_v_delta = __pyx_t_10;
__pyx_t_10 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":69
+ /* "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('"', '\\"')) # <<<<<<<<<<<<<<
@@ -15622,9 +17076,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
*/
__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 = __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_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_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15638,10 +17092,10 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_1 = 0;
__pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_9));
- __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
- __pyx_r = ((PyObject *)__pyx_t_9);
+ __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_d_d_label_s, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_r = __pyx_t_9;
__pyx_t_9 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_t_3);
@@ -15668,28 +17122,45 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
__pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "lattice.pxi":68
+ * yield 'node [shape=circle];'
+ * for i in range(len(self)):
+ * for label, weight, delta in self[i]: # <<<<<<<<<<<<<<
+ * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
+ * yield '%d [shape=doublecircle]' % len(self)
+ */
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "lattice.pxi":67
+ * yield 'rankdir = LR;'
+ * yield 'node [shape=circle];'
+ * for i in range(len(self)): # <<<<<<<<<<<<<<
+ * for label, weight, delta in self[i]:
+ * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
+ */
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":70
+ /* "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) # <<<<<<<<<<<<<<
* yield '}'
* return '\n'.join(lines()).encode('utf8')
*/
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
__pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self);
__Pyx_INCREF(__pyx_t_3);
__pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_d_shape_doublecircle, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
+ __pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -15699,15 +17170,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__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/austinma/git/cdec/python/cdec/lattice.pxi":71
+ /* "lattice.pxi":71
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
* yield '}' # <<<<<<<<<<<<<<
* return '\n'.join(lines()).encode('utf8')
*
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
- __pyx_r = ((PyObject *)__pyx_kp_s_34);
+ __Pyx_INCREF(__pyx_kp_s__13);
+ __pyx_r = __pyx_kp_s__13;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -15715,6 +17186,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
return __pyx_r;
__pyx_L15_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "lattice.pxi":63
+ * def todot(self):
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines(): # <<<<<<<<<<<<<<
+ * yield 'digraph lattice {'
+ * yield 'rankdir = LR;'
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -15734,7 +17215,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
return NULL;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":61
+/* "lattice.pxi":61
* yield self[i]
*
* def todot(self): # <<<<<<<<<<<<<<
@@ -15749,7 +17230,6 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -15764,19 +17244,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":63
+ /* "lattice.pxi":63
* def todot(self):
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_7Lattice_5todot_1lines, 0, __pyx_n_s_38, ((PyObject*)__pyx_cur_scope), __pyx_n_s_39, ((PyObject *)__pyx_k_codeobj_36)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_7Lattice_5todot_1lines, 0, __pyx_n_s_todot_locals_lines, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cdec__cdec, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_lines = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":72
+ /* "lattice.pxi":72
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
@@ -15784,35 +17264,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5
* def as_hypergraph(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_40), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(__pyx_v_lines); 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_4cdec_5_cdec_7Lattice_5todot_lines(__pyx_v_lines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__16, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = __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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_encode); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "lattice.pxi":61
+ * yield self[i]
+ *
+ * def todot(self): # <<<<<<<<<<<<<<
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines():
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec.Lattice.todot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -15823,6 +17301,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5
return __pyx_r;
}
+/* "lattice.pxi":74
+ * return '\n'.join(lines()).encode('utf8')
+ *
+ * def as_hypergraph(self): # <<<<<<<<<<<<<<
+ * """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
+ * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Lattice_21as_hypergraph[] = "lattice.as_hypergraph() -> Hypergraph representation of the lattice.";
@@ -15831,18 +17317,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("as_hypergraph (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":74
- * return '\n'.join(lines()).encode('utf8')
- *
- * def as_hypergraph(self): # <<<<<<<<<<<<<<
- * """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
- * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_result = 0;
PyObject *__pyx_v_plf = 0;
@@ -15856,20 +17336,20 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("as_hypergraph", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":76
+ /* "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_4cdec_5_cdec_Hypergraph(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __pyx_tp_new_4cdec_5_cdec_Hypergraph(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), __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_4cdec_5_cdec_Hypergraph)))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":77
+ /* "lattice.pxi":77
* """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
* cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
* result.hg = new hypergraph.Hypergraph() # <<<<<<<<<<<<<<
@@ -15878,7 +17358,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
*/
__pyx_v_result->hg = new Hypergraph();
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":78
+ /* "lattice.pxi":78
* cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
* result.hg = new hypergraph.Hypergraph()
* cdef bytes plf = str(self) # <<<<<<<<<<<<<<
@@ -15890,23 +17370,23 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_plf = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":79
+ /* "lattice.pxi":79
* result.hg = new hypergraph.Hypergraph()
* cdef bytes plf = str(self)
* hypergraph.ReadFromPLF(plf, result.hg) # <<<<<<<<<<<<<<
* return result
*/
- __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;}
+ __pyx_t_3 = __pyx_convert_string_from_py_(__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/austinma/git/cdec/python/cdec/lattice.pxi":80
+ /* "lattice.pxi":80
* cdef bytes plf = str(self)
* hypergraph.ReadFromPLF(plf, result.hg)
* return result # <<<<<<<<<<<<<<
@@ -15916,8 +17396,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "lattice.pxi":74
+ * return '\n'.join(lines()).encode('utf8')
+ *
+ * def as_hypergraph(self): # <<<<<<<<<<<<<<
+ * """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
+ * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -15931,7 +17418,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":3
+/* "mteval.pxi":3
* cimport mteval
*
* cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<<
@@ -15953,7 +17440,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("as_stats", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":4
+ /* "mteval.pxi":4
*
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats): # <<<<<<<<<<<<<<
@@ -15964,7 +17451,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":5
+ /* "mteval.pxi":5
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats):
* return x # <<<<<<<<<<<<<<
@@ -15976,10 +17463,9 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
__Pyx_INCREF(__pyx_v_x);
__pyx_r = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_x);
goto __pyx_L0;
- goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":6
+ /* "mteval.pxi":6
* if isinstance(x, SufficientStats):
* return x
* elif x == 0 and isinstance(y, SufficientStats): # <<<<<<<<<<<<<<
@@ -15987,29 +17473,34 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
* stats.stats = new mteval.SufficientStats()
*/
__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_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); 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_3); __pyx_t_3 = 0;
- if (__pyx_t_2) {
- __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats));
- __pyx_t_4 = __pyx_t_1;
+ if (__pyx_t_1) {
+ goto __pyx_L5_next_and;
} else {
- __pyx_t_4 = __pyx_t_2;
- }
- if (__pyx_t_4) {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_L5_next_and:;
+ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats));
+ __pyx_t_4 = (__pyx_t_1 != 0);
+ __pyx_t_2 = __pyx_t_4;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":7
+ /* "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_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_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_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), __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_4cdec_5_cdec_SufficientStats *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":8
+ /* "mteval.pxi":8
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -16018,7 +17509,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
*/
__pyx_v_stats->stats = new SufficientStats();
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":9
+ /* "mteval.pxi":9
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric # <<<<<<<<<<<<<<
@@ -16028,7 +17519,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
__pyx_t_5 = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_y)->metric;
__pyx_v_stats->metric = __pyx_t_5;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":10
+ /* "mteval.pxi":10
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric
* return stats # <<<<<<<<<<<<<<
@@ -16039,10 +17530,17 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
__Pyx_INCREF(((PyObject *)__pyx_v_stats));
__pyx_r = __pyx_v_stats;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
+ /* "mteval.pxi":3
+ * cimport mteval
+ *
+ * cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<<
+ * if isinstance(x, SufficientStats):
+ * return x
+ */
+
+ /* function exit code */
__pyx_r = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -16056,6 +17554,14 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
return __pyx_r;
}
+/* "mteval.pxi":17
+ *
+ * property words:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8')
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_self) {
@@ -16063,18 +17569,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5words_1__get__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":17
- *
- * property words:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8')
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16086,7 +17586,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":18
+ /* "mteval.pxi":18
* property words:
* def __get__(self):
* return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8') # <<<<<<<<<<<<<<
@@ -16095,25 +17595,32 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob
*/
__Pyx_XDECREF(__pyx_r);
__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_GOTREF(__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);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyDict_New(); 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));
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_encoding, __pyx_n_s_utf8) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":17
+ *
+ * property words:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8')
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -16126,6 +17633,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob
return __pyx_r;
}
+/* "mteval.pxi":21
+ *
+ * property fmap:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector fmap = SparseVector.__new__(SparseVector)
+ * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_self) {
@@ -16133,18 +17648,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":21
- *
- * property fmap:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef SparseVector fmap = SparseVector.__new__(SparseVector)
- * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap = 0;
PyObject *__pyx_r = NULL;
@@ -16155,29 +17664,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":22
+ /* "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_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __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_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":23
+ /* "mteval.pxi":23
* def __get__(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<<
* return fmap
*
*/
- __pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_v_self->candidate->fmap);
+ __pyx_v_fmap->vector = new FastSparseVector<weight_t> (__pyx_v_self->candidate->fmap);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":24
+ /* "mteval.pxi":24
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
* return fmap # <<<<<<<<<<<<<<
@@ -16189,8 +17698,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_fmap);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":21
+ *
+ * property fmap:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector fmap = SparseVector.__new__(SparseVector)
+ * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Candidate.fmap.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16202,6 +17718,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj
return __pyx_r;
}
+/* "mteval.pxi":14
+ * cdef class Candidate:
+ * cdef mteval.const_Candidate* candidate
+ * cdef public float score # <<<<<<<<<<<<<<
+ *
+ * property words:
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_self) {
@@ -16209,18 +17733,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5score_1__get__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":14
- * cdef class Candidate:
- * cdef mteval.const_Candidate* candidate
- * cdef public float score # <<<<<<<<<<<<<<
- *
- * property words:
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16236,8 +17754,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(struct __pyx_ob
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Candidate.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16255,6 +17772,8 @@ static int __pyx_pw_4cdec_5_cdec_9Candidate_5score_3__set__(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_5score_2__set__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -16270,6 +17789,7 @@ static int __pyx_pf_4cdec_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_4cd
__pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->score = __pyx_t_1;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -16280,28 +17800,82 @@ static int __pyx_pf_4cdec_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "mteval.pxi":30
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.stats = new mteval.SufficientStats()
+ *
+ */
+
/* Python wrapper */
-static void __pyx_pw_4cdec_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_4cdec_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_self) {
+static int __pyx_pw_4cdec_5_cdec_15SufficientStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_4cdec_5_cdec_15SufficientStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_r;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
- __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+ if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats___cinit__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
+ return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":30
+static int __pyx_pf_4cdec_5_cdec_15SufficientStats___cinit__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "mteval.pxi":31
+ *
+ * def __cinit__(self):
+ * self.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(self):
+ */
+ __pyx_v_self->stats = new SufficientStats();
+
+ /* "mteval.pxi":30
* cdef mteval.EvaluationMetric* metric
*
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.stats = new mteval.SufficientStats()
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "mteval.pxi":33
+ * self.stats = new mteval.SufficientStats()
+ *
* def __dealloc__(self): # <<<<<<<<<<<<<<
* del self.stats
*
*/
-static void __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
+/* Python wrapper */
+static void __pyx_pw_4cdec_5_cdec_15SufficientStats_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_4cdec_5_cdec_15SufficientStats_3__dealloc__(PyObject *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_pf_4cdec_5_cdec_15SufficientStats_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_pf_4cdec_5_cdec_15SufficientStats_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":31
+ /* "mteval.pxi":34
*
* def __dealloc__(self):
* del self.stats # <<<<<<<<<<<<<<
@@ -16310,9 +17884,26 @@ static void __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED st
*/
delete __pyx_v_self->stats;
+ /* "mteval.pxi":33
+ * self.stats = new mteval.SufficientStats()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.stats
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "mteval.pxi":37
+ *
+ * property score:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.metric.ComputeScore(self.stats[0])
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(PyObject *__pyx_v_self) {
@@ -16320,18 +17911,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(PyObjec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":34
- *
- * property score:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.metric.ComputeScore(self.stats[0])
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16341,7 +17926,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":35
+ /* "mteval.pxi":38
* property score:
* def __get__(self):
* return self.metric.ComputeScore(self.stats[0]) # <<<<<<<<<<<<<<
@@ -16349,14 +17934,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct _
* property detail:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->metric->ComputeScore((__pyx_v_self->stats[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->metric->ComputeScore((__pyx_v_self->stats[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":37
+ *
+ * property score:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.metric.ComputeScore(self.stats[0])
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SufficientStats.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16367,6 +17959,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct _
return __pyx_r;
}
+/* "mteval.pxi":41
+ *
+ * property detail:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return str(self.metric.DetailedScore(self.stats[0]).c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__pyx_v_self) {
@@ -16374,18 +17974,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(PyObje
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":38
- *
- * property detail:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return str(self.metric.DetailedScore(self.stats[0]).c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16396,7 +17990,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":39
+ /* "mteval.pxi":42
* property detail:
* def __get__(self):
* return str(self.metric.DetailedScore(self.stats[0]).c_str()) # <<<<<<<<<<<<<<
@@ -16404,22 +17998,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct
* def __len__(self):
*/
__Pyx_XDECREF(__pyx_r);
- __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_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 = 42; __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[5]; __pyx_lineno = 42; __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));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":41
+ *
+ * property detail:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return str(self.metric.DetailedScore(self.stats[0]).c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -16431,31 +18032,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct
return __pyx_r;
}
+/* "mteval.pxi":44
+ * return str(self.metric.DetailedScore(self.stats[0]).c_str())
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.stats.size()
+ *
+ */
+
/* Python wrapper */
-static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_5__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_5__len__(PyObject *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_4__len__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":41
- * return str(self.metric.DetailedScore(self.stats[0]).c_str())
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.stats.size()
- *
- */
-
-static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_4__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":42
+ /* "mteval.pxi":45
*
* def __len__(self):
* return self.stats.size() # <<<<<<<<<<<<<<
@@ -16465,33 +18068,43 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(struct __pyx_
__pyx_r = __pyx_v_self->stats->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "mteval.pxi":44
+ * return str(self.metric.DetailedScore(self.stats[0]).c_str())
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.stats.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_8generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "mteval.pxi":47
+ * return self.stats.size()
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * for i in range(len(self)):
+ * yield self[i]
+ */
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_7__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_7__iter__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_6__iter__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":44
- * return self.stats.size()
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * for i in range(len(self)):
- * yield self[i]
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6__iter__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16509,32 +18122,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(struct __pyx_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_15SufficientStats_8generator18, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SufficientStats___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.SufficientStats.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_8generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
+ Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- PyObject *(*__pyx_t_4)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -16548,82 +18158,32 @@ static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_Gene
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":45
+ /* "mteval.pxi":48
*
* def __iter__(self):
* for i in range(len(self)): # <<<<<<<<<<<<<<
* yield self[i]
*
*/
- __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __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[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
- __pyx_t_4 = NULL;
- } else {
- __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_3);
- if (unlikely(!__pyx_t_2)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_2);
- }
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i);
- __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- __pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":46
+ /* "mteval.pxi":49
* def __iter__(self):
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def __getitem__(self, int index):
*/
- __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
- __Pyx_XGIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -16631,17 +18191,22 @@ static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_Gene
return __pyx_r;
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- __pyx_cur_scope->__pyx_t_1 = 0;
- __Pyx_XGOTREF(__pyx_t_3);
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "mteval.pxi":47
+ * return self.stats.size()
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * for i in range(len(self)):
+ * yield self[i]
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
@@ -16652,9 +18217,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_Gene
return NULL;
}
+/* "mteval.pxi":51
+ * yield self[i]
+ *
+ * def __getitem__(self, int index): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('sufficient stats vector index out of range')
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
int __pyx_v_index;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
@@ -16663,7 +18236,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject *
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -16671,20 +18244,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject *
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self), ((int)__pyx_v_index));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_9__getitem__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self), ((int)__pyx_v_index));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":48
- * yield self[i]
- *
- * def __getitem__(self, int index): # <<<<<<<<<<<<<<
- * if not 0 <= index < len(self):
- * raise IndexError('sufficient stats vector index out of range')
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index) {
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__getitem__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
@@ -16696,7 +18263,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":49
+ /* "mteval.pxi":52
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -16705,29 +18272,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p
*/
__pyx_t_1 = (0 <= __pyx_v_index);
if (__pyx_t_1) {
- __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_v_index < __pyx_t_2);
}
__pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":50
+ /* "mteval.pxi":53
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<<
* return self.stats[0][index]
*
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":51
+ /* "mteval.pxi":54
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range')
* return self.stats[0][index] # <<<<<<<<<<<<<<
@@ -16735,14 +18300,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p
* def __iadd__(SufficientStats self, SufficientStats other):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_self->stats[0])[__pyx_v_index])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_self->stats[0])[__pyx_v_index])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __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;
+ /* "mteval.pxi":51
+ * yield self[i]
+ *
+ * def __getitem__(self, int index): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('sufficient stats vector index out of range')
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec._cdec.SufficientStats.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16753,17 +18325,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p
return __pyx_r;
}
+/* "mteval.pxi":56
+ * return self.stats[0][index]
+ *
+ * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
+ * self.stats[0] += other.stats[0]
+ * return self
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__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);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SufficientStats, 1, "other", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_other));
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SufficientStats, 1, "other", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_11__iadd__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_other));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -16772,20 +18354,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__iadd__(PyObject *__
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":53
- * return self.stats[0][index]
- *
- * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
- * self.stats[0] += other.stats[0]
- * return self
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_other) {
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__iadd__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":54
+ /* "mteval.pxi":57
*
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0] # <<<<<<<<<<<<<<
@@ -16794,7 +18368,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_
*/
(__pyx_v_self->stats[0]) += (__pyx_v_other->stats[0]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":55
+ /* "mteval.pxi":58
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0]
* return self # <<<<<<<<<<<<<<
@@ -16806,33 +18380,43 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "mteval.pxi":56
+ * return self.stats[0][index]
+ *
+ * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
+ * self.stats[0] += other.stats[0]
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "mteval.pxi":60
+ * return self
+ *
+ * def __add__(x, y): # <<<<<<<<<<<<<<
+ * cdef SufficientStats sx = as_stats(x, y)
+ * cdef SufficientStats sy = as_stats(y, x)
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_14__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_14__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_13__add__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":57
- * return self
- *
- * def __add__(x, y): # <<<<<<<<<<<<<<
- * cdef SufficientStats sx = as_stats(x, y)
- * cdef SufficientStats sy = as_stats(y, x)
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_13__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_sx = 0;
struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_sy = 0;
struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_result = 0;
@@ -16845,43 +18429,43 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":58
+ /* "mteval.pxi":61
*
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y) # <<<<<<<<<<<<<<
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats()
*/
- __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_stats(__pyx_v_x, __pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_stats(__pyx_v_x, __pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sx = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":59
+ /* "mteval.pxi":62
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x) # <<<<<<<<<<<<<<
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
*/
- __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_stats(__pyx_v_y, __pyx_v_x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_stats(__pyx_v_y, __pyx_v_x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sy = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":60
+ /* "mteval.pxi":63
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats() # <<<<<<<<<<<<<<
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":61
+ /* "mteval.pxi":64
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) # <<<<<<<<<<<<<<
@@ -16890,7 +18474,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p
*/
__pyx_v_result->stats = new SufficientStats(operator+((__pyx_v_sx->stats[0]), (__pyx_v_sy->stats[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":62
+ /* "mteval.pxi":65
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric # <<<<<<<<<<<<<<
@@ -16900,7 +18484,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p
__pyx_t_2 = __pyx_v_sx->metric;
__pyx_v_result->metric = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":63
+ /* "mteval.pxi":66
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric
* return result # <<<<<<<<<<<<<<
@@ -16912,8 +18496,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":60
+ * return self
+ *
+ * def __add__(x, y): # <<<<<<<<<<<<<<
+ * cdef SufficientStats sx = as_stats(x, y)
+ * cdef SufficientStats sy = as_stats(y, x)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SufficientStats.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16927,6 +18518,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p
return __pyx_r;
}
+/* "mteval.pxi":73
+ * cdef mteval.CandidateSet* cs
+ *
+ * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
+ * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
+ * self.metric = evaluator.metric
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -16938,7 +18537,7 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__evaluator,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_evaluator,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -16951,11 +18550,11 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evaluator)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_evaluator)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -16966,14 +18565,16 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.CandidateSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_evaluator), __pyx_ptype_4cdec_5_cdec_SegmentEvaluator, 1, "evaluator", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_evaluator), __pyx_ptype_4cdec_5_cdec_SegmentEvaluator, 1, "evaluator", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_evaluator);
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -16982,30 +18583,22 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":70
- * cdef mteval.CandidateSet* cs
- *
- * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
- * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
- * self.metric = evaluator.metric
- */
-
static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_evaluator) {
int __pyx_r;
__Pyx_RefNannyDeclarations
EvaluationMetric *__pyx_t_1;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":71
+ /* "mteval.pxi":74
*
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) # <<<<<<<<<<<<<<
* self.metric = evaluator.metric
* self.cs = new mteval.CandidateSet()
*/
- __pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator>((__pyx_v_evaluator->scorer[0]));
+ __pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator> ((__pyx_v_evaluator->scorer[0]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":72
+ /* "mteval.pxi":75
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric # <<<<<<<<<<<<<<
@@ -17015,7 +18608,7 @@ static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec
__pyx_t_1 = __pyx_v_evaluator->metric;
__pyx_v_self->metric = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":73
+ /* "mteval.pxi":76
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric
* self.cs = new mteval.CandidateSet() # <<<<<<<<<<<<<<
@@ -17024,33 +18617,44 @@ static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec
*/
__pyx_v_self->cs = new training::CandidateSet();
+ /* "mteval.pxi":73
+ * cdef mteval.CandidateSet* cs
+ *
+ * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
+ * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
+ * self.metric = evaluator.metric
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "mteval.pxi":78
+ * self.cs = new mteval.CandidateSet()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.scorer
+ * del self.cs
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":75
- * self.cs = new mteval.CandidateSet()
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.scorer
- * del self.cs
- */
-
-static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":76
+ /* "mteval.pxi":79
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -17059,7 +18663,7 @@ static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED stru
*/
delete __pyx_v_self->scorer;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":77
+ /* "mteval.pxi":80
* def __dealloc__(self):
* del self.scorer
* del self.cs # <<<<<<<<<<<<<<
@@ -17068,9 +18672,26 @@ static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED stru
*/
delete __pyx_v_self->cs;
+ /* "mteval.pxi":78
+ * self.cs = new mteval.CandidateSet()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.scorer
+ * del self.cs
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "mteval.pxi":82
+ * del self.cs
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.cs.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self) {
@@ -17078,24 +18699,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":79
- * del self.cs
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.cs.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":80
+ /* "mteval.pxi":83
*
* def __len__(self):
* return self.cs.size() # <<<<<<<<<<<<<<
@@ -17105,12 +18720,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(struct __pyx_obj
__pyx_r = __pyx_v_self->cs->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "mteval.pxi":82
+ * del self.cs
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.cs.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "mteval.pxi":85
+ * return self.cs.size()
+ *
+ * def __getitem__(self,int k): # <<<<<<<<<<<<<<
+ * if not 0 <= k < self.cs.size():
+ * raise IndexError('candidate set index out of range')
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) {
@@ -17122,7 +18753,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_k); {
- __pyx_v_k = __Pyx_PyInt_AsInt(__pyx_arg_k); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_k = __Pyx_PyInt_As_int(__pyx_arg_k); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -17131,18 +18762,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__p
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self), ((int)__pyx_v_k));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":82
- * return self.cs.size()
- *
- * def __getitem__(self,int k): # <<<<<<<<<<<<<<
- * if not 0 <= k < self.cs.size():
- * raise IndexError('candidate set index out of range')
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, int __pyx_v_k) {
struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_candidate = 0;
PyObject *__pyx_r = NULL;
@@ -17155,7 +18780,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":83
+ /* "mteval.pxi":86
*
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size(): # <<<<<<<<<<<<<<
@@ -17169,35 +18794,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":84
+ /* "mteval.pxi":87
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
*/
- __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":85
+ /* "mteval.pxi":88
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate() # <<<<<<<<<<<<<<
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats)
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Candidate)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Candidate)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_candidate = ((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":86
+ /* "mteval.pxi":89
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k] # <<<<<<<<<<<<<<
@@ -17206,7 +18829,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
*/
__pyx_v_candidate->candidate = (&((__pyx_v_self->cs[0])[__pyx_v_k]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":87
+ /* "mteval.pxi":90
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) # <<<<<<<<<<<<<<
@@ -17215,7 +18838,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
*/
__pyx_v_candidate->score = __pyx_v_self->metric->ComputeScore(((__pyx_v_self->cs[0])[__pyx_v_k]).eval_feats);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":88
+ /* "mteval.pxi":91
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats)
* return candidate # <<<<<<<<<<<<<<
@@ -17227,8 +18850,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
__pyx_r = ((PyObject *)__pyx_v_candidate);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":85
+ * return self.cs.size()
+ *
+ * def __getitem__(self,int k): # <<<<<<<<<<<<<<
+ * if not 0 <= k < self.cs.size():
+ * raise IndexError('candidate set index out of range')
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec.CandidateSet.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -17241,6 +18871,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
}
static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "mteval.pxi":93
+ * return candidate
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self) {
@@ -17248,18 +18886,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":90
- * return candidate
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(len(self)):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -17278,18 +18910,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_CandidateSet___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.CandidateSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -17316,27 +18946,27 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_Genera
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":92
+ /* "mteval.pxi":95
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
* yield self[i]
*
*/
- __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":93
+ /* "mteval.pxi":96
* 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, 0, 0, 1); 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, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -17350,8 +18980,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_Genera
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "mteval.pxi":93
+ * return candidate
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -17365,6 +19005,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_Genera
return NULL;
}
+/* "mteval.pxi":98
+ * yield self[i]
+ *
+ * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
+ * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses
+ * from the hypergraph and add them to the candidate set."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_12CandidateSet_11add_kbest[] = "cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses \n from the hypergraph and add them to the candidate set.";
@@ -17378,7 +19026,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hypergraph,&__pyx_n_s__k,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hypergraph,&__pyx_n_s_k,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -17392,16 +19040,16 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hypergraph)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hypergraph)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k)) != 0)) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_kbest") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_kbest") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -17410,18 +19058,20 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_hypergraph = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)values[0]);
- __pyx_v_k = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_k == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_k = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_k == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.CandidateSet.add_kbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hypergraph), __pyx_ptype_4cdec_5_cdec_Hypergraph, 1, "hypergraph", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hypergraph), __pyx_ptype_4cdec_5_cdec_Hypergraph, 1, "hypergraph", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_hypergraph, __pyx_v_k);
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -17430,20 +19080,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":95
- * yield self[i]
- *
- * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
- * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses
- * from the hypergraph and add them to the candidate set."""
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_hypergraph, unsigned int __pyx_v_k) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":98
+ /* "mteval.pxi":101
* """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()) # <<<<<<<<<<<<<<
@@ -17452,34 +19094,45 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(struct __pyx_o
*/
__pyx_v_self->cs->AddKBestCandidates((__pyx_v_hypergraph->hg[0]), __pyx_v_k, __pyx_v_self->scorer->get());
+ /* "mteval.pxi":98
+ * yield self[i]
+ *
+ * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
+ * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses
+ * from the hypergraph and add them to the candidate set."""
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "mteval.pxi":107
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.scorer
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":104
- * cdef mteval.EvaluationMetric* metric
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.scorer
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":105
+ /* "mteval.pxi":108
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -17488,9 +19141,26 @@ static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED s
*/
delete __pyx_v_self->scorer;
+ /* "mteval.pxi":107
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.scorer
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "mteval.pxi":110
+ * del self.scorer
+ *
+ * def evaluate(self, sentence): # <<<<<<<<<<<<<<
+ * """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
+ * cdef vector[WordID] hyp
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_self, PyObject *__pyx_v_sentence); /*proto*/
static char __pyx_doc_4cdec_5_cdec_16SegmentEvaluator_2evaluate[] = "se.evaluate(sentence) -> SufficientStats for the given hypothesis.";
@@ -17499,45 +19169,40 @@ static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self), ((PyObject *)__pyx_v_sentence));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":107
- * del self.scorer
- *
- * def evaluate(self, sentence): # <<<<<<<<<<<<<<
- * """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
- * cdef vector[WordID] hyp
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self, PyObject *__pyx_v_sentence) {
- std::vector<WordID> __pyx_v_hyp;
+ std::vector<WordID> __pyx_v_hyp;
struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_sf = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
EvaluationMetric *__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("evaluate", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":110
+ /* "mteval.pxi":113
* """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats() # <<<<<<<<<<<<<<
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats()
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sf = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":111
+ /* "mteval.pxi":114
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric # <<<<<<<<<<<<<<
@@ -17547,7 +19212,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx
__pyx_t_2 = __pyx_v_self->metric;
__pyx_v_sf->metric = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":112
+ /* "mteval.pxi":115
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -17556,26 +19221,41 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx
*/
__pyx_v_sf->stats = new SufficientStats();
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":113
+ /* "mteval.pxi":116
* 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 = __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_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sentence, __pyx_n_s_strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __pyx_convert_string_from_py_(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- TD::ConvertSentence(__pyx_t_4, (&__pyx_v_hyp));
+ __pyx_t_5 = __pyx_convert_string_from_py_(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ TD::ConvertSentence(__pyx_t_5, (&__pyx_v_hyp));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":114
+ /* "mteval.pxi":117
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(as_str(sentence.strip()), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats) # <<<<<<<<<<<<<<
@@ -17584,7 +19264,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx
*/
__pyx_v_self->scorer->get()->Evaluate(__pyx_v_hyp, __pyx_v_sf->stats);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":115
+ /* "mteval.pxi":118
* ConvertSentence(as_str(sentence.strip()), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats)
* return sf # <<<<<<<<<<<<<<
@@ -17596,11 +19276,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx
__pyx_r = ((PyObject *)__pyx_v_sf);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":110
+ * del self.scorer
+ *
+ * def evaluate(self, sentence): # <<<<<<<<<<<<<<
+ * """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
+ * cdef vector[WordID] hyp
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec._cdec.SegmentEvaluator.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -17610,6 +19298,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx
return __pyx_r;
}
+/* "mteval.pxi":120
+ * return sf
+ *
+ * def candidate_set(self): # <<<<<<<<<<<<<<
+ * """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
+ * return CandidateSet(self)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_16SegmentEvaluator_4candidate_set[] = "se.candidate_set() -> Candidate set using this segment evaluator for scoring.";
@@ -17618,18 +19314,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set(PyObjec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("candidate_set (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":117
- * return sf
- *
- * def candidate_set(self): # <<<<<<<<<<<<<<
- * """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
- * return CandidateSet(self)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -17640,7 +19330,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("candidate_set", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":119
+ /* "mteval.pxi":122
* def candidate_set(self):
* """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
* return CandidateSet(self) # <<<<<<<<<<<<<<
@@ -17648,20 +19338,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct
* cdef class Scorer:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_CandidateSet)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_CandidateSet)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":120
+ * return sf
+ *
+ * def candidate_set(self): # <<<<<<<<<<<<<<
+ * """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
+ * return CandidateSet(self)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -17673,6 +19370,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct
return __pyx_r;
}
+/* "mteval.pxi":128
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<<
+ * if name:
+ * self.name = new string(name)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -17684,16 +19389,8 @@ static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
PyObject* values[1] = {0};
-
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":125
- * cdef mteval.EvaluationMetric* metric
- *
- * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<<
- * if name:
- * self.name = new string(name)
- */
values[0] = ((PyObject*)Py_None);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -17707,12 +19404,12 @@ static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyOb
switch (pos_args) {
case 0:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name);
if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -17725,14 +19422,16 @@ static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyOb
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.Scorer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyBytes_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyBytes_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self), __pyx_v_name);
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -17752,33 +19451,33 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":126
+ /* "mteval.pxi":129
*
* def __cinit__(self, bytes name=None):
* if name: # <<<<<<<<<<<<<<
* self.name = new string(name)
* self.metric = mteval.MetricInstance(self.name[0])
*/
- __pyx_t_1 = (((PyObject *)__pyx_v_name) != Py_None) && (PyBytes_GET_SIZE(((PyObject *)__pyx_v_name)) != 0);
+ __pyx_t_1 = (__pyx_v_name != Py_None) && (PyBytes_GET_SIZE(__pyx_v_name) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":127
+ /* "mteval.pxi":130
* def __cinit__(self, bytes name=None):
* if name:
* self.name = new string(name) # <<<<<<<<<<<<<<
* self.metric = mteval.MetricInstance(self.name[0])
*
*/
- __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;}
+ __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_name); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
try {
__pyx_t_3 = new std::string(__pyx_t_2);
} catch(...) {
__Pyx_CppExn2PyErr();
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->name = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":128
+ /* "mteval.pxi":131
* if name:
* self.name = new string(name)
* self.metric = mteval.MetricInstance(self.name[0]) # <<<<<<<<<<<<<<
@@ -17790,6 +19489,15 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec
}
__pyx_L3:;
+ /* "mteval.pxi":128
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<<
+ * if name:
+ * self.name = new string(name)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -17800,28 +19508,30 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec
return __pyx_r;
}
+/* "mteval.pxi":133
+ * self.metric = mteval.MetricInstance(self.name[0])
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.name
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":130
- * self.metric = mteval.MetricInstance(self.name[0])
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.name
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":131
+ /* "mteval.pxi":134
*
* def __dealloc__(self):
* del self.name # <<<<<<<<<<<<<<
@@ -17830,9 +19540,26 @@ static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __py
*/
delete __pyx_v_self->name;
+ /* "mteval.pxi":133
+ * self.metric = mteval.MetricInstance(self.name[0])
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.name
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "mteval.pxi":136
+ * del self.name
+ *
+ * def __call__(self, refs): # <<<<<<<<<<<<<<
+ * if isinstance(refs, basestring):
+ * refs = [refs]
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -17844,7 +19571,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refs,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -17857,11 +19584,11 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self,
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -17872,28 +19599,22 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer_4__call__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self), __pyx_v_refs);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":133
- * del self.name
- *
- * def __call__(self, refs): # <<<<<<<<<<<<<<
- * if isinstance(refs, basestring):
- * refs = [refs]
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_refs) {
- std::vector<std::vector<WordID> > *__pyx_v_refsv;
- std::vector<WordID> *__pyx_v_refv;
+ std::vector<std::vector<WordID> > *__pyx_v_refsv;
+ std::vector<WordID> *__pyx_v_refv;
PyObject *__pyx_v_ref = NULL;
struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0;
PyObject *__pyx_r = NULL;
@@ -17901,21 +19622,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- std::vector<std::vector<WordID> > *__pyx_t_4;
+ 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;
+ std::vector<WordID> *__pyx_t_8;
PyObject *__pyx_t_9 = NULL;
- std::string __pyx_t_10;
- EvaluationMetric *__pyx_t_11;
+ PyObject *__pyx_t_10 = NULL;
+ std::string __pyx_t_11;
+ EvaluationMetric *__pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__call__", 0);
__Pyx_INCREF(__pyx_v_refs);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":134
+ /* "mteval.pxi":137
*
* def __call__(self, refs):
* if isinstance(refs, basestring): # <<<<<<<<<<<<<<
@@ -17926,26 +19648,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":135
+ /* "mteval.pxi":138
* 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_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_t_3 = PyList_New(1); 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_INCREF(__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_3);
+ __Pyx_DECREF_SET(__pyx_v_refs, __pyx_t_3);
__pyx_t_3 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":136
+ /* "mteval.pxi":139
* if isinstance(refs, basestring):
* refs = [refs]
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<<
@@ -17953,59 +19674,61 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
* for ref in refs:
*/
try {
- __pyx_t_4 = 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_filename = __pyx_f[5]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_refsv = __pyx_t_4;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":138
+ /* "mteval.pxi":141
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
* cdef vector[WordID]* refv
* for ref in refs: # <<<<<<<<<<<<<<
* refv = new vector[WordID]()
* ConvertSentence(as_str(ref.strip()), refv)
*/
- if (PyList_CheckExact(__pyx_v_refs) || PyTuple_CheckExact(__pyx_v_refs)) {
+ if (likely(PyList_CheckExact(__pyx_v_refs)) || PyTuple_CheckExact(__pyx_v_refs)) {
__pyx_t_3 = __pyx_v_refs; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
} else {
- __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_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- 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_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_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_6 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __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_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
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__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;}
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_7);
}
- __Pyx_XDECREF(__pyx_v_ref);
- __pyx_v_ref = __pyx_t_7;
+ __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_7);
__pyx_t_7 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":139
+ /* "mteval.pxi":142
* cdef vector[WordID]* refv
* for ref in refs:
* refv = new vector[WordID]() # <<<<<<<<<<<<<<
@@ -18013,33 +19736,48 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
* refsv.push_back(refv[0])
*/
try {
- __pyx_t_8 = 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_filename = __pyx_f[5]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_refv = __pyx_t_8;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":140
+ /* "mteval.pxi":143
* for ref in refs:
* refv = new vector[WordID]()
* ConvertSentence(as_str(ref.strip()), refv) # <<<<<<<<<<<<<<
* refsv.push_back(refv[0])
* del 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_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref, __pyx_n_s_strip); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __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_4cdec_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_t_10 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ }
+ }
+ if (__pyx_t_10) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ } else {
+ __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __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_t_9 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- TD::ConvertSentence(__pyx_t_10, __pyx_v_refv);
+ __pyx_t_11 = __pyx_convert_string_from_py_(__pyx_t_9); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ TD::ConvertSentence(__pyx_t_11, __pyx_v_refv);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":141
+ /* "mteval.pxi":144
* refv = new vector[WordID]()
* ConvertSentence(as_str(ref.strip()), refv)
* refsv.push_back(refv[0]) # <<<<<<<<<<<<<<
@@ -18048,7 +19786,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
*/
__pyx_v_refsv->push_back((__pyx_v_refv[0]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":142
+ /* "mteval.pxi":145
* ConvertSentence(as_str(ref.strip()), refv)
* refsv.push_back(refv[0])
* del refv # <<<<<<<<<<<<<<
@@ -18056,41 +19794,49 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
*/
delete __pyx_v_refv;
+
+ /* "mteval.pxi":141
+ * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
+ * cdef vector[WordID]* refv
+ * for ref in refs: # <<<<<<<<<<<<<<
+ * refv = new vector[WordID]()
+ * ConvertSentence(as_str(ref.strip()), refv)
+ */
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":144
+ /* "mteval.pxi":147
* del refv
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator() # <<<<<<<<<<<<<<
* evaluator.metric = self.metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_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_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SegmentEvaluator)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_evaluator = ((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":145
+ /* "mteval.pxi":148
* 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_11 = __pyx_v_self->metric;
- __pyx_v_evaluator->metric = __pyx_t_11;
+ __pyx_t_12 = __pyx_v_self->metric;
+ __pyx_v_evaluator->metric = __pyx_t_12;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":146
+ /* "mteval.pxi":149
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = self.metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( # <<<<<<<<<<<<<<
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator
*/
- __pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator>(__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0])));
+ __pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator> (__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":148
+ /* "mteval.pxi":151
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator # <<<<<<<<<<<<<<
@@ -18099,7 +19845,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
*/
delete __pyx_v_refsv;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":149
+ /* "mteval.pxi":152
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator
* return evaluator # <<<<<<<<<<<<<<
@@ -18111,12 +19857,20 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
__pyx_r = ((PyObject *)__pyx_v_evaluator);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":136
+ * del self.name
+ *
+ * def __call__(self, refs): # <<<<<<<<<<<<<<
+ * if isinstance(refs, basestring):
+ * refs = [refs]
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("cdec._cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -18128,6 +19882,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "mteval.pxi":154
+ * return evaluator
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return str(self.name.c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) {
@@ -18135,18 +19897,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer_6__str__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":151
- * return evaluator
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * return str(self.name.c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -18157,7 +19913,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":152
+ /* "mteval.pxi":155
*
* def __str__(self):
* return str(self.name.c_str()) # <<<<<<<<<<<<<<
@@ -18165,22 +19921,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
*/
__Pyx_XDECREF(__pyx_r);
- __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_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->name->c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 155; __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[5]; __pyx_lineno = 155; __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));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":154
+ * return evaluator
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return str(self.name.c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -18192,7 +19955,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":154
+/* "mteval.pxi":157
* return str(self.name.c_str())
*
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<<
@@ -18212,35 +19975,38 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- float __pyx_t_7;
+ PyObject *__pyx_t_7 = NULL;
+ float __pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_compute_score", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":155
+ /* "mteval.pxi":158
*
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
* cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<<
* cdef list ss = []
* cdef unsigned i
*/
- __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_)));
- __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_);
+ __pyx_t_1 = ((PyObject *)__pyx_v_metric_);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":156
+ /* "mteval.pxi":159
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
* cdef Metric metric = <Metric> metric_
* cdef list ss = [] # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(stats.size()):
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); 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_v_ss = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":158
+ /* "mteval.pxi":161
* cdef list ss = []
* cdef unsigned i
* for i in range(stats.size()): # <<<<<<<<<<<<<<
@@ -18251,49 +20017,73 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":159
+ /* "mteval.pxi":162
* cdef unsigned i
* for i in range(stats.size()):
* ss.append(stats[0][i]) # <<<<<<<<<<<<<<
* return metric.score(ss)
*
*/
- __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_t_1 = PyFloat_FromDouble(((__pyx_v_stats[0])[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __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_t_4 = __Pyx_PyList_Append(__pyx_v_ss, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":160
+ /* "mteval.pxi":163
* 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 = __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_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_metric), __pyx_n_s_score); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_v_ss));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_ss));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_ss));
- __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_ss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(__pyx_v_ss);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_ss);
+ __Pyx_GIVEREF(__pyx_v_ss);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_r = __pyx_t_7;
+ __pyx_r = __pyx_t_8;
goto __pyx_L0;
- __pyx_r = 0;
- goto __pyx_L0;
+ /* "mteval.pxi":157
+ * return str(self.name.c_str())
+ *
+ * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<<
+ * cdef Metric metric = <Metric> metric_
+ * cdef list ss = []
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_WriteUnraisable("cdec._cdec._compute_score", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_WriteUnraisable("cdec._cdec._compute_score", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_metric);
@@ -18302,7 +20092,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":162
+/* "mteval.pxi":165
* return metric.score(ss)
*
* cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<<
@@ -18310,7 +20100,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie
* vector[string]* refs,
*/
-static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std::string *__pyx_v_hyp, std::vector<std::string> *__pyx_v_refs, SufficientStats *__pyx_v_out) {
+static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std::string *__pyx_v_hyp, std::vector<std::string> *__pyx_v_refs, SufficientStats *__pyx_v_out) {
struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_metric = 0;
PyObject *__pyx_v_refs_ = 0;
unsigned int __pyx_v_i;
@@ -18322,36 +20112,40 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
- Py_ssize_t __pyx_t_7;
- float __pyx_t_8;
+ PyObject *__pyx_t_7 = NULL;
+ Py_ssize_t __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ float __pyx_t_10;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_compute_sufficient_stats", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":166
+ /* "mteval.pxi":169
* vector[string]* refs,
* mteval.SufficientStats* out):
* cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<<
* cdef list refs_ = []
* cdef unsigned i
*/
- __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_)));
- __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_);
+ __pyx_t_1 = ((PyObject *)__pyx_v_metric_);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":167
+ /* "mteval.pxi":170
* mteval.SufficientStats* out):
* cdef Metric metric = <Metric> metric_
* cdef list refs_ = [] # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(refs.size()):
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); 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_v_refs_ = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":169
+ /* "mteval.pxi":172
* cdef list refs_ = []
* cdef unsigned i
* for i in range(refs.size()): # <<<<<<<<<<<<<<
@@ -18362,115 +20156,141 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":170
+ /* "mteval.pxi":173
* 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 = __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_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 = 173; __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[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __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_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __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 = __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_4); __pyx_t_4 = 0;
+ __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 = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":171
+ /* "mteval.pxi":174
* 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 = __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 = __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);
- 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(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_metric), __pyx_n_s_evaluate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_hyp->c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_v_refs_));
- PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_refs_));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_refs_));
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ss = ((PyObject*)__pyx_t_4);
- __pyx_t_4 = 0;
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_7) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_v_refs_);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_refs_);
+ __Pyx_GIVEREF(__pyx_v_refs_);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_ss = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":172
+ /* "mteval.pxi":175
* 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)):
* out.fields[i] = ss[i]
*/
- if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
+ if (unlikely(__pyx_v_ss == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __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);
+ __pyx_t_8 = PyList_GET_SIZE(__pyx_v_ss); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_out->fields.resize(__pyx_t_8);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":173
+ /* "mteval.pxi":176
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_)
* out.fields.resize(len(ss))
* for i in range(len(ss)): # <<<<<<<<<<<<<<
* out.fields[i] = ss[i]
*
*/
- if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
+ if (unlikely(__pyx_v_ss == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) {
+ __pyx_t_8 = PyList_GET_SIZE(__pyx_v_ss); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_8; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":174
+ /* "mteval.pxi":177
* out.fields.resize(len(ss))
* for i in range(len(ss)):
* out.fields[i] = ss[i] # <<<<<<<<<<<<<<
*
* cdef class Metric:
*/
- if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
+ if (unlikely(__pyx_v_ss == Py_None)) {
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_filename = __pyx_f[5]; __pyx_lineno = 177; __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;
- (__pyx_v_out->fields[__pyx_v_i]) = __pyx_t_8;
+ __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_ss, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ (__pyx_v_out->fields[__pyx_v_i]) = __pyx_t_10;
}
+ /* "mteval.pxi":165
+ * return metric.score(ss)
+ *
+ * cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<<
+ * string* hyp,
+ * vector[string]* refs,
+ */
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_WriteUnraisable("cdec._cdec._compute_sufficient_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_WriteUnraisable("cdec._cdec._compute_sufficient_stats", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_metric);
__Pyx_XDECREF(__pyx_v_refs_);
@@ -18478,6 +20298,14 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_
__Pyx_RefNannyFinishContext();
}
+/* "mteval.pxi":181
+ * cdef class Metric:
+ * cdef Scorer scorer
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.scorer = Scorer()
+ * cdef bytes class_name = self.__class__.__name__
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -18488,18 +20316,12 @@ static int __pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyOb
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
__pyx_r = __pyx_pf_4cdec_5_cdec_6Metric___cinit__(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":178
- * cdef class Metric:
- * cdef Scorer scorer
- * def __cinit__(self): # <<<<<<<<<<<<<<
- * self.scorer = Scorer()
- * cdef bytes class_name = self.__class__.__name__
- */
-
static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self) {
PyObject *__pyx_v_class_name = 0;
int __pyx_r;
@@ -18513,14 +20335,14 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":179
+ /* "mteval.pxi":182
* cdef Scorer scorer
* def __cinit__(self):
* self.scorer = Scorer() # <<<<<<<<<<<<<<
* cdef bytes class_name = self.__class__.__name__
* self.scorer.name = new string(class_name)
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->scorer);
@@ -18528,39 +20350,39 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec
__pyx_v_self->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":180
+ /* "mteval.pxi":183
* 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 = __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_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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 183; __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;}
+ if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_class_name = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":181
+ /* "mteval.pxi":184
* 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 = __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;}
+ __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_class_name); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
try {
__pyx_t_4 = new std::string(__pyx_t_3);
} catch(...) {
__Pyx_CppExn2PyErr();
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->scorer->name = __pyx_t_4;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":182
+ /* "mteval.pxi":185
* cdef bytes class_name = self.__class__.__name__
* self.scorer.name = new string(class_name)
* self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0], # <<<<<<<<<<<<<<
@@ -18569,6 +20391,15 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec
*/
__pyx_v_self->scorer->metric = PythonEvaluationMetric::Instance((__pyx_v_self->scorer->name[0]), ((void *)__pyx_v_self), __pyx_f_4cdec_5_cdec__compute_sufficient_stats, __pyx_f_4cdec_5_cdec__compute_score);
+ /* "mteval.pxi":181
+ * cdef class Metric:
+ * cdef Scorer scorer
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.scorer = Scorer()
+ * cdef bytes class_name = self.__class__.__name__
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -18582,6 +20413,14 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec
return __pyx_r;
}
+/* "mteval.pxi":188
+ * <void*> self, _compute_sufficient_stats, _compute_score)
+ *
+ * def __call__(self, refs): # <<<<<<<<<<<<<<
+ * return self.scorer(refs)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -18593,7 +20432,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refs,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -18606,11 +20445,11 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self,
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -18621,36 +20460,32 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.Metric.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_6Metric_2__call__(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_self), __pyx_v_refs);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":185
- * <void*> self, _compute_sufficient_stats, _compute_score)
- *
- * def __call__(self, refs): # <<<<<<<<<<<<<<
- * return self.scorer(refs)
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_2__call__(struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self, PyObject *__pyx_v_refs) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__call__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":186
+ /* "mteval.pxi":189
*
* def __call__(self, refs):
* return self.scorer(refs) # <<<<<<<<<<<<<<
@@ -18658,23 +20493,50 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_2__call__(struct __pyx_obj_4cdec_
* def score(SufficientStats stats):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_v_refs);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_refs);
- __Pyx_GIVEREF(__pyx_v_refs);
- __pyx_t_2 = PyObject_Call(((PyObject *)__pyx_v_self->scorer), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_INCREF(((PyObject *)__pyx_v_self->scorer));
+ __pyx_t_2 = ((PyObject *)__pyx_v_self->scorer); __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_refs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_v_refs);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_refs);
+ __Pyx_GIVEREF(__pyx_v_refs);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":188
+ * <void*> self, _compute_sufficient_stats, _compute_score)
+ *
+ * def __call__(self, refs): # <<<<<<<<<<<<<<
+ * return self.scorer(refs)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec._cdec.Metric.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -18683,6 +20545,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_2__call__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "mteval.pxi":191
+ * return self.scorer(refs)
+ *
+ * def score(SufficientStats stats): # <<<<<<<<<<<<<<
+ * return 0
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_UNUSED PyObject *unused) {
@@ -18690,24 +20560,18 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, C
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("score (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_6Metric_4score(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_stats));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":188
- * return self.scorer(refs)
- *
- * def score(SufficientStats stats): # <<<<<<<<<<<<<<
- * return 0
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_stats) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("score", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":189
+ /* "mteval.pxi":192
*
* def score(SufficientStats stats):
* return 0 # <<<<<<<<<<<<<<
@@ -18719,13 +20583,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx
__pyx_r = __pyx_int_0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "mteval.pxi":191
+ * return self.scorer(refs)
+ *
+ * def score(SufficientStats stats): # <<<<<<<<<<<<<<
+ * return 0
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "mteval.pxi":194
+ * return 0
+ *
+ * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<<
+ * return []
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -18738,7 +20618,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hyp,&__pyx_n_s__refs,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hyp,&__pyx_n_s_refs,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -18752,16 +20632,16 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self,
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hyp)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hyp)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refs)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -18774,25 +20654,19 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.Metric.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_6Metric_6evaluate(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_self), __pyx_v_hyp, __pyx_v_refs);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":191
- * return 0
- *
- * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<<
- * return []
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_hyp, CYTHON_UNUSED PyObject *__pyx_v_refs) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -18802,7 +20676,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("evaluate", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":192
+ /* "mteval.pxi":195
*
* def evaluate(self, hyp, refs):
* return [] # <<<<<<<<<<<<<<
@@ -18810,14 +20684,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __
* BLEU = Scorer('IBM_BLEU')
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_r = ((PyObject *)__pyx_t_1);
+ __pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "mteval.pxi":194
+ * return 0
+ *
+ * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<<
+ * return []
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Metric.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -18828,27 +20709,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __
return __pyx_r;
}
+/* "cdec/_cdec.pyx":28
+ * class ParseFailed(Exception): pass
+ *
+ * def set_silent(yn): # <<<<<<<<<<<<<<
+ * """set_silent(bool): Configure the verbosity of cdec."""
+ * SetSilent(yn)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__pyx_v_yn); /*proto*/
static char __pyx_doc_4cdec_5_cdec_2set_silent[] = "set_silent(bool): Configure the verbosity of cdec.";
-static PyMethodDef __pyx_mdef_4cdec_5_cdec_3set_silent = {__Pyx_NAMESTR("set_silent"), (PyCFunction)__pyx_pw_4cdec_5_cdec_3set_silent, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_2set_silent)};
+static PyMethodDef __pyx_mdef_4cdec_5_cdec_3set_silent = {"set_silent", (PyCFunction)__pyx_pw_4cdec_5_cdec_3set_silent, METH_O, __pyx_doc_4cdec_5_cdec_2set_silent};
static PyObject *__pyx_pw_4cdec_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__pyx_v_yn) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_silent (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2set_silent(__pyx_self, ((PyObject *)__pyx_v_yn));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":28
- * class ParseFailed(Exception): pass
- *
- * def set_silent(yn): # <<<<<<<<<<<<<<
- * """set_silent(bool): Configure the verbosity of cdec."""
- * SetSilent(yn)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_yn) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -18868,6 +20751,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_yn); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
SetSilent(__pyx_t_1);
+ /* "cdec/_cdec.pyx":28
+ * class ParseFailed(Exception): pass
+ *
+ * def set_silent(yn): # <<<<<<<<<<<<<<
+ * """set_silent(bool): Configure the verbosity of cdec."""
+ * SetSilent(yn)
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -18880,26 +20772,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx
}
static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/_cdec.pyx":32
+ * SetSilent(yn)
+ *
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_5_cdec_5_make_config = {__Pyx_NAMESTR("_make_config"), (PyCFunction)__pyx_pw_4cdec_5_cdec_5_make_config, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_5_cdec_5_make_config = {"_make_config", (PyCFunction)__pyx_pw_4cdec_5_cdec_5_make_config, METH_O, 0};
static PyObject *__pyx_pw_4cdec_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_make_config (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_4_make_config(__pyx_self, ((PyObject *)__pyx_v_config));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":32
- * SetSilent(yn)
- *
- * def _make_config(config): # <<<<<<<<<<<<<<
- * for key, value in config.items():
- * if isinstance(value, dict):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -18918,18 +20812,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__p
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_config);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_config);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_6generator20, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_6generator20, (PyObject *) __pyx_cur_scope, __pyx_n_s_make_config, __pyx_n_s_make_config); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec._make_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -18942,9 +20834,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- Py_ssize_t __pyx_t_3;
- PyObject *(*__pyx_t_4)(PyObject *);
- PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
@@ -18977,48 +20869,66 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* if isinstance(value, dict):
* for name, info in value.items():
*/
- __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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s_items); 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);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
- __pyx_t_4 = NULL;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); 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_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+ __pyx_t_5 = NULL;
+ } else {
+ __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); 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);
+ __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_1 = __pyx_t_5(__pyx_t_2);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
- PyObject* sequence = __pyx_t_2;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -19031,30 +20941,29 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else
- {
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
- index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_5);
+ index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -19069,14 +20978,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
__pyx_L7_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_key);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_cur_scope->__pyx_v_key = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_value);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_value = __pyx_t_6;
__pyx_t_6 = 0;
/* "cdec/_cdec.pyx":34
@@ -19097,48 +21004,66 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* yield key, '%s %s' % (name, info)
* elif isinstance(value, list):
*/
- __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_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_value, __pyx_n_s_items); 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_11 = 0;
- __pyx_t_12 = NULL;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
- __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_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0;
+ __pyx_t_12 = NULL;
+ } else {
+ __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); 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_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- 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_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_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_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_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_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
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_6))) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __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_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __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_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __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();
+ __pyx_t_1 = __pyx_t_12(__pyx_t_6);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_1);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
- PyObject* sequence = __pyx_t_6;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -19151,30 +21076,29 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_7 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_7);
#else
- __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
#endif
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- } else
- {
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
Py_ssize_t index = -1;
- __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_t_13 = PyObject_GetIter(__pyx_t_1); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__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 = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
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_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -19189,14 +21113,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
__pyx_L12_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_name);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_cur_scope->__pyx_v_name = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_info);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_info);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_info, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
- __pyx_cur_scope->__pyx_v_info = __pyx_t_7;
__pyx_t_7 = 0;
/* "cdec/_cdec.pyx":36
@@ -19206,33 +21128,33 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* elif isinstance(value, list):
* for name in value:
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_name);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_info);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_info);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_info);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_info);
- __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_7));
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_s_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_key);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_key);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_7));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
__pyx_t_7 = 0;
- __pyx_r = ((PyObject *)__pyx_t_6);
- __pyx_t_6 = 0;
- __Pyx_XGIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_XGIVEREF(__pyx_t_2);
- __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_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_t_3 = __pyx_t_6;
__pyx_cur_scope->__pyx_t_4 = __pyx_t_11;
__pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
__Pyx_XGIVEREF(__pyx_r);
@@ -19241,19 +21163,27 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
__pyx_generator->resume_label = 1;
return __pyx_r;
__pyx_L13_resume_from_yield:;
- __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
- __Pyx_XGOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- __pyx_cur_scope->__pyx_t_1 = 0;
__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_4 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
+ __pyx_t_6 = __pyx_cur_scope->__pyx_t_3;
+ __pyx_cur_scope->__pyx_t_3 = 0;
+ __Pyx_XGOTREF(__pyx_t_6);
__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;}
+
+ /* "cdec/_cdec.pyx":35
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ * for name, info in value.items(): # <<<<<<<<<<<<<<
+ * yield key, '%s %s' % (name, info)
+ * elif isinstance(value, list):
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L8;
}
@@ -19275,45 +21205,47 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* yield key, name
* 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_11 = 0;
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_value)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_value)) {
+ __pyx_t_6 = __pyx_cur_scope->__pyx_v_value; __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0;
__pyx_t_12 = NULL;
} else {
- __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_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- 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_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_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_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_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_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
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_6))) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __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_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __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_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __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();
+ __pyx_t_1 = __pyx_t_12(__pyx_t_6);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_name);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_name = __pyx_t_6;
- __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
/* "cdec/_cdec.pyx":39
* elif isinstance(value, list):
@@ -19322,22 +21254,22 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* else:
* yield key, str(value)
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_key);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_key);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_name);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
- __pyx_r = ((PyObject *)__pyx_t_6);
- __pyx_t_6 = 0;
- __Pyx_XGIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_XGIVEREF(__pyx_t_2);
- __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_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_t_3 = __pyx_t_6;
__pyx_cur_scope->__pyx_t_4 = __pyx_t_11;
__pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
__Pyx_XGIVEREF(__pyx_r);
@@ -19346,19 +21278,27 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
__pyx_generator->resume_label = 2;
return __pyx_r;
__pyx_L16_resume_from_yield:;
- __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
- __Pyx_XGOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- __pyx_cur_scope->__pyx_t_1 = 0;
__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_4 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
+ __pyx_t_6 = __pyx_cur_scope->__pyx_t_3;
+ __pyx_cur_scope->__pyx_t_3 = 0;
+ __Pyx_XGOTREF(__pyx_t_6);
__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;}
+
+ /* "cdec/_cdec.pyx":38
+ * yield key, '%s %s' % (name, info)
+ * elif isinstance(value, list):
+ * for name in value: # <<<<<<<<<<<<<<
+ * yield key, name
+ * else:
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L8;
}
/*else*/ {
@@ -19370,50 +21310,68 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
*
* cdef class Decoder:
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_value);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_value);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_key);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_key);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_6;
__pyx_t_6 = 0;
- __pyx_r = ((PyObject *)__pyx_t_2);
- __pyx_t_2 = 0;
- __Pyx_XGIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
- __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 3;
return __pyx_r;
__pyx_L17_resume_from_yield:;
- __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
- __Pyx_XGOTREF(__pyx_t_1);
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
+ __Pyx_XGOTREF(__pyx_t_2);
+ __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L8:;
+
+ /* "cdec/_cdec.pyx":33
+ *
+ * def _make_config(config):
+ * for key, value in config.items(): # <<<<<<<<<<<<<<
+ * if isinstance(value, dict):
+ * for name, info in value.items():
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "cdec/_cdec.pyx":32
+ * SetSilent(yn)
+ *
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_13);
@@ -19426,6 +21384,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
return NULL;
}
+/* "cdec/_cdec.pyx":47
+ * cdef DenseVector weights
+ *
+ * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """Decoder('formalism = scfg') -> initialize from configuration string
+ * Decoder(formalism='scfg') -> initialize from named parameters
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Decoder___init__[] = "Decoder('formalism = scfg') -> initialize from configuration string\n Decoder(formalism='scfg') -> initialize from named parameters\n Create a decoder using a given configuration. Formalism is required.";
@@ -19444,16 +21410,8 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyOb
__pyx_v_config = PyDict_New(); if (unlikely(!__pyx_v_config)) return -1;
__Pyx_GOTREF(__pyx_v_config);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config_str,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_config_str,0};
PyObject* values[1] = {0};
-
- /* "cdec/_cdec.pyx":47
- * cdef DenseVector weights
- *
- * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
- * """Decoder('formalism = scfg') -> initialize from configuration string
- * Decoder(formalism='scfg') -> initialize from named parameters
- */
values[0] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -19467,7 +21425,7 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyOb
switch (pos_args) {
case 0:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__config_str);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_config_str);
if (value) { values[0] = value; kw_args--; }
}
}
@@ -19493,6 +21451,8 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyOb
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder___init__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), __pyx_v_config_str, __pyx_v_config);
+
+ /* function exit code */
__Pyx_XDECREF(__pyx_v_config);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -19500,7 +21460,7 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyOb
static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* "cdec/_cdec.pyx":56
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
* cdef istringstream* config_stream = new istringstream(config_str)
@@ -19525,18 +21485,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_8__init___genexpr(PyObject *__py
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Decoder.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -19550,8 +21508,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_Gen
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
+ PyObject *__pyx_t_4 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *(*__pyx_t_6)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -19566,66 +21525,84 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_Gen
}
__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_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;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_make_config); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config));
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__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;
+ 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_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_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);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); 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);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); 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);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __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 = 56; __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;
- #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 = 56; __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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_3 = __pyx_t_5(__pyx_t_2);
- if (unlikely(!__pyx_t_3)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_1 = __pyx_t_6(__pyx_t_2);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_kv);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_kv);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_v_kv = __pyx_t_3;
- __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_r = ((PyObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_kv, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s_3, __pyx_cur_scope->__pyx_v_kv); 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);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_XGIVEREF(__pyx_t_2);
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -19635,17 +21612,20 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_Gen
__pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
__Pyx_XGOTREF(__pyx_t_2);
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
- __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -19673,9 +21653,10 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- char *__pyx_t_7;
+ PyObject *__pyx_t_7 = NULL;
+ char *__pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -19707,9 +21688,9 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
* if config_str is None:
* formalism = config.get('formalism', None) # <<<<<<<<<<<<<<
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
*/
- __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_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_cur_scope->__pyx_v_config, __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;
@@ -19718,116 +21699,130 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
* if config_str is None:
* formalism = config.get('formalism', None)
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb', # <<<<<<<<<<<<<<
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
*/
__Pyx_INCREF(__pyx_v_formalism);
__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);
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_scfg, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L12_next_and;
} else {
- __pyx_t_5 = ((int)__pyx_t_2);
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_5) {
- __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);
+ __pyx_L12_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_fst, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L11_next_and;
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_L11_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_lextrans, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L10_next_and;
} else {
- __pyx_t_1 = __pyx_t_5;
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
+ __pyx_L10_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_pb, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
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);
+ goto __pyx_L9_next_and;
} else {
__pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
- 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);
+ __pyx_L9_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_csplit, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L8_next_and;
} else {
- __pyx_t_5 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_5) {
- __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);
+ __pyx_L8_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_tagger, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L7_next_and;
} else {
- __pyx_t_1 = __pyx_t_5;
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
+ __pyx_L7_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_lexalign, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
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);
+ goto __pyx_L6_next_and;
} else {
__pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
+ __pyx_L6_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_t2s, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_t_1;
+ __pyx_L5_bool_binop_done:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* "cdec/_cdec.pyx":55
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
* raise InvalidConfig('formalism "%s" unknown' % formalism) # <<<<<<<<<<<<<<
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config))
* cdef istringstream* config_stream = new istringstream(config_str)
*/
- __pyx_t_3 = __Pyx_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_48), __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_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_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_InvalidConfig); 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_t_5 = __Pyx_PyString_Format(__pyx_kp_s_formalism_s_unknown, __pyx_v_formalism); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, 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_7); __pyx_t_7 = 0;
+ }
__Pyx_DECREF(__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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L4;
}
- __pyx_L4:;
/* "cdec/_cdec.pyx":56
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
* cdef istringstream* config_stream = new istringstream(config_str)
* self.dec = new decoder.Decoder(config_stream)
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_40), __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_4cdec_5_cdec_7Decoder_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_pf_4cdec_5_cdec_7Decoder_8__init___genexpr(((PyObject*)__pyx_cur_scope)); 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_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_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;
+ __pyx_t_4 = __Pyx_PyString_Join(__pyx_kp_s__16, __pyx_t_3); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF_SET(__pyx_v_config_str, __pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
__pyx_L3:;
@@ -19839,8 +21834,8 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
* self.dec = new decoder.Decoder(config_stream)
* del config_stream
*/
- __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);
+ __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_config_str); if (unlikely((!__pyx_t_8) && 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_8);
/* "cdec/_cdec.pyx":58
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config))
@@ -19867,14 +21862,14 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
* self.weights.vector = &self.dec.CurrentWeightVector()
* self.weights.owned = True
*/
- __pyx_t_6 = __pyx_tp_new_4cdec_5_cdec_DenseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_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_4cdec_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_4 = __pyx_tp_new_4cdec_5_cdec_DenseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_DenseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->weights);
__Pyx_DECREF(((PyObject *)__pyx_v_self->weights));
- __pyx_v_self->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_t_6);
- __pyx_t_6 = 0;
+ __pyx_v_self->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_t_4);
+ __pyx_t_4 = 0;
/* "cdec/_cdec.pyx":61
* del config_stream
@@ -19894,12 +21889,23 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
*/
__pyx_v_self->weights->owned = 1;
+ /* "cdec/_cdec.pyx":47
+ * cdef DenseVector weights
+ *
+ * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """Decoder('formalism = scfg') -> initialize from configuration string
+ * Decoder(formalism='scfg') -> initialize from named parameters
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec._cdec.Decoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -19910,24 +21916,26 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
return __pyx_r;
}
+/* "cdec/_cdec.pyx":64
+ * self.weights.owned = True
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.dec
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "cdec/_cdec.pyx":64
- * self.weights.owned = True
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.dec
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
@@ -19940,9 +21948,26 @@ static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __p
*/
delete __pyx_v_self->dec;
+ /* "cdec/_cdec.pyx":64
+ * self.weights.owned = True
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.dec
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/_cdec.pyx":68
+ *
+ * property weights:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.weights
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_self) {
@@ -19950,18 +21975,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":68
- *
- * property weights:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.weights
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -19979,13 +21998,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self->weights);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/_cdec.pyx":68
+ *
+ * property weights:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.weights
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/_cdec.pyx":71
+ * return self.weights
+ *
+ * def __set__(self, weights): # <<<<<<<<<<<<<<
+ * if isinstance(weights, DenseVector):
+ * self.weights.vector[0] = (<DenseVector> weights).vector[0]
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
static int __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
@@ -19993,18 +22028,12 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":71
- * return self.weights
- *
- * def __set__(self, weights): # <<<<<<<<<<<<<<
- * if isinstance(weights, DenseVector):
- * self.weights.vector[0] = (<DenseVector> weights).vector[0]
- */
-
static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_v_fname = NULL;
PyObject *__pyx_v_fval = NULL;
@@ -20014,9 +22043,9 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
int __pyx_t_2;
PyObject *__pyx_t_3 = 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_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ PyObject *(*__pyx_t_7)(PyObject *);
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
PyObject *(*__pyx_t_10)(PyObject *);
@@ -20096,48 +22125,66 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
* self.weights[fname] = fval
* else:
*/
- __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_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_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s_items); 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;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else {
- __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_t_3 = __Pyx_PyObject_CallNoArg(__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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
+ __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
+ __pyx_t_7 = NULL;
+ } else {
+ __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); 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_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
for (;;) {
- 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_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_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_6 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __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_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
+ if (likely(!__pyx_t_7)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; 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_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; 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_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __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();
+ __pyx_t_3 = __pyx_t_7(__pyx_t_4);
+ if (unlikely(!__pyx_t_3)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_3);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
- PyObject* sequence = __pyx_t_4;
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -20150,30 +22197,29 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_7 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_8 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_8);
#else
- __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_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__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_4); __pyx_t_4 = 0;
- } else
- {
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
Py_ssize_t index = -1;
- __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_t_9 = PyObject_GetIter(__pyx_t_3); 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_DECREF(__pyx_t_3); __pyx_t_3 = 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);
+ index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_5);
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;}
@@ -20187,11 +22233,9 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
{__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_7;
- __pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_v_fval);
- __pyx_v_fval = __pyx_t_8;
+ __Pyx_XDECREF_SET(__pyx_v_fname, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_fval, __pyx_t_8);
__pyx_t_8 = 0;
/* "cdec/_cdec.pyx":79
@@ -20201,9 +22245,17 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
* 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 = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(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;}
+
+ /* "cdec/_cdec.pyx":78
+ * elif isinstance(weights, dict):
+ * self.weights.vector.clear()
+ * for fname, fval in weights.items(): # <<<<<<<<<<<<<<
+ * self.weights[fname] = fval
+ * else:
+ */
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
@@ -20215,28 +22267,37 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
*
* property formalism:
*/
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), ((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_t_4 = __Pyx_PyString_Format(__pyx_kp_s_cannot_initialize_weights_with_s, ((PyObject *)Py_TYPE(__pyx_v_weights))); 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_t_3 = PyTuple_New(1); 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);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); 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);
__Pyx_DECREF(__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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
+ /* "cdec/_cdec.pyx":71
+ * return self.weights
+ *
+ * def __set__(self, weights): # <<<<<<<<<<<<<<
+ * if isinstance(weights, DenseVector):
+ * self.weights.vector[0] = (<DenseVector> weights).vector[0]
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("cdec._cdec.Decoder.weights.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -20248,6 +22309,14 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "cdec/_cdec.pyx":84
+ *
+ * property formalism:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef variables_map* conf = &self.dec.GetConf()
+ * return str(conf[0]['formalism'].as_str().c_str())
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_self) {
@@ -20255,18 +22324,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":84
- *
- * property formalism:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef variables_map* conf = &self.dec.GetConf()
- * return str(conf[0]['formalism'].as_str().c_str())
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) {
const boost::program_options::variables_map *__pyx_v_conf;
PyObject *__pyx_r = NULL;
@@ -20295,22 +22358,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(struct __pyx_
* def read_weights(self, weights):
*/
__Pyx_XDECREF(__pyx_r);
- __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_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(__pyx_t_1);
__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));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&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_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/_cdec.pyx":84
+ *
+ * property formalism:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef variables_map* conf = &self.dec.GetConf()
+ * return str(conf[0]['formalism'].as_str().c_str())
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -20322,6 +22392,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(struct __pyx_
return __pyx_r;
}
+/* "cdec/_cdec.pyx":88
+ * return str(conf[0]['formalism'].as_str().c_str())
+ *
+ * def read_weights(self, weights): # <<<<<<<<<<<<<<
+ * """decoder.read_weights(filename): Read decoder weights from a file."""
+ * with open(weights) as fp:
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Decoder_4read_weights[] = "decoder.read_weights(filename): Read decoder weights from a file.";
@@ -20330,18 +22408,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read_weights (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":88
- * return str(conf[0]['formalism'].as_str().c_str())
- *
- * def read_weights(self, weights): # <<<<<<<<<<<<<<
- * """decoder.read_weights(filename): Read decoder weights from a file."""
- * with open(weights) as fp:
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_v_fp = NULL;
PyObject *__pyx_v_line = NULL;
@@ -20356,10 +22428,10 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- int __pyx_t_10;
- PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
+ int __pyx_t_11;
PyObject *__pyx_t_12 = NULL;
PyObject *(*__pyx_t_13)(PyObject *);
double __pyx_t_14;
@@ -20383,27 +22455,43 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
__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 = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __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 = __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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__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 = __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 = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); 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_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_fp = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
/* "cdec/_cdec.pyx":91
* """decoder.read_weights(filename): Read decoder weights from a file."""
@@ -20412,42 +22500,44 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
* if line.strip().startswith('#'): continue
* fname, value = line.split()
*/
- if (PyList_CheckExact(__pyx_v_fp) || PyTuple_CheckExact(__pyx_v_fp)) {
- __pyx_t_4 = __pyx_v_fp; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_fp)) || PyTuple_CheckExact(__pyx_v_fp)) {
+ __pyx_t_4 = __pyx_v_fp; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
+ __pyx_t_10 = 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 = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = -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;
+ __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- 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 = 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 = 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 = 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 = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; 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_9); __pyx_t_9++; 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_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; 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_9); __pyx_t_9++; 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);
+ __pyx_t_2 = __pyx_t_10(__pyx_t_4);
if (unlikely(!__pyx_t_2)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_2);
}
- __Pyx_XDECREF(__pyx_v_line);
- __pyx_v_line = __pyx_t_2;
+ __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_2);
__pyx_t_2 = 0;
/* "cdec/_cdec.pyx":92
@@ -20457,24 +22547,37 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
* fname, value = line.split()
* self.weights[fname.strip()] = float(value)
*/
- __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); 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 = __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_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); 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_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_startswith); 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 = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__21, NULL); 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;
- if (__pyx_t_10) {
- goto __pyx_L16_continue;
- goto __pyx_L18;
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_11) {
+ goto __pyx_L15_continue;
}
- __pyx_L18:;
/* "cdec/_cdec.pyx":93
* for line in fp:
@@ -20483,9 +22586,24 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
* self.weights[fname.strip()] = float(value)
*
*/
- __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_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 = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); 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))) {
@@ -20503,48 +22621,45 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_1 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_5);
#else
__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 = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
#endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else
- {
+ } 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 = 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;
- index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L19_unpacking_failed;
+ index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L18_unpacking_failed;
__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);
+ index = 1; __pyx_t_5 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_5)) goto __pyx_L18_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_5);
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;
- __pyx_L19_unpacking_failed:;
+ goto __pyx_L19_unpacking_done;
+ __pyx_L18_unpacking_failed:;
__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 = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_L20_unpacking_done:;
+ __pyx_L19_unpacking_done:;
}
- __Pyx_XDECREF(__pyx_v_fname);
- __pyx_v_fname = __pyx_t_1;
+ __Pyx_XDECREF_SET(__pyx_v_fname, __pyx_t_1);
__pyx_t_1 = 0;
- __Pyx_XDECREF(__pyx_v_value);
- __pyx_v_value = __pyx_t_11;
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_5);
+ __pyx_t_5 = 0;
/* "cdec/_cdec.pyx":94
* if line.strip().startswith('#'): continue
@@ -20556,26 +22671,49 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
__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 = __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fname, __pyx_n_s_strip); 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 = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_12) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ } else {
+ __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_5, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_L16_continue:;
+
+ /* "cdec/_cdec.pyx":91
+ * """decoder.read_weights(filename): Read decoder weights from a file."""
+ * with open(weights) as fp:
+ * for line in fp: # <<<<<<<<<<<<<<
+ * if line.strip().startswith('#'): continue
+ * fname, value = line.split()
+ */
+ __pyx_L15_continue:;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -20588,84 +22726,84 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
*/
/*except:*/ {
__Pyx_AddTraceback("cdec._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 = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_5) < 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_5);
+ __pyx_t_1 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_1);
- __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);
- __Pyx_GIVEREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
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_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- 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_11 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_16 = ((!(__pyx_t_11 != 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_XGIVEREF(__pyx_t_5);
+ __Pyx_ErrRestore(__pyx_t_4, __pyx_t_2, __pyx_t_5);
+ __pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- goto __pyx_L23;
}
- __pyx_L23:;
- __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
- if (__pyx_t_3) {
- __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_52, NULL);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- 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 (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*normal exit:*/{
+ if (__pyx_t_3) {
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__22, NULL);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ goto __pyx_L6;
}
+ __pyx_L6:;
}
- goto __pyx_L24;
+ goto __pyx_L23;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L24:;
+ __pyx_L23:;
}
+ /* "cdec/_cdec.pyx":88
+ * return str(conf[0]['formalism'].as_str().c_str())
+ *
+ * def read_weights(self, weights): # <<<<<<<<<<<<<<
+ * """decoder.read_weights(filename): Read decoder weights from a file."""
+ * with open(weights) as fp:
+ */
+
+ /* function exit code */
__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_4);
- __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_AddTraceback("cdec._cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
@@ -20679,6 +22817,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
return __pyx_r;
}
+/* "cdec/_cdec.pyx":96
+ * self.weights[fname.strip()] = float(value)
+ *
+ * def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
+ * """decoder.translate(sentence, grammar=None) -> Hypergraph
+ * Translate a sentence (string/Lattice) with a grammar (string/list of rules)."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Decoder_6translate[] = "decoder.translate(sentence, grammar=None) -> Hypergraph\n Translate a sentence (string/Lattice) with a grammar (string/list of rules).";
@@ -20692,16 +22838,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("translate (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sentence,&__pyx_n_s_grammar,0};
PyObject* values[2] = {0,0};
-
- /* "cdec/_cdec.pyx":96
- * self.weights[fname.strip()] = float(value)
- *
- * def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
- * """decoder.translate(sentence, grammar=None) -> Hypergraph
- * Translate a sentence (string/Lattice) with a grammar (string/list of rules)."""
- */
values[1] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -20715,11 +22853,11 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_sel
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sentence)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sentence)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grammar);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_grammar);
if (value) { values[1] = value; kw_args--; }
}
}
@@ -20746,6 +22884,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_sel
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_6translate(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), __pyx_v_sentence, __pyx_v_grammar);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -20760,7 +22900,8 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
- std::string __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
+ std::string __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -20784,16 +22925,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* elif isinstance(sentence, Lattice):
* input_str = str(sentence) # PLF format
*/
- __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_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_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sentence, __pyx_n_s_strip); 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_t_3 = ((PyObject *)__pyx_f_4cdec_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_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); 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;
+ __pyx_t_4 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, 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_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
@@ -20815,17 +22971,17 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence))
*/
- __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_t_4 = PyTuple_New(1); 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_INCREF(__pyx_v_sentence);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_sentence);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_sentence);
__Pyx_GIVEREF(__pyx_v_sentence);
- __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;
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->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_3);
+ __pyx_t_3 = 0;
goto __pyx_L3;
}
/*else*/ {
@@ -20837,18 +22993,18 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* if grammar:
* if isinstance(grammar, basestring):
*/
- __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((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_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_translate_input_type_s, ((PyObject *)Py_TYPE(__pyx_v_sentence))); 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);
- 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_t_4 = PyTuple_New(1); 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);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); 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(__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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -20881,11 +23037,11 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
*/
- __pyx_t_4 = ((PyObject *)__pyx_f_4cdec_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);
+ __pyx_t_3 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_grammar, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = __pyx_convert_string_from_py_(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_self->dec->AddSupplementalGrammarFromString(__pyx_t_6);
goto __pyx_L5;
}
/*else*/ {
@@ -20897,16 +23053,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(input_str, &observer)
*/
- __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_t_3 = PyTuple_New(1); 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_INCREF(__pyx_v_grammar);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_grammar);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_grammar);
__Pyx_GIVEREF(__pyx_v_grammar);
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_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_4cdec_5_cdec_TextGrammar *)__pyx_t_3)->__pyx_base.grammar[0]));
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TextGrammar)), __pyx_t_3, NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_4cdec_5_cdec_TextGrammar *)__pyx_t_4)->__pyx_base.grammar[0]));
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_L5:;
goto __pyx_L4;
@@ -20929,8 +23085,8 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* if observer.hypergraph == NULL:
* raise ParseFailed()
*/
- __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));
+ __pyx_t_6 = __pyx_convert_string_from_py_(__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_6, (&__pyx_v_observer));
/* "cdec/_cdec.pyx":113
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
@@ -20949,17 +23105,30 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
*/
- __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_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_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_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); 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_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/_cdec.pyx":115
* if observer.hypergraph == NULL:
@@ -20968,7 +23137,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg
*/
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_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_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), __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_4cdec_5_cdec_Hypergraph *)__pyx_t_4);
__pyx_t_4 = 0;
@@ -20991,11 +23160,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
__pyx_r = ((PyObject *)__pyx_v_hg);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/_cdec.pyx":96
+ * self.weights[fname.strip()] = float(value)
+ *
+ * def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
+ * """decoder.translate(sentence, grammar=None) -> Hypergraph
+ * Translate a sentence (string/Lattice) with a grammar (string/list of rules)."""
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec._cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -21019,6 +23196,10 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) {
char *__pyx_v_data;
std::string __pyx_r;
__Pyx_RefNannyDeclarations
+ char *__pyx_t_1;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_convert_string_from_py_", 0);
/* "string.from_py":15
@@ -21028,7 +23209,8 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) {
* return string(data, length)
*
*/
- __pyx_v_data = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length));
+ __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_data = __pyx_t_1;
/* "string.from_py":16
* cdef Py_ssize_t length
@@ -21040,86 +23222,408 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) {
__pyx_r = std::string(__pyx_v_data, __pyx_v_length);
goto __pyx_L0;
+ /* "string.from_py":13
+ *
+ * @cname("__pyx_convert_string_from_py_")
+ * cdef string __pyx_convert_string_from_py_(object o) except *: # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t length
+ * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
+ */
+
+ /* function exit code */
+ __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 struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
} else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_4cdec_5_cdec_DenseVector(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+static PyObject *__pyx_sq_item_4cdec_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_4cdec_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(o, i, v);
+ }
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_DenseVector[] = {
+ {"dot", (PyCFunction)__pyx_pw_4cdec_5_cdec_11DenseVector_14dot, METH_O, __pyx_doc_4cdec_5_cdec_11DenseVector_13dot},
+ {"tosparse", (PyCFunction)__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse, METH_NOARGS, __pyx_doc_4cdec_5_cdec_11DenseVector_15tosparse},
+ {0, 0, 0, 0}
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_DenseVector = {
+ __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ __pyx_sq_item_4cdec_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 PyMappingMethods __pyx_tp_as_mapping_DenseVector = {
+ __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_4cdec_5_cdec_DenseVector, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "cdec._cdec.DenseVector", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_DenseVector), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_4cdec_5_cdec_DenseVector, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ &__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*/
+ 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_4cdec_5_cdec_11DenseVector_11__iter__, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_4cdec_5_cdec_DenseVector, /*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*/
+ __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_4cdec_5_cdec_DenseVector, /*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*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec_SparseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o);
- p->__pyx_v_i = 0;
- p->__pyx_v_self = 0;
- p->__pyx_t_1 = 0;
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_i);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_t_1);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_SparseVector(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+static PyObject *__pyx_sq_item_4cdec_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_mp_ass_subscript_4cdec_5_cdec_SparseVector(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(o, i, v);
+ }
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_SparseVector[] = {
+ {"copy", (PyCFunction)__pyx_pw_4cdec_5_cdec_12SparseVector_5copy, METH_NOARGS, __pyx_doc_4cdec_5_cdec_12SparseVector_4copy},
+ {"dot", (PyCFunction)__pyx_pw_4cdec_5_cdec_12SparseVector_14dot, METH_O, __pyx_doc_4cdec_5_cdec_12SparseVector_13dot},
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_SparseVector = {
+ __pyx_pw_4cdec_5_cdec_12SparseVector_32__add__, /*nb_add*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__, /*nb_subtract*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__, /*nb_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_pw_4cdec_5_cdec_12SparseVector_38__div__, /*nb_divide*/
+ #endif
+ 0, /*nb_remainder*/
+ 0, /*nb_divmod*/
+ 0, /*nb_power*/
+ __pyx_pw_4cdec_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_4cdec_5_cdec_12SparseVector_24__iadd__, /*nb_inplace_add*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__, /*nb_inplace_subtract*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__, /*nb_inplace_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_pw_4cdec_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*/
+ 0, /*nb_index*/
+ #if PY_VERSION_HEX >= 0x03050000
+ 0, /*nb_matrix_multiply*/
+ #endif
+ #if PY_VERSION_HEX >= 0x03050000
+ 0, /*nb_inplace_matrix_multiply*/
+ #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_SparseVector = {
+ __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ __pyx_sq_item_4cdec_5_cdec_SparseVector, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_SparseVector = {
+ __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_4cdec_5_cdec_SparseVector, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "cdec._cdec.SparseVector", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_SparseVector), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_4cdec_5_cdec_SparseVector, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ &__pyx_tp_as_number_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*/
+ 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_4cdec_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_4cdec_5_cdec_SparseVector, /*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*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_4cdec_5_cdec_SparseVector, /*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*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_NT *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
} else {
- (*Py_TYPE(o)->tp_free)(o);
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_NT *)o);
+ p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ return o;
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o;
- if (p->__pyx_v_i) {
- e = (*v)(p->__pyx_v_i, a); if (e) return e;
+static void __pyx_tp_dealloc_4cdec_5_cdec_NT(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec_NT *p = (struct __pyx_obj_4cdec_5_cdec_NT *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ #endif
+ Py_CLEAR(p->cat);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_2NT_cat(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(o);
+}
+
+static int __pyx_setprop_4cdec_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(o, v);
}
- if (p->__pyx_t_1) {
- e = (*v)(p->__pyx_t_1, a); if (e) return e;
+ else {
+ return __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(o);
}
- return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___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_4cdec_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 PyObject *__pyx_getprop_4cdec_5_cdec_2NT_ref(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(o);
+}
+
+static int __pyx_setprop_4cdec_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_24___iter__[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_NT[] = {
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__ = {
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_NT[] = {
+ {(char *)"cat", __pyx_getprop_4cdec_5_cdec_2NT_cat, __pyx_setprop_4cdec_5_cdec_2NT_cat, 0, 0},
+ {(char *)"ref", __pyx_getprop_4cdec_5_cdec_2NT_ref, __pyx_setprop_4cdec_5_cdec_2NT_ref, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_NT = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_24___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__), /*tp_basicsize*/
+ "cdec._cdec.NT", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_NT), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_NT, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21134,29 +23638,29 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__ = {
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- 0, /*tp_str*/
+ __pyx_pw_4cdec_5_cdec_2NT_3__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_HAVE_GC, /*tp_flags*/
+ 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_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_NT, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_NT, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_4cdec_5_cdec_2NT_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_NT, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21165,25 +23669,134 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_4cdec_5_cdec_NTRef(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_5NTRef_ref(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(o);
+}
+
+static int __pyx_setprop_4cdec_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_5NTRef_3ref_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_NTRef[] = {
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_NTRef[] = {
+ {(char *)"ref", __pyx_getprop_4cdec_5_cdec_5NTRef_ref, __pyx_setprop_4cdec_5_cdec_5NTRef_ref, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "cdec._cdec.NTRef", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_NTRef), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_4cdec_5_cdec_NTRef, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ __pyx_pw_4cdec_5_cdec_5NTRef_3__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_4cdec_5_cdec_NTRef, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_4cdec_5_cdec_NTRef, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_4cdec_5_cdec_5NTRef_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_4cdec_5_cdec_NTRef, /*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*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
static PyObject *__pyx_tp_new_4cdec_5_cdec_TRule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
return o;
}
static void __pyx_tp_dealloc_4cdec_5_cdec_TRule(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_4cdec_5_cdec_5TRule_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
@@ -21280,7 +23893,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_TRule[] = {
static PyTypeObject __pyx_type_4cdec_5_cdec_TRule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.TRule"), /*tp_name*/
+ "cdec._cdec.TRule", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec_TRule), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec_TRule, /*tp_dealloc*/
@@ -21329,8 +23942,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_TRule = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -21346,7 +23960,7 @@ static PyMethodDef __pyx_methods_4cdec_5_cdec_MRule[] = {
static PyTypeObject __pyx_type_4cdec_5_cdec_MRule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.MRule"), /*tp_name*/
+ "cdec._cdec.MRule", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec_MRule), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec_TRule, /*tp_dealloc*/
@@ -21399,80 +24013,69 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_MRule = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Grammar(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_DenseVector(PyObject *o) {
+static void __pyx_tp_dealloc_4cdec_5_cdec_Grammar(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ __pyx_pw_4cdec_5_cdec_7Grammar_1__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_4cdec_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 PyObject *__pyx_getprop_4cdec_5_cdec_7Grammar_name(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(o);
}
-static int __pyx_mp_ass_subscript_4cdec_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_setprop_4cdec_5_cdec_7Grammar_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(o, i, v);
+ return __pyx_pw_4cdec_5_cdec_7Grammar_4name_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_4cdec_5_cdec_DenseVector[] = {
- {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_4cdec_5_cdec_11DenseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_11DenseVector_13dot)},
- {__Pyx_NAMESTR("tosparse"), (PyCFunction)__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_11DenseVector_15tosparse)},
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Grammar[] = {
{0, 0, 0, 0}
};
-static PySequenceMethods __pyx_tp_as_sequence_DenseVector = {
- __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_4cdec_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 PyMappingMethods __pyx_tp_as_mapping_DenseVector = {
- __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_4cdec_5_cdec_DenseVector, /*mp_ass_subscript*/
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Grammar[] = {
+ {(char *)"name", __pyx_getprop_4cdec_5_cdec_7Grammar_name, __pyx_setprop_4cdec_5_cdec_7Grammar_name, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.DenseVector"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_DenseVector), /*tp_basicsize*/
+ "cdec._cdec.Grammar", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Grammar), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_DenseVector, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21483,8 +24086,8 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- &__pyx_tp_as_sequence_DenseVector, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_DenseVector, /*tp_as_mapping*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
@@ -21497,19 +24100,19 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__, /*tp_iter*/
+ __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_DenseVector, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Grammar, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_Grammar, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_DenseVector, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Grammar, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21518,139 +24121,28 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+static PyObject *__pyx_tp_new_4cdec_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = __pyx_tp_new_4cdec_5_cdec_Grammar(t, a, k);
if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_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_4cdec_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_4cdec_5_cdec_15SufficientStats_score(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(o);
-}
-
-static PyMethodDef __pyx_methods_4cdec_5_cdec_SufficientStats[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_TextGrammar[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_SufficientStats[] = {
- {(char *)"score", __pyx_getprop_4cdec_5_cdec_15SufficientStats_score, 0, 0, 0},
- {(char *)"detail", __pyx_getprop_4cdec_5_cdec_15SufficientStats_detail, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_SufficientStats = {
- __pyx_pw_4cdec_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_4cdec_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_4cdec_5_cdec_15SufficientStats_3__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_4cdec_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_4cdec_5_cdec_15SufficientStats_3__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_TextGrammar = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.SufficientStats"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_SufficientStats), /*tp_basicsize*/
+ "cdec._cdec.TextGrammar", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_TextGrammar), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21660,9 +24152,9 @@ static PyTypeObject __pyx_type_4cdec_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*/
@@ -21675,19 +24167,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_15SufficientStats_5__iter__, /*tp_iter*/
+ #if CYTHON_COMPILING_IN_PYPY
+ __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/
+ #else
+ 0, /*tp_iter*/
+ #endif
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_SufficientStats, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_TextGrammar, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_SufficientStats, /*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_4cdec_5_cdec_11TextGrammar_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_SufficientStats, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_TextGrammar, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21696,118 +24192,97 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
+static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph __pyx_vtable_4cdec_5_cdec_Hypergraph;
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_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;
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)o);
+ p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_Hypergraph;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_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_4cdec_5_cdec___pyx_scope_struct_23_lines < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
}
+ (*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_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_4cdec_5_cdec_10Hypergraph_edges(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(o);
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_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_4cdec_5_cdec_10Hypergraph_nodes(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_goal(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_23_lines[] = {
+static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Hypergraph[] = {
+ {"viterbi", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_2viterbi},
+ {"viterbi_trees", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_4viterbi_trees},
+ {"viterbi_features", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_6viterbi_features},
+ {"viterbi_forest", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest, METH_NOARGS, 0},
+ {"viterbi_joshua", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_10viterbi_joshua},
+ {"kbest", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_12kbest},
+ {"kbest_trees", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_15kbest_trees},
+ {"kbest_features", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_18kbest_features},
+ {"unique_kbest", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_22unique_kbest, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_21unique_kbest},
+ {"unique_kbest_trees", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_25unique_kbest_trees, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees},
+ {"unique_kbest_features", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_28unique_kbest_features, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_27unique_kbest_features},
+ {"sample", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_30sample},
+ {"sample_trees", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_33sample_trees},
+ {"intersect", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_37intersect, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_36intersect},
+ {"prune", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_5_cdec_10Hypergraph_38prune},
+ {"lattice", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_41lattice, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_40lattice},
+ {"plf", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_43plf, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_42plf},
+ {"reweight", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_45reweight, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_44reweight},
+ {"inside_outside", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_47inside_outside, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_46inside_outside},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Hypergraph[] = {
+ {(char *)"edges", __pyx_getprop_4cdec_5_cdec_10Hypergraph_edges, 0, 0, 0},
+ {(char *)"nodes", __pyx_getprop_4cdec_5_cdec_10Hypergraph_nodes, 0, 0, 0},
+ {(char *)"goal", __pyx_getprop_4cdec_5_cdec_10Hypergraph_goal, 0, 0, 0},
+ {(char *)"npaths", __pyx_getprop_4cdec_5_cdec_10Hypergraph_npaths, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_23_lines"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines), /*tp_basicsize*/
+ "cdec._cdec.Hypergraph", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Hypergraph), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21826,17 +24301,17 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
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_HAVE_GC, /*tp_flags*/
+ 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_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Hypergraph, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_Hypergraph, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -21844,7 +24319,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Hypergraph, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21853,179 +24328,135 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
+static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge __pyx_vtable_4cdec_5_cdec_HypergraphEdge;
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o);
- p->__pyx_v_config = 0;
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o);
+ p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge;
+ p->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_config);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->trule);
+ (*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec_HypergraphEdge(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o;
- if (p->__pyx_v_config) {
- e = (*v)(p->__pyx_v_config, a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+ if (p->trule) {
+ e = (*v)(((PyObject*)p->trule), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec_HypergraphEdge(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_config);
- p->__pyx_v_config = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+ tmp = ((PyObject*)p->trule);
+ p->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_27___init__[] = {
- {0, 0, 0, 0}
-};
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_head_node(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(o);
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__ = {
- PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_27___init__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- #if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
- #else
- 0, /*reserved*/
- #endif
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
- 0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_27___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_4cdec_5_cdec___pyx_scope_struct_27___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_getprop_4cdec_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o);
+}
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ = 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(o);
+}
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p;
- PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o);
- p->__pyx_v_self = 0;
- return o;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_src_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(o);
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
- }
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_feature_values(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get__(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
- }
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_prob(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(o);
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_trule(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_21___iter__[] = {
+static int __pyx_setprop_4cdec_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_5__del__(o);
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphEdge[] = {
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_HypergraphEdge[] = {
+ {(char *)"head_node", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_head_node, 0, 0, 0},
+ {(char *)"tail_nodes", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_tail_nodes, 0, 0, 0},
+ {(char *)"span", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_span, 0, 0, 0},
+ {(char *)"src_span", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_src_span, 0, 0, 0},
+ {(char *)"feature_values", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_feature_values, 0, 0, 0},
+ {(char *)"prob", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_prob, 0, 0, 0},
+ {(char *)"trule", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_trule, __pyx_setprop_4cdec_5_cdec_14HypergraphEdge_trule, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_HypergraphEdge = {
+ __pyx_pw_4cdec_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_4cdec_5_cdec_14HypergraphEdge_1__len__, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_21___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__), /*tp_basicsize*/
+ "cdec._cdec.HypergraphEdge", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22036,25 +24467,25 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
+ &__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*/
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*/
+ 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_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_clear*/
- 0, /*tp_richcompare*/
+ __pyx_tp_traverse_4cdec_5_cdec_HypergraphEdge, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec_HypergraphEdge, /*tp_clear*/
+ __pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_HypergraphEdge, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_HypergraphEdge, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -22062,7 +24493,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_HypergraphEdge, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22071,61 +24502,75 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
+static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode __pyx_vtable_4cdec_5_cdec_HypergraphNode;
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_Metric *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_HypergraphNode *p;
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_Metric *)o);
- p->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
- if (unlikely(__pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
- Py_DECREF(o); o = 0;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)o);
+ p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_HypergraphNode;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Metric(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->scorer);
+static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec_Metric(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
- if (p->scorer) {
- e = (*v)(((PyObject*)p->scorer), a); if (e) return e;
- }
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_id(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(o);
}
-static int __pyx_tp_clear_4cdec_5_cdec_Metric(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->scorer);
- p->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_in_edges(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Metric[] = {
- {__Pyx_NAMESTR("score"), (PyCFunction)__pyx_pw_4cdec_5_cdec_6Metric_5score, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_4cdec_5_cdec_6Metric_7evaluate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_out_edges(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphNode[] = {
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_HypergraphNode[] = {
+ {(char *)"id", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_id, 0, 0, 0},
+ {(char *)"in_edges", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_in_edges, 0, 0, 0},
+ {(char *)"out_edges", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_out_edges, 0, 0, 0},
+ {(char *)"span", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_span, 0, 0, 0},
+ {(char *)"cat", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_cat, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Metric"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Metric), /*tp_basicsize*/
+ "cdec._cdec.HypergraphNode", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphNode), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Metric, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22139,22 +24584,22 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
- __pyx_pw_4cdec_5_cdec_6Metric_3__call__, /*tp_call*/
+ 0, /*tp_call*/
0, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 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_4cdec_5_cdec_Metric, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec_Metric, /*tp_clear*/
- 0, /*tp_richcompare*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ __pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Metric, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_HypergraphNode, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_HypergraphNode, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -22162,7 +24607,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Metric, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_HypergraphNode, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22171,78 +24616,93 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o);
- p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_Lattice(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
}
+ (*Py_TYPE(o)->tp_free)(o);
+}
+static PyObject *__pyx_sq_item_4cdec_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_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+static int __pyx_mp_ass_subscript_4cdec_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(o, i, v);
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
+ return -1;
}
- return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Lattice[] = {
+ {"__unicode__", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__, METH_NOARGS, 0},
+ {"todot", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_20todot, METH_NOARGS, __pyx_doc_4cdec_5_cdec_7Lattice_19todot},
+ {"as_hypergraph", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph, METH_NOARGS, __pyx_doc_4cdec_5_cdec_7Lattice_21as_hypergraph},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = {
+static PySequenceMethods __pyx_tp_as_sequence_Lattice = {
+ __pyx_pw_4cdec_5_cdec_7Lattice_11__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ __pyx_sq_item_4cdec_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_4cdec_5_cdec_7Lattice_11__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_4cdec_5_cdec_Lattice, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_11_unique_kbest"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest), /*tp_basicsize*/
+ "cdec._cdec.Lattice", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Lattice), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Lattice, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22253,23 +24713,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest =
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
+ &__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_4cdec_5_cdec_7Lattice_13__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_HAVE_GC, /*tp_flags*/
+ 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_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_4cdec_5_cdec_7Lattice_17__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Lattice, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22277,9 +24737,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest =
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_4cdec_5_cdec_7Lattice_3__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Lattice, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22288,19 +24748,29 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
static PyObject *__pyx_tp_new_4cdec_5_cdec_Candidate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
return o;
}
static void __pyx_tp_dealloc_4cdec_5_cdec_Candidate(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
(*Py_TYPE(o)->tp_free)(o);
}
@@ -22326,10 +24796,6 @@ static int __pyx_setprop_4cdec_5_cdec_9Candidate_score(PyObject *o, PyObject *v,
}
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Candidate[] = {
- {0, 0, 0, 0}
-};
-
static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Candidate[] = {
{(char *)"words", __pyx_getprop_4cdec_5_cdec_9Candidate_words, 0, 0, 0},
{(char *)"fmap", __pyx_getprop_4cdec_5_cdec_9Candidate_fmap, 0, 0, 0},
@@ -22339,7 +24805,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Candidate[] = {
static PyTypeObject __pyx_type_4cdec_5_cdec_Candidate = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Candidate"), /*tp_name*/
+ "cdec._cdec.Candidate", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec_Candidate), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec_Candidate, /*tp_dealloc*/
@@ -22369,7 +24835,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Candidate = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Candidate, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_4cdec_5_cdec_Candidate, /*tp_getset*/
0, /*tp_base*/
@@ -22388,31 +24854,43 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Candidate = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_SparseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_4cdec_5_cdec_15SufficientStats_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_SparseVector(PyObject *o) {
+static void __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_4cdec_5_cdec_SparseVector(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_4cdec_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);
@@ -22420,34 +24898,35 @@ static PyObject *__pyx_sq_item_4cdec_5_cdec_SparseVector(PyObject *o, Py_ssize_t
return r;
}
-static int __pyx_mp_ass_subscript_4cdec_5_cdec_SparseVector(PyObject *o, PyObject *i, PyObject *v) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(o, i, v);
- }
- else {
- PyErr_Format(PyExc_NotImplementedError,
- "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
- return -1;
- }
+static PyObject *__pyx_getprop_4cdec_5_cdec_15SufficientStats_score(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_SparseVector[] = {
- {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4cdec_5_cdec_12SparseVector_5copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_12SparseVector_4copy)},
- {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_4cdec_5_cdec_12SparseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_12SparseVector_13dot)},
+static PyObject *__pyx_getprop_4cdec_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_SufficientStats[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number_SparseVector = {
- __pyx_pw_4cdec_5_cdec_12SparseVector_32__add__, /*nb_add*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__, /*nb_subtract*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__, /*nb_multiply*/
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_SufficientStats[] = {
+ {(char *)"score", __pyx_getprop_4cdec_5_cdec_15SufficientStats_score, 0, 0, 0},
+ {(char *)"detail", __pyx_getprop_4cdec_5_cdec_15SufficientStats_detail, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_SufficientStats = {
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_14__add__, /*nb_add*/
+ 0, /*nb_subtract*/
+ 0, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
- __pyx_pw_4cdec_5_cdec_12SparseVector_38__div__, /*nb_divide*/
+ 0, /*nb_divide*/
#endif
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__, /*nb_negative*/
+ 0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
@@ -22473,11 +24952,11 @@ static PyNumberMethods __pyx_tp_as_number_SparseVector = {
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
- __pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__, /*nb_inplace_add*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__, /*nb_inplace_subtract*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__, /*nb_inplace_multiply*/
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_12__iadd__, /*nb_inplace_add*/
+ 0, /*nb_inplace_subtract*/
+ 0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
- __pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__, /*nb_inplace_divide*/
+ 0, /*nb_inplace_divide*/
#endif
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
@@ -22490,36 +24969,40 @@ static PyNumberMethods __pyx_tp_as_number_SparseVector = {
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
- #if PY_VERSION_HEX >= 0x02050000
0, /*nb_index*/
+ #if PY_VERSION_HEX >= 0x03050000
+ 0, /*nb_matrix_multiply*/
+ #endif
+ #if PY_VERSION_HEX >= 0x03050000
+ 0, /*nb_inplace_matrix_multiply*/
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence_SparseVector = {
- __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_SufficientStats = {
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_5__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
- __pyx_sq_item_4cdec_5_cdec_SparseVector, /*sq_item*/
+ __pyx_sq_item_4cdec_5_cdec_SufficientStats, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__, /*sq_contains*/
+ 0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping_SparseVector = {
- __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_4cdec_5_cdec_SparseVector, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_SufficientStats = {
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_5__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_10__getitem__, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
};
-static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.SparseVector"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_SparseVector), /*tp_basicsize*/
+ "cdec._cdec.SufficientStats", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_SufficientStats), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_SparseVector, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22529,9 +25012,9 @@ static PyTypeObject __pyx_type_4cdec_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*/
+ &__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*/
@@ -22542,21 +25025,21 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__, /*tp_iter*/
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_7__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_SparseVector, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_SufficientStats, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_SufficientStats, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_SparseVector, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_SufficientStats, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22565,118 +25048,80 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- }
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o);
- p->__pyx_v_config = 0;
- p->__pyx_v_info = 0;
- p->__pyx_v_key = 0;
- p->__pyx_v_name = 0;
- p->__pyx_v_value = 0;
- p->__pyx_t_0 = 0;
- p->__pyx_t_1 = 0;
- return o;
-}
-
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_config);
- Py_CLEAR(p->__pyx_v_info);
- Py_CLEAR(p->__pyx_v_key);
- Py_CLEAR(p->__pyx_v_name);
- Py_CLEAR(p->__pyx_v_value);
- Py_CLEAR(p->__pyx_t_0);
- Py_CLEAR(p->__pyx_t_1);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o);
} else {
- (*Py_TYPE(o)->tp_free)(o);
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(o, a, k) < 0)) {
+ Py_DECREF(o); o = 0;
}
+ return o;
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o;
- if (p->__pyx_v_config) {
- e = (*v)(p->__pyx_v_config, a); if (e) return e;
- }
- if (p->__pyx_v_info) {
- e = (*v)(p->__pyx_v_info, a); if (e) return e;
- }
- if (p->__pyx_v_key) {
- e = (*v)(p->__pyx_v_key, a); if (e) return e;
- }
- if (p->__pyx_v_name) {
- e = (*v)(p->__pyx_v_name, a); if (e) return e;
- }
- if (p->__pyx_v_value) {
- e = (*v)(p->__pyx_v_value, a); if (e) return e;
- }
- if (p->__pyx_t_0) {
- e = (*v)(p->__pyx_t_0, a); if (e) return e;
+static void __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
- if (p->__pyx_t_1) {
- e = (*v)(p->__pyx_t_1, a); if (e) return e;
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
}
- return 0;
+ (*Py_TYPE(o)->tp_free)(o);
}
-
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_config);
- p->__pyx_v_config = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_info);
- p->__pyx_v_info = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_key);
- p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_name);
- p->__pyx_v_name = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_value);
- p->__pyx_v_value = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_0);
- p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_1);
- p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static PyObject *__pyx_sq_item_4cdec_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_4cdec_5_cdec___pyx_scope_struct_26__make_config[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_CandidateSet[] = {
+ {"add_kbest", (PyCFunction)__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_5_cdec_12CandidateSet_11add_kbest},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config = {
+static PySequenceMethods __pyx_tp_as_sequence_CandidateSet = {
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ __pyx_sq_item_4cdec_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 PyMappingMethods __pyx_tp_as_mapping_CandidateSet = {
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_26__make_config"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config), /*tp_basicsize*/
+ "cdec._cdec.CandidateSet", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_CandidateSet), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22687,23 +25132,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config =
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
+ &__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*/
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*/
+ 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_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_CandidateSet, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22713,7 +25158,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config =
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_CandidateSet, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22722,89 +25167,52 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_NT *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_SegmentEvaluator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_NT *)o);
- p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_NT(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_NT *p = (struct __pyx_obj_4cdec_5_cdec_NT *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->cat);
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static int __pyx_tp_traverse_4cdec_5_cdec_NT(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec_NT *p = (struct __pyx_obj_4cdec_5_cdec_NT *)o;
- if (p->cat) {
- e = (*v)(p->cat, a); if (e) return e;
- }
- return 0;
-}
-
-static int __pyx_tp_clear_4cdec_5_cdec_NT(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_NT *p = (struct __pyx_obj_4cdec_5_cdec_NT *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->cat);
- p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_2NT_cat(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(o);
-}
-
-static int __pyx_setprop_4cdec_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(o, v);
- }
- else {
- return __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(o);
- }
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_2NT_ref(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(o);
-}
-
-static int __pyx_setprop_4cdec_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(o, v);
+static void __pyx_tp_dealloc_4cdec_5_cdec_SegmentEvaluator(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_16SegmentEvaluator_1__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
}
+ (*Py_TYPE(o)->tp_free)(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_NT[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_SegmentEvaluator[] = {
+ {"evaluate", (PyCFunction)__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate, METH_O, __pyx_doc_4cdec_5_cdec_16SegmentEvaluator_2evaluate},
+ {"candidate_set", (PyCFunction)__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set, METH_NOARGS, __pyx_doc_4cdec_5_cdec_16SegmentEvaluator_4candidate_set},
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_NT[] = {
- {(char *)"cat", __pyx_getprop_4cdec_5_cdec_2NT_cat, __pyx_setprop_4cdec_5_cdec_2NT_cat, 0, 0},
- {(char *)"ref", __pyx_getprop_4cdec_5_cdec_2NT_ref, __pyx_setprop_4cdec_5_cdec_2NT_ref, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_NT = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_SegmentEvaluator = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.NT"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_NT), /*tp_basicsize*/
+ "cdec._cdec.SegmentEvaluator", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_NT, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_SegmentEvaluator, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22819,29 +25227,29 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_NT = {
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_4cdec_5_cdec_2NT_3__str__, /*tp_str*/
+ 0, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 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_4cdec_5_cdec_NT, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec_NT, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_NT, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_SegmentEvaluator, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_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_4cdec_5_cdec_2NT_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_NT, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_SegmentEvaluator, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22850,84 +25258,53 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_NT = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
- if (unlikely(__pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ if (unlikely(__pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(o, a, k) < 0)) {
Py_DECREF(o); o = 0;
}
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Lattice(PyObject *o) {
+static void __pyx_tp_dealloc_4cdec_5_cdec_Scorer(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ __pyx_pw_4cdec_5_cdec_6Scorer_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_4cdec_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_4cdec_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_7Lattice_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_4cdec_5_cdec_Lattice[] = {
- {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("todot"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_20todot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_7Lattice_19todot)},
- {__Pyx_NAMESTR("as_hypergraph"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_7Lattice_21as_hypergraph)},
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Scorer[] = {
{0, 0, 0, 0}
};
-static PySequenceMethods __pyx_tp_as_sequence_Lattice = {
- __pyx_pw_4cdec_5_cdec_7Lattice_11__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_4cdec_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_4cdec_5_cdec_7Lattice_11__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_4cdec_5_cdec_Lattice, /*mp_ass_subscript*/
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Lattice"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Lattice), /*tp_basicsize*/
+ "cdec._cdec.Scorer", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Scorer), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Lattice, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Scorer, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22938,11 +25315,11 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- &__pyx_tp_as_sequence_Lattice, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Lattice, /*tp_as_mapping*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
- 0, /*tp_call*/
- __pyx_pw_4cdec_5_cdec_7Lattice_13__str__, /*tp_str*/
+ __pyx_pw_4cdec_5_cdec_6Scorer_5__call__, /*tp_call*/
+ __pyx_pw_4cdec_5_cdec_6Scorer_7__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
@@ -22952,9 +25329,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_7Lattice_17__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Lattice, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Scorer, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22962,9 +25339,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_7Lattice_3__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Lattice, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Scorer, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22973,70 +25350,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_Metric *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_Metric *)o);
+ p->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
+ if (unlikely(__pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_Metric(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->scorer);
+ (*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec_Metric(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
+ if (p->scorer) {
+ e = (*v)(((PyObject*)p->scorer), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o;
+static int __pyx_tp_clear_4cdec_5_cdec_Metric(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
+ tmp = ((PyObject*)p->scorer);
+ p->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Metric[] = {
+ {"score", (PyCFunction)__pyx_pw_4cdec_5_cdec_6Metric_5score, METH_NOARGS, 0},
+ {"evaluate", (PyCFunction)__pyx_pw_4cdec_5_cdec_6Metric_7evaluate, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_15_sample_trees"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees), /*tp_basicsize*/
+ "cdec._cdec.Metric", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Metric), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Metric, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23050,20 +25428,20 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees =
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
- 0, /*tp_call*/
+ __pyx_pw_4cdec_5_cdec_6Metric_3__call__, /*tp_call*/
0, /*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_HAVE_GC, /*tp_flags*/
+ 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_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec_Metric, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec_Metric, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Metric, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23073,7 +25451,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees =
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Metric, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23082,125 +25460,100 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge __pyx_vtable_4cdec_5_cdec_HypergraphEdge;
-static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Decoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_Decoder *p;
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o);
- p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge;
- p->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ p = ((struct __pyx_obj_4cdec_5_cdec_Decoder *)o);
+ p->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec_Decoder(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->trule);
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_7Decoder_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ Py_CLEAR(p->weights);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec_HypergraphEdge(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec_Decoder(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
- if (p->trule) {
- e = (*v)(((PyObject*)p->trule), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+ if (p->weights) {
+ e = (*v)(((PyObject*)p->weights), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec_HypergraphEdge(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+static int __pyx_tp_clear_4cdec_5_cdec_Decoder(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->trule);
- p->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+ tmp = ((PyObject*)p->weights);
+ p->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_head_node(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_src_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_feature_values(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_prob(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_trule(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(o);
+static PyObject *__pyx_getprop_4cdec_5_cdec_7Decoder_weights(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(o);
}
-static int __pyx_setprop_4cdec_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_4cdec_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(o, v);
+ return __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(o, v);
}
else {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_5__del__(o);
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
}
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphEdge[] = {
+static PyObject *__pyx_getprop_4cdec_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Decoder[] = {
+ {"read_weights", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights, METH_O, __pyx_doc_4cdec_5_cdec_7Decoder_4read_weights},
+ {"translate", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Decoder_7translate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_5_cdec_7Decoder_6translate},
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_HypergraphEdge[] = {
- {(char *)"head_node", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_head_node, 0, 0, 0},
- {(char *)"tail_nodes", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_tail_nodes, 0, 0, 0},
- {(char *)"span", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_span, 0, 0, 0},
- {(char *)"src_span", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_src_span, 0, 0, 0},
- {(char *)"feature_values", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_feature_values, 0, 0, 0},
- {(char *)"prob", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_prob, 0, 0, 0},
- {(char *)"trule", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_trule, __pyx_setprop_4cdec_5_cdec_14HypergraphEdge_trule, 0, 0},
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Decoder[] = {
+ {(char *)"weights", __pyx_getprop_4cdec_5_cdec_7Decoder_weights, __pyx_setprop_4cdec_5_cdec_7Decoder_weights, 0, 0},
+ {(char *)"formalism", __pyx_getprop_4cdec_5_cdec_7Decoder_formalism, 0, 0, 0},
{0, 0, 0, 0, 0}
};
-static PySequenceMethods __pyx_tp_as_sequence_HypergraphEdge = {
- __pyx_pw_4cdec_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_4cdec_5_cdec_14HypergraphEdge_1__len__, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_Decoder = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.HypergraphEdge"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge), /*tp_basicsize*/
+ "cdec._cdec.Decoder", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Decoder), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Decoder, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23211,8 +25564,8 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- &__pyx_tp_as_sequence_HypergraphEdge, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_HypergraphEdge, /*tp_as_mapping*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
@@ -23221,23 +25574,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
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_4cdec_5_cdec_HypergraphEdge, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec_HypergraphEdge, /*tp_clear*/
- __pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__, /*tp_richcompare*/
+ __pyx_tp_traverse_4cdec_5_cdec_Decoder, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec_Decoder, /*tp_clear*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_HypergraphEdge, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Decoder, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_HypergraphEdge, /*tp_getset*/
+ __pyx_getsets_4cdec_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_4cdec_5_cdec_7Decoder_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_HypergraphEdge, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Decoder, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23246,70 +25599,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o);
- p->__pyx_v_phrase = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_phrase);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____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_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_phrase);
- p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_2__phrase[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_2__phrase"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct____iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23330,13 +25677,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
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_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23346,7 +25693,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23355,44 +25702,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) {
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(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_4cdec_5_cdec_6Scorer_1__cinit__(o, a, k) < 0)) {
- Py_DECREF(o); o = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
}
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Scorer(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_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_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Scorer[] = {
- {0, 0, 0, 0}
-};
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ return 0;
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Scorer"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Scorer), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_1___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Scorer, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23406,20 +25773,20 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
- __pyx_pw_4cdec_5_cdec_6Scorer_5__call__, /*tp_call*/
- __pyx_pw_4cdec_5_cdec_6Scorer_7__str__, /*tp_str*/
+ 0, /*tp_call*/
+ 0, /*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*/
+ 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_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Scorer, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23429,7 +25796,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Scorer, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23438,65 +25805,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode __pyx_vtable_4cdec_5_cdec_HypergraphNode;
-static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_HypergraphNode *p;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)o);
- p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_HypergraphNode;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode(PyObject *o) {
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_id(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_in_edges(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_out_edges(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_phrase);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(o);
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_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 PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(o);
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+ tmp = ((PyObject*)p->__pyx_v_phrase);
+ p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphNode[] = {
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_HypergraphNode[] = {
- {(char *)"id", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_id, 0, 0, 0},
- {(char *)"in_edges", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_in_edges, 0, 0, 0},
- {(char *)"out_edges", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_out_edges, 0, 0, 0},
- {(char *)"span", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_span, 0, 0, 0},
- {(char *)"cat", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_cat, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.HypergraphNode"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphNode), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_2__phrase", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23515,17 +25881,17 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
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*/
+ 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_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__, /*tp_richcompare*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_clear*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_HypergraphNode, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_HypergraphNode, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -23533,7 +25899,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_HypergraphNode, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23542,86 +25908,78 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_fmap);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_w);
+ Py_CLEAR(p->__pyx_t_0);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_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_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ if (p->__pyx_v_w) {
+ e = (*v)(p->__pyx_v_w, 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_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_fmap);
- p->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_w);
+ p->__pyx_v_w = 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_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_10_kbest_features"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_3_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23642,13 +26000,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features
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_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23658,7 +26016,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23667,51 +26025,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_NTRef(PyObject *o) {
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_5NTRef_ref(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_setprop_4cdec_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_5NTRef_3ref_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_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 PyMethodDef __pyx_methods_4cdec_5_cdec_NTRef[] = {
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_NTRef[] = {
- {(char *)"ref", __pyx_getprop_4cdec_5_cdec_5NTRef_ref, __pyx_setprop_4cdec_5_cdec_5NTRef_ref, 0, 0},
- {0, 0, 0, 0, 0}
-};
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.NTRef"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_NTRef), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_4___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_NTRef, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23726,29 +26097,29 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = {
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_4cdec_5_cdec_5NTRef_3__str__, /*tp_str*/
+ 0, /*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*/
+ 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_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_NTRef, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_NTRef, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_5NTRef_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_NTRef, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23757,60 +26128,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Grammar(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Grammar(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_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_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_7Grammar_name(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(o);
-}
-
-static int __pyx_setprop_4cdec_5_cdec_7Grammar_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_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 PyMethodDef __pyx_methods_4cdec_5_cdec_Grammar[] = {
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Grammar[] = {
- {(char *)"name", __pyx_getprop_4cdec_5_cdec_7Grammar_name, __pyx_setprop_4cdec_5_cdec_7Grammar_name, 0, 0},
- {0, 0, 0, 0, 0}
-};
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Grammar"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Grammar), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_5___str__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23829,17 +26204,17 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
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*/
+ 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_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Grammar, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_Grammar, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -23847,7 +26222,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Grammar, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23856,88 +26231,78 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph __pyx_vtable_4cdec_5_cdec_Hypergraph;
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *p;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)o);
- p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_Hypergraph;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_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);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_edges(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_nodes(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(o);
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_goal(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(o);
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_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_4cdec_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(o);
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec_Hypergraph[] = {
- {__Pyx_NAMESTR("viterbi"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_2viterbi)},
- {__Pyx_NAMESTR("viterbi_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_4viterbi_trees)},
- {__Pyx_NAMESTR("viterbi_features"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_6viterbi_features)},
- {__Pyx_NAMESTR("viterbi_forest"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("viterbi_joshua"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_10viterbi_joshua)},
- {__Pyx_NAMESTR("kbest"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_12kbest)},
- {__Pyx_NAMESTR("kbest_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_15kbest_trees)},
- {__Pyx_NAMESTR("kbest_features"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_18kbest_features)},
- {__Pyx_NAMESTR("unique_kbest"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_22unique_kbest, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_21unique_kbest)},
- {__Pyx_NAMESTR("unique_kbest_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_25unique_kbest_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees)},
- {__Pyx_NAMESTR("unique_kbest_features"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_28unique_kbest_features, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_27unique_kbest_features)},
- {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_30sample)},
- {__Pyx_NAMESTR("sample_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_33sample_trees)},
- {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_37intersect, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_36intersect)},
- {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_38prune)},
- {__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_41lattice, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_40lattice)},
- {__Pyx_NAMESTR("plf"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_43plf, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_42plf)},
- {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_45reweight, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_44reweight)},
- {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_47inside_outside, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_46inside_outside)},
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Hypergraph[] = {
- {(char *)"edges", __pyx_getprop_4cdec_5_cdec_10Hypergraph_edges, 0, 0, 0},
- {(char *)"nodes", __pyx_getprop_4cdec_5_cdec_10Hypergraph_nodes, 0, 0, 0},
- {(char *)"goal", __pyx_getprop_4cdec_5_cdec_10Hypergraph_goal, 0, 0, 0},
- {(char *)"npaths", __pyx_getprop_4cdec_5_cdec_10Hypergraph_npaths, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Hypergraph"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Hypergraph), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_6_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23956,17 +26321,17 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
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*/
+ 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_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Hypergraph, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_Hypergraph, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -23974,7 +26339,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Hypergraph, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23983,71 +26348,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k) {
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(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_4cdec_5_cdec_12CandidateSet_1__cinit__(o, a, k) < 0)) {
- Py_DECREF(o); o = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
}
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_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_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ Py_CLEAR(p->__pyx_v_trule);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
-}
-static PyObject *__pyx_sq_item_4cdec_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_4cdec_5_cdec_CandidateSet[] = {
- {__Pyx_NAMESTR("add_kbest"), (PyCFunction)__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_12CandidateSet_11add_kbest)},
- {0, 0, 0, 0}
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_CandidateSet = {
- __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_4cdec_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_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_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 PyMappingMethods __pyx_tp_as_mapping_CandidateSet = {
- __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.CandidateSet"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_CandidateSet), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_7___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24058,23 +26423,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- &__pyx_tp_as_sequence_CandidateSet, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_CandidateSet, /*tp_as_mapping*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 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_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_CandidateSet, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24084,7 +26449,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_CandidateSet, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24093,70 +26458,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o);
+ Py_CLEAR(p->__pyx_v_size);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_22_todot[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_22_todot"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_8_kbest", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24177,13 +26543,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
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_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24193,7 +26559,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24202,8 +26568,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -24211,22 +26578,16 @@ static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_fre
static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees)))) {
o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees));
- PyObject_INIT(o, t);
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_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;
}
@@ -24237,7 +26598,7 @@ static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObj
Py_CLEAR(p->__pyx_v_f_tree);
Py_CLEAR(p->__pyx_v_self);
Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees)))) {
__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -24247,12 +26608,6 @@ static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObj
static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_4cdec_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;
}
@@ -24263,14 +26618,8 @@ static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObj
}
static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_4cdec_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);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -24280,13 +26629,9 @@ static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees[] = {
- {0, 0, 0, 0}
-};
-
static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_9_kbest_trees"), /*tp_name*/
+ "cdec._cdec.__pyx_scope_struct_9_kbest_trees", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_dealloc*/
@@ -24316,7 +26661,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24335,70 +26680,78 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_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);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o);
+ Py_CLEAR(p->__pyx_v_size);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+ tmp = ((PyObject*)p->__pyx_v_fmap);
+ p->__pyx_v_fmap = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_5___str__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_5___str__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_10_kbest_features", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24419,95 +26772,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__ = {
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_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_5___str__, /*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_4cdec_5_cdec___pyx_scope_struct_5___str__, /*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_4cdec_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_4cdec_5_cdec_SegmentEvaluator(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_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 PyMethodDef __pyx_methods_4cdec_5_cdec_SegmentEvaluator[] = {
- {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_16SegmentEvaluator_2evaluate)},
- {__Pyx_NAMESTR("candidate_set"), (PyCFunction)__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_16SegmentEvaluator_4candidate_set)},
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_SegmentEvaluator = {
- PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.SegmentEvaluator"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_SegmentEvaluator, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- #if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
- #else
- 0, /*reserved*/
- #endif
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
- 0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_SegmentEvaluator, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24517,7 +26788,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SegmentEvaluator = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_SegmentEvaluator, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24526,70 +26797,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SegmentEvaluator = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o);
+ Py_CLEAR(p->__pyx_v_size);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_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_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_16___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_16___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_11_unique_kbest", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24610,13 +26882,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
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_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24626,7 +26898,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24635,70 +26907,73 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_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);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o);
+ Py_CLEAR(p->__pyx_v_size);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)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_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_20___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_20___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_12_unique_kbest_trees", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24719,13 +26994,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
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_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24735,7 +27010,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24744,8 +27019,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -24753,21 +27029,16 @@ static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features
static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = 0;
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features)))) {
o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features));
- PyObject_INIT(o, t);
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *)o);
- p->__pyx_v_fmap = 0;
- p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
@@ -24777,7 +27048,7 @@ static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_fea
Py_CLEAR(p->__pyx_v_fmap);
Py_CLEAR(p->__pyx_v_self);
Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features)))) {
__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -24800,8 +27071,8 @@ static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_fea
}
static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *)o;
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *)o;
tmp = ((PyObject*)p->__pyx_v_fmap);
p->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -24814,13 +27085,9 @@ static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_featur
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features[] = {
- {0, 0, 0, 0}
-};
-
static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_13_unique_kbest_features"), /*tp_name*/
+ "cdec._cdec.__pyx_scope_struct_13_unique_kbest_features", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features, /*tp_dealloc*/
@@ -24850,7 +27117,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_f
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24869,86 +27136,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_f
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_kv = 0;
- p->__pyx_t_0 = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)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_4cdec_5_cdec___pyx_scope_struct_28_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_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;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_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_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___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);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_28_genexpr[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_28_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_14_sample", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24969,13 +27214,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
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_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24985,7 +27230,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24994,86 +27239,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)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_4cdec_5_cdec___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)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_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_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);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_3_genexpr[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_3_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_15_sample_trees", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25094,13 +27317,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
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_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25110,7 +27333,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25119,78 +27342,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_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;
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
- }
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_8_kbest[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_8_kbest"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_16___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25211,13 +27420,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
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_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25227,7 +27436,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25236,70 +27445,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_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;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_18___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_18___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_17___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25320,13 +27523,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
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_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25336,7 +27539,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25345,78 +27548,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_trule);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)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_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_7___iter__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_7___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_18___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25437,13 +27626,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
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_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25453,7 +27642,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25462,8 +27651,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -25471,19 +27661,16 @@ static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *__pyx_freeli
static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ = 0;
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__)))) {
o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_19___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__));
- PyObject_INIT(o, t);
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
@@ -25491,7 +27678,7 @@ static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_19___get__(PyObject
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__)))) {
__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_19___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -25508,21 +27695,17 @@ static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_19___get__(PyObject
}
static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_19___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o;
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_19___get__[] = {
- {0, 0, 0, 0}
-};
-
static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_19___get__"), /*tp_name*/
+ "cdec._cdec.__pyx_scope_struct_19___get__", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_19___get__, /*tp_dealloc*/
@@ -25552,7 +27735,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__ = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_19___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25571,140 +27754,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
- #endif
-};
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k) {
- PyObject *o = __pyx_tp_new_4cdec_5_cdec_Grammar(t, a, k);
- if (unlikely(!o)) return 0;
- return o;
-}
-
-static PyMethodDef __pyx_methods_4cdec_5_cdec_TextGrammar[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_TextGrammar = {
- PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.TextGrammar"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_TextGrammar), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- #if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
- #else
- 0, /*reserved*/
- #endif
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_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*/
- #if CYTHON_COMPILING_IN_PYPY
- __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/
- #else
- 0, /*tp_iter*/
- #endif
- 0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_TextGrammar, /*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*/
- __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__, /*tp_init*/
- 0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_TextGrammar, /*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*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___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_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_25___iter__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_25___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_20___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25725,13 +27832,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
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_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25741,7 +27848,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25750,91 +27857,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Decoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_Decoder *p;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_Decoder *)o);
- p->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Decoder(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o;
PyObject_GC_UnTrack(o);
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_7Decoder_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- Py_CLEAR(p->weights);
- (*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec_Decoder(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
- if (p->weights) {
- e = (*v)(((PyObject*)p->weights), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___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_4cdec_5_cdec_Decoder(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->weights);
- p->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_7Decoder_weights(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(o);
-}
-
-static int __pyx_setprop_4cdec_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
- }
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(o);
-}
-
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Decoder[] = {
- {__Pyx_NAMESTR("read_weights"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_7Decoder_4read_weights)},
- {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Decoder_7translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_7Decoder_6translate)},
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Decoder[] = {
- {(char *)"weights", __pyx_getprop_4cdec_5_cdec_7Decoder_weights, __pyx_setprop_4cdec_5_cdec_7Decoder_weights, 0, 0},
- {(char *)"formalism", __pyx_getprop_4cdec_5_cdec_7Decoder_formalism, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_Decoder = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Decoder"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Decoder), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_21___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Decoder, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25853,25 +27933,25 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Decoder = {
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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 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_4cdec_5_cdec_Decoder, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec_Decoder, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Decoder, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_Decoder, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_7Decoder_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Decoder, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25880,70 +27960,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Decoder = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)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_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct____iter__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct____iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_22_todot", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25964,13 +28038,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
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_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25980,7 +28054,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25989,70 +28063,106 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)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 (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_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 int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_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_4cdec_5_cdec___pyx_scope_struct_14_sample[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_14_sample"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_23_lines", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26073,13 +28183,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
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_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26089,7 +28199,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26098,70 +28208,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___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_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_17___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_17___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_24___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26182,13 +28286,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
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_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26198,7 +28302,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26207,86 +28311,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_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_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_feat);
- Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_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;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___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_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_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);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_6_genexpr[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_6_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_25___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26307,13 +28389,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
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_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26323,7 +28405,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26332,94 +28414,106 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_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_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)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);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o);
+ Py_CLEAR(p->__pyx_v_config);
+ Py_CLEAR(p->__pyx_v_info);
+ Py_CLEAR(p->__pyx_v_key);
+ Py_CLEAR(p->__pyx_v_name);
+ Py_CLEAR(p->__pyx_v_value);
+ Py_CLEAR(p->__pyx_t_0);
+ Py_CLEAR(p->__pyx_t_3);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
- if (p->__pyx_v_e_tree) {
- e = (*v)(p->__pyx_v_e_tree, a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o;
+ if (p->__pyx_v_config) {
+ e = (*v)(p->__pyx_v_config, a); if (e) return e;
+ }
+ if (p->__pyx_v_info) {
+ e = (*v)(p->__pyx_v_info, 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_key) {
+ e = (*v)(p->__pyx_v_key, 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_name) {
+ e = (*v)(p->__pyx_v_name, a); if (e) return e;
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ if (p->__pyx_v_value) {
+ e = (*v)(p->__pyx_v_value, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ if (p->__pyx_t_3) {
+ e = (*v)(p->__pyx_t_3, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_e_tree);
- p->__pyx_v_e_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o;
+ tmp = ((PyObject*)p->__pyx_v_config);
+ p->__pyx_v_config = 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);
+ tmp = ((PyObject*)p->__pyx_v_info);
+ p->__pyx_v_info = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_key);
+ p->__pyx_v_key = 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_v_name);
+ p->__pyx_v_name = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_value);
+ p->__pyx_v_value = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_3);
+ p->__pyx_t_3 = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_12_unique_kbest_trees"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_26__make_config", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26440,13 +28534,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_t
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_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26456,7 +28550,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_t
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26465,70 +28559,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_t
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o);
+ Py_CLEAR(p->__pyx_v_config);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_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;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___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_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o;
+ 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_4cdec_5_cdec___pyx_scope_struct_4___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_4___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_27___init__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26549,13 +28637,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
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_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26565,7 +28653,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26574,70 +28662,78 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_kv);
+ Py_CLEAR(p->__pyx_t_0);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_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_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___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_4cdec_5_cdec___pyx_scope_struct_1___iter__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_1___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_28_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26658,13 +28754,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
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_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26674,7 +28770,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26683,8 +28779,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -26699,7 +28796,7 @@ static struct PyModuleDef __pyx_moduledef = {
#else
PyModuleDef_HEAD_INIT,
#endif
- __Pyx_NAMESTR("_cdec"),
+ "_cdec",
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
@@ -26711,163 +28808,196 @@ static struct PyModuleDef __pyx_moduledef = {
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
- {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
- {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
- {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
- {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
- {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
- {&__pyx_n_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 1},
- {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
- {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
- {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
- {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
- {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
- {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
- {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
- {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
- {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
- {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
- {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
- {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
- {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
- {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
- {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
- {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1},
- {&__pyx_n_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 1},
- {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
- {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
- {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
- {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
- {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
- {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
- {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
- {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
- {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
- {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
- {&__pyx_n_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 1},
- {&__pyx_n_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 1},
- {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
- {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
- {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
- {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
- {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
- {&__pyx_n_s__BLEU, __pyx_k__BLEU, sizeof(__pyx_k__BLEU), 0, 0, 1, 1},
- {&__pyx_n_s__CER, __pyx_k__CER, sizeof(__pyx_k__CER), 0, 0, 1, 1},
- {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
- {&__pyx_n_s__IBM_BLEU, __pyx_k__IBM_BLEU, sizeof(__pyx_k__IBM_BLEU), 0, 0, 1, 1},
- {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
- {&__pyx_n_s__InvalidConfig, __pyx_k__InvalidConfig, sizeof(__pyx_k__InvalidConfig), 0, 0, 1, 1},
- {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
- {&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1},
- {&__pyx_n_s__ParseFailed, __pyx_k__ParseFailed, sizeof(__pyx_k__ParseFailed), 0, 0, 1, 1},
- {&__pyx_n_s__QCRI, __pyx_k__QCRI, sizeof(__pyx_k__QCRI), 0, 0, 1, 1},
- {&__pyx_n_s__QCRI_BLEU, __pyx_k__QCRI_BLEU, sizeof(__pyx_k__QCRI_BLEU), 0, 0, 1, 1},
- {&__pyx_n_s__SSK, __pyx_k__SSK, sizeof(__pyx_k__SSK), 0, 0, 1, 1},
- {&__pyx_n_s__TER, __pyx_k__TER, sizeof(__pyx_k__TER), 0, 0, 1, 1},
- {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
- {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
- {&__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___make_config, __pyx_k___make_config, sizeof(__pyx_k___make_config), 0, 0, 1, 1},
- {&__pyx_n_s___phrase, __pyx_k___phrase, sizeof(__pyx_k___phrase), 0, 0, 1, 1},
- {&__pyx_n_s___sa, __pyx_k___sa, sizeof(__pyx_k___sa), 0, 0, 1, 1},
- {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
- {&__pyx_n_s__alignments, __pyx_k__alignments, sizeof(__pyx_k__alignments), 0, 0, 1, 1},
- {&__pyx_n_s__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},
- {&__pyx_n_s__delta, __pyx_k__delta, sizeof(__pyx_k__delta), 0, 0, 1, 1},
- {&__pyx_n_s__density, __pyx_k__density, sizeof(__pyx_k__density), 0, 0, 1, 1},
- {&__pyx_n_s__dot, __pyx_k__dot, sizeof(__pyx_k__dot), 0, 0, 1, 1},
- {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1},
- {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
- {&__pyx_n_s__encoding, __pyx_k__encoding, sizeof(__pyx_k__encoding), 0, 0, 1, 1},
- {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
- {&__pyx_n_s__eval, __pyx_k__eval, sizeof(__pyx_k__eval), 0, 0, 1, 1},
- {&__pyx_n_s__evaluate, __pyx_k__evaluate, sizeof(__pyx_k__evaluate), 0, 0, 1, 1},
- {&__pyx_n_s__evaluator, __pyx_k__evaluator, sizeof(__pyx_k__evaluator), 0, 0, 1, 1},
- {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1},
- {&__pyx_n_s__formalism, __pyx_k__formalism, sizeof(__pyx_k__formalism), 0, 0, 1, 1},
- {&__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},
- {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
- {&__pyx_n_s__in_edges, __pyx_k__in_edges, sizeof(__pyx_k__in_edges), 0, 0, 1, 1},
- {&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1},
- {&__pyx_n_s__inp, __pyx_k__inp, sizeof(__pyx_k__inp), 0, 0, 1, 1},
- {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
- {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
- {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
- {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
- {&__pyx_n_s__label, __pyx_k__label, sizeof(__pyx_k__label), 0, 0, 1, 1},
- {&__pyx_n_s__lexalign, __pyx_k__lexalign, sizeof(__pyx_k__lexalign), 0, 0, 1, 1},
- {&__pyx_n_s__lextrans, __pyx_k__lextrans, sizeof(__pyx_k__lextrans), 0, 0, 1, 1},
- {&__pyx_n_s__lhs, __pyx_k__lhs, sizeof(__pyx_k__lhs), 0, 0, 1, 1},
- {&__pyx_n_s__lines, __pyx_k__lines, sizeof(__pyx_k__lines), 0, 0, 1, 1},
- {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
- {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
- {&__pyx_n_s__pb, __pyx_k__pb, sizeof(__pyx_k__pb), 0, 0, 1, 1},
- {&__pyx_n_s__phrase, __pyx_k__phrase, sizeof(__pyx_k__phrase), 0, 0, 1, 1},
- {&__pyx_n_s__plf, __pyx_k__plf, sizeof(__pyx_k__plf), 0, 0, 1, 1},
- {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
- {&__pyx_n_s__ref, __pyx_k__ref, sizeof(__pyx_k__ref), 0, 0, 1, 1},
- {&__pyx_n_s__refs, __pyx_k__refs, sizeof(__pyx_k__refs), 0, 0, 1, 1},
- {&__pyx_n_s__replace, __pyx_k__replace, sizeof(__pyx_k__replace), 0, 0, 1, 1},
- {&__pyx_n_s__rhs, __pyx_k__rhs, sizeof(__pyx_k__rhs), 0, 0, 1, 1},
- {&__pyx_n_s__rules, __pyx_k__rules, sizeof(__pyx_k__rules), 0, 0, 1, 1},
- {&__pyx_n_s__scfg, __pyx_k__scfg, sizeof(__pyx_k__scfg), 0, 0, 1, 1},
- {&__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},
- {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
- {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
- {&__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__text, __pyx_k__text, sizeof(__pyx_k__text), 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},
- {&__pyx_n_s__yn, __pyx_k__yn, sizeof(__pyx_k__yn), 0, 0, 1, 1},
+ {&__pyx_n_s_BLEU, __pyx_k_BLEU, sizeof(__pyx_k_BLEU), 0, 0, 1, 1},
+ {&__pyx_n_s_CER, __pyx_k_CER, sizeof(__pyx_k_CER), 0, 0, 1, 1},
+ {&__pyx_n_s_CandidateSet___iter, __pyx_k_CandidateSet___iter, sizeof(__pyx_k_CandidateSet___iter), 0, 0, 1, 1},
+ {&__pyx_kp_s_Cannot_translate_input_type_s, __pyx_k_Cannot_translate_input_type_s, sizeof(__pyx_k_Cannot_translate_input_type_s), 0, 0, 1, 0},
+ {&__pyx_n_s_DenseVector___iter, __pyx_k_DenseVector___iter, sizeof(__pyx_k_DenseVector___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
+ {&__pyx_n_s_Grammar___iter, __pyx_k_Grammar___iter, sizeof(__pyx_k_Grammar___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_HypergraphEdge___get, __pyx_k_HypergraphEdge___get, sizeof(__pyx_k_HypergraphEdge___get), 0, 0, 1, 1},
+ {&__pyx_n_s_HypergraphNode___get, __pyx_k_HypergraphNode___get, sizeof(__pyx_k_HypergraphNode___get), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph___get, __pyx_k_Hypergraph___get, sizeof(__pyx_k_Hypergraph___get), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_kbest, __pyx_k_Hypergraph_kbest, sizeof(__pyx_k_Hypergraph_kbest), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_kbest_features, __pyx_k_Hypergraph_kbest_features, sizeof(__pyx_k_Hypergraph_kbest_features), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_kbest_trees, __pyx_k_Hypergraph_kbest_trees, sizeof(__pyx_k_Hypergraph_kbest_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_sample, __pyx_k_Hypergraph_sample, sizeof(__pyx_k_Hypergraph_sample), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_sample_trees, __pyx_k_Hypergraph_sample_trees, sizeof(__pyx_k_Hypergraph_sample_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_unique_kbest, __pyx_k_Hypergraph_unique_kbest, sizeof(__pyx_k_Hypergraph_unique_kbest), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_unique_kbest_features, __pyx_k_Hypergraph_unique_kbest_features, sizeof(__pyx_k_Hypergraph_unique_kbest_features), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_unique_kbest_trees, __pyx_k_Hypergraph_unique_kbest_trees, sizeof(__pyx_k_Hypergraph_unique_kbest_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_IBM_BLEU, __pyx_k_IBM_BLEU, sizeof(__pyx_k_IBM_BLEU), 0, 0, 1, 1},
+ {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
+ {&__pyx_n_s_InvalidConfig, __pyx_k_InvalidConfig, sizeof(__pyx_k_InvalidConfig), 0, 0, 1, 1},
+ {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
+ {&__pyx_n_s_Lattice___iter, __pyx_k_Lattice___iter, sizeof(__pyx_k_Lattice___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
+ {&__pyx_n_s_ParseFailed, __pyx_k_ParseFailed, sizeof(__pyx_k_ParseFailed), 0, 0, 1, 1},
+ {&__pyx_n_s_QCRI, __pyx_k_QCRI, sizeof(__pyx_k_QCRI), 0, 0, 1, 1},
+ {&__pyx_n_s_QCRI_BLEU, __pyx_k_QCRI_BLEU, sizeof(__pyx_k_QCRI_BLEU), 0, 0, 1, 1},
+ {&__pyx_n_s_SSK, __pyx_k_SSK, sizeof(__pyx_k_SSK), 0, 0, 1, 1},
+ {&__pyx_n_s_SparseVector___iter, __pyx_k_SparseVector___iter, sizeof(__pyx_k_SparseVector___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_SufficientStats___iter, __pyx_k_SufficientStats___iter, sizeof(__pyx_k_SufficientStats___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_TER, __pyx_k_TER, sizeof(__pyx_k_TER), 0, 0, 1, 1},
+ {&__pyx_n_s_TRule___get, __pyx_k_TRule___get, sizeof(__pyx_k_TRule___get), 0, 0, 1, 1},
+ {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
+ {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
+ {&__pyx_kp_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 0},
+ {&__pyx_kp_s__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 0, 1, 0},
+ {&__pyx_kp_s__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 1, 0},
+ {&__pyx_kp_s__16, __pyx_k__16, sizeof(__pyx_k__16), 0, 0, 1, 0},
+ {&__pyx_kp_s__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 0, 1, 0},
+ {&__pyx_n_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 1},
+ {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
+ {&__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_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_kp_s_candidate_set_index_out_of_range, __pyx_k_candidate_set_index_out_of_range, sizeof(__pyx_k_candidate_set_index_out_of_range), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_create_lattice_from_s, __pyx_k_cannot_create_lattice_from_s, sizeof(__pyx_k_cannot_create_lattice_from_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_initialize_weights_with_s, __pyx_k_cannot_initialize_weights_with_s, sizeof(__pyx_k_cannot_initialize_weights_with_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_intersect_hypergraph_with, __pyx_k_cannot_intersect_hypergraph_with, sizeof(__pyx_k_cannot_intersect_hypergraph_with), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_reweight_hypergraph_with, __pyx_k_cannot_reweight_hypergraph_with, sizeof(__pyx_k_cannot_reweight_hypergraph_with), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_take_the_dot_product_of_s, __pyx_k_cannot_take_the_dot_product_of_s, sizeof(__pyx_k_cannot_take_the_dot_product_of_s), 0, 0, 1, 0},
+ {&__pyx_n_s_cat, __pyx_k_cat, sizeof(__pyx_k_cat), 0, 0, 1, 1},
+ {&__pyx_n_s_cdec__cdec, __pyx_k_cdec__cdec, sizeof(__pyx_k_cdec__cdec), 0, 0, 1, 1},
+ {&__pyx_n_s_cdec_sa__sa, __pyx_k_cdec_sa__sa, sizeof(__pyx_k_cdec_sa__sa), 0, 0, 1, 1},
+ {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
+ {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
+ {&__pyx_kp_s_comparison_not_implemented_for_H, __pyx_k_comparison_not_implemented_for_H, sizeof(__pyx_k_comparison_not_implemented_for_H), 0, 0, 1, 0},
+ {&__pyx_kp_s_comparison_not_implemented_for_H_2, __pyx_k_comparison_not_implemented_for_H_2, sizeof(__pyx_k_comparison_not_implemented_for_H_2), 0, 0, 1, 0},
+ {&__pyx_kp_s_comparison_not_implemented_for_S, __pyx_k_comparison_not_implemented_for_S, sizeof(__pyx_k_comparison_not_implemented_for_S), 0, 0, 1, 0},
+ {&__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},
+ {&__pyx_n_s_csplit_preserve_full_word, __pyx_k_csplit_preserve_full_word, sizeof(__pyx_k_csplit_preserve_full_word), 0, 0, 1, 1},
+ {&__pyx_kp_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0},
+ {&__pyx_kp_s_d_d_label_s, __pyx_k_d_d_label_s, sizeof(__pyx_k_d_d_label_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_d_shape_doublecircle, __pyx_k_d_shape_doublecircle, sizeof(__pyx_k_d_shape_doublecircle), 0, 0, 1, 0},
+ {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1},
+ {&__pyx_n_s_density, __pyx_k_density, sizeof(__pyx_k_density), 0, 0, 1, 1},
+ {&__pyx_kp_s_digraph_lattice, __pyx_k_digraph_lattice, sizeof(__pyx_k_digraph_lattice), 0, 0, 1, 0},
+ {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
+ {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
+ {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
+ {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
+ {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
+ {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
+ {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
+ {&__pyx_n_s_eval, __pyx_k_eval, sizeof(__pyx_k_eval), 0, 0, 1, 1},
+ {&__pyx_n_s_evaluate, __pyx_k_evaluate, sizeof(__pyx_k_evaluate), 0, 0, 1, 1},
+ {&__pyx_n_s_evaluator, __pyx_k_evaluator, sizeof(__pyx_k_evaluator), 0, 0, 1, 1},
+ {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
+ {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
+ {&__pyx_n_s_formalism, __pyx_k_formalism, sizeof(__pyx_k_formalism), 0, 0, 1, 1},
+ {&__pyx_kp_s_formalism_s_unknown, __pyx_k_formalism_s_unknown, sizeof(__pyx_k_formalism_s_unknown), 0, 0, 1, 0},
+ {&__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_get_2, __pyx_k_get_2, sizeof(__pyx_k_get_2), 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},
+ {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_in_edges, __pyx_k_in_edges, sizeof(__pyx_k_in_edges), 0, 0, 1, 1},
+ {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
+ {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
+ {&__pyx_n_s_init___locals_genexpr, __pyx_k_init___locals_genexpr, sizeof(__pyx_k_init___locals_genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s_inp, __pyx_k_inp, sizeof(__pyx_k_inp), 0, 0, 1, 1},
+ {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
+ {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
+ {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
+ {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
+ {&__pyx_n_s_kbest, __pyx_k_kbest, sizeof(__pyx_k_kbest), 0, 0, 1, 1},
+ {&__pyx_n_s_kbest_features, __pyx_k_kbest_features, sizeof(__pyx_k_kbest_features), 0, 0, 1, 1},
+ {&__pyx_n_s_kbest_trees, __pyx_k_kbest_trees, sizeof(__pyx_k_kbest_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
+ {&__pyx_n_s_label, __pyx_k_label, sizeof(__pyx_k_label), 0, 0, 1, 1},
+ {&__pyx_kp_s_lattice_index_out_of_range, __pyx_k_lattice_index_out_of_range, sizeof(__pyx_k_lattice_index_out_of_range), 0, 0, 1, 0},
+ {&__pyx_n_s_lexalign, __pyx_k_lexalign, sizeof(__pyx_k_lexalign), 0, 0, 1, 1},
+ {&__pyx_n_s_lextrans, __pyx_k_lextrans, sizeof(__pyx_k_lextrans), 0, 0, 1, 1},
+ {&__pyx_n_s_lhs, __pyx_k_lhs, sizeof(__pyx_k_lhs), 0, 0, 1, 1},
+ {&__pyx_n_s_lines, __pyx_k_lines, sizeof(__pyx_k_lines), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_make_config, __pyx_k_make_config, sizeof(__pyx_k_make_config), 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_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
+ {&__pyx_kp_s_node_shape_circle, __pyx_k_node_shape_circle, sizeof(__pyx_k_node_shape_circle), 0, 0, 1, 0},
+ {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
+ {&__pyx_n_s_pb, __pyx_k_pb, sizeof(__pyx_k_pb), 0, 0, 1, 1},
+ {&__pyx_n_s_phrase, __pyx_k_phrase, sizeof(__pyx_k_phrase), 0, 0, 1, 1},
+ {&__pyx_n_s_phrase_2, __pyx_k_phrase_2, sizeof(__pyx_k_phrase_2), 0, 0, 1, 1},
+ {&__pyx_n_s_phrase_locals_genexpr, __pyx_k_phrase_locals_genexpr, sizeof(__pyx_k_phrase_locals_genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s_plf, __pyx_k_plf, sizeof(__pyx_k_plf), 0, 0, 1, 1},
+ {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 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_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
+ {&__pyx_kp_s_rankdir_LR, __pyx_k_rankdir_LR, sizeof(__pyx_k_rankdir_LR), 0, 0, 1, 0},
+ {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
+ {&__pyx_n_s_refs, __pyx_k_refs, sizeof(__pyx_k_refs), 0, 0, 1, 1},
+ {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
+ {&__pyx_n_s_rhs, __pyx_k_rhs, sizeof(__pyx_k_rhs), 0, 0, 1, 1},
+ {&__pyx_n_s_rules, __pyx_k_rules, sizeof(__pyx_k_rules), 0, 0, 1, 1},
+ {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_d, __pyx_k_s_d, sizeof(__pyx_k_s_d), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_s_2, __pyx_k_s_s_2, sizeof(__pyx_k_s_s_2), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_s_3, __pyx_k_s_s_3, sizeof(__pyx_k_s_s_3), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_s_s_s, __pyx_k_s_s_s_s, sizeof(__pyx_k_s_s_s_s), 0, 0, 1, 0},
+ {&__pyx_n_s_sa, __pyx_k_sa, sizeof(__pyx_k_sa), 0, 0, 1, 1},
+ {&__pyx_n_s_sample, __pyx_k_sample, sizeof(__pyx_k_sample), 0, 0, 1, 1},
+ {&__pyx_n_s_sample_trees, __pyx_k_sample_trees, sizeof(__pyx_k_sample_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_scfg, __pyx_k_scfg, sizeof(__pyx_k_scfg), 0, 0, 1, 1},
+ {&__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},
+ {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
+ {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
+ {&__pyx_n_s_str___locals_genexpr, __pyx_k_str___locals_genexpr, sizeof(__pyx_k_str___locals_genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
+ {&__pyx_kp_s_sufficient_stats_vector_index_ou, __pyx_k_sufficient_stats_vector_index_ou, sizeof(__pyx_k_sufficient_stats_vector_index_ou), 0, 0, 1, 0},
+ {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
+ {&__pyx_n_s_t2s, __pyx_k_t2s, sizeof(__pyx_k_t2s), 0, 0, 1, 1},
+ {&__pyx_n_s_tagger, __pyx_k_tagger, sizeof(__pyx_k_tagger), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
+ {&__pyx_kp_s_the_grammar_should_contain_TRule, __pyx_k_the_grammar_should_contain_TRule, sizeof(__pyx_k_the_grammar_should_contain_TRule), 0, 0, 1, 0},
+ {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
+ {&__pyx_n_s_todot_locals_lines, __pyx_k_todot_locals_lines, sizeof(__pyx_k_todot_locals_lines), 0, 0, 1, 1},
+ {&__pyx_n_s_unique_kbest, __pyx_k_unique_kbest, sizeof(__pyx_k_unique_kbest), 0, 0, 1, 1},
+ {&__pyx_n_s_unique_kbest_features, __pyx_k_unique_kbest_features, sizeof(__pyx_k_unique_kbest_features), 0, 0, 1, 1},
+ {&__pyx_n_s_unique_kbest_trees, __pyx_k_unique_kbest_trees, sizeof(__pyx_k_unique_kbest_trees), 0, 0, 1, 1},
+ {&__pyx_kp_s_usr0_home_cdyer_cdec_python_cde, __pyx_k_usr0_home_cdyer_cdec_python_cde, sizeof(__pyx_k_usr0_home_cdyer_cdec_python_cde), 0, 0, 1, 0},
+ {&__pyx_kp_s_usr0_home_cdyer_cdec_python_cde_2, __pyx_k_usr0_home_cdyer_cdec_python_cde_2, sizeof(__pyx_k_usr0_home_cdyer_cdec_python_cde_2), 0, 0, 1, 0},
+ {&__pyx_kp_s_usr0_home_cdyer_cdec_python_cde_3, __pyx_k_usr0_home_cdyer_cdec_python_cde_3, sizeof(__pyx_k_usr0_home_cdyer_cdec_python_cde_3), 0, 0, 1, 0},
+ {&__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},
+ {&__pyx_n_s_yn, __pyx_k_yn, sizeof(__pyx_k_yn), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
- __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 = 197; __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 = 232; __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 = 193; __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;}
+ __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 = 197; __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 = 232; __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 = 193; __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;
@@ -26884,139 +29014,139 @@ static int __Pyx_InitCachedConstants(void) {
* elif isinstance(data, str):
* ret = data
*/
- __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_2);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
+ __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":95
+ /* "vectors.pxi":95
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<<
*
* def __len__(self):
*/
- __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_5);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_comparison_not_implemented_for_S); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__2);
+ __Pyx_GIVEREF(__pyx_tuple__2);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":6
+ /* "grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
*
* cdef class NT:
*/
- __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_6);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
+ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":232
+ /* "grammar.pxi":232
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
* _g.AddRule((<TRule> trule).rule[0])
*/
- __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_14);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
+ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_the_grammar_should_contain_TRule); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__5);
+ __Pyx_GIVEREF(__pyx_tuple__5);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":292
+ /* "hypergraph.pxi":292
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
*
* cdef class HypergraphNode:
*/
- __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_19);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
+ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_comparison_not_implemented_for_H); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__6);
+ __Pyx_GIVEREF(__pyx_tuple__6);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":333
+ /* "hypergraph.pxi":333
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_21);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
+ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_comparison_not_implemented_for_H_2); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__7);
+ __Pyx_GIVEREF(__pyx_tuple__7);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":26
+ /* "lattice.pxi":26
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
*/
- __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_24);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
+ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_lattice_index_out_of_range); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__8);
+ __Pyx_GIVEREF(__pyx_tuple__8);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":39
+ /* "lattice.pxi":39
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
*/
- __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_25);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
+ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_lattice_index_out_of_range); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__9);
+ __Pyx_GIVEREF(__pyx_tuple__9);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":69
+ /* "lattice.pxi":69
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
*/
- __pyx_k_tuple_32 = PyTuple_Pack(2, ((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_32);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
+ __pyx_tuple__12 = PyTuple_Pack(2, __pyx_kp_s__10, __pyx_kp_s__11); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__12);
+ __Pyx_GIVEREF(__pyx_tuple__12);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":63
+ /* "lattice.pxi":63
* def todot(self):
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
- __pyx_k_tuple_35 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_n_s__weight), ((PyObject *)__pyx_n_s__delta)); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_35);
- __Pyx_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;}
+ __pyx_tuple__14 = PyTuple_Pack(4, __pyx_n_s_i, __pyx_n_s_label, __pyx_n_s_weight, __pyx_n_s_delta); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__14);
+ __Pyx_GIVEREF(__pyx_tuple__14);
+ __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_cdyer_cdec_python_cde, __pyx_n_s_lines, 63, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":72
+ /* "lattice.pxi":72
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
*
* def as_hypergraph(self):
*/
- __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_41);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
+ __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__17);
+ __Pyx_GIVEREF(__pyx_tuple__17);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":50
+ /* "mteval.pxi":53
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<<
* return self.stats[0][index]
*
*/
- __pyx_k_tuple_43 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_42)); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_43);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
+ __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_sufficient_stats_vector_index_ou); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__18);
+ __Pyx_GIVEREF(__pyx_tuple__18);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":84
+ /* "mteval.pxi":87
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
*/
- __pyx_k_tuple_45 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_44)); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_45);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
+ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_candidate_set_index_out_of_range); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__19);
+ __Pyx_GIVEREF(__pyx_tuple__19);
/* "cdec/_cdec.pyx":92
* with open(weights) as fp:
@@ -27025,9 +29155,9 @@ static int __Pyx_InitCachedConstants(void) {
* fname, value = line.split()
* self.weights[fname.strip()] = float(value)
*/
- __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_51);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
+ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s__20); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__21);
+ __Pyx_GIVEREF(__pyx_tuple__21);
/* "cdec/_cdec.pyx":90
* def read_weights(self, weights):
@@ -27036,73 +29166,73 @@ static int __Pyx_InitCachedConstants(void) {
* for line in fp:
* if line.strip().startswith('#'): continue
*/
- __pyx_k_tuple_52 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_52);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
+ __pyx_tuple__22 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__22);
+ __Pyx_GIVEREF(__pyx_tuple__22);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":5
+ /* "grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
*/
- __pyx_k_tuple_56 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_56);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
- __pyx_k_codeobj_57 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_58, __pyx_n_s___phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__24 = PyTuple_Pack(3, __pyx_n_s_phrase_2, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__24);
+ __Pyx_GIVEREF(__pyx_tuple__24);
+ __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_cdyer_cdec_python_cde_2, __pyx_n_s_phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":194
+ /* "mteval.pxi":197
* return []
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
*/
- __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__IBM_BLEU)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_59);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
+ __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_IBM_BLEU); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__26);
+ __Pyx_GIVEREF(__pyx_tuple__26);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":195
+ /* "mteval.pxi":198
*
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<<
* TER = Scorer('TER')
* CER = Scorer('CER')
*/
- __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__QCRI_BLEU)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_60);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+ __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_QCRI_BLEU); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__27);
+ __Pyx_GIVEREF(__pyx_tuple__27);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":196
+ /* "mteval.pxi":199
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
* CER = Scorer('CER')
* SSK = Scorer('SSK')
*/
- __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__TER)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_61);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
+ __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_TER); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__28);
+ __Pyx_GIVEREF(__pyx_tuple__28);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":197
+ /* "mteval.pxi":200
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
* SSK = Scorer('SSK')
*/
- __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__CER)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_62);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
+ __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_CER); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__29);
+ __Pyx_GIVEREF(__pyx_tuple__29);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":198
+ /* "mteval.pxi":201
* TER = Scorer('TER')
* CER = Scorer('CER')
* SSK = Scorer('SSK') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SSK)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_63);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
+ __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_SSK); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__30);
+ __Pyx_GIVEREF(__pyx_tuple__30);
/* "cdec/_cdec.pyx":28
* class ParseFailed(Exception): pass
@@ -27111,10 +29241,10 @@ static int __Pyx_InitCachedConstants(void) {
* """set_silent(bool): Configure the verbosity of cdec."""
* SetSilent(yn)
*/
- __pyx_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__yn)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_64);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
- __pyx_k_codeobj_65 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_66, __pyx_n_s__set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_yn); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__31);
+ __Pyx_GIVEREF(__pyx_tuple__31);
+ __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_cdyer_cdec_python_cde_3, __pyx_n_s_set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cdec/_cdec.pyx":32
* SetSilent(yn)
@@ -27123,10 +29253,10 @@ static int __Pyx_InitCachedConstants(void) {
* for key, value in config.items():
* if isinstance(value, dict):
*/
- __pyx_k_tuple_67 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__config), ((PyObject *)__pyx_n_s__key), ((PyObject *)__pyx_n_s__value), ((PyObject *)__pyx_n_s__name), ((PyObject *)__pyx_n_s__info)); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_67);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
- __pyx_k_codeobj_68 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_66, __pyx_n_s___make_config, 32, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_config, __pyx_n_s_key, __pyx_n_s_value, __pyx_n_s_name, __pyx_n_s_info); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__33);
+ __Pyx_GIVEREF(__pyx_tuple__33);
+ __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_cdyer_cdec_python_cde_3, __pyx_n_s_make_config, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -27136,8 +29266,8 @@ static int __Pyx_InitCachedConstants(void) {
static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
@@ -27155,6 +29285,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
PyObject *__pyx_t_2 = NULL;
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;
@@ -27190,34 +29321,34 @@ PyMODINIT_FUNC PyInit__cdec(void)
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
- __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_cdec"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ __pyx_m = Py_InitModule4("_cdec", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__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;}
- if (!PyDict_GetItemString(modules, "cdec._cdec")) {
- if (unlikely(PyDict_SetItemString(modules, "cdec._cdec", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- }
- #endif
- __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
- if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ if (PyObject_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___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;};
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "cdec._cdec")) {
+ if (unlikely(PyDict_SetItemString(modules, "cdec._cdec", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
@@ -27226,39 +29357,11 @@ PyMODINIT_FUNC PyInit__cdec(void)
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if CYTHON_COMPILING_IN_CPYTHON
- {
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__.doc = __pyx_doc_4cdec_5_cdec_5TRule___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5TRule___init__;
- }
- }
- #endif
- if (__Pyx_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_4cdec_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_TRule = &__pyx_type_4cdec_5_cdec_TRule;
- __pyx_type_4cdec_5_cdec_MRule.tp_base = __pyx_ptype_4cdec_5_cdec_TRule;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if CYTHON_COMPILING_IN_CPYTHON
- {
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_MRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__.doc = __pyx_doc_4cdec_5_cdec_5MRule___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5MRule___init__;
- }
- }
- #endif
- if (__Pyx_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_MRule = &__pyx_type_4cdec_5_cdec_MRule;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_DenseVector.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_DenseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_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_4cdec_5_cdec_11DenseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_11DenseVector___init__.doc = __pyx_doc_4cdec_5_cdec_11DenseVector___init__;
@@ -27266,29 +29369,13 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "DenseVector", (PyObject *)&__pyx_type_4cdec_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "DenseVector", (PyObject *)&__pyx_type_4cdec_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_DenseVector = &__pyx_type_4cdec_5_cdec_DenseVector;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_SufficientStats = &__pyx_type_4cdec_5_cdec_SufficientStats;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_lines = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27___init__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Metric = &__pyx_type_4cdec_5_cdec_Metric;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Candidate = &__pyx_type_4cdec_5_cdec_Candidate;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_SparseVector.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_SparseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_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_4cdec_5_cdec_12SparseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_12SparseVector___init__.doc = __pyx_doc_4cdec_5_cdec_12SparseVector___init__;
@@ -27296,14 +29383,13 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_4cdec_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_4cdec_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_SparseVector = &__pyx_type_4cdec_5_cdec_SparseVector;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26__make_config = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_NT.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_NT, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_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_4cdec_5_cdec_2NT___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_2NT___init__.doc = __pyx_doc_4cdec_5_cdec_2NT___init__;
@@ -27311,99 +29397,61 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "NT", (PyObject *)&__pyx_type_4cdec_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "NT", (PyObject *)&__pyx_type_4cdec_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_NT = &__pyx_type_4cdec_5_cdec_NT;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_NTRef.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_Lattice, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_NTRef, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__.doc = __pyx_doc_4cdec_5_cdec_7Lattice_2__init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__;
+ __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__.doc = __pyx_doc_4cdec_5_cdec_5NTRef___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__;
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_4cdec_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Lattice = &__pyx_type_4cdec_5_cdec_Lattice;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees;
- __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge = &__pyx_vtable_4cdec_5_cdec_HypergraphEdge;
- __pyx_vtable_4cdec_5_cdec_HypergraphEdge.init = (PyObject *(*)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int))__pyx_f_4cdec_5_cdec_14HypergraphEdge_init;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_HypergraphEdge = &__pyx_type_4cdec_5_cdec_HypergraphEdge;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec___pyx_scope_struct_2__phrase = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Scorer = &__pyx_type_4cdec_5_cdec_Scorer;
- __pyx_vtabptr_4cdec_5_cdec_HypergraphNode = &__pyx_vtable_4cdec_5_cdec_HypergraphNode;
- __pyx_vtable_4cdec_5_cdec_HypergraphNode.init = (PyObject *(*)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int))__pyx_f_4cdec_5_cdec_14HypergraphNode_init;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_HypergraphNode = &__pyx_type_4cdec_5_cdec_HypergraphNode;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "NTRef", (PyObject *)&__pyx_type_4cdec_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_NTRef = &__pyx_type_4cdec_5_cdec_NTRef;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_TRule.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_NTRef, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__.doc = __pyx_doc_4cdec_5_cdec_5NTRef___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__;
+ __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__.doc = __pyx_doc_4cdec_5_cdec_5TRule___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5TRule___init__;
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "NTRef", (PyObject *)&__pyx_type_4cdec_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_NTRef = &__pyx_type_4cdec_5_cdec_NTRef;
+ if (PyObject_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_4cdec_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_TRule = &__pyx_type_4cdec_5_cdec_TRule;
+ __pyx_type_4cdec_5_cdec_MRule.tp_base = __pyx_ptype_4cdec_5_cdec_TRule;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_MRule.tp_print = 0;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_MRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__.doc = __pyx_doc_4cdec_5_cdec_5MRule___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5MRule___init__;
+ }
+ }
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_MRule = &__pyx_type_4cdec_5_cdec_MRule;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_4cdec_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Grammar.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_4cdec_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_Grammar = &__pyx_type_4cdec_5_cdec_Grammar;
- __pyx_vtabptr_4cdec_5_cdec_Hypergraph = &__pyx_vtable_4cdec_5_cdec_Hypergraph;
- __pyx_vtable_4cdec_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_4cdec_5_cdec_Hypergraph *))__pyx_f_4cdec_5_cdec_10Hypergraph__rng;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_Hypergraph.tp_dict, __pyx_vtabptr_4cdec_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_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Hypergraph = &__pyx_type_4cdec_5_cdec_Hypergraph;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_CandidateSet = &__pyx_type_4cdec_5_cdec_CandidateSet;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22_todot = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_SegmentEvaluator = &__pyx_type_4cdec_5_cdec_SegmentEvaluator;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec___pyx_scope_struct_3_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__;
__pyx_type_4cdec_5_cdec_TextGrammar.tp_base = __pyx_ptype_4cdec_5_cdec_Grammar;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_TextGrammar.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
__pyx_wrapperbase_4cdec_5_cdec_11TextGrammar___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_11TextGrammar___init__.doc = __pyx_doc_4cdec_5_cdec_11TextGrammar___init__;
@@ -27411,14 +29459,72 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_TextGrammar = &__pyx_type_4cdec_5_cdec_TextGrammar;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__;
+ __pyx_vtabptr_4cdec_5_cdec_Hypergraph = &__pyx_vtable_4cdec_5_cdec_Hypergraph;
+ __pyx_vtable_4cdec_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_4cdec_5_cdec_Hypergraph *))__pyx_f_4cdec_5_cdec_10Hypergraph__rng;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Hypergraph.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_Hypergraph.tp_dict, __pyx_vtabptr_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Hypergraph", (PyObject *)&__pyx_type_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Hypergraph = &__pyx_type_4cdec_5_cdec_Hypergraph;
+ __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge = &__pyx_vtable_4cdec_5_cdec_HypergraphEdge;
+ __pyx_vtable_4cdec_5_cdec_HypergraphEdge.init = (PyObject *(*)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int))__pyx_f_4cdec_5_cdec_14HypergraphEdge_init;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_HypergraphEdge.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_HypergraphEdge = &__pyx_type_4cdec_5_cdec_HypergraphEdge;
+ __pyx_vtabptr_4cdec_5_cdec_HypergraphNode = &__pyx_vtable_4cdec_5_cdec_HypergraphNode;
+ __pyx_vtable_4cdec_5_cdec_HypergraphNode.init = (PyObject *(*)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int))__pyx_f_4cdec_5_cdec_14HypergraphNode_init;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_HypergraphNode.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_HypergraphNode = &__pyx_type_4cdec_5_cdec_HypergraphNode;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Lattice.tp_print = 0;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_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_4cdec_5_cdec_7Lattice_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__.doc = __pyx_doc_4cdec_5_cdec_7Lattice_2__init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__;
+ }
+ }
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_4cdec_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Lattice = &__pyx_type_4cdec_5_cdec_Lattice;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Candidate.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Candidate", (PyObject *)&__pyx_type_4cdec_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Candidate = &__pyx_type_4cdec_5_cdec_Candidate;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_SufficientStats.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "SufficientStats", (PyObject *)&__pyx_type_4cdec_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_SufficientStats = &__pyx_type_4cdec_5_cdec_SufficientStats;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_CandidateSet.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "CandidateSet", (PyObject *)&__pyx_type_4cdec_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_CandidateSet = &__pyx_type_4cdec_5_cdec_CandidateSet;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_SegmentEvaluator.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "SegmentEvaluator", (PyObject *)&__pyx_type_4cdec_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_SegmentEvaluator = &__pyx_type_4cdec_5_cdec_SegmentEvaluator;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Scorer.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_4cdec_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Scorer = &__pyx_type_4cdec_5_cdec_Scorer;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Metric.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Metric", (PyObject *)&__pyx_type_4cdec_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Metric = &__pyx_type_4cdec_5_cdec_Metric;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Decoder.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_Decoder, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_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_4cdec_5_cdec_7Decoder___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_7Decoder___init__.doc = __pyx_doc_4cdec_5_cdec_7Decoder___init__;
@@ -27426,31 +29532,104 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_4cdec_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_4cdec_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_Decoder = &__pyx_type_4cdec_5_cdec_Decoder;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__.tp_print = 0;
__pyx_ptype_4cdec_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14_sample = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_2__phrase = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_3_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr.tp_print = 0;
__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_6_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest;
+ if (PyType_Ready(&__pyx_type_4cdec_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_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees;
+ if (PyType_Ready(&__pyx_type_4cdec_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_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees.tp_print = 0;
__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__;
- if (PyType_Ready(&__pyx_type_4cdec_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_4cdec_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14_sample = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22_todot = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_lines = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26__make_config = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27___init__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr;
/*--- 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[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;}
+ __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 = 37; __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;}
@@ -27461,7 +29640,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*--- Execution code ---*/
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":3
+ /* "grammar.pxi":3
* cimport grammar
* cimport cdec.sa._sa as _sa
* import cdec.sa._sa as _sa # <<<<<<<<<<<<<<
@@ -27470,82 +29649,82 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_n_s_55));
- PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_55));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s_55));
- __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_54), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_n_s__23);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s__23);
+ __Pyx_GIVEREF(__pyx_n_s__23);
+ __pyx_t_3 = __Pyx_Import(__pyx_n_s_cdec_sa__sa, __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 (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_2); __pyx_t_2 = 0;
+ 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/austinma/git/cdec/python/cdec/grammar.pxi":5
+ /* "grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_1_phrase, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_1_phrase, NULL, __pyx_n_s_cdec__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 (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;}
+ 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/austinma/git/cdec/python/cdec/mteval.pxi":194
+ /* "mteval.pxi":197
* return []
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__26, 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 (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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLEU, __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/austinma/git/cdec/python/cdec/mteval.pxi":195
+ /* "mteval.pxi":198
*
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<<
* TER = Scorer('TER')
* CER = Scorer('CER')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__27, 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 (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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_QCRI, __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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":196
+ /* "mteval.pxi":199
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
* CER = Scorer('CER')
* SSK = Scorer('SSK')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- 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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":197
+ /* "mteval.pxi":200
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
* SSK = Scorer('SSK')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- 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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":198
+ /* "mteval.pxi":201
* TER = Scorer('TER')
* CER = Scorer('CER')
* SSK = Scorer('SSK') # <<<<<<<<<<<<<<
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- 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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SSK, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "cdec/_cdec.pyx":22
@@ -27573,19 +29752,22 @@ PyMODINIT_FUNC PyInit__cdec(void)
* class ParseFailed(Exception): pass
*
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __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 = 25; __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 = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_builtin_Exception);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception);
__Pyx_GIVEREF(__pyx_builtin_Exception);
- __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__InvalidConfig, __pyx_n_s__InvalidConfig, __pyx_n_s_39); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_3, __pyx_n_s_InvalidConfig, __pyx_n_s_InvalidConfig, (PyObject *) NULL, __pyx_n_s_cdec__cdec, (PyObject *) NULL); 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 (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_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_InvalidConfig, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_InvalidConfig, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "cdec/_cdec.pyx":26
*
@@ -27594,19 +29776,22 @@ PyMODINIT_FUNC PyInit__cdec(void)
*
* def set_silent(yn):
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __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 = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_builtin_Exception);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_Exception);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception);
__Pyx_GIVEREF(__pyx_builtin_Exception);
- __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__ParseFailed, __pyx_n_s__ParseFailed, __pyx_n_s_39); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); 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 (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_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_3, __pyx_n_s_ParseFailed, __pyx_n_s_ParseFailed, (PyObject *) NULL, __pyx_n_s_cdec__cdec, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ParseFailed, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ParseFailed, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __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_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "cdec/_cdec.pyx":28
* class ParseFailed(Exception): pass
@@ -27615,9 +29800,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
* """set_silent(bool): Configure the verbosity of cdec."""
* SetSilent(yn)
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_3set_silent, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_3set_silent, NULL, __pyx_n_s_cdec__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 (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;}
+ 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/_cdec.pyx":32
@@ -27627,9 +29812,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
* for key, value in config.items():
* if isinstance(value, dict):
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_5_make_config, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_5_make_config, NULL, __pyx_n_s_cdec__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 (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;}
+ 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/_cdec.pyx":1
@@ -27638,9 +29823,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
* from utils cimport *
*/
__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 (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;
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "string.from_py":13
*
@@ -27649,14 +29834,21 @@ PyMODINIT_FUNC PyInit__cdec(void)
* cdef Py_ssize_t length
* cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
*/
+
+ /*--- Wrapped vars code ---*/
+
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
if (__pyx_m) {
- __Pyx_AddTraceback("init cdec._cdec", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init cdec._cdec", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ Py_DECREF(__pyx_d); __pyx_d = 0;
+ }
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init cdec._cdec");
@@ -27685,7 +29877,7 @@ end:
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
-#endif /* CYTHON_REFNANNY */
+#endif
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
@@ -27694,11 +29886,79 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
#if PY_MAJOR_VERSION >= 3
"name '%U' is not defined", name);
#else
- "name '%s' is not defined", PyString_AS_STRING(name));
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
}
return result;
}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
@@ -27749,11 +30009,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
goto raise_error;
}
}
- #if PY_VERSION_HEX < 0x02050000
- if (PyClass_Check(type)) {
- #else
if (PyType_Check(type)) {
- #endif
#if CYTHON_COMPILING_IN_PYPY
if (!value) {
Py_INCREF(Py_None);
@@ -27768,17 +30024,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
goto raise_error;
}
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);
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
@@ -27786,7 +30031,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
- #endif
}
__Pyx_ErrRestore(type, value, tb);
return;
@@ -27796,7 +30040,7 @@ raise_error:
Py_XDECREF(tb);
return;
}
-#else /* Python 3+ */
+#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
PyObject* owned_instance = NULL;
if (tb == Py_None) {
@@ -27817,27 +30061,40 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
value = type;
type = (PyObject*) Py_TYPE(value);
} else if (PyExceptionClass_Check(type)) {
- PyObject *args;
- if (!value)
- args = PyTuple_New(0);
- else if (PyTuple_Check(value)) {
- Py_INCREF(value);
- args = value;
- } else
- args = PyTuple_Pack(1, value);
- if (!args)
- goto bad;
- owned_instance = PyEval_CallObject(type, args);
- Py_DECREF(args);
- if (!owned_instance)
- goto bad;
- value = owned_instance;
- if (!PyExceptionInstance_Check(value)) {
- PyErr_Format(PyExc_TypeError,
- "calling %R should have returned an instance of "
- "BaseException, not %R",
- type, Py_TYPE(value));
- goto bad;
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
}
} else {
PyErr_SetString(PyExc_TypeError,
@@ -27903,7 +30160,7 @@ static void __Pyx_RaiseArgtupleInvalid(
more_or_less = "exactly";
}
PyErr_Format(PyExc_TypeError,
- "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
@@ -27915,7 +30172,7 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
{
PyObject* key = 0;
Py_ssize_t pos = 0;
-#if CPYTHON_COMPILING_IN_PYPY
+#if CYTHON_COMPILING_IN_PYPY
if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
goto invalid_keyword;
return 1;
@@ -27932,13 +30189,13 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
return 1;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
- "%s() keywords must be strings", function_name);
+ "%.200s() keywords must be strings", function_name);
return 0;
#endif
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
- "%s() got an unexpected keyword argument '%s'",
+ "%.200s() got an unexpected keyword argument '%.200s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
@@ -27947,29 +30204,35 @@ invalid_keyword:
return 0;
}
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
+ name, type->tp_name, Py_TYPE(obj)->tp_name);
+}
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact)
{
- if (!type) {
- PyErr_Format(PyExc_SystemError, "Missing type object");
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
return 0;
}
if (none_allowed && obj == Py_None) return 1;
else if (exact) {
- if (Py_TYPE(obj) == type) return 1;
+ if (likely(Py_TYPE(obj) == type)) return 1;
+ #if PY_MAJOR_VERSION == 2
+ else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
+ #endif
}
else {
- if (PyObject_TypeCheck(obj, type)) return 1;
+ if (likely(PyObject_TypeCheck(obj, type))) return 1;
}
- PyErr_Format(PyExc_TypeError,
- "Argument '%s' has incorrect type (expected %s, got %s)",
- name, type->tp_name, Py_TYPE(obj)->tp_name);
+ __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
return 0;
}
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
if (unlikely(!type)) {
- PyErr_Format(PyExc_SystemError, "Missing type object");
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
return 0;
}
if (likely(PyObject_TypeCheck(obj, type)))
@@ -27979,10 +30242,123 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
return 0;
}
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ local_type = tstate->curexc_type;
+ 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 (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *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;
+ 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_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = *type;
+ tstate->exc_value = *value;
+ tstate->exc_traceback = *tb;
+#else
+ PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
+ PyErr_SetExcInfo(*type, *value, *tb);
+#endif
+ *type = tmp_type;
+ *value = tmp_value;
+ *tb = tmp_tb;
+}
+
+static CYTHON_INLINE void __Pyx_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 CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}
+#if !CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
+ return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
+}
+#endif
+
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
PyObject* kw_name)
@@ -28082,12 +30458,12 @@ arg_passed_twice:
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
- "%s() keywords must be strings", function_name);
+ "%.200s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
- "%s() got an unexpected keyword argument '%s'",
+ "%.200s() got an unexpected keyword argument '%.200s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
@@ -28097,14 +30473,62 @@ bad:
return -1;
}
-static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
+static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
+ PyObject *method, *result = NULL;
+ method = __Pyx_PyObject_GetAttrStr(obj, method_name);
+ if (unlikely(!method)) goto bad;
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (likely(PyMethod_Check(method))) {
+ PyObject *self = PyMethod_GET_SELF(method);
+ if (likely(self)) {
+ PyObject *args;
+ PyObject *function = PyMethod_GET_FUNCTION(method);
+ args = PyTuple_New(2);
+ if (unlikely(!args)) goto bad;
+ Py_INCREF(self);
+ PyTuple_SET_ITEM(args, 0, self);
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 1, arg);
+ Py_INCREF(function);
+ Py_DECREF(method); method = NULL;
+ result = __Pyx_PyObject_Call(function, args, NULL);
+ Py_DECREF(args);
+ Py_DECREF(function);
+ return result;
+ }
+ }
+#endif
+ result = __Pyx_PyObject_CallOneArg(method, arg);
+bad:
+ Py_XDECREF(method);
+ return result;
+}
+
+static CYTHON_INLINE int __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 */
+ if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
} else {
- return __Pyx_PyObject_CallMethod1(L, __pyx_n_s__append, x);
+ PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
+ if (unlikely(!retval))
+ return -1;
+ Py_DECREF(retval);
}
+ return 0;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
@@ -28192,7 +30616,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
- "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
+ "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
index, (index == 1) ? "" : "s");
}
@@ -28245,7 +30669,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
result = PyDict_GetItem(__pyx_d, name);
- if (result) {
+ if (likely(result)) {
Py_INCREF(result);
} else {
#else
@@ -28259,10 +30683,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
}
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
- CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+ CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
+ int full_traceback) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+ if (full_traceback) {
+ Py_XINCREF(old_exc);
+ Py_XINCREF(old_val);
+ Py_XINCREF(old_tb);
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ PyErr_PrintEx(1);
+ }
#if PY_MAJOR_VERSION < 3
ctx = PyString_FromString(name);
#else
@@ -28293,7 +30725,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject*
if (likely(next))
return next;
#if CYTHON_COMPILING_IN_CPYTHON
-#if PY_VERSION_HEX >= 0x03010000 || (PY_MAJOR_VERSION < 3 && PY_VERSION_HEX >= 0x02070000)
+#if PY_VERSION_HEX >= 0x02070000
if (unlikely(iternext == &_PyObject_NextNotImplemented))
return NULL;
#endif
@@ -28314,6 +30746,44 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject*
return NULL;
}
+static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
+ PyObject* fake_module;
+ PyTypeObject* cached_type = NULL;
+ fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
+ if (!fake_module) return NULL;
+ Py_INCREF(fake_module);
+ cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
+ if (cached_type) {
+ if (!PyType_Check((PyObject*)cached_type)) {
+ PyErr_Format(PyExc_TypeError,
+ "Shared Cython type %.200s is not a type object",
+ type->tp_name);
+ goto bad;
+ }
+ if (cached_type->tp_basicsize != type->tp_basicsize) {
+ PyErr_Format(PyExc_TypeError,
+ "Shared Cython type %.200s has the wrong size, try recompiling",
+ type->tp_name);
+ goto bad;
+ }
+ } else {
+ if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
+ PyErr_Clear();
+ if (PyType_Ready(type) < 0) goto bad;
+ if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
+ goto bad;
+ Py_INCREF(type);
+ cached_type = type;
+ }
+done:
+ Py_DECREF(fake_module);
+ return cached_type;
+bad:
+ Py_XDECREF(cached_type);
+ cached_type = NULL;
+ goto done;
+}
+
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
@@ -28338,8 +30808,9 @@ static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp = op->func_doc;
- if (value == NULL)
- value = Py_None; /* Mark as deleted */
+ if (value == NULL) {
+ value = Py_None;
+ }
Py_INCREF(value);
op->func_doc = value;
Py_XDECREF(tmp);
@@ -28446,11 +30917,10 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
return 0;
}
static PyObject *
-__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
+__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
- PyObject* dict = PyModule_GetDict(__pyx_m);
- Py_XINCREF(dict);
- return dict;
+ Py_INCREF(op->func_globals);
+ return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
@@ -28585,7 +31055,7 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
{(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 */
+#ifndef PY_WRITE_RESTRICTED
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
@@ -28602,16 +31072,21 @@ __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
- {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
+ {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
{0, 0, 0, 0}
};
+#if PY_VERSION_HEX < 0x030500A0
+#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
+#else
+#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
+#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
- PyObject *closure, PyObject *module, PyObject* code) {
+ PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
if (op == NULL)
return NULL;
op->flags = flags;
- op->func_weakreflist = NULL;
+ __Pyx_CyFunction_weakreflist(op) = NULL;
op->func.m_ml = ml;
op->func.m_self = (PyObject *) op;
Py_XINCREF(closure);
@@ -28624,6 +31099,8 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f
op->func_qualname = qualname;
op->func_doc = NULL;
op->func_classobj = NULL;
+ op->func_globals = globals;
+ Py_INCREF(op->func_globals);
Py_XINCREF(code);
op->func_code = code;
op->defaults_pyobjects = 0;
@@ -28644,6 +31121,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
Py_CLEAR(m->func_name);
Py_CLEAR(m->func_qualname);
Py_CLEAR(m->func_doc);
+ Py_CLEAR(m->func_globals);
Py_CLEAR(m->func_code);
Py_CLEAR(m->func_classobj);
Py_CLEAR(m->defaults_tuple);
@@ -28662,7 +31140,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
PyObject_GC_UnTrack(m);
- if (m->func_weakreflist != NULL)
+ if (__Pyx_CyFunction_weakreflist(m) != NULL)
PyObject_ClearWeakRefs((PyObject *) m);
__Pyx_CyFunction_clear(m);
PyObject_GC_Del(m);
@@ -28675,6 +31153,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
Py_VISIT(m->func_name);
Py_VISIT(m->func_qualname);
Py_VISIT(m->func_doc);
+ Py_VISIT(m->func_globals);
Py_VISIT(m->func_code);
Py_VISIT(m->func_classobj);
Py_VISIT(m->defaults_tuple);
@@ -28767,66 +31246,72 @@ static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
- sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
+ "cython_function_or_method",
+ sizeof(__pyx_CyFunctionObject),
+ 0,
+ (destructor) __Pyx_CyFunction_dealloc,
+ 0,
+ 0,
+ 0,
#if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
+ 0,
#else
- 0, /*reserved*/
+ 0,
#endif
- (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- __Pyx_CyFunction_Call, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
- 0, /*tp_doc*/
- (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
- (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
- 0, /*tp_richcompare*/
- offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_CyFunction_methods, /*tp_methods*/
- __pyx_CyFunction_members, /*tp_members*/
- __pyx_CyFunction_getsets, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- __Pyx_CyFunction_descr_get, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- 0, /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
+ (reprfunc) __Pyx_CyFunction_repr,
+ 0,
+ 0,
+ 0,
+ 0,
+ __Pyx_CyFunction_Call,
+ 0,
+ 0,
+ 0,
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ 0,
+ (traverseproc) __Pyx_CyFunction_traverse,
+ (inquiry) __Pyx_CyFunction_clear,
+ 0,
+#if PY_VERSION_HEX < 0x030500A0
+ offsetof(__pyx_CyFunctionObject, func_weakreflist),
+#else
+ offsetof(PyCFunctionObject, m_weakreflist),
+#endif
+ 0,
+ 0,
+ __pyx_CyFunction_methods,
+ __pyx_CyFunction_members,
+ __pyx_CyFunction_getsets,
+ 0,
+ 0,
+ __Pyx_CyFunction_descr_get,
+ 0,
+ offsetof(__pyx_CyFunctionObject, func_dict),
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+#if PY_VERSION_HEX >= 0x030400a1
+ 0,
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
__pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
- if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
+ __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
+ if (__pyx_CyFunctionType == NULL) {
return -1;
- __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
+ }
return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
@@ -28875,12 +31360,132 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec
if (default_value == Py_None)
default_value = NULL;
value = PyObject_CallMethodObjArgs(
- d, __pyx_n_s__get, key, default_value, NULL);
+ d, __pyx_n_s_get_2, key, default_value, NULL);
}
#endif
return value;
}
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyObject_RichCompareBool(s1, s2, equals);
+#else
+ if (s1 == s2) {
+ return (equals == Py_EQ);
+ } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
+ const char *ps1, *ps2;
+ Py_ssize_t length = PyBytes_GET_SIZE(s1);
+ if (length != PyBytes_GET_SIZE(s2))
+ return (equals == Py_NE);
+ ps1 = PyBytes_AS_STRING(s1);
+ ps2 = PyBytes_AS_STRING(s2);
+ if (ps1[0] != ps2[0]) {
+ return (equals == Py_NE);
+ } else if (length == 1) {
+ return (equals == Py_EQ);
+ } else {
+ int result = memcmp(ps1, ps2, (size_t)length);
+ return (equals == Py_EQ) ? (result == 0) : (result != 0);
+ }
+ } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
+ return (equals == Py_NE);
+ } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
+ return (equals == Py_NE);
+ } else {
+ int result;
+ PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+ if (!py_result)
+ return -1;
+ result = __Pyx_PyObject_IsTrue(py_result);
+ Py_DECREF(py_result);
+ return result;
+ }
+#endif
+}
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyObject_RichCompareBool(s1, s2, equals);
+#else
+#if PY_MAJOR_VERSION < 3
+ PyObject* owned_ref = NULL;
+#endif
+ int s1_is_unicode, s2_is_unicode;
+ if (s1 == s2) {
+ goto return_eq;
+ }
+ s1_is_unicode = PyUnicode_CheckExact(s1);
+ s2_is_unicode = PyUnicode_CheckExact(s2);
+#if PY_MAJOR_VERSION < 3
+ if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
+ owned_ref = PyUnicode_FromObject(s2);
+ if (unlikely(!owned_ref))
+ return -1;
+ s2 = owned_ref;
+ s2_is_unicode = 1;
+ } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
+ owned_ref = PyUnicode_FromObject(s1);
+ if (unlikely(!owned_ref))
+ return -1;
+ s1 = owned_ref;
+ s1_is_unicode = 1;
+ } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
+ return __Pyx_PyBytes_Equals(s1, s2, equals);
+ }
+#endif
+ if (s1_is_unicode & s2_is_unicode) {
+ Py_ssize_t length;
+ int kind;
+ void *data1, *data2;
+ if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
+ return -1;
+ length = __Pyx_PyUnicode_GET_LENGTH(s1);
+ if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
+ goto return_ne;
+ }
+ kind = __Pyx_PyUnicode_KIND(s1);
+ if (kind != __Pyx_PyUnicode_KIND(s2)) {
+ goto return_ne;
+ }
+ data1 = __Pyx_PyUnicode_DATA(s1);
+ data2 = __Pyx_PyUnicode_DATA(s2);
+ if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
+ goto return_ne;
+ } else if (length == 1) {
+ goto return_eq;
+ } else {
+ int result = memcmp(data1, data2, (size_t)(length * kind));
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_EQ) ? (result == 0) : (result != 0);
+ }
+ } else if ((s1 == Py_None) & s2_is_unicode) {
+ goto return_ne;
+ } else if ((s2 == Py_None) & s1_is_unicode) {
+ goto return_ne;
+ } else {
+ int result;
+ PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+ if (!py_result)
+ return -1;
+ result = __Pyx_PyObject_IsTrue(py_result);
+ Py_DECREF(py_result);
+ return result;
+ }
+return_eq:
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_EQ);
+return_ne:
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_NE);
+#endif
+}
+
static double __Pyx__PyObject_AsDouble(PyObject* obj) {
PyObject* float_value;
#if CYTHON_COMPILING_IN_PYPY
@@ -28920,72 +31525,15 @@ 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)
+#if PY_VERSION_HEX >= 0x02070000
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)
+ if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
goto bad;
Py_DECREF(ob);
return 0;
@@ -28996,10 +31544,10 @@ bad:
static void* __Pyx_GetVtable(PyObject *dict) {
void* ptr;
- PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__);
+ 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)
+#if PY_VERSION_HEX >= 0x02070000
ptr = PyCapsule_GetPointer(ob, 0);
#else
ptr = PyCObject_AsVoidPtr(ob);
@@ -29013,841 +31561,901 @@ bad:
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);
+static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
+ Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
+ for (i=0; i < nbases; i++) {
+ PyTypeObject *tmptype;
+ PyObject *tmp = PyTuple_GET_ITEM(bases, i);
+ tmptype = Py_TYPE(tmp);
+#if PY_MAJOR_VERSION < 3
+ if (tmptype == &PyClass_Type)
+ continue;
#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);
+ if (!metaclass) {
+ metaclass = tmptype;
+ continue;
+ }
+ if (PyType_IsSubtype(metaclass, tmptype))
+ continue;
+ if (PyType_IsSubtype(tmptype, metaclass)) {
+ metaclass = tmptype;
+ continue;
+ }
+ PyErr_SetString(PyExc_TypeError,
+ "metaclass conflict: "
+ "the metaclass of a derived class "
+ "must be a (non-strict) subclass "
+ "of the metaclasses of all its bases");
+ return NULL;
+ }
+ if (!metaclass) {
+#if PY_MAJOR_VERSION < 3
+ metaclass = &PyClass_Type;
#else
- PyErr_SetExcInfo(type, value, tb);
+ metaclass = &PyType_Type;
#endif
+ }
+ Py_INCREF((PyObject*) metaclass);
+ return (PyObject*) metaclass;
}
-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();
- }
+static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
+ PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
+ PyObject *ns;
+ if (metaclass) {
+ PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
+ if (prep) {
+ PyObject *pargs = PyTuple_Pack(2, name, bases);
+ if (unlikely(!pargs)) {
+ Py_DECREF(prep);
+ return NULL;
}
- 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
+ ns = PyObject_Call(prep, pargs, mkw);
+ Py_DECREF(prep);
+ Py_DECREF(pargs);
+ } else {
+ if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
+ return NULL;
+ PyErr_Clear();
+ ns = PyDict_New();
}
+ } else {
+ ns = PyDict_New();
}
- #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
+ if (unlikely(!ns))
+ return NULL;
+ if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
+ if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
+ if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
+ return ns;
bad:
- #if PY_VERSION_HEX < 0x03030000
- Py_XDECREF(py_import);
- #endif
- Py_XDECREF(empty_list);
- Py_XDECREF(empty_dict);
- return module;
+ Py_DECREF(ns);
+ return NULL;
}
-
-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) {
+static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
+ PyObject *dict, PyObject *mkw,
+ int calculate_metaclass, int allow_py2_metaclass) {
+ PyObject *result, *margs;
+ PyObject *owned_metaclass = NULL;
+ if (allow_py2_metaclass) {
+ owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
+ if (owned_metaclass) {
+ metaclass = owned_metaclass;
+ } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
PyErr_Clear();
- metaclass = (PyObject*) Py_TYPE(base);
+ } else {
+ return NULL;
}
- } 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;
+ if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
+ metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
+ Py_XDECREF(owned_metaclass);
+ if (unlikely(!metaclass))
+ return NULL;
+ owned_metaclass = metaclass;
}
-#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);
+ margs = PyTuple_Pack(3, name, bases, dict);
+ if (unlikely(!margs)) {
+ result = NULL;
} else {
- metaclass = __Pyx_FindPy2Metaclass(bases);
+ result = PyObject_Call(metaclass, margs, mkw);
+ Py_DECREF(margs);
}
- result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
- Py_DECREF(metaclass);
+ Py_XDECREF(owned_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;
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
}
- #endif
- return (WordID)-1;
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 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;
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
}
- 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
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
}
- Py_DECREF(names);
- return globals;
-bad:
- Py_XDECREF(names);
- Py_XDECREF(globals);
- return NULL;
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
}
-
-static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
- const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(unsigned char) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(unsigned char)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to unsigned char" :
- "value too large to convert to unsigned char");
- }
- return (unsigned char)-1;
- }
- return (unsigned char)val;
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
}
- return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
-}
-
-static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
- const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(unsigned short) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(unsigned short)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to unsigned short" :
- "value too large to convert to unsigned short");
- }
- return (unsigned short)-1;
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
}
- return (unsigned short)val;
+ return;
}
- return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
-}
-
-static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
- const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(unsigned int) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(unsigned int)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to unsigned int" :
- "value too large to convert to unsigned int");
- }
- return (unsigned int)-1;
- }
- return (unsigned int)val;
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
}
- return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
-}
-
-static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
- const char neg_one = (char)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(char) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(char)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to char" :
- "value too large to convert to char");
- }
- return (char)-1;
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
}
- return (char)val;
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
}
- return (char)__Pyx_PyInt_AsLong(x);
-}
-
-static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
- const short neg_one = (short)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(short) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(short)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to short" :
- "value too large to convert to short");
- }
- return (short)-1;
- }
- return (short)val;
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
}
- return (short)__Pyx_PyInt_AsLong(x);
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
}
-static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
- const int neg_one = (int)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(int) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(int)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to int" :
- "value too large to convert to int");
- }
- return (int)-1;
- }
- return (int)val;
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
}
- return (int)__Pyx_PyInt_AsLong(x);
-}
-
-static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
- const signed char neg_one = (signed char)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(signed char) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(signed char)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to signed char" :
- "value too large to convert to signed char");
- }
- return (signed char)-1;
- }
- return (signed char)val;
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
}
- return (signed char)__Pyx_PyInt_AsSignedLong(x);
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
}
-
-static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
- const signed short neg_one = (signed short)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(signed short) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(signed short)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to signed short" :
- "value too large to convert to signed short");
- }
- return (signed short)-1;
- }
- return (signed short)val;
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
- return (signed short)__Pyx_PyInt_AsSignedLong(x);
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
}
-static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
- const signed int neg_one = (signed int)-1, const_zero = 0;
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
+ const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
- if (sizeof(signed int) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(signed int)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to signed int" :
- "value too large to convert to signed int");
- }
- return (signed int)-1;
+ if (is_unsigned) {
+ if (sizeof(unsigned int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
}
- return (signed int)val;
+ } else {
+ if (sizeof(unsigned int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(unsigned int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
+ little, !is_unsigned);
}
- return (signed int)__Pyx_PyInt_AsSignedLong(x);
}
-static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
- const int neg_one = (int)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(int) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(int)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to int" :
- "value too large to convert to int");
- }
- return (int)-1;
- }
- return (int)val;
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
}
- return (int)__Pyx_PyInt_AsLong(x);
-}
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
-#include "longintrepr.h"
-#endif
+ #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;
+
+static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
+ const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned long");
- return (unsigned long)-1;
+ if (sizeof(unsigned int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (unsigned int) val;
}
- return (unsigned long)val;
} else
#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];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, ((PyLongObject*)x)->ob_digit[0]);
}
-#endif
+ #endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned long");
- return (unsigned long)-1;
+ goto raise_neg_overflow;
+ }
+ if (sizeof(unsigned int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long long, PyLong_AsUnsignedLongLong(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];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
+ #endif
#endif
+ if (sizeof(unsigned int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, long, PyLong_AsLong(x))
+ } else if (sizeof(unsigned int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ unsigned int 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 (unsigned long)PyLong_AsLong(x);
+ return (unsigned int) -1;
}
} else {
- unsigned long val;
+ unsigned int val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (unsigned long)-1;
- val = __Pyx_PyInt_AsUnsignedLong(tmp);
+ if (!tmp) return (unsigned int) -1;
+ val = __Pyx_PyInt_As_unsigned_int(tmp);
Py_DECREF(tmp);
return val;
}
-}
-
-#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;
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to unsigned int");
+ return (unsigned int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to unsigned int");
+ return (unsigned int) -1;
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned PY_LONG_LONG");
- return (unsigned PY_LONG_LONG)-1;
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
}
- return (unsigned PY_LONG_LONG)val;
} else
#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];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
}
-#endif
+ #endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned PY_LONG_LONG");
- return (unsigned PY_LONG_LONG)-1;
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
- 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];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
+ #endif
#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int 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 (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
+ return (int) -1;
}
} else {
- unsigned PY_LONG_LONG val;
+ int val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (unsigned PY_LONG_LONG)-1;
- val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
Py_DECREF(tmp);
return val;
}
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
}
-#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_MAJOR_VERSION < 3
- if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to long");
- return (long)-1;
- }
- return (long)val;
- } else
-#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");
- return (long)-1;
- }
- 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];
+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_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();
}
}
-#endif
-#endif
- return (long)PyLong_AsLong(x);
+ level = 0;
+ }
+ #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
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
}
} else {
- long val;
- PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (long)-1;
- val = __Pyx_PyInt_AsLong(tmp);
- Py_DECREF(tmp);
- return val;
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
}
}
-#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;
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE WordID __Pyx_PyInt_As_WordID(PyObject *x) {
+ const WordID neg_one = (WordID) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to PY_LONG_LONG");
- return (PY_LONG_LONG)-1;
+ if (sizeof(WordID) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (WordID) val;
}
- return (PY_LONG_LONG)val;
} else
#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];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(WordID, digit, ((PyLongObject*)x)->ob_digit[0]);
}
-#endif
+ #endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to PY_LONG_LONG");
- return (PY_LONG_LONG)-1;
+ goto raise_neg_overflow;
+ }
+ if (sizeof(WordID) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(WordID) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, unsigned long long, PyLong_AsUnsignedLongLong(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];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(WordID, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(WordID, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
+ #endif
#endif
+ if (sizeof(WordID) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, long, PyLong_AsLong(x))
+ } else if (sizeof(WordID) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#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 (PY_LONG_LONG)PyLong_AsLongLong(x);
+ return (WordID) -1;
}
} else {
- PY_LONG_LONG val;
+ WordID val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (PY_LONG_LONG)-1;
- val = __Pyx_PyInt_AsLongLong(tmp);
+ if (!tmp) return (WordID) -1;
+ val = __Pyx_PyInt_As_WordID(tmp);
Py_DECREF(tmp);
return val;
}
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to WordID");
+ return (WordID) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to WordID");
+ return (WordID) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
+ const short neg_one = (short) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(short) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(short) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(short) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(short) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(short) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(short),
+ little, !is_unsigned);
+ }
}
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
-#include "longintrepr.h"
-#endif
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+ if (likely(PyUnicode_Check(n)))
+#else
+ if (likely(PyString_Check(n)))
#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_MAJOR_VERSION < 3
- if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to signed long");
- return (signed long)-1;
- }
- return (signed long)val;
- } else
+ return __Pyx_PyObject_GetAttrStr(o, n);
#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];
- }
- }
+ return PyObject_GetAttr(o, n);
+}
+
+static PyObject* __Pyx_Globals(void) {
+ Py_ssize_t i;
+ PyObject *names;
+ PyObject *globals = __pyx_d;
+ Py_INCREF(globals);
+ 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 = __Pyx_GetAttr(__pyx_m, name);
+ if (!value) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
#endif
- if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to signed long");
- return (signed long)-1;
- }
- 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];
- }
+ goto bad;
}
+ if (PyDict_SetItem(globals, name, value) < 0) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
#endif
-#endif
- return (signed long)PyLong_AsLong(x);
+ Py_DECREF(value);
+ goto bad;
+ }
}
- } else {
- signed long val;
- PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (signed long)-1;
- val = __Pyx_PyInt_AsSignedLong(tmp);
- Py_DECREF(tmp);
- return val;
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
}
+ Py_DECREF(names);
+ return globals;
+bad:
+ Py_XDECREF(names);
+ Py_XDECREF(globals);
+ return NULL;
}
-#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;
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to signed PY_LONG_LONG");
- return (signed PY_LONG_LONG)-1;
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
}
- return (signed PY_LONG_LONG)val;
} else
#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];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
}
-#endif
+ #endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to signed PY_LONG_LONG");
- return (signed PY_LONG_LONG)-1;
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
- 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];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
+ #endif
#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long 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 (signed PY_LONG_LONG)PyLong_AsLongLong(x);
+ return (long) -1;
}
} else {
- signed PY_LONG_LONG val;
+ long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (signed PY_LONG_LONG)-1;
- val = __Pyx_PyInt_AsSignedLongLong(tmp);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
Py_DECREF(tmp);
return val;
}
-}
-
-static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
- PyObject *tmp_type, *tmp_value, *tmp_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
- PyThreadState *tstate = PyThreadState_GET();
- tmp_type = tstate->exc_type;
- tmp_value = tstate->exc_value;
- tmp_tb = tstate->exc_traceback;
- tstate->exc_type = *type;
- tstate->exc_value = *value;
- tstate->exc_traceback = *tb;
-#else
- PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
- PyErr_SetExcInfo(*type, *value, *tb);
-#endif
- *type = tmp_type;
- *value = tmp_value;
- *tb = tmp_tb;
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
}
static PyObject *__Pyx_Generator_Next(PyObject *self);
@@ -29899,7 +32507,7 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
Py_DECREF(ev);
#else
{
- PyObject* args = PyObject_GetAttr(ev, __pyx_n_s__args);
+ PyObject* args = PyObject_GetAttr(ev, __pyx_n_s_args);
Py_DECREF(ev);
if (likely(args)) {
value = PyObject_GetItem(args, 0);
@@ -29956,8 +32564,6 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
if (value) {
#if CYTHON_COMPILING_IN_PYPY
#else
- /* Generators always return to their most recent caller, not
- * necessarily their creator. */
if (self->exc_traceback) {
PyThreadState *tstate = PyThreadState_GET();
PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
@@ -29980,9 +32586,6 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
&self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY
#else
- /* Don't keep the reference to f_back any longer than necessary. It
- * may keep a chain of frames alive or it could create a reference
- * cycle. */
if (self->exc_traceback) {
PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
PyFrameObject *f = tb->tb_frame;
@@ -30035,7 +32638,7 @@ static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
if (value == Py_None)
ret = PyIter_Next(yf);
else
- ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s__send, value);
+ ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
}
gen->is_running = 0;
if (likely(ret)) {
@@ -30055,7 +32658,7 @@ static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
} else {
PyObject *meth;
gen->is_running = 1;
- meth = PyObject_GetAttr(yf, __pyx_n_s__close);
+ meth = PyObject_GetAttr(yf, __pyx_n_s_close);
if (unlikely(!meth)) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_WriteUnraisable(yf);
@@ -30086,11 +32689,7 @@ static PyObject *__Pyx_Generator_Close(PyObject *self) {
Py_DECREF(yf);
}
if (err == 0)
-#if PY_VERSION_HEX < 0x02050000
- PyErr_SetNone(PyExc_StopIteration);
-#else
PyErr_SetNone(PyExc_GeneratorExit);
-#endif
retval = __Pyx_Generator_SendEx(gen, NULL);
if (retval) {
Py_DECREF(retval);
@@ -30101,13 +32700,11 @@ static PyObject *__Pyx_Generator_Close(PyObject *self) {
raised_exception = PyErr_Occurred();
if (!raised_exception
|| raised_exception == PyExc_StopIteration
-#if PY_VERSION_HEX >= 0x02050000
|| raised_exception == PyExc_GeneratorExit
|| PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
-#endif
|| PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
{
- if (raised_exception) PyErr_Clear(); /* ignore these errors */
+ if (raised_exception) PyErr_Clear();
Py_INCREF(Py_None);
return Py_None;
}
@@ -30126,7 +32723,6 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
if (yf) {
PyObject *ret;
Py_INCREF(yf);
-#if PY_VERSION_HEX >= 0x02050000
if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
int err = __Pyx_Generator_CloseIter(gen, yf);
Py_DECREF(yf);
@@ -30135,12 +32731,11 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
return __Pyx_Generator_SendEx(gen, NULL);
goto throw_here;
}
-#endif
gen->is_running = 1;
if (__Pyx_Generator_CheckExact(yf)) {
ret = __Pyx_Generator_Throw(yf, args);
} else {
- PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s__throw);
+ PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s_throw);
if (unlikely(!meth)) {
Py_DECREF(yf);
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
@@ -30184,6 +32779,8 @@ static int __Pyx_Generator_clear(PyObject *self) {
Py_CLEAR(gen->exc_type);
Py_CLEAR(gen->exc_value);
Py_CLEAR(gen->exc_traceback);
+ Py_CLEAR(gen->gi_name);
+ Py_CLEAR(gen->gi_qualname);
return 0;
}
static void __Pyx_Generator_dealloc(PyObject *self) {
@@ -30191,13 +32788,19 @@ static void __Pyx_Generator_dealloc(PyObject *self) {
PyObject_GC_UnTrack(gen);
if (gen->gi_weakreflist != NULL)
PyObject_ClearWeakRefs(self);
- PyObject_GC_Track(self);
if (gen->resume_label > 0) {
+ PyObject_GC_Track(self);
+#if PY_VERSION_HEX >= 0x030400a1
+ if (PyObject_CallFinalizerFromDealloc(self))
+#else
Py_TYPE(gen)->tp_del(self);
if (self->ob_refcnt > 0)
- return; /* resurrected. :( */
+#endif
+ {
+ return;
+ }
+ PyObject_GC_UnTrack(self);
}
- PyObject_GC_UnTrack(self);
__Pyx_Generator_clear(self);
PyObject_GC_Del(gen);
}
@@ -30207,8 +32810,10 @@ static void __Pyx_Generator_del(PyObject *self) {
__pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
if (gen->resume_label <= 0)
return ;
+#if PY_VERSION_HEX < 0x030400a1
assert(self->ob_refcnt == 0);
self->ob_refcnt = 1;
+#endif
__Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
res = __Pyx_Generator_Close(self);
if (res == NULL)
@@ -30216,15 +32821,11 @@ static void __Pyx_Generator_del(PyObject *self) {
else
Py_DECREF(res);
__Pyx_ErrRestore(error_type, error_value, error_traceback);
- /* Undo the temporary resurrection; can't use DECREF here, it would
- * cause a recursive call.
- */
+#if PY_VERSION_HEX < 0x030400a1
assert(self->ob_refcnt > 0);
- if (--self->ob_refcnt == 0)
- return; /* this is the normal path out */
- /* close() resurrected it! Make it look like the original Py_DECREF
- * never happened.
- */
+ if (--self->ob_refcnt == 0) {
+ return;
+ }
{
Py_ssize_t refcnt = self->ob_refcnt;
_Py_NewReference(self);
@@ -30233,96 +32834,143 @@ static void __Pyx_Generator_del(PyObject *self) {
#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
- * we need to undo that. */
_Py_DEC_REFTOTAL;
#endif
- /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
- * chain, so no more to do there.
- * If COUNT_ALLOCS, the original decref bumped tp_frees, and
- * _Py_NewReference bumped tp_allocs: both of those need to be
- * undone.
- */
#ifdef COUNT_ALLOCS
--Py_TYPE(self)->tp_frees;
--Py_TYPE(self)->tp_allocs;
#endif
+#endif
}
-static PyMemberDef __pyx_Generator_memberlist[] = {
- {(char *) "gi_running",
-#if PY_VERSION_HEX >= 0x02060000
- T_BOOL,
+static PyObject *
+__Pyx_Generator_get_name(__pyx_GeneratorObject *self)
+{
+ Py_INCREF(self->gi_name);
+ return self->gi_name;
+}
+static int
+__Pyx_Generator_set_name(__pyx_GeneratorObject *self, PyObject *value)
+{
+ PyObject *tmp;
+#if PY_MAJOR_VERSION >= 3
+ if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
- T_BYTE,
+ if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
- offsetof(__pyx_GeneratorObject, is_running),
- READONLY,
- NULL},
+ PyErr_SetString(PyExc_TypeError,
+ "__name__ must be set to a string object");
+ return -1;
+ }
+ tmp = self->gi_name;
+ Py_INCREF(value);
+ self->gi_name = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
+static PyObject *
+__Pyx_Generator_get_qualname(__pyx_GeneratorObject *self)
+{
+ Py_INCREF(self->gi_qualname);
+ return self->gi_qualname;
+}
+static int
+__Pyx_Generator_set_qualname(__pyx_GeneratorObject *self, PyObject *value)
+{
+ PyObject *tmp;
+#if PY_MAJOR_VERSION >= 3
+ if (unlikely(value == NULL || !PyUnicode_Check(value))) {
+#else
+ if (unlikely(value == NULL || !PyString_Check(value))) {
+#endif
+ PyErr_SetString(PyExc_TypeError,
+ "__qualname__ must be set to a string object");
+ return -1;
+ }
+ tmp = self->gi_qualname;
+ Py_INCREF(value);
+ self->gi_qualname = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
+static PyGetSetDef __pyx_Generator_getsets[] = {
+ {(char *) "__name__", (getter)__Pyx_Generator_get_name, (setter)__Pyx_Generator_set_name,
+ (char*) PyDoc_STR("name of the generator"), 0},
+ {(char *) "__qualname__", (getter)__Pyx_Generator_get_qualname, (setter)__Pyx_Generator_set_qualname,
+ (char*) PyDoc_STR("qualified name of the generator"), 0},
+ {0, 0, 0, 0, 0}
+};
+static PyMemberDef __pyx_Generator_memberlist[] = {
+ {(char *) "gi_running", T_BOOL, offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL},
{0, 0, 0, 0, 0}
};
static PyMethodDef __pyx_Generator_methods[] = {
- {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
- {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
- {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
+ {"send", (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
+ {"throw", (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
+ {"close", (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("generator"), /*tp_name*/
- sizeof(__pyx_GeneratorObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
+ "generator",
+ sizeof(__pyx_GeneratorObject),
+ 0,
+ (destructor) __Pyx_Generator_dealloc,
+ 0,
+ 0,
+ 0,
#if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
+ 0,
+#else
+ 0,
+#endif
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
+ 0,
+ (traverseproc) __Pyx_Generator_traverse,
+ 0,
+ 0,
+ offsetof(__pyx_GeneratorObject, gi_weakreflist),
+ 0,
+ (iternextfunc) __Pyx_Generator_Next,
+ __pyx_Generator_methods,
+ __pyx_Generator_memberlist,
+ __pyx_Generator_getsets,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+#if PY_VERSION_HEX >= 0x030400a1
+ 0,
#else
- 0, /*reserved*/
+ __Pyx_Generator_del,
#endif
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
- 0, /*tp_doc*/
- (traverseproc) __Pyx_Generator_traverse, /*tp_traverse*/
- 0, /*tp_clear*/
- 0, /*tp_richcompare*/
- offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
- 0, /*tp_iter*/
- (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
- __pyx_Generator_methods, /*tp_methods*/
- __pyx_Generator_memberlist, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- __Pyx_Generator_del, /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
+ 0,
+#if PY_VERSION_HEX >= 0x030400a1
+ __Pyx_Generator_del,
#endif
};
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
- PyObject *closure) {
+ PyObject *closure, PyObject *name, PyObject *qualname) {
__pyx_GeneratorObject *gen =
PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
if (gen == NULL)
@@ -30338,16 +32986,20 @@ static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
gen->exc_value = NULL;
gen->exc_traceback = NULL;
gen->gi_weakreflist = NULL;
+ Py_XINCREF(qualname);
+ gen->gi_qualname = qualname;
+ Py_XINCREF(name);
+ gen->gi_name = name;
PyObject_GC_Track(gen);
return gen;
}
static int __pyx_Generator_init(void) {
__pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
__pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
- if (PyType_Ready(&__pyx_GeneratorType_type)) {
+ __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
+ if (__pyx_GeneratorType == NULL) {
return -1;
}
- __pyx_GeneratorType = &__pyx_GeneratorType_type;
return 0;
}
@@ -30361,11 +33013,7 @@ static int __Pyx_check_binary_version(void) {
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
- #if PY_VERSION_HEX < 0x02050000
- return PyErr_Warn(NULL, message);
- #else
return PyErr_WarnEx(NULL, message, 1);
- #endif
}
return 0;
}
@@ -30415,7 +33063,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
goto bad;
if (!PyType_Check(result)) {
PyErr_Format(PyExc_TypeError,
- "%s.%s is not a type object",
+ "%.200s.%.200s is not a type object",
module_name, class_name);
goto bad;
}
@@ -30435,15 +33083,11 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
PyOS_snprintf(warning, sizeof(warning),
"%s.%s size changed, may indicate binary incompatibility",
module_name, class_name);
- #if PY_VERSION_HEX < 0x02050000
- if (PyErr_Warn(NULL, warning) < 0) goto bad;
- #else
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
- #endif
}
else if ((size_t)basicsize != size) {
PyErr_Format(PyExc_ValueError,
- "%s.%s has the wrong size, try recompiling",
+ "%.200s.%.200s has the wrong size, try recompiling",
module_name, class_name);
goto bad;
}
@@ -30470,14 +33114,14 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
cobj = PyDict_GetItemString(d, funcname);
if (!cobj) {
PyErr_Format(PyExc_ImportError,
- "%s does not export expected C function %s",
+ "%.200s does not export expected C function %.200s",
PyModule_GetName(module), funcname);
goto bad;
}
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0)
+#if PY_VERSION_HEX >= 0x02070000
if (!PyCapsule_IsValid(cobj, sig)) {
PyErr_Format(PyExc_TypeError,
- "C function %s.%s has wrong signature (expected %s, got %s)",
+ "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
goto bad;
}
@@ -30491,7 +33135,7 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
if (*s1 != *s2) {
PyErr_Format(PyExc_TypeError,
- "C function %s.%s has wrong signature (expected %s, got %s)",
+ "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, desc);
goto bad;
}
@@ -30508,168 +33152,6 @@ bad:
}
#endif
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
- int start = 0, mid = 0, end = count - 1;
- if (end >= 0 && code_line > entries[end].code_line) {
- return count;
- }
- while (start < end) {
- mid = (start + end) / 2;
- if (code_line < entries[mid].code_line) {
- end = mid;
- } else if (code_line > entries[mid].code_line) {
- start = mid + 1;
- } else {
- return mid;
- }
- }
- if (code_line <= entries[mid].code_line) {
- return mid;
- } else {
- return mid + 1;
- }
-}
-static PyCodeObject *__pyx_find_code_object(int code_line) {
- PyCodeObject* code_object;
- int pos;
- if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
- return NULL;
- }
- pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
- if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
- return NULL;
- }
- code_object = __pyx_code_cache.entries[pos].code_object;
- Py_INCREF(code_object);
- return code_object;
-}
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
- int pos, i;
- __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
- if (unlikely(!code_line)) {
- return;
- }
- if (unlikely(!entries)) {
- entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
- if (likely(entries)) {
- __pyx_code_cache.entries = entries;
- __pyx_code_cache.max_count = 64;
- __pyx_code_cache.count = 1;
- entries[0].code_line = code_line;
- entries[0].code_object = code_object;
- Py_INCREF(code_object);
- }
- return;
- }
- pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
- if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
- PyCodeObject* tmp = entries[pos].code_object;
- entries[pos].code_object = code_object;
- Py_DECREF(tmp);
- return;
- }
- if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
- int new_max = __pyx_code_cache.max_count + 64;
- entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
- __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
- if (unlikely(!entries)) {
- return;
- }
- __pyx_code_cache.entries = entries;
- __pyx_code_cache.max_count = new_max;
- }
- for (i=__pyx_code_cache.count; i>pos; i--) {
- entries[i] = entries[i-1];
- }
- entries[pos].code_line = code_line;
- entries[pos].code_object = code_object;
- __pyx_code_cache.count++;
- Py_INCREF(code_object);
-}
-
-#include "compile.h"
-#include "frameobject.h"
-#include "traceback.h"
-static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
- const char *funcname, int c_line,
- int py_line, const char *filename) {
- PyCodeObject *py_code = 0;
- PyObject *py_srcfile = 0;
- PyObject *py_funcname = 0;
- #if PY_MAJOR_VERSION < 3
- py_srcfile = PyString_FromString(filename);
- #else
- py_srcfile = PyUnicode_FromString(filename);
- #endif
- if (!py_srcfile) goto bad;
- if (c_line) {
- #if PY_MAJOR_VERSION < 3
- py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
- #else
- py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
- #endif
- }
- else {
- #if PY_MAJOR_VERSION < 3
- py_funcname = PyString_FromString(funcname);
- #else
- py_funcname = PyUnicode_FromString(funcname);
- #endif
- }
- if (!py_funcname) goto bad;
- py_code = __Pyx_PyCode_New(
- 0, /*int argcount,*/
- 0, /*int kwonlyargcount,*/
- 0, /*int nlocals,*/
- 0, /*int stacksize,*/
- 0, /*int flags,*/
- __pyx_empty_bytes, /*PyObject *code,*/
- __pyx_empty_tuple, /*PyObject *consts,*/
- __pyx_empty_tuple, /*PyObject *names,*/
- __pyx_empty_tuple, /*PyObject *varnames,*/
- __pyx_empty_tuple, /*PyObject *freevars,*/
- __pyx_empty_tuple, /*PyObject *cellvars,*/
- py_srcfile, /*PyObject *filename,*/
- py_funcname, /*PyObject *name,*/
- py_line, /*int firstlineno,*/
- __pyx_empty_bytes /*PyObject *lnotab*/
- );
- Py_DECREF(py_srcfile);
- Py_DECREF(py_funcname);
- return py_code;
-bad:
- Py_XDECREF(py_srcfile);
- Py_XDECREF(py_funcname);
- return NULL;
-}
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
- int py_line, const char *filename) {
- PyCodeObject *py_code = 0;
- PyObject *py_globals = 0;
- PyFrameObject *py_frame = 0;
- py_code = __pyx_find_code_object(c_line ? c_line : py_line);
- if (!py_code) {
- py_code = __Pyx_CreateCodeObjectForTraceback(
- funcname, c_line, py_line, filename);
- if (!py_code) goto bad;
- __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
- }
- py_globals = PyModule_GetDict(__pyx_m);
- if (!py_globals) goto bad;
- py_frame = PyFrame_New(
- PyThreadState_GET(), /*PyThreadState *tstate,*/
- py_code, /*PyCodeObject *code,*/
- py_globals, /*PyObject *globals,*/
- 0 /*PyObject *locals*/
- );
- if (!py_frame) goto bad;
- py_frame->f_lineno = py_line;
- PyTraceBack_Here(py_frame);
-bad:
- Py_XDECREF(py_code);
- Py_XDECREF(py_frame);
-}
-
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
@@ -30680,7 +33162,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
- #else /* Python 3+ has unicode identifiers */
+ #else
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
@@ -30700,8 +33182,8 @@ 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 PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
Py_ssize_t ignore;
@@ -30730,29 +33212,35 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_
}
}
}
-#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+#endif
*length = PyBytes_GET_SIZE(defenc);
return defenc_c;
-#else /* PY_VERSION_HEX < 0x03030000 */
- if (PyUnicode_READY(o) == -1) return NULL;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
if (PyUnicode_IS_ASCII(o)) {
- *length = PyUnicode_GET_DATA_SIZE(o);
+ *length = PyUnicode_GET_LENGTH(o);
return PyUnicode_AsUTF8(o);
} else {
PyUnicode_AsASCIIString(o);
return NULL;
}
-#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#else
return PyUnicode_AsUTF8AndSize(o, length);
-#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
-#endif /* PY_VERSION_HEX < 0x03030000 */
+#endif
+#endif
} else
-#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
{
char* result;
int r = PyBytes_AsStringAndSize(o, &result, length);
- if (r < 0) {
+ if (unlikely(r < 0)) {
return NULL;
} else {
return result;
@@ -30797,7 +33285,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
- "__%s__ returned non-%s (type %.200s)",
+ "__%.4s__ returned non-%.4s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
@@ -30811,34 +33299,31 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
- PyObject* x = PyNumber_Index(b);
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
-#if PY_VERSION_HEX < 0x02050000
- if (ival <= LONG_MAX)
- return PyInt_FromLong((long)ival);
- else {
- unsigned char *bytes = (unsigned char *) &ival;
- int one = 1; int little = (int)*(unsigned char*)&one;
- return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
- }
-#else
- return PyInt_FromSize_t(ival);
-#endif
-}
-static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
- unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
- if (unlikely(val != (unsigned PY_LONG_LONG)(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;
+ return PyInt_FromSize_t(ival);
}