diff --git a/pycrfsuite/_float_features.py b/pycrfsuite/_float_features.py new file mode 100644 index 0000000..e69398f --- /dev/null +++ b/pycrfsuite/_float_features.py @@ -0,0 +1,15 @@ +from __future__ import print_function, absolute_import + + +class FloatFeatures(object): + def __init__(self, values): + if not isinstance(values, list): + raise ValueError("Values should be an instance of list()") + try: + self.values = [float(v) for v in values] + except ValueError: + print("All elements in values should be castable to type float.", file=sys.stderr) + raise + except: + print("Unexpected error:", sys.exc_info()[0]) + raise diff --git a/pycrfsuite/_pycrfsuite.cpp b/pycrfsuite/_pycrfsuite.cpp index f40b0ed..3cff97a 100644 --- a/pycrfsuite/_pycrfsuite.cpp +++ b/pycrfsuite/_pycrfsuite.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.23.4 */ +/* Generated by Cython 0.24 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -7,10 +7,10 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else -#define CYTHON_ABI "0_23_4" +#define CYTHON_ABI "0_24" #include #ifndef offsetof -#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall @@ -36,17 +36,23 @@ #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION -#define CYTHON_COMPILING_IN_PYPY 1 -#define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 #else -#define CYTHON_COMPILING_IN_PYPY 0 -#define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 -#define CYTHON_USE_PYLONG_INTERNALS 1 + #define CYTHON_USE_PYLONG_INTERNALS 1 +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #undef SHIFT + #undef BASE + #undef MASK #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) -#define Py_OptimizeFlag 0 + #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" @@ -82,6 +88,7 @@ #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) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) @@ -90,6 +97,7 @@ #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])) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) @@ -102,6 +110,14 @@ #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#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 @@ -109,6 +125,9 @@ #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -227,6 +246,11 @@ static CYTHON_INLINE float __PYX_NAN() { #endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ +{ \ + __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ +} + #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) @@ -284,7 +308,7 @@ static CYTHON_INLINE float __PYX_NAN() { # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif -typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 1 @@ -358,7 +382,7 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_COMPILING_IN_CPYTHON @@ -367,6 +391,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(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(void) { @@ -457,6 +487,7 @@ static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; +static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; @@ -475,7 +506,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite_Tagger; struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params; struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr; -/* "pycrfsuite/_pycrfsuite.pyx":113 +/* "pycrfsuite/_pycrfsuite.pyx":120 * * * cdef class ItemSequence(object): # <<<<<<<<<<<<<< @@ -488,7 +519,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite_ItemSequence { }; -/* "pycrfsuite/_pycrfsuite.pyx":201 +/* "pycrfsuite/_pycrfsuite.pyx":208 * * * cdef class BaseTrainer(object): # <<<<<<<<<<<<<< @@ -503,7 +534,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite_BaseTrainer { }; -/* "pycrfsuite/_pycrfsuite.pyx":549 +/* "pycrfsuite/_pycrfsuite.pyx":556 * * * cdef class Tagger(object): # <<<<<<<<<<<<<< @@ -517,7 +548,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite_Tagger { }; -/* "pycrfsuite/_pycrfsuite.pyx":392 +/* "pycrfsuite/_pycrfsuite.pyx":399 * self.set(key, value) * * def get_params(self): # <<<<<<<<<<<<<< @@ -530,7 +561,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params { }; -/* "pycrfsuite/_pycrfsuite.pyx":403 +/* "pycrfsuite/_pycrfsuite.pyx":410 * """ * # params = self.params() * return dict((name, self.get(name)) for name in self.params()) # <<<<<<<<<<<<<< @@ -545,7 +576,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr { -/* "pycrfsuite/_pycrfsuite.pyx":201 +/* "pycrfsuite/_pycrfsuite.pyx":208 * * * cdef class BaseTrainer(object): # <<<<<<<<<<<<<< @@ -559,7 +590,7 @@ struct __pyx_vtabstruct_10pycrfsuite_11_pycrfsuite_BaseTrainer { static struct __pyx_vtabstruct_10pycrfsuite_11_pycrfsuite_BaseTrainer *__pyx_vtabptr_10pycrfsuite_11_pycrfsuite_BaseTrainer; -/* "pycrfsuite/_pycrfsuite.pyx":549 +/* "pycrfsuite/_pycrfsuite.pyx":556 * * * cdef class Tagger(object): # <<<<<<<<<<<<<< @@ -573,6 +604,7 @@ struct __pyx_vtabstruct_10pycrfsuite_11_pycrfsuite_Tagger { static struct __pyx_vtabstruct_10pycrfsuite_11_pycrfsuite_Tagger *__pyx_vtabptr_10pycrfsuite_11_pycrfsuite_Tagger; /* --- Runtime support code (head) --- */ +/* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -635,6 +667,7 @@ static struct __pyx_vtabstruct_10pycrfsuite_11_pycrfsuite_Tagger *__pyx_vtabptr_ #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) +/* PyObjectGetAttrStr.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); @@ -650,17 +683,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif +/* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); +/* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); +/* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); +/* PyObjectSetAttrStr.proto */ #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) { @@ -678,18 +716,22 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) #endif +/* PyObjectCall.proto */ #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 +/* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif +/* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; @@ -710,11 +752,24 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #endif +/* GetModuleGlobalName.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); + +/* PyIntBinop.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); +#else +#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#endif + +/* decode_c_bytes.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); +/* decode_bytes.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_bytes( PyObject* string, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, @@ -724,6 +779,7 @@ static CYTHON_INLINE PyObject* __Pyx_decode_bytes( start, stop, encoding, errors, decode_func); } +/* ListAppend.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; @@ -740,55 +796,116 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* KeywordStringCheck.proto */ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); +/* PyObjectCallNoArg.proto */ #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 -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); +/* PyThreadStateGet.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#endif -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* PyErrFetchRestore.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +/* RaiseNeedMoreValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +/* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); +/* UnpackItemEndCheck.proto */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); +/* None.proto */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); +/* PySequenceContains.proto */ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { int result = PySequence_Contains(seq, item); return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } +/* IncludeStringH.proto */ #include +/* BytesEquals.proto */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); +/* UnicodeEquals.proto */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); +/* StrEquals.proto */ #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals #else #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); +/* SaveResetException.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* PyErrExceptionMatches.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif +/* GetException.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif +/* SwapException.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif +/* PyObjectLookupSpecial.proto */ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { PyObject *res; @@ -814,6 +931,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObj #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) #endif +/* ListCompAppend.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; @@ -830,16 +948,22 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif +/* SetVTable.proto */ static int __Pyx_SetVtable(PyObject *dict, void *vtable); +/* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); +/* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +/* CythonFunction.proto */ #define __Pyx_CyFunction_USED 1 #include #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 @@ -893,14 +1017,16 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(void); +/* Py3ClassCreate.proto */ 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); +/* CodeObjectCache.proto */ typedef struct { - int code_line; PyCodeObject* code_object; + int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; @@ -912,15 +1038,17 @@ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int co static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +/* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); +/* None.proto */ #include +/* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - +/* CppExceptionConversion.proto */ #ifndef __Pyx_CppExn2PyErr #include #include @@ -960,14 +1088,22 @@ static void __Pyx_CppExn2PyErr() { } #endif +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* CIntFromPy.proto */ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); +/* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +/* PyObjectCallMethod1.proto */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); +/* CoroutineBase.proto */ typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *); typedef struct { PyObject_HEAD @@ -993,10 +1129,13 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); #define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) #endif +/* PatchModuleWithCoroutine.proto */ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); +/* PatchGeneratorABC.proto */ static int __Pyx_patch_abc(void); +/* Generator.proto */ #define __Pyx_Generator_USED static PyTypeObject *__pyx_GeneratorType = 0; #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) @@ -1005,8 +1144,10 @@ static PyTypeObject *__pyx_GeneratorType = 0; static PyObject *__Pyx_Generator_Next(PyObject *self); static int __pyx_Generator_init(void); +/* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); +/* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_11BaseTrainer__on_message(struct __pyx_obj_10pycrfsuite_11_pycrfsuite_BaseTrainer *__pyx_v_self, std::string __pyx_v_message); /* proto*/ @@ -1042,183 +1183,187 @@ int __pyx_module_is_main_pycrfsuite___pycrfsuite = 0; /* Implementation of 'pycrfsuite._pycrfsuite' */ static PyObject *__pyx_builtin_Exception; +static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_OSError; static PyObject *__pyx_builtin_open; static PyObject *__pyx_builtin_range; -static char __pyx_k_[] = ""; -static char __pyx_k_c[] = "c"; -static char __pyx_k_y[] = "y"; -static char __pyx_k__8[] = ":"; -static char __pyx_k_ap[] = "ap"; -static char __pyx_k_c1[] = "c1"; -static char __pyx_k_c2[] = "c2"; -static char __pyx_k_os[] = "os"; -static char __pyx_k_pa[] = "pa"; -static char __pyx_k_rb[] = "rb"; -static char __pyx_k_doc[] = "__doc__"; -static char __pyx_k_dup[] = "dup"; -static char __pyx_k_end[] = "end"; -static char __pyx_k_get[] = "get"; -static char __pyx_k_log[] = "log"; -static char __pyx_k_pos[] = "pos"; -static char __pyx_k_set[] = "set"; -static char __pyx_k_sys[] = "sys"; -static char __pyx_k_txt[] = "txt"; -static char __pyx_k_args[] = "args"; -static char __pyx_k_code[] = "code"; -static char __pyx_k_exit[] = "__exit__"; -static char __pyx_k_feed[] = "feed"; -static char __pyx_k_info[] = "info"; -static char __pyx_k_init[] = "__init__"; -static char __pyx_k_lCRF[] = "lCRF"; -static char __pyx_k_main[] = "__main__"; -static char __pyx_k_name[] = "name"; -static char __pyx_k_open[] = "open"; -static char __pyx_k_read[] = "read"; -static char __pyx_k_seek[] = "seek"; -static char __pyx_k_self[] = "self"; -static char __pyx_k_send[] = "send"; -static char __pyx_k_tell[] = "tell"; -static char __pyx_k_test[] = "__test__"; -static char __pyx_k_type[] = "type"; -static char __pyx_k_utf8[] = "utf8"; -static char __pyx_k_xseq[] = "xseq"; -static char __pyx_k_yseq[] = "yseq"; -static char __pyx_k_close[] = "close"; -static char __pyx_k_crf1d[] = "crf1d"; -static char __pyx_k_delta[] = "delta"; -static char __pyx_k_enter[] = "__enter__"; -static char __pyx_k_event[] = "event"; -static char __pyx_k_gamma[] = "gamma"; -static char __pyx_k_group[] = "group"; -static char __pyx_k_items[] = "items"; -static char __pyx_k_lbfgs[] = "lbfgs"; -static char __pyx_k_lower[] = "lower"; -static char __pyx_k_model[] = "model"; -static char __pyx_k_print[] = "print"; -static char __pyx_k_pyseq[] = "pyseq"; -static char __pyx_k_range[] = "range"; -static char __pyx_k_start[] = "start"; -static char __pyx_k_throw[] = "throw"; -static char __pyx_k_value[] = "value"; -static char __pyx_k_decode[] = "decode"; -static char __pyx_k_fileno[] = "fileno"; -static char __pyx_k_import[] = "__import__"; -static char __pyx_k_module[] = "__module__"; -static char __pyx_k_on_end[] = "on_end"; -static char __pyx_k_params[] = "params"; -static char __pyx_k_period[] = "period"; -static char __pyx_k_result[] = "result"; -static char __pyx_k_select[] = "select"; -static char __pyx_k_stdout[] = "stdout"; -static char __pyx_k_unlink[] = "unlink"; -static char __pyx_k_OSError[] = "OSError"; -static char __pyx_k_O_CREAT[] = "O_CREAT"; -static char __pyx_k_Trainer[] = "Trainer"; -static char __pyx_k_closing[] = "closing"; -static char __pyx_k_epsilon[] = "epsilon"; -static char __pyx_k_genexpr[] = "genexpr"; -static char __pyx_k_holdout[] = "holdout"; -static char __pyx_k_intbool[] = "_intbool"; -static char __pyx_k_message[] = "message"; -static char __pyx_k_mkstemp[] = "mkstemp"; -static char __pyx_k_percent[] = "percent"; -static char __pyx_k_prepare[] = "__prepare__"; -static char __pyx_k_verbose[] = "verbose"; -static char __pyx_k_O_WRONLY[] = "O_WRONLY"; -static char __pyx_k_Overflow[] = "Overflow"; -static char __pyx_k_SEEK_END[] = "SEEK_END"; -static char __pyx_k_filename[] = "filename"; -static char __pyx_k_last_log[] = "last_log"; -static char __pyx_k_messages[] = "_messages"; -static char __pyx_k_on_start[] = "on_start"; -static char __pyx_k_prepared[] = "prepared"; -static char __pyx_k_qualname[] = "__qualname__"; -static char __pyx_k_tempfile[] = "tempfile"; -static char __pyx_k_variance[] = "variance"; -static char __pyx_k_Exception[] = "Exception"; -static char __pyx_k_algorithm[] = "algorithm"; -static char __pyx_k_averaging[] = "averaging"; -static char __pyx_k_iteration[] = "iteration"; -static char __pyx_k_logparser[] = "_logparser"; -static char __pyx_k_metaclass[] = "__metaclass__"; -static char __pyx_k_ValueError[] = "ValueError"; -static char __pyx_k_contextlib[] = "contextlib"; -static char __pyx_k_dumpparser[] = "_dumpparser"; -static char __pyx_k_linesearch[] = "linesearch"; -static char __pyx_k_pycrfsuite[] = "pycrfsuite"; -static char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static char __pyx_k_set_params[] = "set_params"; -static char __pyx_k_check_model[] = "_check_model"; -static char __pyx_k_featgen_end[] = "featgen_end"; -static char __pyx_k_logparser_2[] = "logparser"; -static char __pyx_k_on_prepared[] = "on_prepared"; -static char __pyx_k_before_train[] = "_before_train"; -static char __pyx_k_num_memories[] = "num_memories"; -static char __pyx_k_on_iteration[] = "on_iteration"; -static char __pyx_k_CRFSuiteError[] = "CRFSuiteError"; -static char __pyx_k_prepare_error[] = "prepare_error"; -static char __pyx_k_Internal_error[] = "Internal error"; -static char __pyx_k_TrainLogParser[] = "TrainLogParser"; -static char __pyx_k_Trainer_on_end[] = "Trainer.on_end"; -static char __pyx_k_cast_parameter[] = "_cast_parameter"; -static char __pyx_k_last_iteration[] = "last_iteration"; -static char __pyx_k_max_iterations[] = "max_iterations"; -static char __pyx_k_max_linesearch[] = "max_linesearch"; -static char __pyx_k_on_featgen_end[] = "on_featgen_end"; -static char __pyx_k_verbose_object[] = "verbose: object"; -static char __pyx_k_Not_implemented[] = "Not implemented"; -static char __pyx_k_PARAMETER_TYPES[] = "_PARAMETER_TYPES"; -static char __pyx_k_Trainer_message[] = "Trainer.message"; -static char __pyx_k_Unknown_event_r[] = "Unknown event %r"; -static char __pyx_k_calibration_eta[] = "calibration.eta"; -static char __pyx_k_error_sensitive[] = "error_sensitive"; -static char __pyx_k_featgen_percent[] = "featgen_percent"; -static char __pyx_k_feature_minfreq[] = "feature.minfreq"; -static char __pyx_k_CRFSUITE_VERSION[] = "CRFSUITE_VERSION"; -static char __pyx_k_Trainer_on_start[] = "Trainer.on_start"; -static char __pyx_k_Unexpected_error[] = "Unexpected error"; -static char __pyx_k_calibration_rate[] = "calibration.rate"; -static char __pyx_k_featgen_progress[] = "featgen_progress"; -static char __pyx_k_on_prepare_error[] = "on_prepare_error"; -static char __pyx_k_optimization_end[] = "optimization_end"; -static char __pyx_k_ALGORITHM_ALIASES[] = "_ALGORITHM_ALIASES"; -static char __pyx_k_Incompatible_data[] = "Incompatible data"; -static char __pyx_k_CRFsuiteDumpParser[] = "CRFsuiteDumpParser"; -static char __pyx_k_passive_aggressive[] = "passive-aggressive"; -static char __pyx_k_Insufficient_memory[] = "Insufficient memory"; -static char __pyx_k_Trainer_on_prepared[] = "Trainer.on_prepared"; -static char __pyx_k_averaged_perceptron[] = "averaged-perceptron"; -static char __pyx_k_calibration_samples[] = "calibration.samples"; -static char __pyx_k_on_featgen_progress[] = "on_featgen_progress"; -static char __pyx_k_on_optimization_end[] = "on_optimization_end"; -static char __pyx_k_CRFSuiteError___init[] = "CRFSuiteError.__init__"; -static char __pyx_k_Invalid_model_file_r[] = "Invalid model file %r"; -static char __pyx_k_Trainer_on_iteration[] = "Trainer.on_iteration"; -static char __pyx_k_Parameter_not_found_s[] = "Parameter not found: %s"; -static char __pyx_k_Trainer__before_train[] = "Trainer._before_train"; -static char __pyx_k_Unsupported_operation[] = "Unsupported operation"; -static char __pyx_k_ItemSequence_of_size_d[] = ""; -static char __pyx_k_Trainer_on_featgen_end[] = "Trainer.on_featgen_end"; -static char __pyx_k_Unknown_error_occurred[] = "Unknown error occurred"; -static char __pyx_k_calibration_candidates[] = "calibration.candidates"; -static char __pyx_k_calibration_max_trials[] = "calibration.max_trials"; -static char __pyx_k_pycrfsuite__pycrfsuite[] = "pycrfsuite._pycrfsuite"; -static char __pyx_k_feature_possible_states[] = "feature.possible_states"; -static char __pyx_k_Trainer_on_prepare_error[] = "Trainer.on_prepare_error"; -static char __pyx_k_get_params_locals_genexpr[] = "get_params..genexpr"; -static char __pyx_k_Error_opening_model_file_r[] = "Error opening model file %r"; -static char __pyx_k_ItemSequence_items_line_162[] = "ItemSequence.items (line 162)"; -static char __pyx_k_Trainer_on_featgen_progress[] = "Trainer.on_featgen_progress"; -static char __pyx_k_Trainer_on_optimization_end[] = "Trainer.on_optimization_end"; -static char __pyx_k_feature_possible_transitions[] = "feature.possible_transitions"; -static char __pyx_k_Return_a_list_of_prepared_item[] = "\n Return a list of prepared item features:\n a list of ``{unicode_key: float_value}`` dicts.\n\n >>> ItemSequence([[\"foo\"], {\"bar\": {\"baz\": 1}}]).items()\n [{'foo': 1.0}, {'bar:baz': 1.0}]\n\n "; -static char __pyx_k_The_trainer_class_This_class_ma[] = "\n The trainer class.\n\n This class maintains a data set for training, and provides an interface\n to various training algorithms.\n\n Parameters\n ----------\n algorithm : {'lbfgs', 'l2sgd', 'ap', 'pa', 'arow'}\n The name of the training algorithm. See :meth:`Trainer.select`.\n\n params : dict, optional\n Training parameters. See :meth:`Trainer.set_params`\n and :meth:`Trainer.set`.\n\n verbose : boolean\n Whether to print debug messages during training. Default is True.\n\n "; -static char __pyx_k_Users_kmike_svn_python_crfsuite[] = "/Users/kmike/svn/python-crfsuite/pycrfsuite/_pycrfsuite.pyx"; -static char __pyx_k_Bad_arguments_algorithm_r_type_r[] = "Bad arguments: algorithm=%r, type=%r"; -static char __pyx_k_Model_file_r_doesn_t_have_a_comp[] = "Model file %r doesn't have a complete header"; +static const char __pyx_k_[] = ""; +static const char __pyx_k_c[] = "c"; +static const char __pyx_k_y[] = "y"; +static const char __pyx_k__8[] = ":"; +static const char __pyx_k_ap[] = "ap"; +static const char __pyx_k_c1[] = "c1"; +static const char __pyx_k_c2[] = "c2"; +static const char __pyx_k_os[] = "os"; +static const char __pyx_k_pa[] = "pa"; +static const char __pyx_k_rb[] = "rb"; +static const char __pyx_k_doc[] = "__doc__"; +static const char __pyx_k_dup[] = "dup"; +static const char __pyx_k_end[] = "end"; +static const char __pyx_k_get[] = "get"; +static const char __pyx_k_log[] = "log"; +static const char __pyx_k_pos[] = "pos"; +static const char __pyx_k_set[] = "set"; +static const char __pyx_k_sys[] = "sys"; +static const char __pyx_k_txt[] = "txt"; +static const char __pyx_k_args[] = "args"; +static const char __pyx_k_code[] = "code"; +static const char __pyx_k_exit[] = "__exit__"; +static const char __pyx_k_feed[] = "feed"; +static const char __pyx_k_info[] = "info"; +static const char __pyx_k_init[] = "__init__"; +static const char __pyx_k_lCRF[] = "lCRF"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_name[] = "name"; +static const char __pyx_k_open[] = "open"; +static const char __pyx_k_read[] = "read"; +static const char __pyx_k_seek[] = "seek"; +static const char __pyx_k_self[] = "self"; +static const char __pyx_k_send[] = "send"; +static const char __pyx_k_tell[] = "tell"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_type[] = "type"; +static const char __pyx_k_utf8[] = "utf8"; +static const char __pyx_k_xseq[] = "xseq"; +static const char __pyx_k_yseq[] = "yseq"; +static const char __pyx_k_close[] = "close"; +static const char __pyx_k_crf1d[] = "crf1d"; +static const char __pyx_k_delta[] = "delta"; +static const char __pyx_k_enter[] = "__enter__"; +static const char __pyx_k_event[] = "event"; +static const char __pyx_k_gamma[] = "gamma"; +static const char __pyx_k_group[] = "group"; +static const char __pyx_k_items[] = "items"; +static const char __pyx_k_lbfgs[] = "lbfgs"; +static const char __pyx_k_lower[] = "lower"; +static const char __pyx_k_model[] = "model"; +static const char __pyx_k_print[] = "print"; +static const char __pyx_k_pyseq[] = "pyseq"; +static const char __pyx_k_range[] = "range"; +static const char __pyx_k_start[] = "start"; +static const char __pyx_k_throw[] = "throw"; +static const char __pyx_k_value[] = "value"; +static const char __pyx_k_decode[] = "decode"; +static const char __pyx_k_fileno[] = "fileno"; +static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_module[] = "__module__"; +static const char __pyx_k_on_end[] = "on_end"; +static const char __pyx_k_params[] = "params"; +static const char __pyx_k_period[] = "period"; +static const char __pyx_k_result[] = "result"; +static const char __pyx_k_select[] = "select"; +static const char __pyx_k_stdout[] = "stdout"; +static const char __pyx_k_unlink[] = "unlink"; +static const char __pyx_k_values[] = "values"; +static const char __pyx_k_OSError[] = "OSError"; +static const char __pyx_k_O_CREAT[] = "O_CREAT"; +static const char __pyx_k_Trainer[] = "Trainer"; +static const char __pyx_k_closing[] = "closing"; +static const char __pyx_k_epsilon[] = "epsilon"; +static const char __pyx_k_genexpr[] = "genexpr"; +static const char __pyx_k_holdout[] = "holdout"; +static const char __pyx_k_intbool[] = "_intbool"; +static const char __pyx_k_message[] = "message"; +static const char __pyx_k_mkstemp[] = "mkstemp"; +static const char __pyx_k_percent[] = "percent"; +static const char __pyx_k_prepare[] = "__prepare__"; +static const char __pyx_k_verbose[] = "verbose"; +static const char __pyx_k_O_WRONLY[] = "O_WRONLY"; +static const char __pyx_k_Overflow[] = "Overflow"; +static const char __pyx_k_SEEK_END[] = "SEEK_END"; +static const char __pyx_k_filename[] = "filename"; +static const char __pyx_k_last_log[] = "last_log"; +static const char __pyx_k_messages[] = "_messages"; +static const char __pyx_k_on_start[] = "on_start"; +static const char __pyx_k_prepared[] = "prepared"; +static const char __pyx_k_qualname[] = "__qualname__"; +static const char __pyx_k_tempfile[] = "tempfile"; +static const char __pyx_k_variance[] = "variance"; +static const char __pyx_k_Exception[] = "Exception"; +static const char __pyx_k_algorithm[] = "algorithm"; +static const char __pyx_k_averaging[] = "averaging"; +static const char __pyx_k_enumerate[] = "enumerate"; +static const char __pyx_k_iteration[] = "iteration"; +static const char __pyx_k_logparser[] = "_logparser"; +static const char __pyx_k_metaclass[] = "__metaclass__"; +static const char __pyx_k_ValueError[] = "ValueError"; +static const char __pyx_k_contextlib[] = "contextlib"; +static const char __pyx_k_dumpparser[] = "_dumpparser"; +static const char __pyx_k_linesearch[] = "linesearch"; +static const char __pyx_k_pycrfsuite[] = "pycrfsuite"; +static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; +static const char __pyx_k_set_params[] = "set_params"; +static const char __pyx_k_check_model[] = "_check_model"; +static const char __pyx_k_featgen_end[] = "featgen_end"; +static const char __pyx_k_logparser_2[] = "logparser"; +static const char __pyx_k_on_prepared[] = "on_prepared"; +static const char __pyx_k_before_train[] = "_before_train"; +static const char __pyx_k_num_memories[] = "num_memories"; +static const char __pyx_k_on_iteration[] = "on_iteration"; +static const char __pyx_k_CRFSuiteError[] = "CRFSuiteError"; +static const char __pyx_k_FloatFeatures[] = "FloatFeatures"; +static const char __pyx_k_prepare_error[] = "prepare_error"; +static const char __pyx_k_Internal_error[] = "Internal error"; +static const char __pyx_k_TrainLogParser[] = "TrainLogParser"; +static const char __pyx_k_Trainer_on_end[] = "Trainer.on_end"; +static const char __pyx_k_cast_parameter[] = "_cast_parameter"; +static const char __pyx_k_float_features[] = "_float_features"; +static const char __pyx_k_last_iteration[] = "last_iteration"; +static const char __pyx_k_max_iterations[] = "max_iterations"; +static const char __pyx_k_max_linesearch[] = "max_linesearch"; +static const char __pyx_k_on_featgen_end[] = "on_featgen_end"; +static const char __pyx_k_Not_implemented[] = "Not implemented"; +static const char __pyx_k_PARAMETER_TYPES[] = "_PARAMETER_TYPES"; +static const char __pyx_k_Trainer_message[] = "Trainer.message"; +static const char __pyx_k_Unknown_event_r[] = "Unknown event %r"; +static const char __pyx_k_calibration_eta[] = "calibration.eta"; +static const char __pyx_k_error_sensitive[] = "error_sensitive"; +static const char __pyx_k_featgen_percent[] = "featgen_percent"; +static const char __pyx_k_feature_minfreq[] = "feature.minfreq"; +static const char __pyx_k_CRFSUITE_VERSION[] = "CRFSUITE_VERSION"; +static const char __pyx_k_Trainer_on_start[] = "Trainer.on_start"; +static const char __pyx_k_Unexpected_error[] = "Unexpected error"; +static const char __pyx_k_calibration_rate[] = "calibration.rate"; +static const char __pyx_k_featgen_progress[] = "featgen_progress"; +static const char __pyx_k_on_prepare_error[] = "on_prepare_error"; +static const char __pyx_k_optimization_end[] = "optimization_end"; +static const char __pyx_k_ALGORITHM_ALIASES[] = "_ALGORITHM_ALIASES"; +static const char __pyx_k_Incompatible_data[] = "Incompatible data"; +static const char __pyx_k_CRFsuiteDumpParser[] = "CRFsuiteDumpParser"; +static const char __pyx_k_passive_aggressive[] = "passive-aggressive"; +static const char __pyx_k_Insufficient_memory[] = "Insufficient memory"; +static const char __pyx_k_Trainer_on_prepared[] = "Trainer.on_prepared"; +static const char __pyx_k_averaged_perceptron[] = "averaged-perceptron"; +static const char __pyx_k_calibration_samples[] = "calibration.samples"; +static const char __pyx_k_on_featgen_progress[] = "on_featgen_progress"; +static const char __pyx_k_on_optimization_end[] = "on_optimization_end"; +static const char __pyx_k_CRFSuiteError___init[] = "CRFSuiteError.__init__"; +static const char __pyx_k_Invalid_model_file_r[] = "Invalid model file %r"; +static const char __pyx_k_Trainer_on_iteration[] = "Trainer.on_iteration"; +static const char __pyx_k_Parameter_not_found_s[] = "Parameter not found: %s"; +static const char __pyx_k_Trainer__before_train[] = "Trainer._before_train"; +static const char __pyx_k_Unsupported_operation[] = "Unsupported operation"; +static const char __pyx_k_ItemSequence_of_size_d[] = ""; +static const char __pyx_k_Trainer_on_featgen_end[] = "Trainer.on_featgen_end"; +static const char __pyx_k_Unknown_error_occurred[] = "Unknown error occurred"; +static const char __pyx_k_calibration_candidates[] = "calibration.candidates"; +static const char __pyx_k_calibration_max_trials[] = "calibration.max_trials"; +static const char __pyx_k_pycrfsuite__pycrfsuite[] = "pycrfsuite._pycrfsuite"; +static const char __pyx_k_feature_possible_states[] = "feature.possible_states"; +static const char __pyx_k_Trainer_on_prepare_error[] = "Trainer.on_prepare_error"; +static const char __pyx_k_get_params_locals_genexpr[] = "get_params..genexpr"; +static const char __pyx_k_Error_opening_model_file_r[] = "Error opening model file %r"; +static const char __pyx_k_ItemSequence_items_line_169[] = "ItemSequence.items (line 169)"; +static const char __pyx_k_Trainer_on_featgen_progress[] = "Trainer.on_featgen_progress"; +static const char __pyx_k_Trainer_on_optimization_end[] = "Trainer.on_optimization_end"; +static const char __pyx_k_feature_possible_transitions[] = "feature.possible_transitions"; +static const char __pyx_k_Return_a_list_of_prepared_item[] = "\n Return a list of prepared item features:\n a list of ``{unicode_key: float_value}`` dicts.\n\n >>> ItemSequence([[\"foo\"], {\"bar\": {\"baz\": 1}}]).items()\n [{'foo': 1.0}, {'bar:baz': 1.0}]\n\n "; +static const char __pyx_k_The_trainer_class_This_class_ma[] = "\n The trainer class.\n\n This class maintains a data set for training, and provides an interface\n to various training algorithms.\n\n Parameters\n ----------\n algorithm : {'lbfgs', 'l2sgd', 'ap', 'pa', 'arow'}\n The name of the training algorithm. See :meth:`Trainer.select`.\n\n params : dict, optional\n Training parameters. See :meth:`Trainer.set_params`\n and :meth:`Trainer.set`.\n\n verbose : boolean\n Whether to print debug messages during training. Default is True.\n\n "; +static const char __pyx_k_home_entity_Code_python_crfsuit[] = "/home/entity/Code/python-crfsuite/pycrfsuite/_pycrfsuite.pyx"; +static const char __pyx_k_Bad_arguments_algorithm_r_type_r[] = "Bad arguments: algorithm=%r, type=%r"; +static const char __pyx_k_Model_file_r_doesn_t_have_a_comp[] = "Model file %r doesn't have a complete header"; static PyObject *__pyx_kp_s_; static PyObject *__pyx_n_s_ALGORITHM_ALIASES; static PyObject *__pyx_kp_s_Bad_arguments_algorithm_r_type_r; @@ -1228,11 +1373,12 @@ static PyObject *__pyx_n_s_CRFSuiteError___init; static PyObject *__pyx_n_s_CRFsuiteDumpParser; static PyObject *__pyx_kp_s_Error_opening_model_file_r; static PyObject *__pyx_n_s_Exception; +static PyObject *__pyx_n_s_FloatFeatures; static PyObject *__pyx_kp_s_Incompatible_data; static PyObject *__pyx_kp_s_Insufficient_memory; static PyObject *__pyx_kp_s_Internal_error; static PyObject *__pyx_kp_s_Invalid_model_file_r; -static PyObject *__pyx_kp_u_ItemSequence_items_line_162; +static PyObject *__pyx_kp_u_ItemSequence_items_line_169; static PyObject *__pyx_kp_s_ItemSequence_of_size_d; static PyObject *__pyx_kp_s_Model_file_r_doesn_t_have_a_comp; static PyObject *__pyx_kp_s_Not_implemented; @@ -1261,7 +1407,6 @@ static PyObject *__pyx_kp_s_Unexpected_error; static PyObject *__pyx_kp_s_Unknown_error_occurred; static PyObject *__pyx_kp_s_Unknown_event_r; static PyObject *__pyx_kp_s_Unsupported_operation; -static PyObject *__pyx_kp_s_Users_kmike_svn_python_crfsuite; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_kp_b__8; static PyObject *__pyx_n_s_algorithm; @@ -1293,6 +1438,7 @@ static PyObject *__pyx_n_s_dumpparser; static PyObject *__pyx_n_s_dup; static PyObject *__pyx_n_s_end; static PyObject *__pyx_n_s_enter; +static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_epsilon; static PyObject *__pyx_n_s_error_sensitive; static PyObject *__pyx_n_s_event; @@ -1306,12 +1452,14 @@ static PyObject *__pyx_kp_s_feature_possible_transitions; static PyObject *__pyx_n_s_feed; static PyObject *__pyx_n_s_filename; static PyObject *__pyx_n_s_fileno; +static PyObject *__pyx_n_s_float_features; static PyObject *__pyx_n_s_gamma; static PyObject *__pyx_n_s_genexpr; static PyObject *__pyx_n_s_get; static PyObject *__pyx_n_s_get_params_locals_genexpr; static PyObject *__pyx_n_s_group; static PyObject *__pyx_n_s_holdout; +static PyObject *__pyx_kp_s_home_entity_Code_python_crfsuit; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_info; static PyObject *__pyx_n_s_init; @@ -1386,6 +1534,7 @@ static PyObject *__pyx_n_s_type; static PyObject *__pyx_n_s_unlink; static PyObject *__pyx_n_s_utf8; static PyObject *__pyx_n_s_value; +static PyObject *__pyx_n_s_values; static PyObject *__pyx_n_s_variance; static PyObject *__pyx_n_s_verbose; static PyObject *__pyx_n_s_xseq; @@ -1442,6 +1591,7 @@ static PyObject *__pyx_tp_new_10pycrfsuite_11_pycrfsuite_Tagger(PyTypeObject *t, static PyObject *__pyx_tp_new_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; static PyObject *__pyx_int_4; static PyObject *__pyx_int_48; static PyObject *__pyx_tuple__2; @@ -1488,9 +1638,6 @@ static PyMethodDef __pyx_mdef_10pycrfsuite_11_pycrfsuite_13CRFSuiteError_1__init static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_13CRFSuiteError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_code = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -1514,11 +1661,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_13CRFSuiteError_1__init__(P case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_code)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 32, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 32, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1531,7 +1678,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_13CRFSuiteError_1__init__(P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 32, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.CRFSuiteError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1555,9 +1702,6 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY PyObject *__pyx_t_6 = NULL; Py_ssize_t __pyx_t_7; PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "pycrfsuite/_pycrfsuite.pyx":33 @@ -1567,7 +1711,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY * Exception.__init__(self._messages.get(self.code, "Unexpected error")) * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code, __pyx_v_code) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code, __pyx_v_code) < 0) __PYX_ERR(0, 33, __pyx_L1_error) /* "pycrfsuite/_pycrfsuite.pyx":34 * def __init__(self, code): @@ -1576,14 +1720,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_Exception, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_Exception, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_messages); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_messages); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_code); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; __pyx_t_7 = 0; @@ -1597,7 +1741,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY __pyx_t_7 = 1; } } - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; @@ -1608,7 +1752,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY __Pyx_GIVEREF(__pyx_kp_s_Unexpected_error); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_kp_s_Unexpected_error); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -1623,17 +1767,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY } } if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } @@ -1682,6 +1826,8 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx int __pyx_v_is_dict; PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_v = NULL; CRFSuite::Attribute __pyx_v_attr; CRFSuite::Item __pyx_r; __Pyx_RefNannyDeclarations @@ -1693,14 +1839,17 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx PyObject *__pyx_t_6 = NULL; int __pyx_t_7; std::string __pyx_t_8; - int __pyx_t_9; - std::vector ::iterator __pyx_t_10; - CRFSuite::Item *__pyx_t_11; - CRFSuite::Attribute __pyx_t_12; - double __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + double __pyx_t_15; + int __pyx_t_16; + std::vector ::iterator __pyx_t_17; + CRFSuite::Item *__pyx_t_18; + CRFSuite::Attribute __pyx_t_19; __Pyx_RefNannySetupContext("to_item", 0); /* "pycrfsuite/_pycrfsuite.pyx":46 @@ -1724,7 +1873,7 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx __pyx_t_2 = CRFSuite::Item(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 47, __pyx_L1_error) } __pyx_v_c_item = __pyx_t_2; @@ -1735,7 +1884,7 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx * for key in x: * if isinstance(key, unicode): */ - __pyx_t_3 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 48, __pyx_L1_error) __pyx_v_c_item.reserve(__pyx_t_3); /* "pycrfsuite/_pycrfsuite.pyx":49 @@ -1749,26 +1898,26 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx __pyx_t_4 = __pyx_v_x; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_x); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 49, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 49, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } @@ -1778,7 +1927,7 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx 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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else __PYX_ERR(0, 49, __pyx_L1_error) } break; } @@ -1807,11 +1956,11 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx */ if (unlikely(__pyx_v_key == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 51, __pyx_L1_error) } - __pyx_t_6 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_key)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_key)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_c_key = __pyx_t_8; @@ -1833,7 +1982,7 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx * if not is_dict: */ /*else*/ { - __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error) __pyx_v_c_key = __pyx_t_8; } __pyx_L5:; @@ -1868,7 +2017,7 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx __pyx_v_c_item.push_back(CRFSuite::Attribute(__pyx_v_c_key, __pyx_v_c_value)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 58, __pyx_L1_error) } /* "pycrfsuite/_pycrfsuite.pyx":55 @@ -1885,48 +2034,194 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx * c_item.push_back(crfsuite_api.Attribute(c_key, c_value)) * else: * value = (x)[key] # <<<<<<<<<<<<<< - * - * if isinstance(value, (dict, list, set)): + * if isinstance(value, _float_features.FloatFeatures): + * # {"string_prefix": _float_features.FloatFeatures([1., 2. ])} */ /*else*/ { if (unlikely(__pyx_v_x == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 60, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_x), __pyx_v_key); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_x), __pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6); __pyx_t_6 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":62 + /* "pycrfsuite/_pycrfsuite.pyx":61 + * else: * value = (x)[key] - * + * if isinstance(value, _float_features.FloatFeatures): # <<<<<<<<<<<<<< + * # {"string_prefix": _float_features.FloatFeatures([1., 2. ])} + * # value should be an instance of FloatFeatures + */ + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_float_features); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_FloatFeatures); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = PyObject_IsInstance(__pyx_v_value, __pyx_t_9); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = (__pyx_t_7 != 0); + if (__pyx_t_1) { + + /* "pycrfsuite/_pycrfsuite.pyx":64 + * # {"string_prefix": _float_features.FloatFeatures([1., 2. ])} + * # value should be an instance of FloatFeatures + * for i,v in enumerate(value.values): # <<<<<<<<<<<<<< + * c_item.push_back( + * crfsuite_api.Attribute(c_key + _SEP + str(i), v) + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_9 = __pyx_int_0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_values); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_10 = __pyx_t_6; __Pyx_INCREF(__pyx_t_10); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 64, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 64, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_10, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 64, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_10, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_12(__pyx_t_10); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 64, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_9); + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_9, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); + __pyx_t_9 = __pyx_t_6; + __pyx_t_6 = 0; + + /* "pycrfsuite/_pycrfsuite.pyx":66 + * for i,v in enumerate(value.values): + * c_item.push_back( + * crfsuite_api.Attribute(c_key + _SEP + str(i), v) # <<<<<<<<<<<<<< + * ) + * continue + */ + __pyx_t_6 = __pyx_convert_PyStr_string_to_py_std__in_string((__pyx_v_c_key + __pyx_v_10pycrfsuite_11_pycrfsuite__SEP)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_INCREF(__pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_i); + __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyNumber_Add(__pyx_t_6, __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L1_error) + + /* "pycrfsuite/_pycrfsuite.pyx":65 + * # value should be an instance of FloatFeatures + * for i,v in enumerate(value.values): + * c_item.push_back( # <<<<<<<<<<<<<< + * crfsuite_api.Attribute(c_key + _SEP + str(i), v) + * ) + */ + try { + __pyx_v_c_item.push_back(CRFSuite::Attribute(__pyx_t_8, __pyx_t_15)); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 65, __pyx_L1_error) + } + + /* "pycrfsuite/_pycrfsuite.pyx":64 + * # {"string_prefix": _float_features.FloatFeatures([1., 2. ])} + * # value should be an instance of FloatFeatures + * for i,v in enumerate(value.values): # <<<<<<<<<<<<<< + * c_item.push_back( + * crfsuite_api.Attribute(c_key + _SEP + str(i), v) + */ + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "pycrfsuite/_pycrfsuite.pyx":68 + * crfsuite_api.Attribute(c_key + _SEP + str(i), v) + * ) + * continue # <<<<<<<<<<<<<< + * if isinstance(value, (dict, list, set)): + * # {"string_prefix": {...}} + */ + goto __pyx_L3_continue; + + /* "pycrfsuite/_pycrfsuite.pyx":61 + * else: + * value = (x)[key] + * if isinstance(value, _float_features.FloatFeatures): # <<<<<<<<<<<<<< + * # {"string_prefix": _float_features.FloatFeatures([1., 2. ])} + * # value should be an instance of FloatFeatures + */ + } + + /* "pycrfsuite/_pycrfsuite.pyx":69 + * ) + * continue * if isinstance(value, (dict, list, set)): # <<<<<<<<<<<<<< * # {"string_prefix": {...}} * for attr in to_item(value): */ - __pyx_t_1 = PyDict_Check(__pyx_v_value); - __pyx_t_9 = (__pyx_t_1 != 0); - if (!__pyx_t_9) { + __pyx_t_7 = PyDict_Check(__pyx_v_value); + __pyx_t_16 = (__pyx_t_7 != 0); + if (!__pyx_t_16) { } else { - __pyx_t_7 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; + __pyx_t_1 = __pyx_t_16; + goto __pyx_L11_bool_binop_done; } - __pyx_t_9 = PyList_Check(__pyx_v_value); - __pyx_t_1 = (__pyx_t_9 != 0); - if (!__pyx_t_1) { + __pyx_t_16 = PyList_Check(__pyx_v_value); + __pyx_t_7 = (__pyx_t_16 != 0); + if (!__pyx_t_7) { } else { - __pyx_t_7 = __pyx_t_1; - goto __pyx_L8_bool_binop_done; + __pyx_t_1 = __pyx_t_7; + goto __pyx_L11_bool_binop_done; } - __pyx_t_1 = PySet_Check(__pyx_v_value); - __pyx_t_9 = (__pyx_t_1 != 0); - __pyx_t_7 = __pyx_t_9; - __pyx_L8_bool_binop_done:; - __pyx_t_9 = (__pyx_t_7 != 0); - if (__pyx_t_9) { - - /* "pycrfsuite/_pycrfsuite.pyx":64 + __pyx_t_7 = PySet_Check(__pyx_v_value); + __pyx_t_16 = (__pyx_t_7 != 0); + __pyx_t_1 = __pyx_t_16; + __pyx_L11_bool_binop_done:; + __pyx_t_16 = (__pyx_t_1 != 0); + if (__pyx_t_16) { + + /* "pycrfsuite/_pycrfsuite.pyx":71 * if isinstance(value, (dict, list, set)): * # {"string_prefix": {...}} * for attr in to_item(value): # <<<<<<<<<<<<<< @@ -1937,17 +2232,17 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx __pyx_t_2 = __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(__pyx_v_value); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 71, __pyx_L1_error) } - __pyx_t_11 = &__pyx_t_2; - __pyx_t_10 = __pyx_t_11->begin(); + __pyx_t_18 = &__pyx_t_2; + __pyx_t_17 = __pyx_t_18->begin(); for (;;) { - if (!(__pyx_t_10 != __pyx_t_11->end())) break; - __pyx_t_12 = *__pyx_t_10; - ++__pyx_t_10; - __pyx_v_attr = __pyx_t_12; + if (!(__pyx_t_17 != __pyx_t_18->end())) break; + __pyx_t_19 = *__pyx_t_17; + ++__pyx_t_17; + __pyx_v_attr = __pyx_t_19; - /* "pycrfsuite/_pycrfsuite.pyx":65 + /* "pycrfsuite/_pycrfsuite.pyx":72 * # {"string_prefix": {...}} * for attr in to_item(value): * c_item.push_back( # <<<<<<<<<<<<<< @@ -1958,10 +2253,10 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx __pyx_v_c_item.push_back(CRFSuite::Attribute(((__pyx_v_c_key + __pyx_v_10pycrfsuite_11_pycrfsuite__SEP) + __pyx_v_attr.attr), __pyx_v_attr.value)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 72, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":64 + /* "pycrfsuite/_pycrfsuite.pyx":71 * if isinstance(value, (dict, list, set)): * # {"string_prefix": {...}} * for attr in to_item(value): # <<<<<<<<<<<<<< @@ -1970,17 +2265,17 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx */ } - /* "pycrfsuite/_pycrfsuite.pyx":62 - * value = (x)[key] - * + /* "pycrfsuite/_pycrfsuite.pyx":69 + * ) + * continue * if isinstance(value, (dict, list, set)): # <<<<<<<<<<<<<< * # {"string_prefix": {...}} * for attr in to_item(value): */ - goto __pyx_L7; + goto __pyx_L10; } - /* "pycrfsuite/_pycrfsuite.pyx":69 + /* "pycrfsuite/_pycrfsuite.pyx":76 * ) * else: * if isinstance(value, unicode): # <<<<<<<<<<<<<< @@ -1988,11 +2283,11 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx * c_key += _SEP */ /*else*/ { - __pyx_t_9 = PyUnicode_Check(__pyx_v_value); - __pyx_t_7 = (__pyx_t_9 != 0); - if (__pyx_t_7) { + __pyx_t_16 = PyUnicode_Check(__pyx_v_value); + __pyx_t_1 = (__pyx_t_16 != 0); + if (__pyx_t_1) { - /* "pycrfsuite/_pycrfsuite.pyx":71 + /* "pycrfsuite/_pycrfsuite.pyx":78 * if isinstance(value, unicode): * # {"string_key": "string_value"} * c_key += _SEP # <<<<<<<<<<<<<< @@ -2001,7 +2296,7 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx */ __pyx_v_c_key += __pyx_v_10pycrfsuite_11_pycrfsuite__SEP; - /* "pycrfsuite/_pycrfsuite.pyx":72 + /* "pycrfsuite/_pycrfsuite.pyx":79 * # {"string_key": "string_value"} * c_key += _SEP * c_key += (value).encode('utf8') # <<<<<<<<<<<<<< @@ -2010,15 +2305,15 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx */ if (unlikely(__pyx_v_value == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 79, __pyx_L1_error) } - __pyx_t_6 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_value)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_value)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_9); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_c_key += ((std::string)__pyx_t_8); - /* "pycrfsuite/_pycrfsuite.pyx":73 + /* "pycrfsuite/_pycrfsuite.pyx":80 * c_key += _SEP * c_key += (value).encode('utf8') * c_value = 1.0 # <<<<<<<<<<<<<< @@ -2027,28 +2322,28 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx */ __pyx_v_c_value = 1.0; - /* "pycrfsuite/_pycrfsuite.pyx":69 + /* "pycrfsuite/_pycrfsuite.pyx":76 * ) * else: * if isinstance(value, unicode): # <<<<<<<<<<<<<< * # {"string_key": "string_value"} * c_key += _SEP */ - goto __pyx_L13; + goto __pyx_L16; } - /* "pycrfsuite/_pycrfsuite.pyx":74 + /* "pycrfsuite/_pycrfsuite.pyx":81 * c_key += (value).encode('utf8') * c_value = 1.0 * elif isinstance(value, bytes): # <<<<<<<<<<<<<< * # {"string_key": "string_value"} * c_key += _SEP */ - __pyx_t_7 = PyBytes_Check(__pyx_v_value); - __pyx_t_9 = (__pyx_t_7 != 0); - if (__pyx_t_9) { + __pyx_t_1 = PyBytes_Check(__pyx_v_value); + __pyx_t_16 = (__pyx_t_1 != 0); + if (__pyx_t_16) { - /* "pycrfsuite/_pycrfsuite.pyx":76 + /* "pycrfsuite/_pycrfsuite.pyx":83 * elif isinstance(value, bytes): * # {"string_key": "string_value"} * c_key += _SEP # <<<<<<<<<<<<<< @@ -2057,17 +2352,17 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx */ __pyx_v_c_key += __pyx_v_10pycrfsuite_11_pycrfsuite__SEP; - /* "pycrfsuite/_pycrfsuite.pyx":77 + /* "pycrfsuite/_pycrfsuite.pyx":84 * # {"string_key": "string_value"} * c_key += _SEP * c_key += value # <<<<<<<<<<<<<< * c_value = 1.0 * else: */ - __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error) __pyx_v_c_key += ((std::string)__pyx_t_8); - /* "pycrfsuite/_pycrfsuite.pyx":78 + /* "pycrfsuite/_pycrfsuite.pyx":85 * c_key += _SEP * c_key += value * c_value = 1.0 # <<<<<<<<<<<<<< @@ -2076,17 +2371,17 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx */ __pyx_v_c_value = 1.0; - /* "pycrfsuite/_pycrfsuite.pyx":74 + /* "pycrfsuite/_pycrfsuite.pyx":81 * c_key += (value).encode('utf8') * c_value = 1.0 * elif isinstance(value, bytes): # <<<<<<<<<<<<<< * # {"string_key": "string_value"} * c_key += _SEP */ - goto __pyx_L13; + goto __pyx_L16; } - /* "pycrfsuite/_pycrfsuite.pyx":82 + /* "pycrfsuite/_pycrfsuite.pyx":89 * # {"string_key": float_value} * # {"string_key": bool} * c_value = value # <<<<<<<<<<<<<< @@ -2094,12 +2389,12 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx * c_item.push_back(crfsuite_api.Attribute(c_key, c_value)) */ /*else*/ { - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_c_value = __pyx_t_13; + __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_v_c_value = __pyx_t_15; } - __pyx_L13:; + __pyx_L16:; - /* "pycrfsuite/_pycrfsuite.pyx":84 + /* "pycrfsuite/_pycrfsuite.pyx":91 * c_value = value * * c_item.push_back(crfsuite_api.Attribute(c_key, c_value)) # <<<<<<<<<<<<<< @@ -2110,10 +2405,10 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx __pyx_v_c_item.push_back(CRFSuite::Attribute(__pyx_v_c_key, __pyx_v_c_value)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 91, __pyx_L1_error) } } - __pyx_L7:; + __pyx_L10:; } __pyx_L6:; @@ -2124,10 +2419,11 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx * if isinstance(key, unicode): * c_key = (key).encode('utf8') */ + __pyx_L3_continue:; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":86 + /* "pycrfsuite/_pycrfsuite.pyx":93 * c_item.push_back(crfsuite_api.Attribute(c_key, c_value)) * * return c_item # <<<<<<<<<<<<<< @@ -2149,15 +2445,21 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("pycrfsuite._pycrfsuite.to_item", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_key); __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_v); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":89 +/* "pycrfsuite/_pycrfsuite.pyx":96 * * * cdef crfsuite_api.ItemSequence to_seq(pyseq) except+: # <<<<<<<<<<<<<< @@ -2178,12 +2480,9 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject PyObject *(*__pyx_t_6)(PyObject *); PyObject *__pyx_t_7 = NULL; CRFSuite::Item __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("to_seq", 0); - /* "pycrfsuite/_pycrfsuite.pyx":105 + /* "pycrfsuite/_pycrfsuite.pyx":112 * cdef crfsuite_api.ItemSequence c_seq * * if isinstance(pyseq, ItemSequence): # <<<<<<<<<<<<<< @@ -2194,7 +2493,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pycrfsuite/_pycrfsuite.pyx":106 + /* "pycrfsuite/_pycrfsuite.pyx":113 * * if isinstance(pyseq, ItemSequence): * c_seq = (pyseq).c_seq # <<<<<<<<<<<<<< @@ -2204,7 +2503,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject __pyx_t_3 = ((struct __pyx_obj_10pycrfsuite_11_pycrfsuite_ItemSequence *)__pyx_v_pyseq)->c_seq; __pyx_v_c_seq = __pyx_t_3; - /* "pycrfsuite/_pycrfsuite.pyx":105 + /* "pycrfsuite/_pycrfsuite.pyx":112 * cdef crfsuite_api.ItemSequence c_seq * * if isinstance(pyseq, ItemSequence): # <<<<<<<<<<<<<< @@ -2214,7 +2513,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject goto __pyx_L3; } - /* "pycrfsuite/_pycrfsuite.pyx":108 + /* "pycrfsuite/_pycrfsuite.pyx":115 * c_seq = (pyseq).c_seq * else: * for x in pyseq: # <<<<<<<<<<<<<< @@ -2226,26 +2525,26 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject __pyx_t_4 = __pyx_v_pyseq; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_pyseq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_pyseq); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 115, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 115, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 115, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -2255,7 +2554,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject 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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else __PYX_ERR(0, 115, __pyx_L1_error) } break; } @@ -2264,7 +2563,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_7); __pyx_t_7 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":109 + /* "pycrfsuite/_pycrfsuite.pyx":116 * else: * for x in pyseq: * c_seq.push_back(to_item(x)) # <<<<<<<<<<<<<< @@ -2275,16 +2574,16 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject __pyx_t_8 = __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(__pyx_v_x); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 116, __pyx_L1_error) } try { __pyx_v_c_seq.push_back(__pyx_t_8); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 116, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":108 + /* "pycrfsuite/_pycrfsuite.pyx":115 * c_seq = (pyseq).c_seq * else: * for x in pyseq: # <<<<<<<<<<<<<< @@ -2296,7 +2595,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject } __pyx_L3:; - /* "pycrfsuite/_pycrfsuite.pyx":110 + /* "pycrfsuite/_pycrfsuite.pyx":117 * for x in pyseq: * c_seq.push_back(to_item(x)) * return c_seq # <<<<<<<<<<<<<< @@ -2306,7 +2605,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject __pyx_r = __pyx_v_c_seq; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":89 + /* "pycrfsuite/_pycrfsuite.pyx":96 * * * cdef crfsuite_api.ItemSequence to_seq(pyseq) except+: # <<<<<<<<<<<<<< @@ -2325,7 +2624,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":159 +/* "pycrfsuite/_pycrfsuite.pyx":166 * cdef crfsuite_api.ItemSequence c_seq * * def __init__(self, pyseq): # <<<<<<<<<<<<<< @@ -2337,9 +2636,6 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject static int __pyx_pw_10pycrfsuite_11_pycrfsuite_12ItemSequence_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_10pycrfsuite_11_pycrfsuite_12ItemSequence_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_pyseq = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -2361,7 +2657,7 @@ static int __pyx_pw_10pycrfsuite_11_pycrfsuite_12ItemSequence_1__init__(PyObject else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 166, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -2372,7 +2668,7 @@ static int __pyx_pw_10pycrfsuite_11_pycrfsuite_12ItemSequence_1__init__(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 166, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.ItemSequence.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2389,12 +2685,9 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence___init__(struct __ int __pyx_r; __Pyx_RefNannyDeclarations CRFSuite::ItemSequence __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "pycrfsuite/_pycrfsuite.pyx":160 + /* "pycrfsuite/_pycrfsuite.pyx":167 * * def __init__(self, pyseq): * self.c_seq = to_seq(pyseq) # <<<<<<<<<<<<<< @@ -2405,11 +2698,11 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence___init__(struct __ __pyx_t_1 = __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(__pyx_v_pyseq); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 167, __pyx_L1_error) } __pyx_v_self->c_seq = __pyx_t_1; - /* "pycrfsuite/_pycrfsuite.pyx":159 + /* "pycrfsuite/_pycrfsuite.pyx":166 * cdef crfsuite_api.ItemSequence c_seq * * def __init__(self, pyseq): # <<<<<<<<<<<<<< @@ -2428,7 +2721,7 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence___init__(struct __ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":162 +/* "pycrfsuite/_pycrfsuite.pyx":169 * self.c_seq = to_seq(pyseq) * * def items(self): # <<<<<<<<<<<<<< @@ -2466,24 +2759,21 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_2items(struc CRFSuite::Attribute __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("items", 0); - /* "pycrfsuite/_pycrfsuite.pyx":174 + /* "pycrfsuite/_pycrfsuite.pyx":181 * cdef crfsuite_api.Attribute c_attr * cdef bytes key * seq = [] # <<<<<<<<<<<<<< * * for c_item in self.c_seq: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_seq = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":176 + /* "pycrfsuite/_pycrfsuite.pyx":183 * seq = [] * * for c_item in self.c_seq: # <<<<<<<<<<<<<< @@ -2498,19 +2788,19 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_2items(struc ++__pyx_t_2; __pyx_v_c_item = __pyx_t_4; - /* "pycrfsuite/_pycrfsuite.pyx":177 + /* "pycrfsuite/_pycrfsuite.pyx":184 * * for c_item in self.c_seq: * x = {} # <<<<<<<<<<<<<< * for c_attr in c_item: * # Always decode keys from utf-8. It means binary keys are */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_x, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":178 + /* "pycrfsuite/_pycrfsuite.pyx":185 * for c_item in self.c_seq: * x = {} * for c_attr in c_item: # <<<<<<<<<<<<<< @@ -2524,14 +2814,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_2items(struc ++__pyx_t_5; __pyx_v_c_attr = __pyx_t_6; - /* "pycrfsuite/_pycrfsuite.pyx":185 + /* "pycrfsuite/_pycrfsuite.pyx":192 * # XXX: (c_attr.attr).decode('utf8') doesn't * # work properly in Cython 0.21 * key = c_attr.attr.c_str() # <<<<<<<<<<<<<< * x[key.decode('utf8')] = c_attr.value * seq.append(x) */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_c_attr.attr.c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_c_attr.attr.c_str()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __pyx_t_1; __Pyx_INCREF(__pyx_t_7); @@ -2539,26 +2829,26 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_2items(struc __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_7)); __pyx_t_7 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":186 + /* "pycrfsuite/_pycrfsuite.pyx":193 * # work properly in Cython 0.21 * key = c_attr.attr.c_str() * x[key.decode('utf8')] = c_attr.value # <<<<<<<<<<<<<< * seq.append(x) * return seq */ - __pyx_t_7 = PyFloat_FromDouble(__pyx_v_c_attr.value); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_c_attr.value); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (unlikely(__pyx_v_key == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "decode"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 193, __pyx_L1_error) } - __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_key, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_key, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_x, __pyx_t_1, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyDict_SetItem(__pyx_v_x, __pyx_t_1, __pyx_t_7) < 0)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":178 + /* "pycrfsuite/_pycrfsuite.pyx":185 * for c_item in self.c_seq: * x = {} * for c_attr in c_item: # <<<<<<<<<<<<<< @@ -2567,16 +2857,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_2items(struc */ } - /* "pycrfsuite/_pycrfsuite.pyx":187 + /* "pycrfsuite/_pycrfsuite.pyx":194 * key = c_attr.attr.c_str() * x[key.decode('utf8')] = c_attr.value * seq.append(x) # <<<<<<<<<<<<<< * return seq * */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_seq, __pyx_v_x); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_seq, __pyx_v_x); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 194, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":176 + /* "pycrfsuite/_pycrfsuite.pyx":183 * seq = [] * * for c_item in self.c_seq: # <<<<<<<<<<<<<< @@ -2585,7 +2875,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_2items(struc */ } - /* "pycrfsuite/_pycrfsuite.pyx":188 + /* "pycrfsuite/_pycrfsuite.pyx":195 * x[key.decode('utf8')] = c_attr.value * seq.append(x) * return seq # <<<<<<<<<<<<<< @@ -2597,7 +2887,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_2items(struc __pyx_r = __pyx_v_seq; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":162 + /* "pycrfsuite/_pycrfsuite.pyx":169 * self.c_seq = to_seq(pyseq) * * def items(self): # <<<<<<<<<<<<<< @@ -2620,7 +2910,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_2items(struc return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":190 +/* "pycrfsuite/_pycrfsuite.pyx":197 * return seq * * def __len__(self): # <<<<<<<<<<<<<< @@ -2646,7 +2936,7 @@ static Py_ssize_t __pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_4__len__(st __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "pycrfsuite/_pycrfsuite.pyx":191 + /* "pycrfsuite/_pycrfsuite.pyx":198 * * def __len__(self): * return self.c_seq.size() # <<<<<<<<<<<<<< @@ -2656,7 +2946,7 @@ static Py_ssize_t __pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_4__len__(st __pyx_r = __pyx_v_self->c_seq.size(); goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":190 + /* "pycrfsuite/_pycrfsuite.pyx":197 * return seq * * def __len__(self): # <<<<<<<<<<<<<< @@ -2670,7 +2960,7 @@ static Py_ssize_t __pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_4__len__(st return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":193 +/* "pycrfsuite/_pycrfsuite.pyx":200 * return self.c_seq.size() * * def __repr__(self): # <<<<<<<<<<<<<< @@ -2697,12 +2987,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_6__repr__(st Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "pycrfsuite/_pycrfsuite.pyx":194 + /* "pycrfsuite/_pycrfsuite.pyx":201 * * def __repr__(self): * return "" % len(self) # <<<<<<<<<<<<<< @@ -2710,17 +2997,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_6__repr__(st * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __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[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_ItemSequence_of_size_d, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_ItemSequence_of_size_d, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":193 + /* "pycrfsuite/_pycrfsuite.pyx":200 * return self.c_seq.size() * * def __repr__(self): # <<<<<<<<<<<<<< @@ -2740,7 +3027,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_6__repr__(st return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":197 +/* "pycrfsuite/_pycrfsuite.pyx":204 * * * def _intbool(txt): # <<<<<<<<<<<<<< @@ -2768,12 +3055,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite__intbool(CYTHON_UNUSED PyOb __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_intbool", 0); - /* "pycrfsuite/_pycrfsuite.pyx":198 + /* "pycrfsuite/_pycrfsuite.pyx":205 * * def _intbool(txt): * return bool(int(txt)) # <<<<<<<<<<<<<< @@ -2781,17 +3065,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite__intbool(CYTHON_UNUSED PyOb * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyNumber_Int(__pyx_v_txt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_txt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":197 + /* "pycrfsuite/_pycrfsuite.pyx":204 * * * def _intbool(txt): # <<<<<<<<<<<<<< @@ -2810,7 +3094,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite__intbool(CYTHON_UNUSED PyOb return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":256 +/* "pycrfsuite/_pycrfsuite.pyx":263 * cdef public verbose * * def __init__(self, algorithm=None, params=None, verbose=True): # <<<<<<<<<<<<<< @@ -2824,9 +3108,6 @@ static int __pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_1__init__(PyObject PyObject *__pyx_v_algorithm = 0; PyObject *__pyx_v_params = 0; PyObject *__pyx_v_verbose = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -2865,7 +3146,7 @@ static int __pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_1__init__(PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 263, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2882,7 +3163,7 @@ static int __pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_1__init__(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 263, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.BaseTrainer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2904,12 +3185,9 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p 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; __Pyx_RefNannySetupContext("__init__", 0); - /* "pycrfsuite/_pycrfsuite.pyx":257 + /* "pycrfsuite/_pycrfsuite.pyx":264 * * def __init__(self, algorithm=None, params=None, verbose=True): * if algorithm is not None: # <<<<<<<<<<<<<< @@ -2920,14 +3198,14 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pycrfsuite/_pycrfsuite.pyx":258 + /* "pycrfsuite/_pycrfsuite.pyx":265 * def __init__(self, algorithm=None, params=None, verbose=True): * if algorithm is not None: * self.select(algorithm) # <<<<<<<<<<<<<< * if params is not None: * self.set_params(params) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_select); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_select); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { @@ -2940,23 +3218,23 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p } } if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_algorithm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_algorithm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_algorithm); __Pyx_GIVEREF(__pyx_v_algorithm); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_algorithm); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":257 + /* "pycrfsuite/_pycrfsuite.pyx":264 * * def __init__(self, algorithm=None, params=None, verbose=True): * if algorithm is not None: # <<<<<<<<<<<<<< @@ -2965,7 +3243,7 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p */ } - /* "pycrfsuite/_pycrfsuite.pyx":259 + /* "pycrfsuite/_pycrfsuite.pyx":266 * if algorithm is not None: * self.select(algorithm) * if params is not None: # <<<<<<<<<<<<<< @@ -2976,14 +3254,14 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "pycrfsuite/_pycrfsuite.pyx":260 + /* "pycrfsuite/_pycrfsuite.pyx":267 * self.select(algorithm) * if params is not None: * self.set_params(params) # <<<<<<<<<<<<<< * self.verbose = verbose * */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_params); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { @@ -2996,23 +3274,23 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p } } if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_params); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_INCREF(__pyx_v_params); __Pyx_GIVEREF(__pyx_v_params); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_params); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":259 + /* "pycrfsuite/_pycrfsuite.pyx":266 * if algorithm is not None: * self.select(algorithm) * if params is not None: # <<<<<<<<<<<<<< @@ -3021,7 +3299,7 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p */ } - /* "pycrfsuite/_pycrfsuite.pyx":261 + /* "pycrfsuite/_pycrfsuite.pyx":268 * if params is not None: * self.set_params(params) * self.verbose = verbose # <<<<<<<<<<<<<< @@ -3034,7 +3312,7 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p __Pyx_DECREF(__pyx_v_self->verbose); __pyx_v_self->verbose = __pyx_v_verbose; - /* "pycrfsuite/_pycrfsuite.pyx":256 + /* "pycrfsuite/_pycrfsuite.pyx":263 * cdef public verbose * * def __init__(self, algorithm=None, params=None, verbose=True): # <<<<<<<<<<<<<< @@ -3057,7 +3335,7 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":263 +/* "pycrfsuite/_pycrfsuite.pyx":270 * self.verbose = verbose * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -3086,12 +3364,9 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_2__cinit__(struct _ __Pyx_RefNannyDeclarations std::string __pyx_t_1; std::string __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "pycrfsuite/_pycrfsuite.pyx":265 + /* "pycrfsuite/_pycrfsuite.pyx":272 * def __cinit__(self): * # setup message handler * self.c_trainer.set_handler(self, self._on_message) # <<<<<<<<<<<<<< @@ -3102,26 +3377,26 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_2__cinit__(struct _ __pyx_v_self->c_trainer.set_handler(((PyObject *)__pyx_v_self), ((CRFSuiteWrapper::messagefunc)((struct __pyx_vtabstruct_10pycrfsuite_11_pycrfsuite_BaseTrainer *)__pyx_v_self->__pyx_vtab)->_on_message)); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 272, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":268 + /* "pycrfsuite/_pycrfsuite.pyx":275 * * # fix segfaults, see https://github.com/chokkan/crfsuite/pull/21 * self.c_trainer.select("lbfgs", "crf1d") # <<<<<<<<<<<<<< * self.c_trainer._init_hack() * */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_lbfgs); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_crf1d); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_lbfgs); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_crf1d); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error) try { __pyx_v_self->c_trainer.select(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 275, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":269 + /* "pycrfsuite/_pycrfsuite.pyx":276 * # fix segfaults, see https://github.com/chokkan/crfsuite/pull/21 * self.c_trainer.select("lbfgs", "crf1d") * self.c_trainer._init_hack() # <<<<<<<<<<<<<< @@ -3132,10 +3407,10 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_2__cinit__(struct _ __pyx_v_self->c_trainer._init_hack(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 276, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":263 + /* "pycrfsuite/_pycrfsuite.pyx":270 * self.verbose = verbose * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -3154,7 +3429,7 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_2__cinit__(struct _ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":271 +/* "pycrfsuite/_pycrfsuite.pyx":278 * self.c_trainer._init_hack() * * cdef _on_message(self, string message): # <<<<<<<<<<<<<< @@ -3170,21 +3445,18 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_11BaseTrainer__on_message(st PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_on_message", 0); - /* "pycrfsuite/_pycrfsuite.pyx":272 + /* "pycrfsuite/_pycrfsuite.pyx":279 * * cdef _on_message(self, string message): * self.message(message) # <<<<<<<<<<<<<< * * def message(self, message): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_convert_PyStr_string_to_py_std__in_string(__pyx_v_message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_convert_PyStr_string_to_py_std__in_string(__pyx_v_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -3197,24 +3469,24 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_11BaseTrainer__on_message(st } } if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":271 + /* "pycrfsuite/_pycrfsuite.pyx":278 * self.c_trainer._init_hack() * * cdef _on_message(self, string message): # <<<<<<<<<<<<<< @@ -3239,7 +3511,7 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_11BaseTrainer__on_message(st return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":274 +/* "pycrfsuite/_pycrfsuite.pyx":281 * self.message(message) * * def message(self, message): # <<<<<<<<<<<<<< @@ -3268,43 +3540,40 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_4message(stru 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("message", 0); - /* "pycrfsuite/_pycrfsuite.pyx":288 + /* "pycrfsuite/_pycrfsuite.pyx":295 * The message * """ * if self.verbose: # <<<<<<<<<<<<<< * print(message, end='') * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->verbose); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->verbose); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 295, __pyx_L1_error) if (__pyx_t_1) { - /* "pycrfsuite/_pycrfsuite.pyx":289 + /* "pycrfsuite/_pycrfsuite.pyx":296 * """ * if self.verbose: * print(message, end='') # <<<<<<<<<<<<<< * * def append(self, xseq, yseq, int group=0): */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_message); __Pyx_GIVEREF(__pyx_v_message); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_message); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":288 + /* "pycrfsuite/_pycrfsuite.pyx":295 * The message * """ * if self.verbose: # <<<<<<<<<<<<<< @@ -3313,7 +3582,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_4message(stru */ } - /* "pycrfsuite/_pycrfsuite.pyx":274 + /* "pycrfsuite/_pycrfsuite.pyx":281 * self.message(message) * * def message(self, message): # <<<<<<<<<<<<<< @@ -3336,7 +3605,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_4message(stru return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":291 +/* "pycrfsuite/_pycrfsuite.pyx":298 * print(message, end='') * * def append(self, xseq, yseq, int group=0): # <<<<<<<<<<<<<< @@ -3351,9 +3620,6 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_7append(PyObj PyObject *__pyx_v_xseq = 0; PyObject *__pyx_v_yseq = 0; int __pyx_v_group; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("append (wrapper)", 0); @@ -3378,7 +3644,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_7append(PyObj case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yseq)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("append", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("append", 0, 2, 3, 1); __PYX_ERR(0, 298, __pyx_L3_error) } case 2: if (kw_args > 0) { @@ -3387,7 +3653,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_7append(PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "append") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "append") < 0)) __PYX_ERR(0, 298, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3401,14 +3667,14 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_7append(PyObj __pyx_v_xseq = values[0]; __pyx_v_yseq = values[1]; if (values[2]) { - __pyx_v_group = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_group == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_group = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_group == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L3_error) } else { __pyx_v_group = ((int)0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("append", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("append", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 298, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.BaseTrainer.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3426,12 +3692,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_6append(struc __Pyx_RefNannyDeclarations CRFSuite::ItemSequence __pyx_t_1; CRFSuite::StringList __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("append", 0); - /* "pycrfsuite/_pycrfsuite.pyx":312 + /* "pycrfsuite/_pycrfsuite.pyx":319 * select subset of data for heldout evaluation. * """ * self.c_trainer.append(to_seq(xseq), yseq, group) # <<<<<<<<<<<<<< @@ -3442,17 +3705,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_6append(struc __pyx_t_1 = __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(__pyx_v_xseq); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 319, __pyx_L1_error) } - __pyx_t_2 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_yseq); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_yseq); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) try { __pyx_v_self->c_trainer.append(__pyx_t_1, __pyx_t_2, __pyx_v_group); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 319, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":291 + /* "pycrfsuite/_pycrfsuite.pyx":298 * print(message, end='') * * def append(self, xseq, yseq, int group=0): # <<<<<<<<<<<<<< @@ -3472,7 +3735,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_6append(struc return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":314 +/* "pycrfsuite/_pycrfsuite.pyx":321 * self.c_trainer.append(to_seq(xseq), yseq, group) * * def select(self, algorithm, type='crf1d'): # <<<<<<<<<<<<<< @@ -3486,9 +3749,6 @@ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select[] = "Base static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_9select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_algorithm = 0; PyObject *__pyx_v_type = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("select (wrapper)", 0); @@ -3517,7 +3777,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_9select(PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "select") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "select") < 0)) __PYX_ERR(0, 321, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3532,7 +3792,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_9select(PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("select", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("select", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 321, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.BaseTrainer.select", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3557,20 +3817,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc std::string __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("select", 0); __Pyx_INCREF(__pyx_v_algorithm); - /* "pycrfsuite/_pycrfsuite.pyx":332 + /* "pycrfsuite/_pycrfsuite.pyx":339 * The name of the graphical model. * """ * algorithm = algorithm.lower() # <<<<<<<<<<<<<< * algorithm = self._ALGORITHM_ALIASES.get(algorithm, algorithm) * if not self.c_trainer.select(algorithm, type): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_algorithm, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_algorithm, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -3583,26 +3840,26 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc } } 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 = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_algorithm, __pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":333 + /* "pycrfsuite/_pycrfsuite.pyx":340 * """ * algorithm = algorithm.lower() * algorithm = self._ALGORITHM_ALIASES.get(algorithm, algorithm) # <<<<<<<<<<<<<< * if not self.c_trainer.select(algorithm, type): * raise ValueError( */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ALGORITHM_ALIASES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ALGORITHM_ALIASES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -3617,7 +3874,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc __pyx_t_4 = 1; } } - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; @@ -3628,39 +3885,39 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc __Pyx_INCREF(__pyx_v_algorithm); __Pyx_GIVEREF(__pyx_v_algorithm); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_algorithm); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_algorithm, __pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":334 + /* "pycrfsuite/_pycrfsuite.pyx":341 * algorithm = algorithm.lower() * algorithm = self._ALGORITHM_ALIASES.get(algorithm, algorithm) * if not self.c_trainer.select(algorithm, type): # <<<<<<<<<<<<<< * raise ValueError( * "Bad arguments: algorithm=%r, type=%r" % (algorithm, type) */ - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_algorithm); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_v_type); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_algorithm); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_v_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L1_error) try { __pyx_t_8 = __pyx_v_self->c_trainer.select(__pyx_t_6, __pyx_t_7); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 341, __pyx_L1_error) } __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0); if (__pyx_t_9) { - /* "pycrfsuite/_pycrfsuite.pyx":336 + /* "pycrfsuite/_pycrfsuite.pyx":343 * if not self.c_trainer.select(algorithm, type): * raise ValueError( * "Bad arguments: algorithm=%r, type=%r" % (algorithm, type) # <<<<<<<<<<<<<< * ) * */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_algorithm); __Pyx_GIVEREF(__pyx_v_algorithm); @@ -3668,30 +3925,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc __Pyx_INCREF(__pyx_v_type); __Pyx_GIVEREF(__pyx_v_type); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_type); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Bad_arguments_algorithm_r_type_r, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Bad_arguments_algorithm_r_type_r, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":335 + /* "pycrfsuite/_pycrfsuite.pyx":342 * algorithm = self._ALGORITHM_ALIASES.get(algorithm, algorithm) * if not self.c_trainer.select(algorithm, type): * raise ValueError( # <<<<<<<<<<<<<< * "Bad arguments: algorithm=%r, type=%r" % (algorithm, type) * ) */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 342, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":334 + /* "pycrfsuite/_pycrfsuite.pyx":341 * algorithm = algorithm.lower() * algorithm = self._ALGORITHM_ALIASES.get(algorithm, algorithm) * if not self.c_trainer.select(algorithm, type): # <<<<<<<<<<<<<< @@ -3700,7 +3957,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc */ } - /* "pycrfsuite/_pycrfsuite.pyx":314 + /* "pycrfsuite/_pycrfsuite.pyx":321 * self.c_trainer.append(to_seq(xseq), yseq, group) * * def select(self, algorithm, type='crf1d'): # <<<<<<<<<<<<<< @@ -3725,7 +3982,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":339 +/* "pycrfsuite/_pycrfsuite.pyx":346 * ) * * def train(self, model, int holdout=-1): # <<<<<<<<<<<<<< @@ -3739,9 +3996,6 @@ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train[] = "Base static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_11train(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_model = 0; int __pyx_v_holdout; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("train (wrapper)", 0); @@ -3769,7 +4023,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_11train(PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train") < 0)) __PYX_ERR(0, 346, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3781,14 +4035,14 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_11train(PyObj } __pyx_v_model = values[0]; if (values[1]) { - __pyx_v_holdout = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_holdout == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_holdout = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_holdout == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L3_error) } else { __pyx_v_holdout = ((int)-1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("train", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 346, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.BaseTrainer.train", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3813,19 +4067,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("train", 0); - /* "pycrfsuite/_pycrfsuite.pyx":358 + /* "pycrfsuite/_pycrfsuite.pyx":365 * Default value is -1, meaning "use all instances for training". * """ * self._before_train() # <<<<<<<<<<<<<< * status_code = self.c_trainer.train(model, holdout) * if status_code != crfsuite_api.CRFSUITE_SUCCESS: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_before_train); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_before_train); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -3838,32 +4089,32 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc } } 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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":359 + /* "pycrfsuite/_pycrfsuite.pyx":366 * """ * self._before_train() * status_code = self.c_trainer.train(model, holdout) # <<<<<<<<<<<<<< * if status_code != crfsuite_api.CRFSUITE_SUCCESS: * raise CRFSuiteError(status_code) */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_model); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_model); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 366, __pyx_L1_error) try { __pyx_t_5 = __pyx_v_self->c_trainer.train(__pyx_t_4, __pyx_v_holdout); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 366, __pyx_L1_error) } __pyx_v_status_code = __pyx_t_5; - /* "pycrfsuite/_pycrfsuite.pyx":360 + /* "pycrfsuite/_pycrfsuite.pyx":367 * self._before_train() * status_code = self.c_trainer.train(model, holdout) * if status_code != crfsuite_api.CRFSUITE_SUCCESS: # <<<<<<<<<<<<<< @@ -3873,16 +4124,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc __pyx_t_6 = ((__pyx_v_status_code != CRFSUITE_SUCCESS) != 0); if (__pyx_t_6) { - /* "pycrfsuite/_pycrfsuite.pyx":361 + /* "pycrfsuite/_pycrfsuite.pyx":368 * status_code = self.c_trainer.train(model, holdout) * if status_code != crfsuite_api.CRFSUITE_SUCCESS: * raise CRFSuiteError(status_code) # <<<<<<<<<<<<<< * * def params(self): */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_CRFSuiteError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_CRFSuiteError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_status_code); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_status_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -3895,26 +4146,26 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc } } if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 368, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":360 + /* "pycrfsuite/_pycrfsuite.pyx":367 * self._before_train() * status_code = self.c_trainer.train(model, holdout) * if status_code != crfsuite_api.CRFSUITE_SUCCESS: # <<<<<<<<<<<<<< @@ -3923,7 +4174,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc */ } - /* "pycrfsuite/_pycrfsuite.pyx":339 + /* "pycrfsuite/_pycrfsuite.pyx":346 * ) * * def train(self, model, int holdout=-1): # <<<<<<<<<<<<<< @@ -3948,7 +4199,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":363 +/* "pycrfsuite/_pycrfsuite.pyx":370 * raise CRFSuiteError(status_code) * * def params(self): # <<<<<<<<<<<<<< @@ -3975,12 +4226,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_12params(stru __Pyx_RefNannyDeclarations CRFSuite::StringList __pyx_t_1; PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("params", 0); - /* "pycrfsuite/_pycrfsuite.pyx":378 + /* "pycrfsuite/_pycrfsuite.pyx":385 * * """ * return self.c_trainer.params() # <<<<<<<<<<<<<< @@ -3992,15 +4240,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_12params(stru __pyx_t_1 = __pyx_v_self->c_trainer.params(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 385, __pyx_L1_error) } - __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":363 + /* "pycrfsuite/_pycrfsuite.pyx":370 * raise CRFSuiteError(status_code) * * def params(self): # <<<<<<<<<<<<<< @@ -4019,7 +4267,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_12params(stru return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":380 +/* "pycrfsuite/_pycrfsuite.pyx":387 * return self.c_trainer.params() * * def set_params(self, params): # <<<<<<<<<<<<<< @@ -4055,19 +4303,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( PyObject *__pyx_t_7 = NULL; PyObject *(*__pyx_t_8)(PyObject *); Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_params", 0); - /* "pycrfsuite/_pycrfsuite.pyx":389 + /* "pycrfsuite/_pycrfsuite.pyx":396 * A dict with parameters ``{name: value}`` * """ * for key, value in params.items(): # <<<<<<<<<<<<<< * self.set(key, value) * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_params, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_params, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -4080,10 +4325,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( } } 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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4091,9 +4336,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 396, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -4101,17 +4346,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( 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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_ERR(0, 396, __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_ERR(0, 396, __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -4121,7 +4366,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( 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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else __PYX_ERR(0, 396, __pyx_L1_error) } break; } @@ -4137,7 +4382,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 396, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -4150,15 +4395,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; @@ -4166,7 +4411,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( __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[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 396, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; @@ -4174,7 +4419,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 396, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3); @@ -4182,14 +4427,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6); __pyx_t_6 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":390 + /* "pycrfsuite/_pycrfsuite.pyx":397 * """ * for key, value in params.items(): * self.set(key, value) # <<<<<<<<<<<<<< * * def get_params(self): */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = NULL; __pyx_t_9 = 0; @@ -4203,7 +4448,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( __pyx_t_9 = 1; } } - __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL; @@ -4214,13 +4459,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_value); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":389 + /* "pycrfsuite/_pycrfsuite.pyx":396 * A dict with parameters ``{name: value}`` * """ * for key, value in params.items(): # <<<<<<<<<<<<<< @@ -4230,7 +4475,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":380 + /* "pycrfsuite/_pycrfsuite.pyx":387 * return self.c_trainer.params() * * def set_params(self, params): # <<<<<<<<<<<<<< @@ -4257,7 +4502,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":392 +/* "pycrfsuite/_pycrfsuite.pyx":399 * self.set(key, value) * * def get_params(self): # <<<<<<<<<<<<<< @@ -4280,7 +4525,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_17get_params( } static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "pycrfsuite/_pycrfsuite.pyx":403 +/* "pycrfsuite/_pycrfsuite.pyx":410 * """ * # params = self.params() * return dict((name, self.get(name)) for name in self.params()) # <<<<<<<<<<<<<< @@ -4292,9 +4537,6 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("genexpr", 0); __pyx_cur_scope = (struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr *)__pyx_tp_new_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr(__pyx_ptype_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { @@ -4306,7 +4548,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_2generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_get_params_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_2generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_get_params_locals_genexpr); if (unlikely(!gen)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -4333,9 +4575,6 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { @@ -4345,11 +4584,11 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_params); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 410, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -4362,10 +4601,10 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ } } 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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4373,9 +4612,9 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ __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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 410, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -4383,17 +4622,17 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ 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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_ERR(0, 410, __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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_ERR(0, 410, __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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -4403,7 +4642,7 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ 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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else __PYX_ERR(0, 410, __pyx_L1_error) } break; } @@ -4413,8 +4652,8 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 410, __pyx_L1_error) } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { @@ -4427,21 +4666,21 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ } } if (!__pyx_t_6) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __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[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_name); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_cur_scope->__pyx_v_name); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyDict_SetItem(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_name, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyDict_SetItem(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_name, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4464,7 +4703,7 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":392 +/* "pycrfsuite/_pycrfsuite.pyx":399 * self.set(key, value) * * def get_params(self): # <<<<<<<<<<<<<< @@ -4478,9 +4717,6 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_16get_params( __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_params", 0); __pyx_cur_scope = (struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params *)__pyx_tp_new_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params(__pyx_ptype_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { @@ -4492,7 +4728,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_16get_params( __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "pycrfsuite/_pycrfsuite.pyx":403 + /* "pycrfsuite/_pycrfsuite.pyx":410 * """ * # params = self.params() * return dict((name, self.get(name)) for name in self.params()) # <<<<<<<<<<<<<< @@ -4500,16 +4736,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_16get_params( * def set(self, name, value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":392 + /* "pycrfsuite/_pycrfsuite.pyx":399 * self.set(key, value) * * def get_params(self): # <<<<<<<<<<<<<< @@ -4530,7 +4766,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_16get_params( return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":405 +/* "pycrfsuite/_pycrfsuite.pyx":412 * return dict((name, self.get(name)) for name in self.params()) * * def set(self, name, value): # <<<<<<<<<<<<<< @@ -4544,9 +4780,6 @@ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_11BaseTrainer_18set[] = "BaseTr static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_19set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; PyObject *__pyx_v_value = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set (wrapper)", 0); @@ -4570,11 +4803,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_19set(PyObjec case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); __PYX_ERR(0, 412, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) __PYX_ERR(0, 412, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4587,7 +4820,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_19set(PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 412, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.BaseTrainer.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4609,13 +4842,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_18set(struct std::string __pyx_t_4; PyObject *__pyx_t_5 = NULL; std::string __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set", 0); __Pyx_INCREF(__pyx_v_value); - /* "pycrfsuite/_pycrfsuite.pyx":419 + /* "pycrfsuite/_pycrfsuite.pyx":426 * * """ * if isinstance(value, bool): # <<<<<<<<<<<<<< @@ -4624,24 +4854,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_18set(struct */ __pyx_t_1 = ((PyObject*)&PyBool_Type); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "pycrfsuite/_pycrfsuite.pyx":420 + /* "pycrfsuite/_pycrfsuite.pyx":427 * """ * if isinstance(value, bool): * value = int(value) # <<<<<<<<<<<<<< * self.c_trainer.set(name, str(value)) * */ - __pyx_t_1 = PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":419 + /* "pycrfsuite/_pycrfsuite.pyx":426 * * """ * if isinstance(value, bool): # <<<<<<<<<<<<<< @@ -4650,32 +4880,32 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_18set(struct */ } - /* "pycrfsuite/_pycrfsuite.pyx":421 + /* "pycrfsuite/_pycrfsuite.pyx":428 * if isinstance(value, bool): * value = int(value) * self.c_trainer.set(name, str(value)) # <<<<<<<<<<<<<< * * def get(self, name): */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; try { __pyx_v_self->c_trainer.set(__pyx_t_4, __pyx_t_6); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 428, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":405 + /* "pycrfsuite/_pycrfsuite.pyx":412 * return dict((name, self.get(name)) for name in self.params()) * * def set(self, name, value): # <<<<<<<<<<<<<< @@ -4698,7 +4928,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_18set(struct return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":423 +/* "pycrfsuite/_pycrfsuite.pyx":430 * self.c_trainer.set(name, str(value)) * * def get(self, name): # <<<<<<<<<<<<<< @@ -4731,12 +4961,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct PyObject *__pyx_t_6 = NULL; Py_ssize_t __pyx_t_7; PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get", 0); - /* "pycrfsuite/_pycrfsuite.pyx":434 + /* "pycrfsuite/_pycrfsuite.pyx":441 * The parameter name. * """ * return self._cast_parameter(name, self.c_trainer.get(name)) # <<<<<<<<<<<<<< @@ -4744,16 +4971,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct * def help(self, name): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cast_parameter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cast_parameter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L1_error) try { __pyx_t_4 = __pyx_v_self->c_trainer.get(__pyx_t_3); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 441, __pyx_L1_error) } - __pyx_t_5 = __pyx_convert_PyStr_string_to_py_std__in_string(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_convert_PyStr_string_to_py_std__in_string(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; __pyx_t_7 = 0; @@ -4767,7 +4994,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct __pyx_t_7 = 1; } } - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; @@ -4778,7 +5005,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4786,7 +5013,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct __pyx_t_1 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":423 + /* "pycrfsuite/_pycrfsuite.pyx":430 * self.c_trainer.set(name, str(value)) * * def get(self, name): # <<<<<<<<<<<<<< @@ -4809,7 +5036,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":436 +/* "pycrfsuite/_pycrfsuite.pyx":443 * return self._cast_parameter(name, self.c_trainer.get(name)) * * def help(self, name): # <<<<<<<<<<<<<< @@ -4841,19 +5068,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_22help(struct int __pyx_t_5; std::string __pyx_t_6; std::string __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("help", 0); - /* "pycrfsuite/_pycrfsuite.pyx":454 + /* "pycrfsuite/_pycrfsuite.pyx":461 * * """ * if name not in self.params(): # <<<<<<<<<<<<<< * # c_trainer.help(name) segfaults without this workaround; * # see https://github.com/chokkan/crfsuite/pull/21 */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_params); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -4866,40 +5090,40 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_22help(struct } } 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 = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":457 + /* "pycrfsuite/_pycrfsuite.pyx":464 * # c_trainer.help(name) segfaults without this workaround; * # see https://github.com/chokkan/crfsuite/pull/21 * raise ValueError("Parameter not found: %s" % name) # <<<<<<<<<<<<<< * return self.c_trainer.help(name) * */ - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Parameter_not_found_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Parameter_not_found_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __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 = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 464, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":454 + /* "pycrfsuite/_pycrfsuite.pyx":461 * * """ * if name not in self.params(): # <<<<<<<<<<<<<< @@ -4908,7 +5132,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_22help(struct */ } - /* "pycrfsuite/_pycrfsuite.pyx":458 + /* "pycrfsuite/_pycrfsuite.pyx":465 * # see https://github.com/chokkan/crfsuite/pull/21 * raise ValueError("Parameter not found: %s" % name) * return self.c_trainer.help(name) # <<<<<<<<<<<<<< @@ -4916,20 +5140,20 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_22help(struct * def clear(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error) try { __pyx_t_7 = __pyx_v_self->c_trainer.help(__pyx_t_6); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 465, __pyx_L1_error) } - __pyx_t_1 = __pyx_convert_PyStr_string_to_py_std__in_string(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_convert_PyStr_string_to_py_std__in_string(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":436 + /* "pycrfsuite/_pycrfsuite.pyx":443 * return self._cast_parameter(name, self.c_trainer.get(name)) * * def help(self, name): # <<<<<<<<<<<<<< @@ -4950,7 +5174,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_22help(struct return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":460 +/* "pycrfsuite/_pycrfsuite.pyx":467 * return self.c_trainer.help(name) * * def clear(self): # <<<<<<<<<<<<<< @@ -4975,12 +5199,9 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_25clear(PyObj static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_24clear(struct __pyx_obj_10pycrfsuite_11_pycrfsuite_BaseTrainer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("clear", 0); - /* "pycrfsuite/_pycrfsuite.pyx":462 + /* "pycrfsuite/_pycrfsuite.pyx":469 * def clear(self): * """ Remove all instances in the data set. """ * self.c_trainer.clear() # <<<<<<<<<<<<<< @@ -4991,10 +5212,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_24clear(struc __pyx_v_self->c_trainer.clear(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 469, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":460 + /* "pycrfsuite/_pycrfsuite.pyx":467 * return self.c_trainer.help(name) * * def clear(self): # <<<<<<<<<<<<<< @@ -5014,7 +5235,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_24clear(struc return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":464 +/* "pycrfsuite/_pycrfsuite.pyx":471 * self.c_trainer.clear() * * def _cast_parameter(self, name, value): # <<<<<<<<<<<<<< @@ -5028,9 +5249,6 @@ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_parameter static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_27_cast_parameter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; PyObject *__pyx_v_value = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_cast_parameter (wrapper)", 0); @@ -5054,11 +5272,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_27_cast_param case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_cast_parameter", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_cast_parameter", 1, 2, 2, 1); __PYX_ERR(0, 471, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cast_parameter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cast_parameter") < 0)) __PYX_ERR(0, 471, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5071,7 +5289,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_27_cast_param } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_cast_parameter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_cast_parameter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 471, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.BaseTrainer._cast_parameter", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5093,26 +5311,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param 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; __Pyx_RefNannySetupContext("_cast_parameter", 0); - /* "pycrfsuite/_pycrfsuite.pyx":465 + /* "pycrfsuite/_pycrfsuite.pyx":472 * * def _cast_parameter(self, name, value): * if name in self._PARAMETER_TYPES: # <<<<<<<<<<<<<< * return self._PARAMETER_TYPES[name](value) * return value */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_PARAMETER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_PARAMETER_TYPES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "pycrfsuite/_pycrfsuite.pyx":466 + /* "pycrfsuite/_pycrfsuite.pyx":473 * def _cast_parameter(self, name, value): * if name in self._PARAMETER_TYPES: * return self._PARAMETER_TYPES[name](value) # <<<<<<<<<<<<<< @@ -5120,9 +5335,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_PARAMETER_TYPES); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_PARAMETER_TYPES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_v_name); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -5136,16 +5351,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param } } if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_value); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -5154,7 +5369,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param __pyx_t_1 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":465 + /* "pycrfsuite/_pycrfsuite.pyx":472 * * def _cast_parameter(self, name, value): * if name in self._PARAMETER_TYPES: # <<<<<<<<<<<<<< @@ -5163,7 +5378,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param */ } - /* "pycrfsuite/_pycrfsuite.pyx":467 + /* "pycrfsuite/_pycrfsuite.pyx":474 * if name in self._PARAMETER_TYPES: * return self._PARAMETER_TYPES[name](value) * return value # <<<<<<<<<<<<<< @@ -5175,7 +5390,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param __pyx_r = __pyx_v_value; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":464 + /* "pycrfsuite/_pycrfsuite.pyx":471 * self.c_trainer.clear() * * def _cast_parameter(self, name, value): # <<<<<<<<<<<<<< @@ -5197,7 +5412,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":469 +/* "pycrfsuite/_pycrfsuite.pyx":476 * return value * * def _before_train(self): # <<<<<<<<<<<<<< @@ -5231,7 +5446,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_28_before_tra return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":254 +/* "pycrfsuite/_pycrfsuite.pyx":261 * } * * cdef public verbose # <<<<<<<<<<<<<< @@ -5326,7 +5541,7 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_7verbose_4__del__(s return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":495 +/* "pycrfsuite/_pycrfsuite.pyx":502 * logparser = None * * def _before_train(self): # <<<<<<<<<<<<<< @@ -5355,21 +5570,18 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer__before_train(CYTH 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; __Pyx_RefNannySetupContext("_before_train", 0); - /* "pycrfsuite/_pycrfsuite.pyx":496 + /* "pycrfsuite/_pycrfsuite.pyx":503 * * def _before_train(self): * self.logparser = _logparser.TrainLogParser() # <<<<<<<<<<<<<< * * def message(self, message): */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logparser); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logparser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_TrainLogParser); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_TrainLogParser); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -5383,17 +5595,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer__before_train(CYTH } } if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2, __pyx_t_1) < 0) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":495 + /* "pycrfsuite/_pycrfsuite.pyx":502 * logparser = None * * def _before_train(self): # <<<<<<<<<<<<<< @@ -5416,7 +5628,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer__before_train(CYTH return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":498 +/* "pycrfsuite/_pycrfsuite.pyx":505 * self.logparser = _logparser.TrainLogParser() * * def message(self, message): # <<<<<<<<<<<<<< @@ -5431,9 +5643,6 @@ static PyMethodDef __pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_3message = {"m static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_3message(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_message = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("message (wrapper)", 0); @@ -5457,11 +5666,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_3message(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("message", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("message", 1, 2, 2, 1); __PYX_ERR(0, 505, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "message") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "message") < 0)) __PYX_ERR(0, 505, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5474,7 +5683,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_3message(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("message", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("message", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 505, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.message", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5501,21 +5710,18 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN int __pyx_t_7; Py_ssize_t __pyx_t_8; PyObject *__pyx_t_9 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("message", 0); - /* "pycrfsuite/_pycrfsuite.pyx":499 + /* "pycrfsuite/_pycrfsuite.pyx":506 * * def message(self, message): * event = self.logparser.feed(message) # <<<<<<<<<<<<<< * * if not self.verbose or event is None: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_feed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_feed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -5529,16 +5735,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } } if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __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 = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_message); __Pyx_GIVEREF(__pyx_v_message); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_message); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } @@ -5546,16 +5752,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __pyx_v_event = __pyx_t_1; __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":501 + /* "pycrfsuite/_pycrfsuite.pyx":508 * event = self.logparser.feed(message) * * if not self.verbose or event is None: # <<<<<<<<<<<<<< * return * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_verbose); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_verbose); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = ((!__pyx_t_6) != 0); if (!__pyx_t_7) { @@ -5569,7 +5775,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __pyx_L4_bool_binop_done:; if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":502 + /* "pycrfsuite/_pycrfsuite.pyx":509 * * if not self.verbose or event is None: * return # <<<<<<<<<<<<<< @@ -5580,7 +5786,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":501 + /* "pycrfsuite/_pycrfsuite.pyx":508 * event = self.logparser.feed(message) * * if not self.verbose or event is None: # <<<<<<<<<<<<<< @@ -5589,39 +5795,39 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN */ } - /* "pycrfsuite/_pycrfsuite.pyx":504 + /* "pycrfsuite/_pycrfsuite.pyx":511 * return * * log = self.logparser.last_log # <<<<<<<<<<<<<< * if event == 'start': * self.on_start(log) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_last_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_last_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_log = __pyx_t_3; __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":505 + /* "pycrfsuite/_pycrfsuite.pyx":512 * * log = self.logparser.last_log * if event == 'start': # <<<<<<<<<<<<<< * self.on_start(log) * elif event == 'featgen_progress': */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_start, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_start, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 512, __pyx_L1_error) if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":506 + /* "pycrfsuite/_pycrfsuite.pyx":513 * log = self.logparser.last_log * if event == 'start': * self.on_start(log) # <<<<<<<<<<<<<< * elif event == 'featgen_progress': * self.on_featgen_progress(log, self.logparser.featgen_percent) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { @@ -5634,23 +5840,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } } if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_log); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":505 + /* "pycrfsuite/_pycrfsuite.pyx":512 * * log = self.logparser.last_log * if event == 'start': # <<<<<<<<<<<<<< @@ -5660,28 +5866,28 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN goto __pyx_L6; } - /* "pycrfsuite/_pycrfsuite.pyx":507 + /* "pycrfsuite/_pycrfsuite.pyx":514 * if event == 'start': * self.on_start(log) * elif event == 'featgen_progress': # <<<<<<<<<<<<<< * self.on_featgen_progress(log, self.logparser.featgen_percent) * elif event == 'featgen_end': */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_featgen_progress, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_featgen_progress, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 514, __pyx_L1_error) if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":508 + /* "pycrfsuite/_pycrfsuite.pyx":515 * self.on_start(log) * elif event == 'featgen_progress': * self.on_featgen_progress(log, self.logparser.featgen_percent) # <<<<<<<<<<<<<< * elif event == 'featgen_end': * self.on_featgen_end(log) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_featgen_progress); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_featgen_progress); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_featgen_percent); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_featgen_percent); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -5696,7 +5902,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __pyx_t_8 = 1; } } - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL; @@ -5707,13 +5913,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":507 + /* "pycrfsuite/_pycrfsuite.pyx":514 * if event == 'start': * self.on_start(log) * elif event == 'featgen_progress': # <<<<<<<<<<<<<< @@ -5723,24 +5929,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN goto __pyx_L6; } - /* "pycrfsuite/_pycrfsuite.pyx":509 + /* "pycrfsuite/_pycrfsuite.pyx":516 * elif event == 'featgen_progress': * self.on_featgen_progress(log, self.logparser.featgen_percent) * elif event == 'featgen_end': # <<<<<<<<<<<<<< * self.on_featgen_end(log) * elif event == 'prepared': */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_featgen_end, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_featgen_end, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 516, __pyx_L1_error) if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":510 + /* "pycrfsuite/_pycrfsuite.pyx":517 * self.on_featgen_progress(log, self.logparser.featgen_percent) * elif event == 'featgen_end': * self.on_featgen_end(log) # <<<<<<<<<<<<<< * elif event == 'prepared': * self.on_prepared(log) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_featgen_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_featgen_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { @@ -5753,23 +5959,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } } if (!__pyx_t_9) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_log); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":509 + /* "pycrfsuite/_pycrfsuite.pyx":516 * elif event == 'featgen_progress': * self.on_featgen_progress(log, self.logparser.featgen_percent) * elif event == 'featgen_end': # <<<<<<<<<<<<<< @@ -5779,24 +5985,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN goto __pyx_L6; } - /* "pycrfsuite/_pycrfsuite.pyx":511 + /* "pycrfsuite/_pycrfsuite.pyx":518 * elif event == 'featgen_end': * self.on_featgen_end(log) * elif event == 'prepared': # <<<<<<<<<<<<<< * self.on_prepared(log) * elif event == 'prepare_error': */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_prepared, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_prepared, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 518, __pyx_L1_error) if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":512 + /* "pycrfsuite/_pycrfsuite.pyx":519 * self.on_featgen_end(log) * elif event == 'prepared': * self.on_prepared(log) # <<<<<<<<<<<<<< * elif event == 'prepare_error': * self.on_prepare_error(log) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_prepared); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_prepared); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { @@ -5809,23 +6015,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } } if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_log); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":511 + /* "pycrfsuite/_pycrfsuite.pyx":518 * elif event == 'featgen_end': * self.on_featgen_end(log) * elif event == 'prepared': # <<<<<<<<<<<<<< @@ -5835,24 +6041,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN goto __pyx_L6; } - /* "pycrfsuite/_pycrfsuite.pyx":513 + /* "pycrfsuite/_pycrfsuite.pyx":520 * elif event == 'prepared': * self.on_prepared(log) * elif event == 'prepare_error': # <<<<<<<<<<<<<< * self.on_prepare_error(log) * elif event == 'iteration': */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_prepare_error, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_prepare_error, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 520, __pyx_L1_error) if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":514 + /* "pycrfsuite/_pycrfsuite.pyx":521 * self.on_prepared(log) * elif event == 'prepare_error': * self.on_prepare_error(log) # <<<<<<<<<<<<<< * elif event == 'iteration': * self.on_iteration(log, self.logparser.last_iteration) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_prepare_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_prepare_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { @@ -5865,23 +6071,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } } if (!__pyx_t_9) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_log); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":513 + /* "pycrfsuite/_pycrfsuite.pyx":520 * elif event == 'prepared': * self.on_prepared(log) * elif event == 'prepare_error': # <<<<<<<<<<<<<< @@ -5891,28 +6097,28 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN goto __pyx_L6; } - /* "pycrfsuite/_pycrfsuite.pyx":515 + /* "pycrfsuite/_pycrfsuite.pyx":522 * elif event == 'prepare_error': * self.on_prepare_error(log) * elif event == 'iteration': # <<<<<<<<<<<<<< * self.on_iteration(log, self.logparser.last_iteration) * elif event == 'optimization_end': */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_iteration, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_iteration, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 522, __pyx_L1_error) if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":516 + /* "pycrfsuite/_pycrfsuite.pyx":523 * self.on_prepare_error(log) * elif event == 'iteration': * self.on_iteration(log, self.logparser.last_iteration) # <<<<<<<<<<<<<< * elif event == 'optimization_end': * self.on_optimization_end(log) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_iteration); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_iteration); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_last_iteration); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_last_iteration); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -5927,7 +6133,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __pyx_t_8 = 1; } } - __pyx_t_2 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -5938,13 +6144,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_t_9); __pyx_t_9 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":515 + /* "pycrfsuite/_pycrfsuite.pyx":522 * elif event == 'prepare_error': * self.on_prepare_error(log) * elif event == 'iteration': # <<<<<<<<<<<<<< @@ -5954,24 +6160,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN goto __pyx_L6; } - /* "pycrfsuite/_pycrfsuite.pyx":517 + /* "pycrfsuite/_pycrfsuite.pyx":524 * elif event == 'iteration': * self.on_iteration(log, self.logparser.last_iteration) * elif event == 'optimization_end': # <<<<<<<<<<<<<< * self.on_optimization_end(log) * elif event == 'end': */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_optimization_end, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_optimization_end, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 524, __pyx_L1_error) if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":518 + /* "pycrfsuite/_pycrfsuite.pyx":525 * self.on_iteration(log, self.logparser.last_iteration) * elif event == 'optimization_end': * self.on_optimization_end(log) # <<<<<<<<<<<<<< * elif event == 'end': * self.on_end(log) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_optimization_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_optimization_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { @@ -5984,23 +6190,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } } if (!__pyx_t_2) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_log); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":517 + /* "pycrfsuite/_pycrfsuite.pyx":524 * elif event == 'iteration': * self.on_iteration(log, self.logparser.last_iteration) * elif event == 'optimization_end': # <<<<<<<<<<<<<< @@ -6010,24 +6216,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN goto __pyx_L6; } - /* "pycrfsuite/_pycrfsuite.pyx":519 + /* "pycrfsuite/_pycrfsuite.pyx":526 * elif event == 'optimization_end': * self.on_optimization_end(log) * elif event == 'end': # <<<<<<<<<<<<<< * self.on_end(log) * else: */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_end, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_end, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 526, __pyx_L1_error) if (__pyx_t_5) { - /* "pycrfsuite/_pycrfsuite.pyx":520 + /* "pycrfsuite/_pycrfsuite.pyx":527 * self.on_optimization_end(log) * elif event == 'end': * self.on_end(log) # <<<<<<<<<<<<<< * else: * raise Exception("Unknown event %r" % event) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_on_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { @@ -6040,23 +6246,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } } if (!__pyx_t_9) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_log); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":519 + /* "pycrfsuite/_pycrfsuite.pyx":526 * elif event == 'optimization_end': * self.on_optimization_end(log) * elif event == 'end': # <<<<<<<<<<<<<< @@ -6066,7 +6272,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN goto __pyx_L6; } - /* "pycrfsuite/_pycrfsuite.pyx":522 + /* "pycrfsuite/_pycrfsuite.pyx":529 * self.on_end(log) * else: * raise Exception("Unknown event %r" % event) # <<<<<<<<<<<<<< @@ -6074,23 +6280,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN * def on_start(self, log): */ /*else*/ { - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_event_r, __pyx_v_event); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_event_r, __pyx_v_event); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 529, __pyx_L1_error) } __pyx_L6:; - /* "pycrfsuite/_pycrfsuite.pyx":498 + /* "pycrfsuite/_pycrfsuite.pyx":505 * self.logparser = _logparser.TrainLogParser() * * def message(self, message): # <<<<<<<<<<<<<< @@ -6117,7 +6323,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":524 +/* "pycrfsuite/_pycrfsuite.pyx":531 * raise Exception("Unknown event %r" % event) * * def on_start(self, log): # <<<<<<<<<<<<<< @@ -6132,9 +6338,6 @@ static PyMethodDef __pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_5on_start = {" static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_5on_start(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_log = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("on_start (wrapper)", 0); @@ -6158,11 +6361,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_5on_start(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_start", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_start", 1, 2, 2, 1); __PYX_ERR(0, 531, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_start") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_start") < 0)) __PYX_ERR(0, 531, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6175,7 +6378,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_5on_start(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_start", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_start", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 531, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.on_start", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6194,33 +6397,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_4on_start(CYTHON_U 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; __Pyx_RefNannySetupContext("on_start", 0); - /* "pycrfsuite/_pycrfsuite.pyx":525 + /* "pycrfsuite/_pycrfsuite.pyx":532 * * def on_start(self, log): * print(log, end='') # <<<<<<<<<<<<<< * * def on_featgen_progress(self, log, percent): */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_log); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 532, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":524 + /* "pycrfsuite/_pycrfsuite.pyx":531 * raise Exception("Unknown event %r" % event) * * def on_start(self, log): # <<<<<<<<<<<<<< @@ -6243,7 +6443,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_4on_start(CYTHON_U return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":527 +/* "pycrfsuite/_pycrfsuite.pyx":534 * print(log, end='') * * def on_featgen_progress(self, log, percent): # <<<<<<<<<<<<<< @@ -6259,9 +6459,6 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_7on_featgen_progre CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_log = 0; CYTHON_UNUSED PyObject *__pyx_v_percent = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("on_featgen_progress (wrapper)", 0); @@ -6286,16 +6483,16 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_7on_featgen_progre case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, 1); __PYX_ERR(0, 534, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_percent)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, 2); __PYX_ERR(0, 534, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_featgen_progress") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_featgen_progress") < 0)) __PYX_ERR(0, 534, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -6310,7 +6507,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_7on_featgen_progre } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 534, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.on_featgen_progress", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6329,33 +6526,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_6on_featgen_progre 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; __Pyx_RefNannySetupContext("on_featgen_progress", 0); - /* "pycrfsuite/_pycrfsuite.pyx":528 + /* "pycrfsuite/_pycrfsuite.pyx":535 * * def on_featgen_progress(self, log, percent): * print(log, end='') # <<<<<<<<<<<<<< * * def on_featgen_end(self, log): */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_log); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":527 + /* "pycrfsuite/_pycrfsuite.pyx":534 * print(log, end='') * * def on_featgen_progress(self, log, percent): # <<<<<<<<<<<<<< @@ -6378,7 +6572,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_6on_featgen_progre return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":530 +/* "pycrfsuite/_pycrfsuite.pyx":537 * print(log, end='') * * def on_featgen_end(self, log): # <<<<<<<<<<<<<< @@ -6393,9 +6587,6 @@ static PyMethodDef __pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_9on_featgen_en static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_9on_featgen_end(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_log = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("on_featgen_end (wrapper)", 0); @@ -6419,11 +6610,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_9on_featgen_end(Py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_featgen_end", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_featgen_end", 1, 2, 2, 1); __PYX_ERR(0, 537, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_featgen_end") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_featgen_end") < 0)) __PYX_ERR(0, 537, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6436,7 +6627,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_9on_featgen_end(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_featgen_end", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_featgen_end", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 537, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.on_featgen_end", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6455,33 +6646,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_8on_featgen_end(CY 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; __Pyx_RefNannySetupContext("on_featgen_end", 0); - /* "pycrfsuite/_pycrfsuite.pyx":531 + /* "pycrfsuite/_pycrfsuite.pyx":538 * * def on_featgen_end(self, log): * print(log, end='') # <<<<<<<<<<<<<< * * def on_prepared(self, log): */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_log); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 538, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":530 + /* "pycrfsuite/_pycrfsuite.pyx":537 * print(log, end='') * * def on_featgen_end(self, log): # <<<<<<<<<<<<<< @@ -6504,7 +6692,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_8on_featgen_end(CY return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":533 +/* "pycrfsuite/_pycrfsuite.pyx":540 * print(log, end='') * * def on_prepared(self, log): # <<<<<<<<<<<<<< @@ -6519,9 +6707,6 @@ static PyMethodDef __pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_11on_prepared static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_11on_prepared(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_log = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("on_prepared (wrapper)", 0); @@ -6545,11 +6730,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_11on_prepared(PyOb case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_prepared", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_prepared", 1, 2, 2, 1); __PYX_ERR(0, 540, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_prepared") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_prepared") < 0)) __PYX_ERR(0, 540, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6562,7 +6747,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_11on_prepared(PyOb } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_prepared", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_prepared", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 540, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.on_prepared", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6581,33 +6766,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_10on_prepared(CYTH 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; __Pyx_RefNannySetupContext("on_prepared", 0); - /* "pycrfsuite/_pycrfsuite.pyx":534 + /* "pycrfsuite/_pycrfsuite.pyx":541 * * def on_prepared(self, log): * print(log, end='') # <<<<<<<<<<<<<< * * def on_prepare_error(self, log): */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_log); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 541, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":533 + /* "pycrfsuite/_pycrfsuite.pyx":540 * print(log, end='') * * def on_prepared(self, log): # <<<<<<<<<<<<<< @@ -6630,7 +6812,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_10on_prepared(CYTH return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":536 +/* "pycrfsuite/_pycrfsuite.pyx":543 * print(log, end='') * * def on_prepare_error(self, log): # <<<<<<<<<<<<<< @@ -6645,9 +6827,6 @@ static PyMethodDef __pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_13on_prepare_e static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_13on_prepare_error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_log = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("on_prepare_error (wrapper)", 0); @@ -6671,11 +6850,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_13on_prepare_error case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_prepare_error", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_prepare_error", 1, 2, 2, 1); __PYX_ERR(0, 543, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_prepare_error") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_prepare_error") < 0)) __PYX_ERR(0, 543, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6688,7 +6867,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_13on_prepare_error } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_prepare_error", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_prepare_error", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 543, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.on_prepare_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6707,33 +6886,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_12on_prepare_error 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; __Pyx_RefNannySetupContext("on_prepare_error", 0); - /* "pycrfsuite/_pycrfsuite.pyx":537 + /* "pycrfsuite/_pycrfsuite.pyx":544 * * def on_prepare_error(self, log): * print(log, end='') # <<<<<<<<<<<<<< * * def on_iteration(self, log, info): */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_log); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 544, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":536 + /* "pycrfsuite/_pycrfsuite.pyx":543 * print(log, end='') * * def on_prepare_error(self, log): # <<<<<<<<<<<<<< @@ -6756,7 +6932,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_12on_prepare_error return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":539 +/* "pycrfsuite/_pycrfsuite.pyx":546 * print(log, end='') * * def on_iteration(self, log, info): # <<<<<<<<<<<<<< @@ -6772,9 +6948,6 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_15on_iteration(PyO CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_log = 0; CYTHON_UNUSED PyObject *__pyx_v_info = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("on_iteration (wrapper)", 0); @@ -6799,16 +6972,16 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_15on_iteration(PyO case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, 1); __PYX_ERR(0, 546, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_info)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, 2); __PYX_ERR(0, 546, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_iteration") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_iteration") < 0)) __PYX_ERR(0, 546, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -6823,7 +6996,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_15on_iteration(PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 546, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.on_iteration", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6842,33 +7015,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_14on_iteration(CYT 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; __Pyx_RefNannySetupContext("on_iteration", 0); - /* "pycrfsuite/_pycrfsuite.pyx":540 + /* "pycrfsuite/_pycrfsuite.pyx":547 * * def on_iteration(self, log, info): * print(log, end='') # <<<<<<<<<<<<<< * * def on_optimization_end(self, log): */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_log); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 547, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":539 + /* "pycrfsuite/_pycrfsuite.pyx":546 * print(log, end='') * * def on_iteration(self, log, info): # <<<<<<<<<<<<<< @@ -6891,7 +7061,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_14on_iteration(CYT return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":542 +/* "pycrfsuite/_pycrfsuite.pyx":549 * print(log, end='') * * def on_optimization_end(self, log): # <<<<<<<<<<<<<< @@ -6906,9 +7076,6 @@ static PyMethodDef __pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_17on_optimizat static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_17on_optimization_end(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_log = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("on_optimization_end (wrapper)", 0); @@ -6932,11 +7099,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_17on_optimization_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_optimization_end", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_optimization_end", 1, 2, 2, 1); __PYX_ERR(0, 549, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_optimization_end") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_optimization_end") < 0)) __PYX_ERR(0, 549, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6949,7 +7116,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_17on_optimization_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_optimization_end", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_optimization_end", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 549, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.on_optimization_end", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6968,33 +7135,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_16on_optimization_ 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; __Pyx_RefNannySetupContext("on_optimization_end", 0); - /* "pycrfsuite/_pycrfsuite.pyx":543 + /* "pycrfsuite/_pycrfsuite.pyx":550 * * def on_optimization_end(self, log): * print(log, end='') # <<<<<<<<<<<<<< * * def on_end(self, log): */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_log); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 550, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":542 + /* "pycrfsuite/_pycrfsuite.pyx":549 * print(log, end='') * * def on_optimization_end(self, log): # <<<<<<<<<<<<<< @@ -7017,7 +7181,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_16on_optimization_ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":545 +/* "pycrfsuite/_pycrfsuite.pyx":552 * print(log, end='') * * def on_end(self, log): # <<<<<<<<<<<<<< @@ -7032,9 +7196,6 @@ static PyMethodDef __pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_19on_end = {"o static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_19on_end(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_log = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("on_end (wrapper)", 0); @@ -7058,11 +7219,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_19on_end(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_end", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_end", 1, 2, 2, 1); __PYX_ERR(0, 552, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_end") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_end") < 0)) __PYX_ERR(0, 552, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -7075,7 +7236,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_19on_end(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("on_end", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("on_end", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 552, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Trainer.on_end", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7094,33 +7255,30 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_18on_end(CYTHON_UN 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; __Pyx_RefNannySetupContext("on_end", 0); - /* "pycrfsuite/_pycrfsuite.pyx":546 + /* "pycrfsuite/_pycrfsuite.pyx":553 * * def on_end(self, log): * print(log, end='') # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_log); __Pyx_GIVEREF(__pyx_v_log); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_log); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s_) < 0) __PYX_ERR(0, 553, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":545 + /* "pycrfsuite/_pycrfsuite.pyx":552 * print(log, end='') * * def on_end(self, log): # <<<<<<<<<<<<<< @@ -7143,7 +7301,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_18on_end(CYTHON_UN return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":558 +/* "pycrfsuite/_pycrfsuite.pyx":565 * cdef crfsuite_api.Tagger c_tagger * * def open(self, name): # <<<<<<<<<<<<<< @@ -7175,19 +7333,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o std::string __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("open", 0); - /* "pycrfsuite/_pycrfsuite.pyx":571 + /* "pycrfsuite/_pycrfsuite.pyx":578 * # may segfault if the file is invalid. * # See https://github.com/chokkan/crfsuite/pull/24 * self._check_model(name) # <<<<<<<<<<<<<< * if not self.c_tagger.open(name): * raise ValueError("Error opening model file %r" % name) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_model); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -7200,61 +7355,61 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o } } if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __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 = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_name); - __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 = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":572 + /* "pycrfsuite/_pycrfsuite.pyx":579 * # See https://github.com/chokkan/crfsuite/pull/24 * self._check_model(name) * if not self.c_tagger.open(name): # <<<<<<<<<<<<<< * raise ValueError("Error opening model file %r" % name) * return contextlib.closing(self) */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 579, __pyx_L1_error) try { __pyx_t_6 = __pyx_v_self->c_tagger.open(__pyx_t_5); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 579, __pyx_L1_error) } __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); if (__pyx_t_7) { - /* "pycrfsuite/_pycrfsuite.pyx":573 + /* "pycrfsuite/_pycrfsuite.pyx":580 * self._check_model(name) * if not self.c_tagger.open(name): * raise ValueError("Error opening model file %r" % name) # <<<<<<<<<<<<<< * return contextlib.closing(self) * */ - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Error_opening_model_file_r, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Error_opening_model_file_r, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __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 = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 580, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":572 + /* "pycrfsuite/_pycrfsuite.pyx":579 * # See https://github.com/chokkan/crfsuite/pull/24 * self._check_model(name) * if not self.c_tagger.open(name): # <<<<<<<<<<<<<< @@ -7263,7 +7418,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o */ } - /* "pycrfsuite/_pycrfsuite.pyx":574 + /* "pycrfsuite/_pycrfsuite.pyx":581 * if not self.c_tagger.open(name): * raise ValueError("Error opening model file %r" % name) * return contextlib.closing(self) # <<<<<<<<<<<<<< @@ -7271,9 +7426,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o * def close(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_contextlib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_contextlib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_closing); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_closing); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -7287,16 +7442,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o } } if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_self)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } @@ -7305,7 +7460,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o __pyx_t_1 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":558 + /* "pycrfsuite/_pycrfsuite.pyx":565 * cdef crfsuite_api.Tagger c_tagger * * def open(self, name): # <<<<<<<<<<<<<< @@ -7327,7 +7482,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":576 +/* "pycrfsuite/_pycrfsuite.pyx":583 * return contextlib.closing(self) * * def close(self): # <<<<<<<<<<<<<< @@ -7352,12 +7507,9 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_3close(PyObject *__ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2close(struct __pyx_obj_10pycrfsuite_11_pycrfsuite_Tagger *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("close", 0); - /* "pycrfsuite/_pycrfsuite.pyx":580 + /* "pycrfsuite/_pycrfsuite.pyx":587 * Close the model. * """ * self.c_tagger.close() # <<<<<<<<<<<<<< @@ -7368,10 +7520,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2close(struct __pyx __pyx_v_self->c_tagger.close(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 587, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":576 + /* "pycrfsuite/_pycrfsuite.pyx":583 * return contextlib.closing(self) * * def close(self): # <<<<<<<<<<<<<< @@ -7391,7 +7543,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2close(struct __pyx return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":582 +/* "pycrfsuite/_pycrfsuite.pyx":589 * self.c_tagger.close() * * def labels(self): # <<<<<<<<<<<<<< @@ -7418,12 +7570,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_4labels(struct __py __Pyx_RefNannyDeclarations CRFSuite::StringList __pyx_t_1; PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("labels", 0); - /* "pycrfsuite/_pycrfsuite.pyx":591 + /* "pycrfsuite/_pycrfsuite.pyx":598 * The list of labels in the model. * """ * return self.c_tagger.labels() # <<<<<<<<<<<<<< @@ -7435,15 +7584,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_4labels(struct __py __pyx_t_1 = __pyx_v_self->c_tagger.labels(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 598, __pyx_L1_error) } - __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":582 + /* "pycrfsuite/_pycrfsuite.pyx":589 * self.c_tagger.close() * * def labels(self): # <<<<<<<<<<<<<< @@ -7462,7 +7611,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_4labels(struct __py return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":593 +/* "pycrfsuite/_pycrfsuite.pyx":600 * return self.c_tagger.labels() * * def tag(self, xseq=None): # <<<<<<<<<<<<<< @@ -7475,9 +7624,6 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_7tag(PyObject *__py static char __pyx_doc_10pycrfsuite_11_pycrfsuite_6Tagger_6tag[] = "Tagger.tag(self, xseq=None)\n\n Predict the label sequence for the item sequence.\n\n Parameters\n ----------\n xseq : item sequence, optional\n The item sequence. If omitted, the current sequence is used\n (a sequence set using :meth:`Tagger.set` method or\n a sequence used in a previous :meth:`Tagger.tag` call).\n\n ``xseq`` should be a list of item features or\n an :class:`~ItemSequence` instance. Allowed item features formats\n are the same as described in :class:`~ItemSequence` docs.\n\n Returns\n -------\n list of strings\n The label sequence predicted.\n "; static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_7tag(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_xseq = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("tag (wrapper)", 0); @@ -7502,7 +7648,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_7tag(PyObject *__py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tag") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tag") < 0)) __PYX_ERR(0, 600, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7515,7 +7661,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_7tag(PyObject *__py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("tag", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("tag", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 600, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger.tag", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7535,12 +7681,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6tag(struct __pyx_o int __pyx_t_2; PyObject *__pyx_t_3 = NULL; CRFSuite::StringList __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tag", 0); - /* "pycrfsuite/_pycrfsuite.pyx":613 + /* "pycrfsuite/_pycrfsuite.pyx":620 * The label sequence predicted. * """ * if xseq is not None: # <<<<<<<<<<<<<< @@ -7551,7 +7694,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6tag(struct __pyx_o __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pycrfsuite/_pycrfsuite.pyx":614 + /* "pycrfsuite/_pycrfsuite.pyx":621 * """ * if xseq is not None: * self.set(xseq) # <<<<<<<<<<<<<< @@ -7562,12 +7705,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6tag(struct __pyx_o __pyx_t_3 = ((struct __pyx_vtabstruct_10pycrfsuite_11_pycrfsuite_Tagger *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_v_xseq, 0); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 621, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":613 + /* "pycrfsuite/_pycrfsuite.pyx":620 * The label sequence predicted. * """ * if xseq is not None: # <<<<<<<<<<<<<< @@ -7576,7 +7719,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6tag(struct __pyx_o */ } - /* "pycrfsuite/_pycrfsuite.pyx":616 + /* "pycrfsuite/_pycrfsuite.pyx":623 * self.set(xseq) * * return self.c_tagger.viterbi() # <<<<<<<<<<<<<< @@ -7588,15 +7731,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6tag(struct __pyx_o __pyx_t_4 = __pyx_v_self->c_tagger.viterbi(); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 623, __pyx_L1_error) } - __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":593 + /* "pycrfsuite/_pycrfsuite.pyx":600 * return self.c_tagger.labels() * * def tag(self, xseq=None): # <<<<<<<<<<<<<< @@ -7615,7 +7758,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6tag(struct __pyx_o return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":618 +/* "pycrfsuite/_pycrfsuite.pyx":625 * return self.c_tagger.viterbi() * * def probability(self, yseq): # <<<<<<<<<<<<<< @@ -7643,12 +7786,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8probability(struct CRFSuite::StringList __pyx_t_1; double __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("probability", 0); - /* "pycrfsuite/_pycrfsuite.pyx":634 + /* "pycrfsuite/_pycrfsuite.pyx":641 * The probability ``P(yseq|xseq)``. * """ * return self.c_tagger.probability(yseq) # <<<<<<<<<<<<<< @@ -7656,20 +7796,20 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8probability(struct * def marginal(self, y, pos): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_yseq); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_yseq); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 641, __pyx_L1_error) try { __pyx_t_2 = __pyx_v_self->c_tagger.probability(__pyx_t_1); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 641, __pyx_L1_error) } - __pyx_t_3 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":618 + /* "pycrfsuite/_pycrfsuite.pyx":625 * return self.c_tagger.viterbi() * * def probability(self, yseq): # <<<<<<<<<<<<<< @@ -7688,7 +7828,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8probability(struct return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":636 +/* "pycrfsuite/_pycrfsuite.pyx":643 * return self.c_tagger.probability(yseq) * * def marginal(self, y, pos): # <<<<<<<<<<<<<< @@ -7702,9 +7842,6 @@ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_6Tagger_10marginal[] = "Tagger. static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_11marginal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_y = 0; PyObject *__pyx_v_pos = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("marginal (wrapper)", 0); @@ -7728,11 +7865,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_11marginal(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("marginal", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("marginal", 1, 2, 2, 1); __PYX_ERR(0, 643, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "marginal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "marginal") < 0)) __PYX_ERR(0, 643, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -7745,7 +7882,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_11marginal(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("marginal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("marginal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 643, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger.marginal", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7765,12 +7902,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_10marginal(struct _ int __pyx_t_2; double __pyx_t_3; PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("marginal", 0); - /* "pycrfsuite/_pycrfsuite.pyx":655 + /* "pycrfsuite/_pycrfsuite.pyx":662 * The marginal probability of the label ``y`` at position ``t``. * """ * return self.c_tagger.marginal(y, pos) # <<<<<<<<<<<<<< @@ -7778,21 +7912,21 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_10marginal(struct _ * cpdef set(self, xseq) except +: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_y); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_pos); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_y); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_pos); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L1_error) try { __pyx_t_3 = __pyx_v_self->c_tagger.marginal(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 662, __pyx_L1_error) } - __pyx_t_4 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":636 + /* "pycrfsuite/_pycrfsuite.pyx":643 * return self.c_tagger.probability(yseq) * * def marginal(self, y, pos): # <<<<<<<<<<<<<< @@ -7811,7 +7945,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_10marginal(struct _ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":657 +/* "pycrfsuite/_pycrfsuite.pyx":664 * return self.c_tagger.marginal(y, pos) * * cpdef set(self, xseq) except +: # <<<<<<<<<<<<<< @@ -7829,15 +7963,12 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; CRFSuite::ItemSequence __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_13set)) { __Pyx_XDECREF(__pyx_r); @@ -7853,16 +7984,16 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj } } if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_xseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_xseq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_INCREF(__pyx_v_xseq); __Pyx_GIVEREF(__pyx_v_xseq); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_xseq); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -7875,7 +8006,7 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "pycrfsuite/_pycrfsuite.pyx":672 + /* "pycrfsuite/_pycrfsuite.pyx":679 * * """ * self.c_tagger.set(to_seq(xseq)) # <<<<<<<<<<<<<< @@ -7886,16 +8017,16 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj __pyx_t_6 = __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(__pyx_v_xseq); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 679, __pyx_L1_error) } try { __pyx_v_self->c_tagger.set(__pyx_t_6); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 679, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":657 + /* "pycrfsuite/_pycrfsuite.pyx":664 * return self.c_tagger.marginal(y, pos) * * cpdef set(self, xseq) except +: # <<<<<<<<<<<<<< @@ -7938,16 +8069,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_12set(struct __pyx_ PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set", 0); __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(__pyx_v_self, __pyx_v_xseq, 1); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 664, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; @@ -7965,7 +8093,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_12set(struct __pyx_ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":674 +/* "pycrfsuite/_pycrfsuite.pyx":681 * self.c_tagger.set(to_seq(xseq)) * * def dump(self, filename=None): # <<<<<<<<<<<<<< @@ -7978,9 +8106,6 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_15dump(PyObject *__ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_6Tagger_14dump[] = "Tagger.dump(self, filename=None)\n\n Dump a CRF model in plain-text format.\n\n Parameters\n ----------\n filename : string, optional\n File name to dump the model to.\n If None, the model is dumped to stdout.\n "; static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_15dump(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_filename = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dump (wrapper)", 0); @@ -8005,7 +8130,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_15dump(PyObject *__ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dump") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dump") < 0)) __PYX_ERR(0, 681, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -8018,7 +8143,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_15dump(PyObject *__ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dump", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dump", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 681, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger.dump", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8056,12 +8181,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; int __pyx_t_21; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dump", 0); - /* "pycrfsuite/_pycrfsuite.pyx":684 + /* "pycrfsuite/_pycrfsuite.pyx":691 * If None, the model is dumped to stdout. * """ * if filename is None: # <<<<<<<<<<<<<< @@ -8072,24 +8194,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pycrfsuite/_pycrfsuite.pyx":685 + /* "pycrfsuite/_pycrfsuite.pyx":692 * """ * if filename is None: * self.c_tagger.dump(os.dup(sys.stdout.fileno())) # <<<<<<<<<<<<<< * else: * fd = os.open(filename, os.O_CREAT | os.O_WRONLY) */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dup); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dup); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_stdout); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_stdout); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_fileno); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_fileno); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; @@ -8103,10 +8225,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx } } if (__pyx_t_7) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -8121,31 +8243,31 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx } } if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 692, __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[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; try { __pyx_v_self->c_tagger.dump(__pyx_t_8); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 692, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":684 + /* "pycrfsuite/_pycrfsuite.pyx":691 * If None, the model is dumped to stdout. * """ * if filename is None: # <<<<<<<<<<<<<< @@ -8155,7 +8277,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx goto __pyx_L3; } - /* "pycrfsuite/_pycrfsuite.pyx":687 + /* "pycrfsuite/_pycrfsuite.pyx":694 * self.c_tagger.dump(os.dup(sys.stdout.fileno())) * else: * fd = os.open(filename, os.O_CREAT | os.O_WRONLY) # <<<<<<<<<<<<<< @@ -8163,22 +8285,22 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx * self.c_tagger.dump(fd) */ /*else*/ { - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_open); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_open); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_O_CREAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_O_CREAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_O_WRONLY); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_O_WRONLY); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Or(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Or(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -8194,7 +8316,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx __pyx_t_9 = 1; } } - __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; @@ -8205,14 +8327,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_fd = __pyx_t_3; __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":688 + /* "pycrfsuite/_pycrfsuite.pyx":695 * else: * fd = os.open(filename, os.O_CREAT | os.O_WRONLY) * try: # <<<<<<<<<<<<<< @@ -8221,23 +8343,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx */ /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":689 + /* "pycrfsuite/_pycrfsuite.pyx":696 * fd = os.open(filename, os.O_CREAT | os.O_WRONLY) * try: * self.c_tagger.dump(fd) # <<<<<<<<<<<<<< * finally: * try: */ - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_fd); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_fd); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L5_error) try { __pyx_v_self->c_tagger.dump(__pyx_t_8); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __PYX_ERR(0, 696, __pyx_L5_error) } } - /* "pycrfsuite/_pycrfsuite.pyx":691 + /* "pycrfsuite/_pycrfsuite.pyx":698 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< @@ -8247,22 +8369,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx /*finally:*/ { /*normal exit:*/{ { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_12); /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":692 + /* "pycrfsuite/_pycrfsuite.pyx":699 * finally: * try: * os.close(fd) # <<<<<<<<<<<<<< * except OSError: * pass # already closed by Tagger::dump */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 699, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; @@ -8276,23 +8400,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx } } if (!__pyx_t_7) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL; __Pyx_INCREF(__pyx_v_fd); __Pyx_GIVEREF(__pyx_v_fd); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_fd); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":691 + /* "pycrfsuite/_pycrfsuite.pyx":698 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< @@ -8305,40 +8429,43 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L14_try_end; __pyx_L7_error:; + __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":693 + /* "pycrfsuite/_pycrfsuite.pyx":700 * try: * os.close(fd) * except OSError: # <<<<<<<<<<<<<< * pass # already closed by Tagger::dump * */ - __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_OSError); + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OSError); if (__pyx_t_8) { - PyErr_Restore(0,0,0); + __Pyx_ErrRestore(0,0,0); goto __pyx_L8_exception_handled; } goto __pyx_L9_except_error; __pyx_L9_except_error:; - /* "pycrfsuite/_pycrfsuite.pyx":691 + /* "pycrfsuite/_pycrfsuite.pyx":698 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< * os.close(fd) * except OSError: */ + __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); goto __pyx_L1_error; __pyx_L8_exception_handled:; + __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); @@ -8348,8 +8475,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx goto __pyx_L6; } /*exception exit:*/{ + __Pyx_PyThreadState_declare __pyx_L5_error:; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; + __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -8366,22 +8495,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx __pyx_t_8 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename; { { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":692 + /* "pycrfsuite/_pycrfsuite.pyx":699 * finally: * try: * os.close(fd) # <<<<<<<<<<<<<< * except OSError: * pass # already closed by Tagger::dump */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -8395,23 +8526,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx } } if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_fd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_fd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L17_error) __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 = 692; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 699, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_INCREF(__pyx_v_fd); __Pyx_GIVEREF(__pyx_v_fd); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_fd); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":691 + /* "pycrfsuite/_pycrfsuite.pyx":698 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< @@ -8424,40 +8555,43 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; goto __pyx_L24_try_end; __pyx_L17_error:; + __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":693 + /* "pycrfsuite/_pycrfsuite.pyx":700 * try: * os.close(fd) * except OSError: # <<<<<<<<<<<<<< * pass # already closed by Tagger::dump * */ - __pyx_t_21 = PyErr_ExceptionMatches(__pyx_builtin_OSError); + __pyx_t_21 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OSError); if (__pyx_t_21) { - PyErr_Restore(0,0,0); + __Pyx_ErrRestore(0,0,0); goto __pyx_L18_exception_handled; } goto __pyx_L19_except_error; __pyx_L19_except_error:; - /* "pycrfsuite/_pycrfsuite.pyx":691 + /* "pycrfsuite/_pycrfsuite.pyx":698 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< * os.close(fd) * except OSError: */ + __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20); goto __pyx_L16_error; __pyx_L18_exception_handled:; + __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); @@ -8465,6 +8599,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx __pyx_L24_try_end:; } } + __Pyx_PyThreadState_assign if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); @@ -8479,6 +8614,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14; goto __pyx_L1_error; __pyx_L16_error:; + __Pyx_PyThreadState_assign if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); @@ -8496,7 +8632,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx } __pyx_L3:; - /* "pycrfsuite/_pycrfsuite.pyx":674 + /* "pycrfsuite/_pycrfsuite.pyx":681 * self.c_tagger.set(to_seq(xseq)) * * def dump(self, filename=None): # <<<<<<<<<<<<<< @@ -8522,7 +8658,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14dump(struct __pyx return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":696 +/* "pycrfsuite/_pycrfsuite.pyx":703 * pass # already closed by Tagger::dump * * def info(self): # <<<<<<<<<<<<<< @@ -8572,21 +8708,22 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx int __pyx_t_18; char const *__pyx_t_19; PyObject *__pyx_t_20 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + int __pyx_t_24; __Pyx_RefNannySetupContext("info", 0); - /* "pycrfsuite/_pycrfsuite.pyx":700 + /* "pycrfsuite/_pycrfsuite.pyx":707 * Return a :class:`~.ParsedDump` structure with model internal information. * """ * parser = _dumpparser.CRFsuiteDumpParser() # <<<<<<<<<<<<<< * fd, name = tempfile.mkstemp() * try: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dumpparser); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dumpparser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_CRFsuiteDumpParser); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_CRFsuiteDumpParser); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -8600,26 +8737,26 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx } } if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_parser = __pyx_t_1; __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":701 + /* "pycrfsuite/_pycrfsuite.pyx":708 * """ * parser = _dumpparser.CRFsuiteDumpParser() * fd, name = tempfile.mkstemp() # <<<<<<<<<<<<<< * try: * self.c_tagger.dump(fd) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_tempfile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_tempfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_mkstemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_mkstemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -8633,10 +8770,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx } } 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 = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -8650,7 +8787,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 708, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -8663,15 +8800,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; @@ -8679,7 +8816,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 708, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; @@ -8687,7 +8824,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __PYX_ERR(0, 708, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_fd = __pyx_t_2; @@ -8695,7 +8832,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __pyx_v_name = __pyx_t_3; __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":702 + /* "pycrfsuite/_pycrfsuite.pyx":709 * parser = _dumpparser.CRFsuiteDumpParser() * fd, name = tempfile.mkstemp() * try: # <<<<<<<<<<<<<< @@ -8704,22 +8841,22 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx */ /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":703 + /* "pycrfsuite/_pycrfsuite.pyx":710 * fd, name = tempfile.mkstemp() * try: * self.c_tagger.dump(fd) # <<<<<<<<<<<<<< * with open(name, 'rb') as f: * for line in f: */ - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_fd); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_fd); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 710, __pyx_L6_error) try { __pyx_v_self->c_tagger.dump(__pyx_t_6); } catch(...) { __Pyx_CppExn2PyErr(); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __PYX_ERR(0, 710, __pyx_L6_error) } - /* "pycrfsuite/_pycrfsuite.pyx":704 + /* "pycrfsuite/_pycrfsuite.pyx":711 * try: * self.c_tagger.dump(fd) * with open(name, 'rb') as f: # <<<<<<<<<<<<<< @@ -8727,7 +8864,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx * parser.feed(line.decode('utf8')) */ /*with:*/ { - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); @@ -8735,12 +8872,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __Pyx_INCREF(__pyx_n_s_rb); __Pyx_GIVEREF(__pyx_n_s_rb); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_rb); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 711, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 711, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { @@ -8753,10 +8890,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx } } if (__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L8_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L8_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -8765,6 +8902,8 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /*try:*/ { { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); @@ -8773,7 +8912,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __pyx_v_f = __pyx_t_2; __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":705 + /* "pycrfsuite/_pycrfsuite.pyx":712 * self.c_tagger.dump(fd) * with open(name, 'rb') as f: * for line in f: # <<<<<<<<<<<<<< @@ -8784,26 +8923,26 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __pyx_t_2 = __pyx_v_f; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 712, __pyx_L12_error) } for (;;) { if (likely(!__pyx_t_12)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 712, __pyx_L12_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 712, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 712, __pyx_L12_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 712, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_3); #endif } @@ -8813,7 +8952,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx 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 = 705; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + else __PYX_ERR(0, 712, __pyx_L12_error) } break; } @@ -8822,18 +8961,18 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":706 + /* "pycrfsuite/_pycrfsuite.pyx":713 * with open(name, 'rb') as f: * for line in f: * parser.feed(line.decode('utf8')) # <<<<<<<<<<<<<< * finally: - * os.unlink(name) + * try: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parser, __pyx_n_s_feed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parser, __pyx_n_s_feed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 713, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -8847,24 +8986,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx } } if (!__pyx_t_4) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L12_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_3); } else { - __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 713, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_13); __pyx_t_13 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":705 + /* "pycrfsuite/_pycrfsuite.pyx":712 * self.c_tagger.dump(fd) * with open(name, 'rb') as f: * for line in f: # <<<<<<<<<<<<<< @@ -8874,7 +9013,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":704 + /* "pycrfsuite/_pycrfsuite.pyx":711 * try: * self.c_tagger.dump(fd) * with open(name, 'rb') as f: # <<<<<<<<<<<<<< @@ -8887,6 +9026,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L19_try_end; __pyx_L12_error:; + __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; @@ -8895,28 +9035,28 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; /*except:*/ { __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger.info", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 711, __pyx_L14_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __pyx_t_14 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 711, __pyx_L14_except_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 711, __pyx_L14_except_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_15); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + if (__pyx_t_16 < 0) __PYX_ERR(0, 711, __pyx_L14_except_error) __pyx_t_17 = ((!(__pyx_t_16 != 0)) != 0); if (__pyx_t_17) { __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ErrRestore(__pyx_t_2, __pyx_t_3, __pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __PYX_ERR(0, 711, __pyx_L14_except_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -8924,12 +9064,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx goto __pyx_L13_exception_handled; } __pyx_L14_except_error:; + __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); goto __pyx_L6_error; __pyx_L13_exception_handled:; + __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); @@ -8942,7 +9084,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx if (__pyx_t_7) { __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__3, NULL); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 711, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } @@ -8958,143 +9100,295 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx } } - /* "pycrfsuite/_pycrfsuite.pyx":708 + /* "pycrfsuite/_pycrfsuite.pyx":715 * parser.feed(line.decode('utf8')) * finally: - * os.unlink(name) # <<<<<<<<<<<<<< - * return parser.result - * + * try: # <<<<<<<<<<<<<< + * os.unlink(name) + * except OSError: */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_unlink); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __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_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_name); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L7; - } - /*exception exit:*/{ - __pyx_L6_error:; - __pyx_t_7 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_15 = 0; __pyx_t_20 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_15, &__pyx_t_20); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_10, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_20); - __pyx_t_6 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename; { - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L27_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unlink); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L27_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L27_error;} - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L27_error;} + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_10, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_9); + /*try:*/ { + + /* "pycrfsuite/_pycrfsuite.pyx":716 + * finally: + * try: + * os.unlink(name) # <<<<<<<<<<<<<< + * except OSError: + * pass + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L26_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_name); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L27_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_unlink); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + __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_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 716, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_name); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pycrfsuite/_pycrfsuite.pyx":715 + * parser.feed(line.decode('utf8')) + * finally: + * try: # <<<<<<<<<<<<<< + * os.unlink(name) + * except OSError: + */ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L33_try_end; + __pyx_L26_error:; + __Pyx_PyThreadState_assign + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pycrfsuite/_pycrfsuite.pyx":717 + * try: + * os.unlink(name) + * except OSError: # <<<<<<<<<<<<<< + * pass + * return parser.result + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OSError); + if (__pyx_t_6) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + goto __pyx_L28_except_error; + __pyx_L28_except_error:; + + /* "pycrfsuite/_pycrfsuite.pyx":715 + * parser.feed(line.decode('utf8')) + * finally: + * try: # <<<<<<<<<<<<<< + * os.unlink(name) + * except OSError: + */ + __Pyx_PyThreadState_assign + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_10, __pyx_t_9); + goto __pyx_L1_error; + __pyx_L27_exception_handled:; + __Pyx_PyThreadState_assign + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_10, __pyx_t_9); + __pyx_L33_try_end:; + } + goto __pyx_L7; + } + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __pyx_L6_error:; + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_15 = 0; __pyx_t_20 = 0; + __Pyx_PyThreadState_assign + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_15, &__pyx_t_20); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_20); + __pyx_t_6 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename; + { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); + __Pyx_XGOTREF(__pyx_t_21); + __Pyx_XGOTREF(__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_23); + /*try:*/ { + + /* "pycrfsuite/_pycrfsuite.pyx":716 + * finally: + * try: + * os.unlink(name) # <<<<<<<<<<<<<< + * except OSError: + * pass + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unlink); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 716, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_14); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_14, function); + } + } + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_name); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pycrfsuite/_pycrfsuite.pyx":715 + * parser.feed(line.decode('utf8')) + * finally: + * try: # <<<<<<<<<<<<<< + * os.unlink(name) + * except OSError: + */ + } + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + goto __pyx_L43_try_end; + __pyx_L36_error:; + __Pyx_PyThreadState_assign + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pycrfsuite/_pycrfsuite.pyx":717 + * try: + * os.unlink(name) + * except OSError: # <<<<<<<<<<<<<< + * pass + * return parser.result + */ + __pyx_t_24 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OSError); + if (__pyx_t_24) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L37_exception_handled; + } + goto __pyx_L38_except_error; + __pyx_L38_except_error:; + + /* "pycrfsuite/_pycrfsuite.pyx":715 + * parser.feed(line.decode('utf8')) + * finally: + * try: # <<<<<<<<<<<<<< + * os.unlink(name) + * except OSError: + */ + __Pyx_PyThreadState_assign + __Pyx_XGIVEREF(__pyx_t_21); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); + goto __pyx_L35_error; + __pyx_L37_exception_handled:; + __Pyx_PyThreadState_assign + __Pyx_XGIVEREF(__pyx_t_21); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); + __pyx_L43_try_end:; + } + } + __Pyx_PyThreadState_assign if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_15, __pyx_t_20); } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_10, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_15 = 0; __pyx_t_20 = 0; + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_7); + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_15 = 0; __pyx_t_20 = 0; __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_19; goto __pyx_L1_error; - __pyx_L27_error:; + __pyx_L35_error:; + __Pyx_PyThreadState_assign if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_15, __pyx_t_20); } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_15 = 0; __pyx_t_20 = 0; goto __pyx_L1_error; } __pyx_L7:; } - /* "pycrfsuite/_pycrfsuite.pyx":709 - * finally: - * os.unlink(name) + /* "pycrfsuite/_pycrfsuite.pyx":719 + * except OSError: + * pass * return parser.result # <<<<<<<<<<<<<< * * def _check_model(self, name): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parser, __pyx_n_s_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parser, __pyx_n_s_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":696 + /* "pycrfsuite/_pycrfsuite.pyx":703 * pass # already closed by Tagger::dump * * def info(self): # <<<<<<<<<<<<<< @@ -9123,7 +9417,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16info(struct __pyx return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":711 +/* "pycrfsuite/_pycrfsuite.pyx":721 * return parser.result * * def _check_model(self, name): # <<<<<<<<<<<<<< @@ -9164,12 +9458,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_check_model", 0); - /* "pycrfsuite/_pycrfsuite.pyx":714 + /* "pycrfsuite/_pycrfsuite.pyx":724 * # See https://github.com/chokkan/crfsuite/pull/24 * # 1. Check that the file can be opened. * with open(name, 'rb') as f: # <<<<<<<<<<<<<< @@ -9177,7 +9468,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH * # 2. Check that file magic is correct. */ /*with:*/ { - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); @@ -9185,12 +9476,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH __Pyx_INCREF(__pyx_n_s_rb); __Pyx_GIVEREF(__pyx_n_s_rb); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_rb); - __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 = 714; __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_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __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 = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __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 = 714; __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_ERR(0, 724, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { @@ -9203,10 +9494,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH } } 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 = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __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 = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L3_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9215,6 +9506,8 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*try:*/ { { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); @@ -9223,53 +9516,53 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH __pyx_v_f = __pyx_t_4; __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":717 + /* "pycrfsuite/_pycrfsuite.pyx":727 * * # 2. Check that file magic is correct. * magic = f.read(4) # <<<<<<<<<<<<<< * if magic != b'lCRF': * raise ValueError("Invalid model file %r" % name) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 727, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_magic = __pyx_t_2; __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":718 + /* "pycrfsuite/_pycrfsuite.pyx":728 * # 2. Check that file magic is correct. * magic = f.read(4) * if magic != b'lCRF': # <<<<<<<<<<<<<< * raise ValueError("Invalid model file %r" % name) * */ - __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_magic, __pyx_n_b_lCRF, Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_magic, __pyx_n_b_lCRF, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 728, __pyx_L7_error) if (__pyx_t_9) { - /* "pycrfsuite/_pycrfsuite.pyx":719 + /* "pycrfsuite/_pycrfsuite.pyx":729 * magic = f.read(4) * if magic != b'lCRF': * raise ValueError("Invalid model file %r" % name) # <<<<<<<<<<<<<< * * # 3. Make sure crfsuite won't read past allocated memory */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_model_file_r, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_model_file_r, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 729, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 729, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 729, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __PYX_ERR(0, 729, __pyx_L7_error) - /* "pycrfsuite/_pycrfsuite.pyx":718 + /* "pycrfsuite/_pycrfsuite.pyx":728 * # 2. Check that file magic is correct. * magic = f.read(4) * if magic != b'lCRF': # <<<<<<<<<<<<<< @@ -9278,18 +9571,18 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH */ } - /* "pycrfsuite/_pycrfsuite.pyx":723 + /* "pycrfsuite/_pycrfsuite.pyx":733 * # 3. Make sure crfsuite won't read past allocated memory * # in case of incomplete header. * f.seek(0, os.SEEK_END) # <<<<<<<<<<<<<< * size = f.tell() * if size <= 48: # header size */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 733, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SEEK_END); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SEEK_END); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 733, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -9304,7 +9597,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH __pyx_t_10 = 1; } } - __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 733, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_1) { __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL; @@ -9315,20 +9608,20 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__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; - /* "pycrfsuite/_pycrfsuite.pyx":724 + /* "pycrfsuite/_pycrfsuite.pyx":734 * # in case of incomplete header. * f.seek(0, os.SEEK_END) * size = f.tell() # <<<<<<<<<<<<<< * if size <= 48: # header size * raise ValueError("Model file %r doesn't have a complete header" % name) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_tell); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_tell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 734, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_11 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { @@ -9341,47 +9634,47 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH } } if (__pyx_t_11) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L7_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L7_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_size = __pyx_t_2; __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":725 + /* "pycrfsuite/_pycrfsuite.pyx":735 * f.seek(0, os.SEEK_END) * size = f.tell() * if size <= 48: # header size # <<<<<<<<<<<<<< * raise ValueError("Model file %r doesn't have a complete header" % name) */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_size, __pyx_int_48, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_size, __pyx_int_48, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L7_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 735, __pyx_L7_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_9) { - /* "pycrfsuite/_pycrfsuite.pyx":726 + /* "pycrfsuite/_pycrfsuite.pyx":736 * size = f.tell() * if size <= 48: # header size * raise ValueError("Model file %r doesn't have a complete header" % name) # <<<<<<<<<<<<<< */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Model_file_r_doesn_t_have_a_comp, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Model_file_r_doesn_t_have_a_comp, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __PYX_ERR(0, 736, __pyx_L7_error) - /* "pycrfsuite/_pycrfsuite.pyx":725 + /* "pycrfsuite/_pycrfsuite.pyx":735 * f.seek(0, os.SEEK_END) * size = f.tell() * if size <= 48: # header size # <<<<<<<<<<<<<< @@ -9389,7 +9682,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH */ } - /* "pycrfsuite/_pycrfsuite.pyx":714 + /* "pycrfsuite/_pycrfsuite.pyx":724 * # See https://github.com/chokkan/crfsuite/pull/24 * # 1. Check that the file can be opened. * with open(name, 'rb') as f: # <<<<<<<<<<<<<< @@ -9402,6 +9695,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L14_try_end; __pyx_L7_error:; + __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -9409,28 +9703,28 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; /*except:*/ { __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger._check_model", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_11) < 0) __PYX_ERR(0, 724, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 724, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + if (__pyx_t_9 < 0) __PYX_ERR(0, 724, __pyx_L9_except_error) __pyx_t_13 = ((!(__pyx_t_9 != 0)) != 0); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ErrRestore(__pyx_t_2, __pyx_t_4, __pyx_t_11); + __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_4, __pyx_t_11); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_11 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __PYX_ERR(0, 724, __pyx_L9_except_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9438,12 +9732,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH goto __pyx_L8_exception_handled; } __pyx_L9_except_error:; + __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__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_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); @@ -9456,7 +9752,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } @@ -9471,7 +9767,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18_check_model(CYTH __pyx_L20:; } - /* "pycrfsuite/_pycrfsuite.pyx":711 + /* "pycrfsuite/_pycrfsuite.pyx":721 * return parser.result * * def _check_model(self, name): # <<<<<<<<<<<<<< @@ -9511,9 +9807,6 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_strin PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); /* "string.to_py":32 @@ -9524,7 +9817,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_strin * cdef object __Pyx_PyUnicode_FromStringAndSize(char*, size_t) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9561,9 +9854,6 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_stri PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); /* "string.to_py":38 @@ -9574,7 +9864,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_stri * cdef object __Pyx_PyStr_FromStringAndSize(char*, size_t) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9611,9 +9901,6 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(s PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); /* "string.to_py":44 @@ -9624,7 +9911,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(s * cdef object __Pyx_PyBytes_FromStringAndSize(char*, size_t) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9661,9 +9948,6 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); /* "string.to_py":50 @@ -9674,7 +9958,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string * cdef object __Pyx_PyByteArray_FromStringAndSize(char*, size_t) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9711,9 +9995,6 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_st PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); /* "string.to_py":56 @@ -9723,7 +10004,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_st * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9762,9 +10043,6 @@ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v 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_std__in_string", 0); /* "string.from_py":15 @@ -9774,7 +10052,7 @@ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v * return string(data, length) * */ - __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(1, 15, __pyx_L1_error) __pyx_v_data = __pyx_t_1; /* "string.from_py":16 @@ -9821,9 +10099,6 @@ static std::vector __pyx_convert_vector_from_py_std_3a__3a_string( PyObject *(*__pyx_t_3)(PyObject *); 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("__pyx_convert_vector_from_py_std_3a__3a_string", 0); /* "vector.from_py":52 @@ -9837,26 +10112,26 @@ static std::vector __pyx_convert_vector_from_py_std_3a__3a_string( __pyx_t_1 = __pyx_v_o; __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_o); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 52, __pyx_L1_error) } for (;;) { 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[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_ERR(1, 52, __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[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #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[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_ERR(1, 52, __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[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -9866,7 +10141,7 @@ static std::vector __pyx_convert_vector_from_py_std_3a__3a_string( 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[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else __PYX_ERR(1, 52, __pyx_L1_error) } break; } @@ -9882,7 +10157,7 @@ static std::vector __pyx_convert_vector_from_py_std_3a__3a_string( * return v * */ - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 53, __pyx_L1_error) __pyx_v_v.push_back(__pyx_t_5); /* "vector.from_py":52 @@ -9940,9 +10215,6 @@ static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector< size_t __pyx_t_2; size_t __pyx_t_3; PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_string", 0); /* "vector.to_py":68 @@ -9953,14 +10225,14 @@ static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector< * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_v_v.size(); for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - __pyx_t_4 = __pyx_convert_PyObject_string_to_py_std__in_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_convert_PyObject_string_to_py_std__in_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(1, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_r = __pyx_t_1; @@ -10176,7 +10448,7 @@ static PyMethodDef __pyx_methods_10pycrfsuite_11_pycrfsuite_BaseTrainer[] = { }; static struct PyGetSetDef __pyx_getsets_10pycrfsuite_11_pycrfsuite_BaseTrainer[] = { - {(char *)"verbose", __pyx_getprop_10pycrfsuite_11_pycrfsuite_11BaseTrainer_verbose, __pyx_setprop_10pycrfsuite_11_pycrfsuite_11BaseTrainer_verbose, __pyx_k_verbose_object, 0}, + {(char *)"verbose", __pyx_getprop_10pycrfsuite_11_pycrfsuite_11BaseTrainer_verbose, __pyx_setprop_10pycrfsuite_11_pycrfsuite_11BaseTrainer_verbose, (char *)"verbose: object", 0}, {0, 0, 0, 0, 0} }; @@ -10584,11 +10856,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_CRFsuiteDumpParser, __pyx_k_CRFsuiteDumpParser, sizeof(__pyx_k_CRFsuiteDumpParser), 0, 0, 1, 1}, {&__pyx_kp_s_Error_opening_model_file_r, __pyx_k_Error_opening_model_file_r, sizeof(__pyx_k_Error_opening_model_file_r), 0, 0, 1, 0}, {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1}, + {&__pyx_n_s_FloatFeatures, __pyx_k_FloatFeatures, sizeof(__pyx_k_FloatFeatures), 0, 0, 1, 1}, {&__pyx_kp_s_Incompatible_data, __pyx_k_Incompatible_data, sizeof(__pyx_k_Incompatible_data), 0, 0, 1, 0}, {&__pyx_kp_s_Insufficient_memory, __pyx_k_Insufficient_memory, sizeof(__pyx_k_Insufficient_memory), 0, 0, 1, 0}, {&__pyx_kp_s_Internal_error, __pyx_k_Internal_error, sizeof(__pyx_k_Internal_error), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_model_file_r, __pyx_k_Invalid_model_file_r, sizeof(__pyx_k_Invalid_model_file_r), 0, 0, 1, 0}, - {&__pyx_kp_u_ItemSequence_items_line_162, __pyx_k_ItemSequence_items_line_162, sizeof(__pyx_k_ItemSequence_items_line_162), 0, 1, 0, 0}, + {&__pyx_kp_u_ItemSequence_items_line_169, __pyx_k_ItemSequence_items_line_169, sizeof(__pyx_k_ItemSequence_items_line_169), 0, 1, 0, 0}, {&__pyx_kp_s_ItemSequence_of_size_d, __pyx_k_ItemSequence_of_size_d, sizeof(__pyx_k_ItemSequence_of_size_d), 0, 0, 1, 0}, {&__pyx_kp_s_Model_file_r_doesn_t_have_a_comp, __pyx_k_Model_file_r_doesn_t_have_a_comp, sizeof(__pyx_k_Model_file_r_doesn_t_have_a_comp), 0, 0, 1, 0}, {&__pyx_kp_s_Not_implemented, __pyx_k_Not_implemented, sizeof(__pyx_k_Not_implemented), 0, 0, 1, 0}, @@ -10617,7 +10890,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Unknown_error_occurred, __pyx_k_Unknown_error_occurred, sizeof(__pyx_k_Unknown_error_occurred), 0, 0, 1, 0}, {&__pyx_kp_s_Unknown_event_r, __pyx_k_Unknown_event_r, sizeof(__pyx_k_Unknown_event_r), 0, 0, 1, 0}, {&__pyx_kp_s_Unsupported_operation, __pyx_k_Unsupported_operation, sizeof(__pyx_k_Unsupported_operation), 0, 0, 1, 0}, - {&__pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_k_Users_kmike_svn_python_crfsuite, sizeof(__pyx_k_Users_kmike_svn_python_crfsuite), 0, 0, 1, 0}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_kp_b__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 0, 0}, {&__pyx_n_s_algorithm, __pyx_k_algorithm, sizeof(__pyx_k_algorithm), 0, 0, 1, 1}, @@ -10649,6 +10921,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_dup, __pyx_k_dup, sizeof(__pyx_k_dup), 0, 0, 1, 1}, {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 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_epsilon, __pyx_k_epsilon, sizeof(__pyx_k_epsilon), 0, 0, 1, 1}, {&__pyx_n_s_error_sensitive, __pyx_k_error_sensitive, sizeof(__pyx_k_error_sensitive), 0, 0, 1, 1}, {&__pyx_n_s_event, __pyx_k_event, sizeof(__pyx_k_event), 0, 0, 1, 1}, @@ -10662,12 +10935,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_feed, __pyx_k_feed, sizeof(__pyx_k_feed), 0, 0, 1, 1}, {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1}, {&__pyx_n_s_fileno, __pyx_k_fileno, sizeof(__pyx_k_fileno), 0, 0, 1, 1}, + {&__pyx_n_s_float_features, __pyx_k_float_features, sizeof(__pyx_k_float_features), 0, 0, 1, 1}, {&__pyx_n_s_gamma, __pyx_k_gamma, sizeof(__pyx_k_gamma), 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_params_locals_genexpr, __pyx_k_get_params_locals_genexpr, sizeof(__pyx_k_get_params_locals_genexpr), 0, 0, 1, 1}, {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1}, {&__pyx_n_s_holdout, __pyx_k_holdout, sizeof(__pyx_k_holdout), 0, 0, 1, 1}, + {&__pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_k_home_entity_Code_python_crfsuit, sizeof(__pyx_k_home_entity_Code_python_crfsuit), 0, 0, 1, 0}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 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}, @@ -10742,6 +11017,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_unlink, __pyx_k_unlink, sizeof(__pyx_k_unlink), 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_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, {&__pyx_n_s_variance, __pyx_k_variance, sizeof(__pyx_k_variance), 0, 0, 1, 1}, {&__pyx_n_s_verbose, __pyx_k_verbose, sizeof(__pyx_k_verbose), 0, 0, 1, 1}, {&__pyx_n_s_xseq, __pyx_k_xseq, sizeof(__pyx_k_xseq), 0, 0, 1, 1}, @@ -10750,12 +11026,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {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 = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __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 = 704; __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 711, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 68, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -10765,47 +11042,47 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "pycrfsuite/_pycrfsuite.pyx":706 + /* "pycrfsuite/_pycrfsuite.pyx":713 * with open(name, 'rb') as f: * for line in f: * parser.feed(line.decode('utf8')) # <<<<<<<<<<<<<< * finally: - * os.unlink(name) + * try: */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "pycrfsuite/_pycrfsuite.pyx":704 + /* "pycrfsuite/_pycrfsuite.pyx":711 * try: * self.c_tagger.dump(fd) * with open(name, 'rb') as f: # <<<<<<<<<<<<<< * for line in f: * parser.feed(line.decode('utf8')) */ - __pyx_tuple__3 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__3 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "pycrfsuite/_pycrfsuite.pyx":717 + /* "pycrfsuite/_pycrfsuite.pyx":727 * * # 2. Check that file magic is correct. * magic = f.read(4) # <<<<<<<<<<<<<< * if magic != b'lCRF': * raise ValueError("Invalid model file %r" % name) */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 727, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "pycrfsuite/_pycrfsuite.pyx":714 + /* "pycrfsuite/_pycrfsuite.pyx":724 * # See https://github.com/chokkan/crfsuite/pull/24 * # 1. Check that the file can be opened. * with open(name, 'rb') as f: # <<<<<<<<<<<<<< * * # 2. Check that file magic is correct. */ - __pyx_tuple__5 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__5 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); @@ -10816,142 +11093,142 @@ static int __Pyx_InitCachedConstants(void) { * self.code = code * Exception.__init__(self._messages.get(self.code, "Unexpected error")) */ - __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_code); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_code); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_init, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_init, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 32, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":197 + /* "pycrfsuite/_pycrfsuite.pyx":204 * * * def _intbool(txt): # <<<<<<<<<<<<<< * return bool(int(txt)) * */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_txt); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_txt); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_intbool, 197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_intbool, 204, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 204, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":495 + /* "pycrfsuite/_pycrfsuite.pyx":502 * logparser = None * * def _before_train(self): # <<<<<<<<<<<<<< * self.logparser = _logparser.TrainLogParser() * */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_before_train, 495, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_before_train, 502, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 502, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":498 + /* "pycrfsuite/_pycrfsuite.pyx":505 * self.logparser = _logparser.TrainLogParser() * * def message(self, message): # <<<<<<<<<<<<<< * event = self.logparser.feed(message) * */ - __pyx_tuple__13 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_event, __pyx_n_s_log); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__13 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_event, __pyx_n_s_log); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_message, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_message, 505, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 505, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":524 + /* "pycrfsuite/_pycrfsuite.pyx":531 * raise Exception("Unknown event %r" % event) * * def on_start(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_on_start, 524, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_on_start, 531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 531, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":527 + /* "pycrfsuite/_pycrfsuite.pyx":534 * print(log, end='') * * def on_featgen_progress(self, log, percent): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_tuple__17 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_log, __pyx_n_s_percent); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__17 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_log, __pyx_n_s_percent); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_on_featgen_progress, 527, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_on_featgen_progress, 534, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 534, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":530 + /* "pycrfsuite/_pycrfsuite.pyx":537 * print(log, end='') * * def on_featgen_end(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_on_featgen_end, 530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_on_featgen_end, 537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 537, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":533 + /* "pycrfsuite/_pycrfsuite.pyx":540 * print(log, end='') * * def on_prepared(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_on_prepared, 533, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_on_prepared, 540, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 540, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":536 + /* "pycrfsuite/_pycrfsuite.pyx":543 * print(log, end='') * * def on_prepare_error(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_on_prepare_error, 536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_on_prepare_error, 543, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 543, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":539 + /* "pycrfsuite/_pycrfsuite.pyx":546 * print(log, end='') * * def on_iteration(self, log, info): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_log, __pyx_n_s_info); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_log, __pyx_n_s_info); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_on_iteration, 539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_on_iteration, 546, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 546, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":542 + /* "pycrfsuite/_pycrfsuite.pyx":549 * print(log, end='') * * def on_optimization_end(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_on_optimization_end, 542, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_on_optimization_end, 549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 549, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":545 + /* "pycrfsuite/_pycrfsuite.pyx":552 * print(log, end='') * * def on_end(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_kmike_svn_python_crfsuite, __pyx_n_s_on_end, 545, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_entity_Code_python_crfsuit, __pyx_n_s_on_end, 552, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -10960,10 +11237,11 @@ 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_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_int_48 = PyInt_FromLong(48); if (unlikely(!__pyx_int_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_48 = PyInt_FromLong(48); if (unlikely(!__pyx_int_48)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -10983,9 +11261,6 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; std::string __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); @@ -10997,23 +11272,24 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__pycrfsuite(void)", 0); - if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -11028,60 +11304,60 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) #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;} + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); - __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;} + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif - if (PyObject_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_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __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;} + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_pycrfsuite___pycrfsuite) { - 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 (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __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;} + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "pycrfsuite._pycrfsuite")) { - if (unlikely(PyDict_SetItemString(modules, "pycrfsuite._pycrfsuite", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyDict_SetItemString(modules, "pycrfsuite._pycrfsuite", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "ItemSequence", (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "ItemSequence", (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __pyx_ptype_10pycrfsuite_11_pycrfsuite_ItemSequence = &__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence; __pyx_vtabptr_10pycrfsuite_11_pycrfsuite_BaseTrainer = &__pyx_vtable_10pycrfsuite_11_pycrfsuite_BaseTrainer; __pyx_vtable_10pycrfsuite_11_pycrfsuite_BaseTrainer._on_message = (PyObject *(*)(struct __pyx_obj_10pycrfsuite_11_pycrfsuite_BaseTrainer *, std::string))__pyx_f_10pycrfsuite_11_pycrfsuite_11BaseTrainer__on_message; - if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) __PYX_ERR(0, 208, __pyx_L1_error) __pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer.tp_dict, __pyx_vtabptr_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttrString(__pyx_m, "BaseTrainer", (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer.tp_dict, __pyx_vtabptr_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "BaseTrainer", (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) __PYX_ERR(0, 208, __pyx_L1_error) __pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer = &__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer; __pyx_vtabptr_10pycrfsuite_11_pycrfsuite_Tagger = &__pyx_vtable_10pycrfsuite_11_pycrfsuite_Tagger; __pyx_vtable_10pycrfsuite_11_pycrfsuite_Tagger.set = (PyObject *(*)(struct __pyx_obj_10pycrfsuite_11_pycrfsuite_Tagger *, PyObject *, int __pyx_skip_dispatch))__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set; - if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger) < 0) __PYX_ERR(0, 556, __pyx_L1_error) __pyx_type_10pycrfsuite_11_pycrfsuite_Tagger.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger.tp_dict, __pyx_vtabptr_10pycrfsuite_11_pycrfsuite_Tagger) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttrString(__pyx_m, "Tagger", (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger.tp_dict, __pyx_vtabptr_10pycrfsuite_11_pycrfsuite_Tagger) < 0) __PYX_ERR(0, 556, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Tagger", (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger) < 0) __PYX_ERR(0, 556, __pyx_L1_error) __pyx_ptype_10pycrfsuite_11_pycrfsuite_Tagger = &__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger; - if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params) < 0) __PYX_ERR(0, 399, __pyx_L1_error) __pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params.tp_print = 0; __pyx_ptype_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params = &__pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params; - if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 410, __pyx_L1_error) __pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr.tp_print = 0; __pyx_ptype_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr = &__pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr; /*--- Type import code ---*/ @@ -11089,7 +11365,7 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) /*--- Function import code ---*/ /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /* "pycrfsuite/_pycrfsuite.pyx":9 @@ -11099,9 +11375,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * import os * import contextlib */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pycrfsuite/_pycrfsuite.pyx":10 @@ -11111,9 +11387,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * import contextlib * import tempfile */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pycrfsuite/_pycrfsuite.pyx":11 @@ -11123,9 +11399,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * import tempfile * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_contextlib, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_contextlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_contextlib, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_contextlib, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pycrfsuite/_pycrfsuite.pyx":12 @@ -11135,9 +11411,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * * from pycrfsuite import _dumpparser */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_tempfile, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_tempfile, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_tempfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_tempfile, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pycrfsuite/_pycrfsuite.pyx":14 @@ -11145,19 +11421,19 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * * from pycrfsuite import _dumpparser # <<<<<<<<<<<<<< * from pycrfsuite import _logparser - * + * from pycrfsuite import _float_features */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_dumpparser); __Pyx_GIVEREF(__pyx_n_s_dumpparser); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_dumpparser); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_pycrfsuite, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(__pyx_n_s_pycrfsuite, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dumpparser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dumpparser); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dumpparser, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dumpparser, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -11165,50 +11441,71 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * * from pycrfsuite import _dumpparser * from pycrfsuite import _logparser # <<<<<<<<<<<<<< + * from pycrfsuite import _float_features * - * CRFSUITE_VERSION = crfsuite_api.version() */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_logparser); __Pyx_GIVEREF(__pyx_n_s_logparser); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_logparser); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_pycrfsuite, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_pycrfsuite, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_logparser); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_logparser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_logparser, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_logparser, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":17 + /* "pycrfsuite/_pycrfsuite.pyx":16 + * from pycrfsuite import _dumpparser * from pycrfsuite import _logparser + * from pycrfsuite import _float_features # <<<<<<<<<<<<<< * - * CRFSUITE_VERSION = crfsuite_api.version() # <<<<<<<<<<<<<< - * - * + * CRFSUITE_VERSION = crfsuite_api.version() */ - __pyx_t_1 = __pyx_convert_PyStr_string_to_py_std__in_string(CRFSuite::version()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_float_features); + __Pyx_GIVEREF(__pyx_n_s_float_features); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_float_features); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_pycrfsuite, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_float_features); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_CRFSUITE_VERSION, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_float_features, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":20 + /* "pycrfsuite/_pycrfsuite.pyx":18 + * from pycrfsuite import _float_features * + * CRFSUITE_VERSION = crfsuite_api.version() # <<<<<<<<<<<<<< + * + * class CRFSuiteError(Exception): + */ + __pyx_t_2 = __pyx_convert_PyStr_string_to_py_std__in_string(CRFSuite::version()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_CRFSUITE_VERSION, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pycrfsuite/_pycrfsuite.pyx":20 + * CRFSUITE_VERSION = crfsuite_api.version() * * class CRFSuiteError(Exception): # <<<<<<<<<<<<<< * * _messages = { */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_builtin_Exception); __Pyx_GIVEREF(__pyx_builtin_Exception); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_Exception); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_CRFSuiteError, __pyx_n_s_CRFSuiteError, (PyObject *) NULL, __pyx_n_s_pycrfsuite__pycrfsuite, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception); + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_CRFSuiteError, __pyx_n_s_CRFSuiteError, (PyObject *) NULL, __pyx_n_s_pycrfsuite__pycrfsuite, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "pycrfsuite/_pycrfsuite.pyx":23 @@ -11218,11 +11515,11 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * crfsuite_api.CRFSUITEERR_OUTOFMEMORY: "Insufficient memory", * crfsuite_api.CRFSUITEERR_NOTSUPPORTED: "Unsupported operation", */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_UNKNOWN); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_UNKNOWN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Unknown_error_occurred) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Unknown_error_occurred) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "pycrfsuite/_pycrfsuite.pyx":24 @@ -11232,9 +11529,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * crfsuite_api.CRFSUITEERR_NOTSUPPORTED: "Unsupported operation", * crfsuite_api.CRFSUITEERR_INCOMPATIBLE: "Incompatible data", */ - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_OUTOFMEMORY); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_OUTOFMEMORY); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Insufficient_memory) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Insufficient_memory) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "pycrfsuite/_pycrfsuite.pyx":25 @@ -11244,9 +11541,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * crfsuite_api.CRFSUITEERR_INCOMPATIBLE: "Incompatible data", * crfsuite_api.CRFSUITEERR_INTERNAL_LOGIC: "Internal error", */ - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_NOTSUPPORTED); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_NOTSUPPORTED); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Unsupported_operation) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Unsupported_operation) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "pycrfsuite/_pycrfsuite.pyx":26 @@ -11256,9 +11553,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * crfsuite_api.CRFSUITEERR_INTERNAL_LOGIC: "Internal error", * crfsuite_api.CRFSUITEERR_OVERFLOW: "Overflow", */ - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_INCOMPATIBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_INCOMPATIBLE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Incompatible_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Incompatible_data) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "pycrfsuite/_pycrfsuite.pyx":27 @@ -11268,9 +11565,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * crfsuite_api.CRFSUITEERR_OVERFLOW: "Overflow", * crfsuite_api.CRFSUITEERR_NOTIMPLEMENTED: "Not implemented", */ - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_INTERNAL_LOGIC); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_INTERNAL_LOGIC); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Internal_error) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Internal_error) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "pycrfsuite/_pycrfsuite.pyx":28 @@ -11280,9 +11577,9 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * crfsuite_api.CRFSUITEERR_NOTIMPLEMENTED: "Not implemented", * } */ - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_OVERFLOW); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_OVERFLOW); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_n_s_Overflow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_n_s_Overflow) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "pycrfsuite/_pycrfsuite.pyx":29 @@ -11292,11 +11589,11 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * } * */ - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_NOTIMPLEMENTED); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_NOTIMPLEMENTED); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Not_implemented) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Not_implemented) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_messages, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_messages, __pyx_t_4) < 0) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "pycrfsuite/_pycrfsuite.pyx":32 @@ -11306,25 +11603,25 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * self.code = code * Exception.__init__(self._messages.get(self.code, "Unexpected error")) */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_13CRFSuiteError_1__init__, 0, __pyx_n_s_CRFSuiteError___init, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_13CRFSuiteError_1__init__, 0, __pyx_n_s_CRFSuiteError___init, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "pycrfsuite/_pycrfsuite.pyx":20 - * + * CRFSUITE_VERSION = crfsuite_api.version() * * class CRFSuiteError(Exception): # <<<<<<<<<<<<<< * * _messages = { */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_CRFSuiteError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_CRFSuiteError, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_CRFSuiteError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_CRFSuiteError, __pyx_t_4) < 0) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pycrfsuite/_pycrfsuite.pyx":37 * @@ -11333,431 +11630,431 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) * * cdef crfsuite_api.Item to_item(x) except+: */ - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__8); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L1_error) __pyx_v_10pycrfsuite_11_pycrfsuite__SEP = __pyx_t_6; - /* "pycrfsuite/_pycrfsuite.pyx":197 + /* "pycrfsuite/_pycrfsuite.pyx":204 * * * def _intbool(txt): # <<<<<<<<<<<<<< * return bool(int(txt)) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_1_intbool, NULL, __pyx_n_s_pycrfsuite__pycrfsuite); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_intbool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_1_intbool, NULL, __pyx_n_s_pycrfsuite__pycrfsuite); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_intbool, __pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":224 + /* "pycrfsuite/_pycrfsuite.pyx":231 * * _PARAMETER_TYPES = { * 'feature.minfreq': float, # <<<<<<<<<<<<<< * 'feature.possible_states': _intbool, * 'feature.possible_transitions': _intbool, */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_feature_minfreq, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_feature_minfreq, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":225 + /* "pycrfsuite/_pycrfsuite.pyx":232 * _PARAMETER_TYPES = { * 'feature.minfreq': float, * 'feature.possible_states': _intbool, # <<<<<<<<<<<<<< * 'feature.possible_transitions': _intbool, * 'c1': float, */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_intbool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_feature_possible_states, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_intbool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_feature_possible_states, __pyx_t_1) < 0) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":226 + /* "pycrfsuite/_pycrfsuite.pyx":233 * 'feature.minfreq': float, * 'feature.possible_states': _intbool, * 'feature.possible_transitions': _intbool, # <<<<<<<<<<<<<< * 'c1': float, * 'c2': float, */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_intbool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_feature_possible_transitions, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_intbool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_feature_possible_transitions, __pyx_t_1) < 0) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":227 + /* "pycrfsuite/_pycrfsuite.pyx":234 * 'feature.possible_states': _intbool, * 'feature.possible_transitions': _intbool, * 'c1': float, # <<<<<<<<<<<<<< * 'c2': float, * 'max_iterations': int, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_c1, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_c1, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":228 + /* "pycrfsuite/_pycrfsuite.pyx":235 * 'feature.possible_transitions': _intbool, * 'c1': float, * 'c2': float, # <<<<<<<<<<<<<< * 'max_iterations': int, * 'num_memories': int, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_c2, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_c2, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":229 + /* "pycrfsuite/_pycrfsuite.pyx":236 * 'c1': float, * 'c2': float, * 'max_iterations': int, # <<<<<<<<<<<<<< * 'num_memories': int, * 'epsilon': float, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_iterations, ((PyObject *)(&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_max_iterations, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":230 + /* "pycrfsuite/_pycrfsuite.pyx":237 * 'c2': float, * 'max_iterations': int, * 'num_memories': int, # <<<<<<<<<<<<<< * 'epsilon': float, * 'period': int, # XXX: is it called 'stop' in docs? */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_num_memories, ((PyObject *)(&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_num_memories, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":231 + /* "pycrfsuite/_pycrfsuite.pyx":238 * 'max_iterations': int, * 'num_memories': int, * 'epsilon': float, # <<<<<<<<<<<<<< * 'period': int, # XXX: is it called 'stop' in docs? * 'delta': float, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_epsilon, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_epsilon, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":232 + /* "pycrfsuite/_pycrfsuite.pyx":239 * 'num_memories': int, * 'epsilon': float, * 'period': int, # XXX: is it called 'stop' in docs? # <<<<<<<<<<<<<< * 'delta': float, * 'linesearch': str, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_period, ((PyObject *)(&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_period, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":233 + /* "pycrfsuite/_pycrfsuite.pyx":240 * 'epsilon': float, * 'period': int, # XXX: is it called 'stop' in docs? * 'delta': float, # <<<<<<<<<<<<<< * 'linesearch': str, * 'max_linesearch': int, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_delta, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_delta, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":234 + /* "pycrfsuite/_pycrfsuite.pyx":241 * 'period': int, # XXX: is it called 'stop' in docs? * 'delta': float, * 'linesearch': str, # <<<<<<<<<<<<<< * 'max_linesearch': int, * 'calibration.eta': float, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_linesearch, ((PyObject *)(&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_linesearch, ((PyObject *)(&PyString_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":235 + /* "pycrfsuite/_pycrfsuite.pyx":242 * 'delta': float, * 'linesearch': str, * 'max_linesearch': int, # <<<<<<<<<<<<<< * 'calibration.eta': float, * 'calibration.rate': float, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_linesearch, ((PyObject *)(&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_max_linesearch, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":236 + /* "pycrfsuite/_pycrfsuite.pyx":243 * 'linesearch': str, * 'max_linesearch': int, * 'calibration.eta': float, # <<<<<<<<<<<<<< * 'calibration.rate': float, * 'calibration.samples': float, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_calibration_eta, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_calibration_eta, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":237 + /* "pycrfsuite/_pycrfsuite.pyx":244 * 'max_linesearch': int, * 'calibration.eta': float, * 'calibration.rate': float, # <<<<<<<<<<<<<< * 'calibration.samples': float, * 'calibration.candidates': int, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_calibration_rate, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_calibration_rate, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":238 + /* "pycrfsuite/_pycrfsuite.pyx":245 * 'calibration.eta': float, * 'calibration.rate': float, * 'calibration.samples': float, # <<<<<<<<<<<<<< * 'calibration.candidates': int, * 'calibration.max_trials': int, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_calibration_samples, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_calibration_samples, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":239 + /* "pycrfsuite/_pycrfsuite.pyx":246 * 'calibration.rate': float, * 'calibration.samples': float, * 'calibration.candidates': int, # <<<<<<<<<<<<<< * 'calibration.max_trials': int, * 'type': int, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_calibration_candidates, ((PyObject *)(&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_calibration_candidates, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":240 + /* "pycrfsuite/_pycrfsuite.pyx":247 * 'calibration.samples': float, * 'calibration.candidates': int, * 'calibration.max_trials': int, # <<<<<<<<<<<<<< * 'type': int, * 'c': float, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_calibration_max_trials, ((PyObject *)(&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_calibration_max_trials, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":241 + /* "pycrfsuite/_pycrfsuite.pyx":248 * 'calibration.candidates': int, * 'calibration.max_trials': int, * 'type': int, # <<<<<<<<<<<<<< * 'c': float, * 'error_sensitive': _intbool, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_type, ((PyObject *)(&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_type, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":242 + /* "pycrfsuite/_pycrfsuite.pyx":249 * 'calibration.max_trials': int, * 'type': int, * 'c': float, # <<<<<<<<<<<<<< * 'error_sensitive': _intbool, * 'averaging': _intbool, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_c, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_c, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":243 + /* "pycrfsuite/_pycrfsuite.pyx":250 * 'type': int, * 'c': float, * 'error_sensitive': _intbool, # <<<<<<<<<<<<<< * 'averaging': _intbool, * 'variance': float, */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_intbool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_error_sensitive, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_intbool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_error_sensitive, __pyx_t_1) < 0) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":244 + /* "pycrfsuite/_pycrfsuite.pyx":251 * 'c': float, * 'error_sensitive': _intbool, * 'averaging': _intbool, # <<<<<<<<<<<<<< * 'variance': float, * 'gamma': float, */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_intbool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_averaging, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_intbool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_averaging, __pyx_t_1) < 0) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":245 + /* "pycrfsuite/_pycrfsuite.pyx":252 * 'error_sensitive': _intbool, * 'averaging': _intbool, * 'variance': float, # <<<<<<<<<<<<<< * 'gamma': float, * } */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_variance, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_variance, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":246 + /* "pycrfsuite/_pycrfsuite.pyx":253 * 'averaging': _intbool, * 'variance': float, * 'gamma': float, # <<<<<<<<<<<<<< * } * */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_gamma, ((PyObject *)(&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem((PyObject *)__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer->tp_dict, __pyx_n_s_PARAMETER_TYPES, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_gamma, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 231, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer->tp_dict, __pyx_n_s_PARAMETER_TYPES, __pyx_t_2) < 0) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer); - /* "pycrfsuite/_pycrfsuite.pyx":250 + /* "pycrfsuite/_pycrfsuite.pyx":257 * * _ALGORITHM_ALIASES = { * 'ap': 'averaged-perceptron', # <<<<<<<<<<<<<< * 'pa': 'passive-aggressive', * } */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ap, __pyx_kp_s_averaged_perceptron) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_pa, __pyx_kp_s_passive_aggressive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem((PyObject *)__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer->tp_dict, __pyx_n_s_ALGORITHM_ALIASES, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ap, __pyx_kp_s_averaged_perceptron) < 0) __PYX_ERR(0, 257, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_pa, __pyx_kp_s_passive_aggressive) < 0) __PYX_ERR(0, 257, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer->tp_dict, __pyx_n_s_ALGORITHM_ALIASES, __pyx_t_2) < 0) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer); - /* "pycrfsuite/_pycrfsuite.pyx":473 + /* "pycrfsuite/_pycrfsuite.pyx":480 * * * class Trainer(BaseTrainer): # <<<<<<<<<<<<<< * """ * The trainer class. */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer)); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Trainer, __pyx_n_s_Trainer, (PyObject *) NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_kp_s_The_trainer_class_This_class_ma); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_10pycrfsuite_11_pycrfsuite_BaseTrainer)); + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Trainer, __pyx_n_s_Trainer, (PyObject *) NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_kp_s_The_trainer_class_This_class_ma); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "pycrfsuite/_pycrfsuite.pyx":493 + /* "pycrfsuite/_pycrfsuite.pyx":500 * * """ * logparser = None # <<<<<<<<<<<<<< * * def _before_train(self): */ - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_logparser_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_logparser_2, Py_None) < 0) __PYX_ERR(0, 500, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":495 + /* "pycrfsuite/_pycrfsuite.pyx":502 * logparser = None * * def _before_train(self): # <<<<<<<<<<<<<< * self.logparser = _logparser.TrainLogParser() * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_1_before_train, 0, __pyx_n_s_Trainer__before_train, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_1_before_train, 0, __pyx_n_s_Trainer__before_train, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_before_train, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_before_train, __pyx_t_4) < 0) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":498 + /* "pycrfsuite/_pycrfsuite.pyx":505 * self.logparser = _logparser.TrainLogParser() * * def message(self, message): # <<<<<<<<<<<<<< * event = self.logparser.feed(message) * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_3message, 0, __pyx_n_s_Trainer_message, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_3message, 0, __pyx_n_s_Trainer_message, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_message, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_message, __pyx_t_4) < 0) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":524 + /* "pycrfsuite/_pycrfsuite.pyx":531 * raise Exception("Unknown event %r" % event) * * def on_start(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_5on_start, 0, __pyx_n_s_Trainer_on_start, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_5on_start, 0, __pyx_n_s_Trainer_on_start, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_start, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_start, __pyx_t_4) < 0) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":527 + /* "pycrfsuite/_pycrfsuite.pyx":534 * print(log, end='') * * def on_featgen_progress(self, log, percent): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_7on_featgen_progress, 0, __pyx_n_s_Trainer_on_featgen_progress, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_7on_featgen_progress, 0, __pyx_n_s_Trainer_on_featgen_progress, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_featgen_progress, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_featgen_progress, __pyx_t_4) < 0) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":530 + /* "pycrfsuite/_pycrfsuite.pyx":537 * print(log, end='') * * def on_featgen_end(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_9on_featgen_end, 0, __pyx_n_s_Trainer_on_featgen_end, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_9on_featgen_end, 0, __pyx_n_s_Trainer_on_featgen_end, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_featgen_end, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_featgen_end, __pyx_t_4) < 0) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":533 + /* "pycrfsuite/_pycrfsuite.pyx":540 * print(log, end='') * * def on_prepared(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_11on_prepared, 0, __pyx_n_s_Trainer_on_prepared, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_11on_prepared, 0, __pyx_n_s_Trainer_on_prepared, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_prepared, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_prepared, __pyx_t_4) < 0) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":536 + /* "pycrfsuite/_pycrfsuite.pyx":543 * print(log, end='') * * def on_prepare_error(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_13on_prepare_error, 0, __pyx_n_s_Trainer_on_prepare_error, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_13on_prepare_error, 0, __pyx_n_s_Trainer_on_prepare_error, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_prepare_error, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_prepare_error, __pyx_t_4) < 0) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":539 + /* "pycrfsuite/_pycrfsuite.pyx":546 * print(log, end='') * * def on_iteration(self, log, info): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_15on_iteration, 0, __pyx_n_s_Trainer_on_iteration, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_15on_iteration, 0, __pyx_n_s_Trainer_on_iteration, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_iteration, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_iteration, __pyx_t_4) < 0) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":542 + /* "pycrfsuite/_pycrfsuite.pyx":549 * print(log, end='') * * def on_optimization_end(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_17on_optimization_end, 0, __pyx_n_s_Trainer_on_optimization_end, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_17on_optimization_end, 0, __pyx_n_s_Trainer_on_optimization_end, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_optimization_end, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_optimization_end, __pyx_t_4) < 0) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":545 + /* "pycrfsuite/_pycrfsuite.pyx":552 * print(log, end='') * * def on_end(self, log): # <<<<<<<<<<<<<< * print(log, end='') * */ - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_19on_end, 0, __pyx_n_s_Trainer_on_end, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_19on_end, 0, __pyx_n_s_Trainer_on_end, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_end, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_on_end, __pyx_t_4) < 0) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":473 + /* "pycrfsuite/_pycrfsuite.pyx":480 * * * class Trainer(BaseTrainer): # <<<<<<<<<<<<<< * """ * The trainer class. */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Trainer, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Trainer, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Trainer, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Trainer, __pyx_t_4) < 0) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pycrfsuite/_pycrfsuite.pyx":1 * # cython: embedsignature=True # <<<<<<<<<<<<<< * # cython: c_string_type=str * # cython: c_string_encoding=ascii */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_ItemSequence_items_line_162, __pyx_kp_u_Return_a_list_of_prepared_item) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_ItemSequence_items_line_169, __pyx_kp_u_Return_a_list_of_prepared_item) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "vector.to_py":67 * @@ -11794,6 +12091,7 @@ PyMODINIT_FUNC PyInit__pycrfsuite(void) } /* --- Runtime support code --- */ +/* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -11810,6 +12108,7 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { @@ -11823,6 +12122,7 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } +/* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, @@ -11848,6 +12148,7 @@ static void __Pyx_RaiseArgtupleInvalid( (num_expected == 1) ? "" : "s", num_found); } +/* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) @@ -11861,6 +12162,7 @@ static void __Pyx_RaiseDoubleKeywordsError( #endif } +/* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], @@ -11962,6 +12264,7 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +/* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; @@ -11981,6 +12284,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif +/* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; @@ -12000,6 +12304,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif +/* PyObjectCallOneArg */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; @@ -12034,7 +12339,124 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec } #endif -static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( +/* GetModuleGlobalName */ + static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (likely(result)) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +/* PyIntBinop */ + #if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long x; + long a = PyInt_AS_LONG(op1); + x = (long)((unsigned long)a + b); + if (likely((x^a) >= 0 || (x^b) >= 0)) + return PyInt_FromLong(x); + return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a, x; + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla, llx; + const digit* digits = ((PyLongObject*)op1)->ob_digit; + const Py_ssize_t size = Py_SIZE(op1); + if (likely(__Pyx_sst_abs(size) <= 1)) { + a = likely(size) ? digits[0] : 0; + if (size == -1) a = -a; + } else { + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + } + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + } + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + } + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + } + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + } + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + } + default: return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + } + x = a + b; + return PyLong_FromLong(x); + long_long: + llx = lla + llb; + return PyLong_FromLongLong(llx); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = PyFloat_AS_DOUBLE(op1); + double result; + PyFPE_START_PROTECT("add", return NULL) + result = ((double)a) + (double)b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); + } + return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); +} +#endif + +/* decode_c_bytes */ + static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { @@ -12060,7 +12482,8 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( } } -static CYTHON_INLINE int __Pyx_CheckKeywordStrings( +/* KeywordStringCheck */ + static CYTHON_INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) @@ -12099,7 +12522,8 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings( return 0; } -#if CYTHON_COMPILING_IN_CPYTHON +/* PyObjectCallNoArg */ + #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))) { @@ -12114,10 +12538,10 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { } #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { -#if CYTHON_COMPILING_IN_CPYTHON +/* PyErrFetchRestore */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -12127,27 +12551,22 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); -#else - PyErr_Restore(type, value, tb); -#endif } -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; -#else - PyErr_Fetch(type, value, tb); -#endif } +#endif -#if PY_MAJOR_VERSION < 3 +/* RaiseException */ + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { + __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; @@ -12186,6 +12605,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, goto raise_error; } } + __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -12305,35 +12725,21 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +/* RaiseTooManyValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +/* RaiseNeedMoreValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } -static CYTHON_INLINE int __Pyx_IterFinish(void) { +/* IterFinish */ + static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; @@ -12367,7 +12773,8 @@ static CYTHON_INLINE int __Pyx_IterFinish(void) { #endif } -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { +/* UnpackItemEndCheck */ + static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); @@ -12378,11 +12785,13 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { +/* None */ + static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +/* BytesEquals */ + 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 @@ -12419,7 +12828,8 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq #endif } -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +/* UnicodeEquals */ + 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 @@ -12502,23 +12912,18 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #endif } -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); +/* SaveResetException */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *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 +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { 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; @@ -12528,16 +12933,28 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(type, value, tb); +} #endif + +/* PyErrExceptionMatches */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { + PyObject *exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; + return PyErr_GivenExceptionMatches(exc_type, err); } +#endif +/* GetException */ + #if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { +#endif 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; @@ -12590,26 +13007,33 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { +/* SwapException */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, 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; + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} #else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); PyErr_SetExcInfo(*type, *value, *tb); -#endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } +#endif -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +/* SetVTable */ + static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else @@ -12626,7 +13050,8 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { +/* Import */ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; @@ -12699,7 +13124,8 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { return module; } -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { +/* ImportFrom */ + static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, @@ -12712,7 +13138,8 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { return value; } -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { +/* CalculateMetaclass */ + 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; @@ -12750,7 +13177,8 @@ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bas return (PyObject*) metaclass; } -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { +/* FetchCommonType */ + static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); @@ -12788,7 +13216,8 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { goto done; } -static PyObject * +/* CythonFunction */ + static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { if (unlikely(op->func_doc == NULL)) { @@ -13143,7 +13572,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) int i; for (i = 0; i < m->defaults_pyobjects; i++) Py_XDECREF(pydefaults[i]); - PyMem_Free(m->defaults); + PyObject_Free(m->defaults); m->defaults = NULL; } return 0; @@ -13331,7 +13760,7 @@ static int __pyx_CyFunction_init(void) { } static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyMem_Malloc(size); + m->defaults = PyObject_Malloc(size); if (!m->defaults) return PyErr_NoMemory(); memset(m->defaults, 0, size); @@ -13354,7 +13783,8 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py Py_INCREF(dict); } -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, +/* Py3ClassCreate */ + static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { @@ -13420,7 +13850,8 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return result; } -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { +/* CodeObjectCache */ + 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; @@ -13499,7 +13930,8 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { Py_INCREF(code_object); } -#include "compile.h" +/* AddTraceback */ + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -13579,7 +14011,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_frame); } -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -13605,7 +14038,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { } } -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ +/* CIntFromPyVerify */ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -13626,11 +14060,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { return (target_type) value;\ } -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" -#endif - -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +/* CIntFromPy */ + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -13705,7 +14136,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) digits[0]) + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { @@ -13775,7 +14206,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; - PyObject *v = __Pyx_PyNumber_Int(x); + PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; @@ -13798,7 +14229,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { } } else { int val; - PyObject *tmp = __Pyx_PyNumber_Int(x); + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); @@ -13814,7 +14245,8 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { return (int) -1; } -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { +/* CIntFromPy */ + static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -13889,7 +14321,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (size_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) digits[0]) + case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) case -2: if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { @@ -13959,7 +14391,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else size_t val; - PyObject *v = __Pyx_PyNumber_Int(x); + PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; @@ -13982,7 +14414,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { } } else { size_t val; - PyObject *tmp = __Pyx_PyNumber_Int(x); + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (size_t) -1; val = __Pyx_PyInt_As_size_t(tmp); Py_DECREF(tmp); @@ -13998,7 +14430,8 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { return (size_t) -1; } -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -14024,7 +14457,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } } -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { +/* CIntFromPy */ + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -14099,7 +14533,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) digits[0]) + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { @@ -14169,7 +14603,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; - PyObject *v = __Pyx_PyNumber_Int(x); + PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; @@ -14192,7 +14626,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { } } else { long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); @@ -14208,7 +14642,8 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { return (long) -1; } -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +/* PyObjectCallMethod1 */ + 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; @@ -14239,7 +14674,8 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name return result; } -#include +/* CoroutineBase */ + #include #include static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); static PyObject *__Pyx_Coroutine_Close(PyObject *self); @@ -14249,6 +14685,8 @@ static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { PyObject *et, *ev, *tb; PyObject *value = NULL; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign __Pyx_ErrFetch(&et, &ev, &tb); if (!et) { Py_XDECREF(tb); @@ -14353,6 +14791,7 @@ int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) { static CYTHON_INLINE PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) { PyObject *retval; + __Pyx_PyThreadState_declare assert(!self->is_running); if (unlikely(self->resume_label == 0)) { if (unlikely(value && value != Py_None)) { @@ -14366,16 +14805,16 @@ PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) { PyErr_SetNone(PyExc_StopIteration); return NULL; } + __Pyx_PyThreadState_assign if (value) { #if CYTHON_COMPILING_IN_PYPY #else if (self->exc_traceback) { - PyThreadState *tstate = PyThreadState_GET(); PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; - Py_XINCREF(tstate->frame); + Py_XINCREF(__pyx_tstate->frame); assert(f->f_back == NULL); - f->f_back = tstate->frame; + f->f_back = __pyx_tstate->frame; } #endif __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, @@ -14440,7 +14879,7 @@ static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { #endif { if (value == Py_None) - ret = PyIter_Next(yf); + ret = Py_TYPE(yf)->tp_iternext(yf); else ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); } @@ -14649,12 +15088,14 @@ static void __Pyx_Coroutine_del(PyObject *self) { PyObject *res; PyObject *error_type, *error_value, *error_traceback; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare if (gen->resume_label <= 0) return ; #if PY_VERSION_HEX < 0x030400a1 assert(self->ob_refcnt == 0); self->ob_refcnt = 1; #endif + __Pyx_PyThreadState_assign __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); res = __Pyx_Coroutine_Close(self); if (res == NULL) @@ -14757,7 +15198,8 @@ static __pyx_CoroutineObject *__Pyx__Coroutine_New(PyTypeObject* type, __pyx_cor return gen; } -static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { +/* PatchModuleWithCoroutine */ + static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) int result; PyObject *globals, *result_obj; @@ -14796,7 +15238,8 @@ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_c return module; } -#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) +/* PatchGeneratorABC */ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) static PyObject* __Pyx_patch_abc_module(PyObject *module); static PyObject* __Pyx_patch_abc_module(PyObject *module) { module = __Pyx_Coroutine_patch_module( @@ -14849,7 +15292,8 @@ static int __Pyx_patch_abc(void) { return 0; } -static PyMethodDef __pyx_Generator_methods[] = { +/* Generator */ + static PyMethodDef __pyx_Generator_methods[] = { {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, @@ -14937,7 +15381,8 @@ static int __pyx_Generator_init(void) { return 0; } -static int __Pyx_check_binary_version(void) { +/* CheckBinaryVersion */ + static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); @@ -14952,7 +15397,8 @@ static int __Pyx_check_binary_version(void) { return 0; } -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { +/* InitStrings */ + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -15052,7 +15498,7 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; diff --git a/pycrfsuite/_pycrfsuite.pyx b/pycrfsuite/_pycrfsuite.pyx index 7be306e..72d8c09 100644 --- a/pycrfsuite/_pycrfsuite.pyx +++ b/pycrfsuite/_pycrfsuite.pyx @@ -13,10 +13,10 @@ import tempfile from pycrfsuite import _dumpparser from pycrfsuite import _logparser +from pycrfsuite import _float_features CRFSUITE_VERSION = crfsuite_api.version() - class CRFSuiteError(Exception): _messages = { @@ -58,7 +58,14 @@ cdef crfsuite_api.Item to_item(x) except+: c_item.push_back(crfsuite_api.Attribute(c_key, c_value)) else: value = (x)[key] - + if isinstance(value, _float_features.FloatFeatures): + # {"string_prefix": _float_features.FloatFeatures([1., 2. ])} + # value should be an instance of FloatFeatures + for i,v in enumerate(value.values): + c_item.push_back( + crfsuite_api.Attribute(c_key + _SEP + str(i), v) + ) + continue if isinstance(value, (dict, list, set)): # {"string_prefix": {...}} for attr in to_item(value): diff --git a/tests/test_itemsequence.py b/tests/test_itemsequence.py index ed855f8..6b65a60 100644 --- a/tests/test_itemsequence.py +++ b/tests/test_itemsequence.py @@ -3,6 +3,7 @@ import pytest import pycrfsuite +from pycrfsuite._float_features import FloatFeatures as FF def test_basic(): @@ -11,6 +12,16 @@ def test_basic(): assert seq.items() == [] +def test_floatlists(): + seq = pycrfsuite.ItemSequence([ + {"w2v": FF([1., 2., 3.])}, + {"w2v": FF([-1., 5, 4.])} + ]) + assert len(seq) == 2 + assert seq.items() == [{"w2v:0": 1., "w2v:1": 2., "w2v:2": 3.}, + {"w2v:0": -1., "w2v:1": 5., "w2v:2": 4.}] + assert pycrfsuite.ItemSequence(seq.items()).items() == seq.items() + def test_lists(): seq = pycrfsuite.ItemSequence([['foo', 'bar'], ['bar', 'baz']]) assert len(seq) == 2