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 84d9bf5..a6f5c99 100644 --- a/pycrfsuite/_pycrfsuite.cpp +++ b/pycrfsuite/_pycrfsuite.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.15 */ +/* Generated by Cython 0.29.21 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -7,8 +7,8 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_15" -#define CYTHON_HEX_VERSION 0x001D0FF0 +#define CYTHON_ABI "0_29_21" +#define CYTHON_HEX_VERSION 0x001D15F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -449,7 +449,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #endif #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 @@ -498,8 +502,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact +#ifndef PyObject_Unicode #define PyObject_Unicode PyObject_Str #endif +#endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) @@ -510,6 +516,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #else @@ -549,7 +562,7 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif @@ -590,11 +603,10 @@ static CYTHON_INLINE float __PYX_NAN() { #define __Pyx_truncl truncl #endif - +#define __PYX_MARK_ERR_POS(f_index, lineno) \ + { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } #define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifndef __PYX_EXTERN_C #ifdef __cplusplus @@ -826,8 +838,8 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "stringsource", "pycrfsuite/_pycrfsuite.pyx", + "stringsource", }; /*--- Type declarations ---*/ @@ -837,7 +849,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): # <<<<<<<<<<<<<< @@ -850,7 +862,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite_ItemSequence { }; -/* "pycrfsuite/_pycrfsuite.pyx":201 +/* "pycrfsuite/_pycrfsuite.pyx":208 * * * cdef class BaseTrainer(object): # <<<<<<<<<<<<<< @@ -865,7 +877,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite_BaseTrainer { }; -/* "pycrfsuite/_pycrfsuite.pyx":549 +/* "pycrfsuite/_pycrfsuite.pyx":556 * * * cdef class Tagger(object): # <<<<<<<<<<<<<< @@ -879,7 +891,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite_Tagger { }; -/* "pycrfsuite/_pycrfsuite.pyx":392 +/* "pycrfsuite/_pycrfsuite.pyx":399 * self.set(key, value) * * def get_params(self): # <<<<<<<<<<<<<< @@ -892,7 +904,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()) # <<<<<<<<<<<<<< @@ -907,7 +919,7 @@ struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr { -/* "pycrfsuite/_pycrfsuite.pyx":201 +/* "pycrfsuite/_pycrfsuite.pyx":208 * * * cdef class BaseTrainer(object): # <<<<<<<<<<<<<< @@ -921,7 +933,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): # <<<<<<<<<<<<<< @@ -1088,6 +1100,61 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyIntBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#endif + /* decode_c_string_utf16.proto */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; @@ -1126,7 +1193,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; + __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); @@ -1184,53 +1251,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) #endif -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); @@ -1377,7 +1397,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { if (likely(L->allocated > len)) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; + __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); @@ -1400,6 +1420,9 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); @@ -1429,7 +1452,7 @@ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bas /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); -/* CythonFunction.proto */ +/* CythonFunctionShared.proto */ #define __Pyx_CyFunction_USED 1 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 @@ -1457,6 +1480,7 @@ typedef struct { PyObject *func_classobj; void *defaults; int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; @@ -1465,9 +1489,7 @@ typedef struct { } __pyx_CyFunctionObject; static PyTypeObject *__pyx_CyFunctionType = 0; #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) -#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ - __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *self, PyObject *module, PyObject *globals, @@ -1483,6 +1505,13 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(void); +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); @@ -1708,6 +1737,7 @@ extern int __pyx_module_is_main_pycrfsuite___pycrfsuite; int __pyx_module_is_main_pycrfsuite___pycrfsuite = 0; /* Implementation of 'pycrfsuite._pycrfsuite' */ +static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_ValueError; @@ -1784,6 +1814,7 @@ 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"; @@ -1813,6 +1844,7 @@ static const char __pyx_k_variance[] = "variance"; static const char __pyx_k_TypeError[] = "TypeError"; 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__"; @@ -1834,6 +1866,7 @@ 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_Invalid_model[] = "Invalid model"; static const char __pyx_k_prepare_error[] = "prepare_error"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; @@ -1841,6 +1874,7 @@ 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"; @@ -1891,7 +1925,7 @@ 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_pycrfsuite__pycrfsuite_pyx[] = "pycrfsuite/_pycrfsuite.pyx"; -static const char __pyx_k_ItemSequence_items_line_162[] = "ItemSequence.items (line 162)"; +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"; @@ -1912,6 +1946,7 @@ static PyObject *__pyx_n_s_CRFSuiteError___init; static PyObject *__pyx_n_s_CRFsuiteDumpParser; static PyObject *__pyx_kp_s_Error_opening_model; static PyObject *__pyx_kp_s_Error_opening_model_file_r; +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; @@ -1919,7 +1954,7 @@ static PyObject *__pyx_kp_s_Invalid_model; static PyObject *__pyx_kp_s_Invalid_model_file_r; static PyObject *__pyx_kp_s_Invalid_model_incomplete_header; static PyObject *__pyx_n_s_ItemSequence; -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; @@ -1984,6 +2019,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; @@ -1997,6 +2033,7 @@ 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; @@ -2088,6 +2125,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; @@ -2152,6 +2190,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_; @@ -2205,6 +2244,9 @@ 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); @@ -2231,11 +2273,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_13CRFSuiteError_1__init__(P case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_code)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(1, 32, __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_ERR(1, 32, __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; @@ -2248,7 +2290,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_ERR(1, 32, __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(); @@ -2272,6 +2314,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY PyObject *__pyx_t_6 = NULL; int __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 @@ -2281,7 +2326,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_ERR(1, 33, __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): @@ -2290,14 +2335,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 34, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __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_ERR(1, 34, __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_ERR(1, 34, __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_ERR(1, 34, __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; @@ -2314,7 +2359,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_kp_s_Unexpected_error}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 34, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -2323,14 +2368,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_kp_s_Unexpected_error}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 34, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 34, __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; @@ -2341,7 +2386,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_ERR(1, 34, __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; } @@ -2359,7 +2404,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_13CRFSuiteError___init__(CY __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 34, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __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; @@ -2406,6 +2451,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 @@ -2417,11 +2464,20 @@ 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; + 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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("to_item", 0); /* "pycrfsuite/_pycrfsuite.pyx":46 @@ -2445,7 +2501,7 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx __pyx_t_2 = CRFSuite::Item(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 47, __pyx_L1_error) + __PYX_ERR(0, 47, __pyx_L1_error) } __pyx_v_c_item = __pyx_t_2; @@ -2456,7 +2512,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 == ((Py_ssize_t)-1))) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_t_3 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 48, __pyx_L1_error) __pyx_v_c_item.reserve(__pyx_t_3); /* "pycrfsuite/_pycrfsuite.pyx":49 @@ -2470,26 +2526,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_ERR(1, 49, __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_ERR(1, 49, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 49, __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_ERR(1, 49, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 49, __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_ERR(1, 49, __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 } @@ -2499,7 +2555,7 @@ static CRFSuite::Item __pyx_f_10pycrfsuite_11_pycrfsuite_to_item(PyObject *__pyx PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 49, __pyx_L1_error) + else __PYX_ERR(0, 49, __pyx_L1_error) } break; } @@ -2528,11 +2584,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 '%.30s'", "encode"); - __PYX_ERR(1, 51, __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_ERR(1, 51, __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_ERR(1, 51, __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; @@ -2554,7 +2610,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_ERR(1, 53, __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:; @@ -2589,7 +2645,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_ERR(1, 58, __pyx_L1_error) + __PYX_ERR(0, 58, __pyx_L1_error) } /* "pycrfsuite/_pycrfsuite.pyx":55 @@ -2606,48 +2662,188 @@ 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_ERR(1, 60, __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)) __PYX_ERR(1, 60, __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_GetModuleGlobalName(__pyx_t_6, __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 == ((int)-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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __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(__Pyx_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, 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 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyNumber_Add(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_t_14); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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): # <<<<<<<<<<<<<< @@ -2658,17 +2854,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_ERR(1, 64, __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( # <<<<<<<<<<<<<< @@ -2679,10 +2875,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_ERR(1, 65, __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): # <<<<<<<<<<<<<< @@ -2691,17 +2887,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): # <<<<<<<<<<<<<< @@ -2709,11 +2905,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 # <<<<<<<<<<<<<< @@ -2722,7 +2918,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') # <<<<<<<<<<<<<< @@ -2731,15 +2927,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 '%.30s'", "encode"); - __PYX_ERR(1, 72, __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_ERR(1, 72, __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_ERR(1, 72, __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 # <<<<<<<<<<<<<< @@ -2748,28 +2944,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 # <<<<<<<<<<<<<< @@ -2778,17 +2974,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_ERR(1, 77, __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 # <<<<<<<<<<<<<< @@ -2797,17 +2993,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 # <<<<<<<<<<<<<< @@ -2815,12 +3011,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_ERR(1, 82, __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)) # <<<<<<<<<<<<<< @@ -2831,10 +3027,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_ERR(1, 84, __pyx_L1_error) + __PYX_ERR(0, 91, __pyx_L1_error) } } - __pyx_L7:; + __pyx_L10:; } __pyx_L6:; @@ -2845,10 +3041,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 # <<<<<<<<<<<<<< @@ -2870,16 +3067,22 @@ 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_pretend_to_initialize(&__pyx_r); __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+: # <<<<<<<<<<<<<< @@ -2900,9 +3103,12 @@ 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): # <<<<<<<<<<<<<< @@ -2913,7 +3119,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 # <<<<<<<<<<<<<< @@ -2923,7 +3129,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): # <<<<<<<<<<<<<< @@ -2933,7 +3139,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: # <<<<<<<<<<<<<< @@ -2945,26 +3151,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_ERR(1, 108, __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_ERR(1, 108, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 108, __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_ERR(1, 108, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 108, __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_ERR(1, 108, __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 } @@ -2974,7 +3180,7 @@ static CRFSuite::ItemSequence __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(PyObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 108, __pyx_L1_error) + else __PYX_ERR(0, 115, __pyx_L1_error) } break; } @@ -2983,7 +3189,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)) # <<<<<<<<<<<<<< @@ -2994,16 +3200,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_ERR(1, 109, __pyx_L1_error) + __PYX_ERR(0, 116, __pyx_L1_error) } try { __pyx_v_c_seq.push_back(__pyx_t_8); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 109, __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: # <<<<<<<<<<<<<< @@ -3015,7 +3221,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 # <<<<<<<<<<<<<< @@ -3025,7 +3231,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+: # <<<<<<<<<<<<<< @@ -3045,7 +3251,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): # <<<<<<<<<<<<<< @@ -3057,6 +3263,9 @@ 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); @@ -3079,7 +3288,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_ERR(1, 159, __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; @@ -3090,7 +3299,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_ERR(1, 159, __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(); @@ -3107,9 +3316,12 @@ 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) # <<<<<<<<<<<<<< @@ -3120,11 +3332,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_ERR(1, 160, __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): # <<<<<<<<<<<<<< @@ -3143,7 +3355,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): # <<<<<<<<<<<<<< @@ -3181,21 +3393,24 @@ 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_ERR(1, 174, __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: # <<<<<<<<<<<<<< @@ -3210,19 +3425,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 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 177, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); 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: # <<<<<<<<<<<<<< @@ -3236,14 +3451,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_ERR(1, 185, __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); @@ -3251,26 +3466,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_ERR(1, 186, __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 '%.30s'", "decode"); - __PYX_ERR(1, 186, __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_ERR(1, 186, __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_ERR(1, 186, __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: # <<<<<<<<<<<<<< @@ -3279,16 +3494,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 == ((int)-1))) __PYX_ERR(1, 187, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_seq, __pyx_v_x); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 194, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":176 + /* "pycrfsuite/_pycrfsuite.pyx":183 * seq = [] * * for c_item in self.c_seq: # <<<<<<<<<<<<<< @@ -3297,7 +3512,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 # <<<<<<<<<<<<<< @@ -3309,7 +3524,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): # <<<<<<<<<<<<<< @@ -3332,7 +3547,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): # <<<<<<<<<<<<<< @@ -3358,7 +3573,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() # <<<<<<<<<<<<<< @@ -3368,7 +3583,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): # <<<<<<<<<<<<<< @@ -3382,7 +3597,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): # <<<<<<<<<<<<<< @@ -3409,9 +3624,12 @@ 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) # <<<<<<<<<<<<<< @@ -3419,17 +3637,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 == ((Py_ssize_t)-1))) __PYX_ERR(1, 194, __pyx_L1_error) - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 194, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-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_ERR(1, 194, __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): # <<<<<<<<<<<<<< @@ -3473,6 +3691,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_8__reduce_cy 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("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -3481,11 +3702,11 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_8__reduce_cy * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_seq cannot be converted to a Python object for pickling") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 2, __pyx_L1_error) + __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< @@ -3528,6 +3749,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_10__setstate 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("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -3535,11 +3759,11 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_10__setstate * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_seq cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 4, __pyx_L1_error) + __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -3558,7 +3782,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_12ItemSequence_10__setstate return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":197 +/* "pycrfsuite/_pycrfsuite.pyx":204 * * * def _intbool(txt): # <<<<<<<<<<<<<< @@ -3586,9 +3810,12 @@ 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)) # <<<<<<<<<<<<<< @@ -3596,17 +3823,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite__intbool(CYTHON_UNUSED PyOb * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_txt); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 198, __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_ERR(1, 198, __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_ERR(1, 198, __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): # <<<<<<<<<<<<<< @@ -3625,7 +3852,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): # <<<<<<<<<<<<<< @@ -3639,6 +3866,9 @@ 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); @@ -3682,7 +3912,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_ERR(1, 256, __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)) { @@ -3702,7 +3932,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_ERR(1, 256, __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(); @@ -3723,9 +3953,12 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p 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("__init__", 0); - /* "pycrfsuite/_pycrfsuite.pyx":257 + /* "pycrfsuite/_pycrfsuite.pyx":264 * * def __init__(self, algorithm=None, params=None, verbose=True): * if algorithm is not None: # <<<<<<<<<<<<<< @@ -3736,14 +3969,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_ERR(1, 258, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -3757,12 +3990,12 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_algorithm) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_algorithm); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 258, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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: # <<<<<<<<<<<<<< @@ -3771,7 +4004,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: # <<<<<<<<<<<<<< @@ -3782,14 +4015,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_ERR(1, 260, __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_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -3803,12 +4036,12 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer___init__(struct __p } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_params) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_params); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 260, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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: # <<<<<<<<<<<<<< @@ -3817,7 +4050,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 # <<<<<<<<<<<<<< @@ -3830,7 +4063,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): # <<<<<<<<<<<<<< @@ -3852,7 +4085,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): # <<<<<<<<<<<<<< @@ -3881,9 +4114,12 @@ 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) # <<<<<<<<<<<<<< @@ -3894,26 +4130,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_ERR(1, 265, __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_ERR(1, 268, __pyx_L1_error) - __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_crf1d); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 268, __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_ERR(1, 268, __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() # <<<<<<<<<<<<<< @@ -3924,10 +4160,10 @@ static int __pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_2__cinit__(struct _ __pyx_v_self->c_trainer._init_hack(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 269, __pyx_L1_error) + __PYX_ERR(0, 276, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":263 + /* "pycrfsuite/_pycrfsuite.pyx":270 * self.verbose = verbose * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -3946,7 +4182,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): # <<<<<<<<<<<<<< @@ -3961,18 +4197,21 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_11BaseTrainer__on_message(st 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("_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_ERR(1, 272, __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_ERR(1, 272, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -3987,12 +4226,12 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_11BaseTrainer__on_message(st __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 272, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __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":271 + /* "pycrfsuite/_pycrfsuite.pyx":278 * self.c_trainer._init_hack() * * cdef _on_message(self, string message): # <<<<<<<<<<<<<< @@ -4016,7 +4255,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): # <<<<<<<<<<<<<< @@ -4045,40 +4284,43 @@ 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_ERR(1, 288, __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_ERR(1, 289, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 289, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 289, __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(1, 289, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_end, __pyx_kp_s__3) < 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: # <<<<<<<<<<<<<< @@ -4087,7 +4329,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): # <<<<<<<<<<<<<< @@ -4110,7 +4352,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): # <<<<<<<<<<<<<< @@ -4125,6 +4367,9 @@ 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); @@ -4153,7 +4398,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_7append(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yseq)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("append", 0, 2, 3, 1); __PYX_ERR(1, 291, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("append", 0, 2, 3, 1); __PYX_ERR(0, 298, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4163,7 +4408,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_ERR(1, 291, __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)) { @@ -4178,14 +4423,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_ERR(1, 291, __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_ERR(1, 291, __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(); @@ -4203,9 +4448,12 @@ 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) # <<<<<<<<<<<<<< @@ -4216,17 +4464,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_ERR(1, 312, __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_ERR(1, 312, __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_ERR(1, 312, __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): # <<<<<<<<<<<<<< @@ -4246,7 +4494,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'): # <<<<<<<<<<<<<< @@ -4260,6 +4508,9 @@ 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); @@ -4291,7 +4542,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_ERR(1, 314, __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)) { @@ -4307,7 +4558,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_ERR(1, 314, __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(); @@ -4332,17 +4583,20 @@ 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_ERR(1, 332, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -4356,22 +4610,22 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 332, __pyx_L1_error) + 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_ERR(1, 333, __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_ERR(1, 333, __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; @@ -4389,7 +4643,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_algorithm, __pyx_v_algorithm}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 333, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -4397,13 +4651,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_algorithm, __pyx_v_algorithm}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 333, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 333, __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; @@ -4414,7 +4668,7 @@ 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_ERR(1, 333, __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; } @@ -4422,32 +4676,32 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_8select(struc __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_ERR(1, 334, __pyx_L1_error) - __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_v_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 334, __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_ERR(1, 334, __pyx_L1_error) + __PYX_ERR(0, 341, __pyx_L1_error) } __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0); if (unlikely(__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_ERR(1, 336, __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); @@ -4455,25 +4709,25 @@ 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_ERR(1, 336, __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 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 335, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 335, __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): # <<<<<<<<<<<<<< @@ -4482,7 +4736,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'): # <<<<<<<<<<<<<< @@ -4507,7 +4761,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): # <<<<<<<<<<<<<< @@ -4521,6 +4775,9 @@ 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); @@ -4551,7 +4808,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_ERR(1, 339, __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)) { @@ -4564,14 +4821,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_ERR(1, 339, __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_ERR(1, 339, __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(); @@ -4595,16 +4852,19 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = 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_ERR(1, 358, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -4618,28 +4878,28 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 358, __pyx_L1_error) + 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_ERR(1, 359, __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_ERR(1, 359, __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: # <<<<<<<<<<<<<< @@ -4649,16 +4909,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc __pyx_t_6 = ((__pyx_v_status_code != CRFSUITE_SUCCESS) != 0); if (unlikely(__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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CRFSuiteError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 361, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __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_ERR(1, 361, __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_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -4673,14 +4933,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10train(struc __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 361, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __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_ERR(1, 361, __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: # <<<<<<<<<<<<<< @@ -4689,7 +4949,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): # <<<<<<<<<<<<<< @@ -4713,7 +4973,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): # <<<<<<<<<<<<<< @@ -4740,9 +5000,12 @@ 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() # <<<<<<<<<<<<<< @@ -4754,15 +5017,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_12params(stru __pyx_t_1 = __pyx_v_self->c_trainer.params(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 378, __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_ERR(1, 378, __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): # <<<<<<<<<<<<<< @@ -4781,7 +5044,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): # <<<<<<<<<<<<<< @@ -4817,16 +5080,19 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( PyObject *__pyx_t_7 = NULL; PyObject *(*__pyx_t_8)(PyObject *); int __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_ERR(1, 389, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -4840,16 +5106,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 389, __pyx_L1_error) + 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; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 389, __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_ERR(1, 389, __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 (;;) { @@ -4857,17 +5123,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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 389, __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_ERR(1, 389, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 389, __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_ERR(1, 389, __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 } @@ -4877,7 +5143,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 389, __pyx_L1_error) + else __PYX_ERR(0, 396, __pyx_L1_error) } break; } @@ -4889,7 +5155,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_ERR(1, 389, __pyx_L1_error) + __PYX_ERR(0, 396, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4902,15 +5168,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_ERR(1, 389, __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_ERR(1, 389, __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_ERR(1, 389, __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; @@ -4918,7 +5184,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_ERR(1, 389, __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; @@ -4926,7 +5192,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_ERR(1, 389, __pyx_L1_error) + __PYX_ERR(0, 396, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3); @@ -4934,14 +5200,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_ERR(1, 390, __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; @@ -4958,7 +5224,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_key, __pyx_v_value}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 390, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -4966,13 +5232,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_14set_params( #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_key, __pyx_v_value}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 390, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { - __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 390, __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; @@ -4983,14 +5249,14 @@ 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_ERR(1, 390, __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(): # <<<<<<<<<<<<<< @@ -5000,7 +5266,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): # <<<<<<<<<<<<<< @@ -5027,7 +5293,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): # <<<<<<<<<<<<<< @@ -5050,7 +5316,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, CYTHON_UNUSED PyThreadState *__pyx_tstate, 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()) # <<<<<<<<<<<<<< @@ -5062,12 +5328,15 @@ 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)) { __pyx_cur_scope = ((struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(1, 403, __pyx_L1_error) + __PYX_ERR(0, 410, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -5075,7 +5344,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, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_get_params_locals_genexpr, __pyx_n_s_pycrfsuite__pycrfsuite); if (unlikely(!gen)) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_get_params_locals_genexpr, __pyx_n_s_pycrfsuite__pycrfsuite); if (unlikely(!gen)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5101,6 +5370,9 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("genexpr", 0); switch (__pyx_generator->resume_label) { @@ -5110,11 +5382,11 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 403, __pyx_L1_error) - __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) __PYX_ERR(1, 403, __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_ERR(1, 403, __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(1, 403, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -5128,16 +5400,16 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 403, __pyx_L1_error) + 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; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 403, __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_ERR(1, 403, __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 (;;) { @@ -5145,17 +5417,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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 403, __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_ERR(1, 403, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 403, __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_ERR(1, 403, __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 } @@ -5165,7 +5437,7 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 403, __pyx_L1_error) + else __PYX_ERR(0, 410, __pyx_L1_error) } break; } @@ -5175,8 +5447,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_ERR(1, 403, __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(1, 403, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -5190,10 +5462,10 @@ static PyObject *__pyx_gb_10pycrfsuite_11_pycrfsuite_11BaseTrainer_10get_params_ } __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_cur_scope->__pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_name); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 403, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __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_ERR(1, 403, __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; @@ -5219,7 +5491,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): # <<<<<<<<<<<<<< @@ -5233,12 +5505,15 @@ 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)) { __pyx_cur_scope = ((struct __pyx_obj_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(1, 392, __pyx_L1_error) + __PYX_ERR(0, 399, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -5246,7 +5521,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()) # <<<<<<<<<<<<<< @@ -5254,16 +5529,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_ERR(1, 403, __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_ERR(1, 403, __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): # <<<<<<<<<<<<<< @@ -5284,7 +5559,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): # <<<<<<<<<<<<<< @@ -5298,6 +5573,9 @@ 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); @@ -5324,11 +5602,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_19set(PyObjec case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); __PYX_ERR(1, 405, __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_ERR(1, 405, __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; @@ -5341,7 +5619,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_ERR(1, 405, __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(); @@ -5362,10 +5640,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_18set(struct int __pyx_t_3; std::string __pyx_t_4; std::string __pyx_t_5; + 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): # <<<<<<<<<<<<<< @@ -5374,24 +5655,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 == ((int)-1))) __PYX_ERR(1, 419, __pyx_L1_error) + __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-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 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 420, __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): # <<<<<<<<<<<<<< @@ -5400,26 +5681,26 @@ 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_ERR(1, 421, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 421, __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 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 421, __pyx_L1_error) + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { __pyx_v_self->c_trainer.set(__pyx_t_4, __pyx_t_5); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 421, __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): # <<<<<<<<<<<<<< @@ -5441,7 +5722,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): # <<<<<<<<<<<<<< @@ -5474,9 +5755,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct PyObject *__pyx_t_6 = NULL; int __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)) # <<<<<<<<<<<<<< @@ -5484,16 +5768,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_ERR(1, 434, __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_ERR(1, 434, __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_ERR(1, 434, __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_ERR(1, 434, __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; @@ -5510,7 +5794,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_name, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -5519,14 +5803,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_20get(struct #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_name, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __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; @@ -5537,7 +5821,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_ERR(1, 434, __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; } @@ -5546,7 +5830,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): # <<<<<<<<<<<<<< @@ -5569,7 +5853,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): # <<<<<<<<<<<<<< @@ -5601,16 +5885,19 @@ 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_ERR(1, 454, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -5624,31 +5911,31 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_22help(struct } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 454, __pyx_L1_error) + 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_ERR(1, 454, __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 (unlikely(__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_FormatSafe(__pyx_kp_s_Parameter_not_found_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 457, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_FormatSafe(__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 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 457, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 457, __pyx_L1_error) + __PYX_ERR(0, 464, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":454 + /* "pycrfsuite/_pycrfsuite.pyx":461 * * """ * if name not in self.params(): # <<<<<<<<<<<<<< @@ -5657,7 +5944,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) # <<<<<<<<<<<<<< @@ -5665,20 +5952,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_ERR(1, 458, __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_ERR(1, 458, __pyx_L1_error) + __PYX_ERR(0, 465, __pyx_L1_error) } - __pyx_t_2 = __pyx_convert_PyStr_string_to_py_std__in_string(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 458, __pyx_L1_error) + __pyx_t_2 = __pyx_convert_PyStr_string_to_py_std__in_string(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 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): # <<<<<<<<<<<<<< @@ -5699,7 +5986,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): # <<<<<<<<<<<<<< @@ -5724,9 +6011,12 @@ 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() # <<<<<<<<<<<<<< @@ -5737,10 +6027,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_24clear(struc __pyx_v_self->c_trainer.clear(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 462, __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): # <<<<<<<<<<<<<< @@ -5760,7 +6050,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): # <<<<<<<<<<<<<< @@ -5774,6 +6064,9 @@ 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); @@ -5800,11 +6093,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_11BaseTrainer_27_cast_param case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_cast_parameter", 1, 2, 2, 1); __PYX_ERR(1, 464, __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_ERR(1, 464, __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; @@ -5817,7 +6110,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_ERR(1, 464, __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(); @@ -5838,23 +6131,26 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_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_ERR(1, 465, __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_ERR(1, 465, __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) # <<<<<<<<<<<<<< @@ -5862,9 +6158,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_ERR(1, 466, __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 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 466, __pyx_L1_error) + __pyx_t_5 = __Pyx_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; @@ -5879,14 +6175,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_26_cast_param } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_value); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 466, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_1; __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: # <<<<<<<<<<<<<< @@ -5895,7 +6191,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 # <<<<<<<<<<<<<< @@ -5907,7 +6203,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): # <<<<<<<<<<<<<< @@ -5928,7 +6224,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): # <<<<<<<<<<<<<< @@ -5962,7 +6258,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 # <<<<<<<<<<<<<< @@ -6081,6 +6377,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_30__reduce_cy 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("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -6089,11 +6388,11 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_30__reduce_cy * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 2, __pyx_L1_error) + __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< @@ -6136,6 +6435,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_32__setstate_ 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("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -6143,11 +6445,11 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_32__setstate_ * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 4, __pyx_L1_error) + __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -6166,7 +6468,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_11BaseTrainer_32__setstate_ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":495 +/* "pycrfsuite/_pycrfsuite.pyx":502 * logparser = None * * def _before_train(self): # <<<<<<<<<<<<<< @@ -6195,18 +6497,21 @@ 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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logparser); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __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_ERR(1, 496, __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; @@ -6221,13 +6526,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer__before_train(CYTH } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + 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_ERR(1, 496, __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): # <<<<<<<<<<<<<< @@ -6250,7 +6555,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): # <<<<<<<<<<<<<< @@ -6265,6 +6570,9 @@ 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); @@ -6291,11 +6599,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_3message(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("message", 1, 2, 2, 1); __PYX_ERR(1, 498, __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_ERR(1, 498, __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; @@ -6308,7 +6616,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_ERR(1, 498, __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(); @@ -6335,18 +6643,21 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN PyObject *__pyx_t_7 = NULL; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("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_ERR(1, 499, __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_ERR(1, 499, __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; @@ -6361,22 +6672,22 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_message) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_message); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 499, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __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_ERR(1, 501, __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_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 501, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = ((!__pyx_t_5) != 0); if (!__pyx_t_6) { @@ -6390,7 +6701,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __pyx_L4_bool_binop_done:; if (__pyx_t_4) { - /* "pycrfsuite/_pycrfsuite.pyx":502 + /* "pycrfsuite/_pycrfsuite.pyx":509 * * if not self.verbose or event is None: * return # <<<<<<<<<<<<<< @@ -6401,7 +6712,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: # <<<<<<<<<<<<<< @@ -6410,39 +6721,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_ERR(1, 504, __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_ERR(1, 504, __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_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_start, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 505, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_start, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 512, __pyx_L1_error) if (__pyx_t_4) { - /* "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_ERR(1, 506, __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_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -6456,12 +6767,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_log) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 506, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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': # <<<<<<<<<<<<<< @@ -6471,28 +6782,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_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_featgen_progress, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 507, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_featgen_progress, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 514, __pyx_L1_error) if (__pyx_t_4) { - /* "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_ERR(1, 508, __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_ERR(1, 508, __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_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_featgen_percent); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 508, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_featgen_percent); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -6510,7 +6821,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_log, __pyx_t_7}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 508, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -6519,14 +6830,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_log, __pyx_t_7}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 508, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 508, __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; @@ -6537,14 +6848,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 508, __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': # <<<<<<<<<<<<<< @@ -6554,24 +6865,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_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_featgen_end, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_featgen_end, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 516, __pyx_L1_error) if (__pyx_t_4) { - /* "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_ERR(1, 510, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -6585,12 +6896,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_v_log) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 510, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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': # <<<<<<<<<<<<<< @@ -6600,24 +6911,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_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_prepared, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 511, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_prepared, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 518, __pyx_L1_error) if (__pyx_t_4) { - /* "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_ERR(1, 512, __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_9 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -6631,12 +6942,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_v_log) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 512, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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': # <<<<<<<<<<<<<< @@ -6646,24 +6957,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_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_prepare_error, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 513, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_prepare_error, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 520, __pyx_L1_error) if (__pyx_t_4) { - /* "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_ERR(1, 514, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -6677,12 +6988,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_v_log) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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': # <<<<<<<<<<<<<< @@ -6692,28 +7003,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_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_iteration, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_iteration, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 522, __pyx_L1_error) if (__pyx_t_4) { - /* "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_ERR(1, 516, __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_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_logparser_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_last_iteration); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_last_iteration); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; @@ -6731,7 +7042,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_log, __pyx_t_7}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -6740,14 +7051,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_log, __pyx_t_7}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { - __pyx_t_2 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 516, __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_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL; @@ -6758,14 +7069,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __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': # <<<<<<<<<<<<<< @@ -6775,24 +7086,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_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_optimization_end, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_optimization_end, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 524, __pyx_L1_error) if (__pyx_t_4) { - /* "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_ERR(1, 518, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -6806,12 +7117,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_log) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 518, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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': # <<<<<<<<<<<<<< @@ -6821,24 +7132,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_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_end, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_event, __pyx_n_s_end, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 526, __pyx_L1_error) if (likely(__pyx_t_4)) { - /* "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_ERR(1, 520, __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_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -6852,12 +7163,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN } __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_log) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_log); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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': # <<<<<<<<<<<<<< @@ -6867,7 +7178,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) # <<<<<<<<<<<<<< @@ -6875,18 +7186,18 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_7Trainer_2message(CYTHON_UN * def on_start(self, log): */ /*else*/ { - __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Unknown_event_r, __pyx_v_event); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 522, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_FormatSafe(__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 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 522, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 522, __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): # <<<<<<<<<<<<<< @@ -6913,7 +7224,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): # <<<<<<<<<<<<<< @@ -6928,6 +7239,9 @@ 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); @@ -6954,11 +7268,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_5on_start(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_start", 1, 2, 2, 1); __PYX_ERR(1, 524, __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_ERR(1, 524, __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; @@ -6971,7 +7285,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_ERR(1, 524, __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(); @@ -6990,30 +7304,33 @@ 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_ERR(1, 525, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 525, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 525, __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(1, 525, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s__3) < 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): # <<<<<<<<<<<<<< @@ -7036,7 +7353,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): # <<<<<<<<<<<<<< @@ -7052,6 +7369,9 @@ 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); @@ -7080,17 +7400,17 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_7on_featgen_progre case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, 1); __PYX_ERR(1, 527, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, 1); __PYX_ERR(0, 534, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_percent)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_featgen_progress", 1, 3, 3, 2); __PYX_ERR(1, 527, __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_ERR(1, 527, __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; @@ -7105,7 +7425,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_ERR(1, 527, __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(); @@ -7124,30 +7444,33 @@ 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_ERR(1, 528, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 528, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 528, __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(1, 528, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s__3) < 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): # <<<<<<<<<<<<<< @@ -7170,7 +7493,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): # <<<<<<<<<<<<<< @@ -7185,6 +7508,9 @@ 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); @@ -7211,11 +7537,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_9on_featgen_end(Py case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_featgen_end", 1, 2, 2, 1); __PYX_ERR(1, 530, __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_ERR(1, 530, __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; @@ -7228,7 +7554,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_ERR(1, 530, __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(); @@ -7247,30 +7573,33 @@ 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_ERR(1, 531, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 531, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 531, __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(1, 531, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s__3) < 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): # <<<<<<<<<<<<<< @@ -7293,7 +7622,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): # <<<<<<<<<<<<<< @@ -7308,6 +7637,9 @@ 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); @@ -7334,11 +7666,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_11on_prepared(PyOb case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_prepared", 1, 2, 2, 1); __PYX_ERR(1, 533, __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_ERR(1, 533, __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; @@ -7351,7 +7683,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_ERR(1, 533, __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(); @@ -7370,30 +7702,33 @@ 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_ERR(1, 534, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 534, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 534, __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(1, 534, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s__3) < 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): # <<<<<<<<<<<<<< @@ -7416,7 +7751,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): # <<<<<<<<<<<<<< @@ -7431,6 +7766,9 @@ 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); @@ -7457,11 +7795,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_13on_prepare_error case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_prepare_error", 1, 2, 2, 1); __PYX_ERR(1, 536, __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_ERR(1, 536, __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; @@ -7474,7 +7812,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_ERR(1, 536, __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(); @@ -7493,30 +7831,33 @@ 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_ERR(1, 537, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 537, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 537, __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(1, 537, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s__3) < 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): # <<<<<<<<<<<<<< @@ -7539,7 +7880,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): # <<<<<<<<<<<<<< @@ -7555,6 +7896,9 @@ 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); @@ -7583,17 +7927,17 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_15on_iteration(PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, 1); __PYX_ERR(1, 539, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, 1); __PYX_ERR(0, 546, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_info)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_iteration", 1, 3, 3, 2); __PYX_ERR(1, 539, __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_ERR(1, 539, __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; @@ -7608,7 +7952,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_ERR(1, 539, __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(); @@ -7627,30 +7971,33 @@ 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_ERR(1, 540, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 540, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 540, __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(1, 540, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s__3) < 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): # <<<<<<<<<<<<<< @@ -7673,7 +8020,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): # <<<<<<<<<<<<<< @@ -7688,6 +8035,9 @@ 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); @@ -7714,11 +8064,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_17on_optimization_ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_optimization_end", 1, 2, 2, 1); __PYX_ERR(1, 542, __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_ERR(1, 542, __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; @@ -7731,7 +8081,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_ERR(1, 542, __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(); @@ -7750,30 +8100,33 @@ 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_ERR(1, 543, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 543, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 543, __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(1, 543, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s__3) < 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): # <<<<<<<<<<<<<< @@ -7796,7 +8149,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): # <<<<<<<<<<<<<< @@ -7811,6 +8164,9 @@ 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); @@ -7837,11 +8193,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_7Trainer_19on_end(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("on_end", 1, 2, 2, 1); __PYX_ERR(1, 545, __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_ERR(1, 545, __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; @@ -7854,7 +8210,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_ERR(1, 545, __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(); @@ -7873,30 +8229,33 @@ 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_ERR(1, 546, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 546, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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__3) < 0) __PYX_ERR(1, 546, __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(1, 546, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end, __pyx_kp_s__3) < 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): # <<<<<<<<<<<<<< @@ -7919,7 +8278,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): # <<<<<<<<<<<<<< @@ -7950,16 +8309,19 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o std::string __pyx_t_4; int __pyx_t_5; int __pyx_t_6; + 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_ERR(1, 571, __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_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -7973,45 +8335,45 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_name); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 571, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __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":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_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 572, __pyx_L1_error) + __pyx_t_4 = __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_5 = __pyx_v_self->c_tagger.open(__pyx_t_4); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 572, __pyx_L1_error) + __PYX_ERR(0, 579, __pyx_L1_error) } __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); if (unlikely(__pyx_t_6)) { - /* "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_FormatSafe(__pyx_kp_s_Error_opening_model_file_r, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 573, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_FormatSafe(__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 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 573, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 573, __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): # <<<<<<<<<<<<<< @@ -8020,7 +8382,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) # <<<<<<<<<<<<<< @@ -8028,9 +8390,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o * def open_inmemory(self, bytes value): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_contextlib); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 574, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_contextlib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_closing); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 574, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_closing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -8045,14 +8407,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o } __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_self)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 574, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":558 + /* "pycrfsuite/_pycrfsuite.pyx":565 * cdef crfsuite_api.Tagger c_tagger * * def open(self, name): # <<<<<<<<<<<<<< @@ -8073,7 +8435,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 open_inmemory(self, bytes value): # <<<<<<<<<<<<<< @@ -8085,10 +8447,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_open(struct __pyx_o static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_3open_inmemory(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory[] = "Tagger.open_inmemory(self, bytes value)\n\n Open a model from memory.\n\n Parameters\n ----------\n value : bytes\n Binary model data (content of a file saved by Trainer.train).\n\n "; static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_3open_inmemory(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("open_inmemory (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyBytes_Type), 1, "value", 1))) __PYX_ERR(1, 576, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyBytes_Type), 1, "value", 1))) __PYX_ERR(0, 583, __pyx_L1_error) __pyx_r = __pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(((struct __pyx_obj_10pycrfsuite_11_pycrfsuite_Tagger *)__pyx_v_self), ((PyObject*)__pyx_v_value)); /* function exit code */ @@ -8111,16 +8476,19 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(stru Py_ssize_t __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_inmemory", 0); - /* "pycrfsuite/_pycrfsuite.pyx":586 + /* "pycrfsuite/_pycrfsuite.pyx":593 * * """ * self._check_inmemory_model(value) # <<<<<<<<<<<<<< * cdef const char *v = value * if not self.c_tagger.open(v, len(value)): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_inmemory_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 586, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_inmemory_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -8134,12 +8502,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(stru } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_value); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 586, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __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":587 + /* "pycrfsuite/_pycrfsuite.pyx":594 * """ * self._check_inmemory_model(value) * cdef const char *v = value # <<<<<<<<<<<<<< @@ -8148,12 +8516,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(stru */ if (unlikely(__pyx_v_value == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(1, 587, __pyx_L1_error) + __PYX_ERR(0, 594, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(1, 587, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L1_error) __pyx_v_v = __pyx_t_4; - /* "pycrfsuite/_pycrfsuite.pyx":588 + /* "pycrfsuite/_pycrfsuite.pyx":595 * self._check_inmemory_model(value) * cdef const char *v = value * if not self.c_tagger.open(v, len(value)): # <<<<<<<<<<<<<< @@ -8162,32 +8530,32 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(stru */ if (unlikely(__pyx_v_value == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 588, __pyx_L1_error) + __PYX_ERR(0, 595, __pyx_L1_error) } - __pyx_t_5 = PyBytes_GET_SIZE(__pyx_v_value); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 588, __pyx_L1_error) + __pyx_t_5 = PyBytes_GET_SIZE(__pyx_v_value); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 595, __pyx_L1_error) try { __pyx_t_6 = __pyx_v_self->c_tagger.open(__pyx_v_v, __pyx_t_5); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 588, __pyx_L1_error) + __PYX_ERR(0, 595, __pyx_L1_error) } __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); if (unlikely(__pyx_t_7)) { - /* "pycrfsuite/_pycrfsuite.pyx":589 + /* "pycrfsuite/_pycrfsuite.pyx":596 * cdef const char *v = value * if not self.c_tagger.open(v, len(value)): * raise ValueError("Error opening model") # <<<<<<<<<<<<<< * return contextlib.closing(self) * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 589, __pyx_L1_error) + __PYX_ERR(0, 596, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":588 + /* "pycrfsuite/_pycrfsuite.pyx":595 * self._check_inmemory_model(value) * cdef const char *v = value * if not self.c_tagger.open(v, len(value)): # <<<<<<<<<<<<<< @@ -8196,7 +8564,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(stru */ } - /* "pycrfsuite/_pycrfsuite.pyx":590 + /* "pycrfsuite/_pycrfsuite.pyx":597 * if not self.c_tagger.open(v, len(value)): * raise ValueError("Error opening model") * return contextlib.closing(self) # <<<<<<<<<<<<<< @@ -8204,9 +8572,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(stru * def close(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_contextlib); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 590, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_contextlib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_closing); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 590, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_closing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -8221,14 +8589,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(stru } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_self)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 590, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":576 + /* "pycrfsuite/_pycrfsuite.pyx":583 * return contextlib.closing(self) * * def open_inmemory(self, bytes value): # <<<<<<<<<<<<<< @@ -8249,7 +8617,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_2open_inmemory(stru return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":592 +/* "pycrfsuite/_pycrfsuite.pyx":599 * return contextlib.closing(self) * * def close(self): # <<<<<<<<<<<<<< @@ -8274,9 +8642,12 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_5close(PyObject *__ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_4close(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":596 + /* "pycrfsuite/_pycrfsuite.pyx":603 * Close the model. * """ * self.c_tagger.close() # <<<<<<<<<<<<<< @@ -8287,10 +8658,10 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_4close(struct __pyx __pyx_v_self->c_tagger.close(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 596, __pyx_L1_error) + __PYX_ERR(0, 603, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":592 + /* "pycrfsuite/_pycrfsuite.pyx":599 * return contextlib.closing(self) * * def close(self): # <<<<<<<<<<<<<< @@ -8310,7 +8681,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_4close(struct __pyx return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":598 +/* "pycrfsuite/_pycrfsuite.pyx":605 * self.c_tagger.close() * * def labels(self): # <<<<<<<<<<<<<< @@ -8337,9 +8708,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6labels(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":607 + /* "pycrfsuite/_pycrfsuite.pyx":614 * The list of labels in the model. * """ * return self.c_tagger.labels() # <<<<<<<<<<<<<< @@ -8351,15 +8725,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6labels(struct __py __pyx_t_1 = __pyx_v_self->c_tagger.labels(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 607, __pyx_L1_error) + __PYX_ERR(0, 614, __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(1, 607, __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, 614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":598 + /* "pycrfsuite/_pycrfsuite.pyx":605 * self.c_tagger.close() * * def labels(self): # <<<<<<<<<<<<<< @@ -8378,7 +8752,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_6labels(struct __py return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":609 +/* "pycrfsuite/_pycrfsuite.pyx":616 * return self.c_tagger.labels() * * def tag(self, xseq=None): # <<<<<<<<<<<<<< @@ -8391,6 +8765,9 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_9tag(PyObject *__py static char __pyx_doc_10pycrfsuite_11_pycrfsuite_6Tagger_8tag[] = "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_9tag(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); @@ -8416,7 +8793,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_9tag(PyObject *__py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tag") < 0)) __PYX_ERR(1, 609, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tag") < 0)) __PYX_ERR(0, 616, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -8430,7 +8807,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_9tag(PyObject *__py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("tag", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 609, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("tag", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 616, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger.tag", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8450,9 +8827,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8tag(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":629 + /* "pycrfsuite/_pycrfsuite.pyx":636 * The label sequence predicted. * """ * if xseq is not None: # <<<<<<<<<<<<<< @@ -8463,7 +8843,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8tag(struct __pyx_o __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pycrfsuite/_pycrfsuite.pyx":630 + /* "pycrfsuite/_pycrfsuite.pyx":637 * """ * if xseq is not None: * self.set(xseq) # <<<<<<<<<<<<<< @@ -8472,15 +8852,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8tag(struct __pyx_o */ try { __pyx_t_3 = ((struct __pyx_vtabstruct_10pycrfsuite_11_pycrfsuite_Tagger *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_v_xseq, 0); - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 630, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 630, __pyx_L1_error) + __PYX_ERR(0, 637, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":629 + /* "pycrfsuite/_pycrfsuite.pyx":636 * The label sequence predicted. * """ * if xseq is not None: # <<<<<<<<<<<<<< @@ -8489,7 +8869,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8tag(struct __pyx_o */ } - /* "pycrfsuite/_pycrfsuite.pyx":632 + /* "pycrfsuite/_pycrfsuite.pyx":639 * self.set(xseq) * * return self.c_tagger.viterbi() # <<<<<<<<<<<<<< @@ -8501,15 +8881,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8tag(struct __pyx_o __pyx_t_4 = __pyx_v_self->c_tagger.viterbi(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 632, __pyx_L1_error) + __PYX_ERR(0, 639, __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(1, 632, __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, 639, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":609 + /* "pycrfsuite/_pycrfsuite.pyx":616 * return self.c_tagger.labels() * * def tag(self, xseq=None): # <<<<<<<<<<<<<< @@ -8528,7 +8908,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_8tag(struct __pyx_o return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":634 +/* "pycrfsuite/_pycrfsuite.pyx":641 * return self.c_tagger.viterbi() * * def probability(self, yseq): # <<<<<<<<<<<<<< @@ -8556,9 +8936,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_10probability(struc 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":650 + /* "pycrfsuite/_pycrfsuite.pyx":657 * The probability ``P(yseq|xseq)``. * """ * return self.c_tagger.probability(yseq) # <<<<<<<<<<<<<< @@ -8566,20 +8949,20 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_10probability(struc * 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_ERR(1, 650, __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, 657, __pyx_L1_error) try { __pyx_t_2 = __pyx_v_self->c_tagger.probability(__pyx_t_1); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 650, __pyx_L1_error) + __PYX_ERR(0, 657, __pyx_L1_error) } - __pyx_t_3 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 650, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 657, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":634 + /* "pycrfsuite/_pycrfsuite.pyx":641 * return self.c_tagger.viterbi() * * def probability(self, yseq): # <<<<<<<<<<<<<< @@ -8598,7 +8981,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_10probability(struc return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":652 +/* "pycrfsuite/_pycrfsuite.pyx":659 * return self.c_tagger.probability(yseq) * * def marginal(self, y, pos): # <<<<<<<<<<<<<< @@ -8612,6 +8995,9 @@ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_6Tagger_12marginal[] = "Tagger. static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_13marginal(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); @@ -8638,11 +9024,11 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_13marginal(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("marginal", 1, 2, 2, 1); __PYX_ERR(1, 652, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("marginal", 1, 2, 2, 1); __PYX_ERR(0, 659, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "marginal") < 0)) __PYX_ERR(1, 652, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "marginal") < 0)) __PYX_ERR(0, 659, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -8655,7 +9041,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_13marginal(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("marginal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 652, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("marginal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 659, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger.marginal", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8675,9 +9061,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_12marginal(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":671 + /* "pycrfsuite/_pycrfsuite.pyx":678 * The marginal probability of the label ``y`` at position ``t``. * """ * return self.c_tagger.marginal(y, pos) # <<<<<<<<<<<<<< @@ -8685,21 +9074,21 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_12marginal(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_ERR(1, 671, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_pos); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 671, __pyx_L1_error) + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_y); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 678, __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, 678, __pyx_L1_error) try { __pyx_t_3 = __pyx_v_self->c_tagger.marginal(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 671, __pyx_L1_error) + __PYX_ERR(0, 678, __pyx_L1_error) } - __pyx_t_4 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 671, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 678, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":652 + /* "pycrfsuite/_pycrfsuite.pyx":659 * return self.c_tagger.probability(yseq) * * def marginal(self, y, pos): # <<<<<<<<<<<<<< @@ -8718,7 +9107,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_12marginal(struct _ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":673 +/* "pycrfsuite/_pycrfsuite.pyx":680 * return self.c_tagger.marginal(y, pos) * * cpdef set(self, xseq) except +: # <<<<<<<<<<<<<< @@ -8735,6 +9124,9 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; CRFSuite::ItemSequence __pyx_t_5; + 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)) ; @@ -8745,7 +9137,7 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 673, __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, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_15set)) { __Pyx_XDECREF(__pyx_r); @@ -8762,7 +9154,7 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_xseq) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_xseq); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 673, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -8783,7 +9175,7 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj #endif } - /* "pycrfsuite/_pycrfsuite.pyx":688 + /* "pycrfsuite/_pycrfsuite.pyx":695 * * """ * self.c_tagger.set(to_seq(xseq)) # <<<<<<<<<<<<<< @@ -8794,16 +9186,16 @@ static PyObject *__pyx_f_10pycrfsuite_11_pycrfsuite_6Tagger_set(struct __pyx_obj __pyx_t_5 = __pyx_f_10pycrfsuite_11_pycrfsuite_to_seq(__pyx_v_xseq); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 688, __pyx_L1_error) + __PYX_ERR(0, 695, __pyx_L1_error) } try { __pyx_v_self->c_tagger.set(__pyx_t_5); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 688, __pyx_L1_error) + __PYX_ERR(0, 695, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":673 + /* "pycrfsuite/_pycrfsuite.pyx":680 * return self.c_tagger.marginal(y, pos) * * cpdef set(self, xseq) except +: # <<<<<<<<<<<<<< @@ -8845,14 +9237,17 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14set(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); - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 673, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 673, __pyx_L1_error) + __PYX_ERR(0, 680, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; @@ -8870,7 +9265,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_14set(struct __pyx_ return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":690 +/* "pycrfsuite/_pycrfsuite.pyx":697 * self.c_tagger.set(to_seq(xseq)) * * def dump(self, filename=None): # <<<<<<<<<<<<<< @@ -8883,6 +9278,9 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_17dump(PyObject *__ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_6Tagger_16dump[] = "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_17dump(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); @@ -8908,7 +9306,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_17dump(PyObject *__ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dump") < 0)) __PYX_ERR(1, 690, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dump") < 0)) __PYX_ERR(0, 697, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -8922,7 +9320,7 @@ static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_17dump(PyObject *__ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dump", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 690, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("dump", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 697, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger.dump", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8959,9 +9357,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; int __pyx_t_20; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dump", 0); - /* "pycrfsuite/_pycrfsuite.pyx":700 + /* "pycrfsuite/_pycrfsuite.pyx":707 * If None, the model is dumped to stdout. * """ * if filename is None: # <<<<<<<<<<<<<< @@ -8972,24 +9373,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pycrfsuite/_pycrfsuite.pyx":701 + /* "pycrfsuite/_pycrfsuite.pyx":708 * """ * 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_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 701, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __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_ERR(1, 701, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dup); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 701, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 708, __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_ERR(1, 701, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_stdout); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 708, __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_ERR(1, 701, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_fileno); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; @@ -9004,7 +9405,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx } __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 701, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -9020,19 +9421,19 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 701, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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_ERR(1, 701, __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, 708, __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_ERR(1, 701, __pyx_L1_error) + __PYX_ERR(0, 708, __pyx_L1_error) } - /* "pycrfsuite/_pycrfsuite.pyx":700 + /* "pycrfsuite/_pycrfsuite.pyx":707 * If None, the model is dumped to stdout. * """ * if filename is None: # <<<<<<<<<<<<<< @@ -9042,7 +9443,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx goto __pyx_L3; } - /* "pycrfsuite/_pycrfsuite.pyx":703 + /* "pycrfsuite/_pycrfsuite.pyx":710 * self.c_tagger.dump(os.dup(sys.stdout.fileno())) * else: * fd = os.open(filename, os.O_CREAT | os.O_WRONLY) # <<<<<<<<<<<<<< @@ -9050,22 +9451,22 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx * self.c_tagger.dump(fd) */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_open); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 703, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_open); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_O_CREAT); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 703, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_O_CREAT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_O_WRONLY); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 703, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_O_WRONLY); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Or(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error) + __pyx_t_5 = PyNumber_Or(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -9084,7 +9485,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_filename, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 703, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9093,14 +9494,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_filename, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 703, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 703, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL; @@ -9111,7 +9512,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 703, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -9119,7 +9520,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx __pyx_v_fd = __pyx_t_3; __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":704 + /* "pycrfsuite/_pycrfsuite.pyx":711 * else: * fd = os.open(filename, os.O_CREAT | os.O_WRONLY) * try: # <<<<<<<<<<<<<< @@ -9128,23 +9529,23 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx */ /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":705 + /* "pycrfsuite/_pycrfsuite.pyx":712 * 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_ERR(1, 705, __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, 712, __pyx_L5_error) try { __pyx_v_self->c_tagger.dump(__pyx_t_8); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 705, __pyx_L5_error) + __PYX_ERR(0, 712, __pyx_L5_error) } } - /* "pycrfsuite/_pycrfsuite.pyx":707 + /* "pycrfsuite/_pycrfsuite.pyx":714 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< @@ -9162,16 +9563,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx __Pyx_XGOTREF(__pyx_t_11); /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":708 + /* "pycrfsuite/_pycrfsuite.pyx":715 * finally: * try: * os.close(fd) # <<<<<<<<<<<<<< * except OSError: * pass # already closed by Tagger::dump */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 708, __pyx_L7_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 708, __pyx_L7_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 715, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -9186,12 +9587,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_fd) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_fd); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 708, __pyx_L7_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":707 + /* "pycrfsuite/_pycrfsuite.pyx":714 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< @@ -9210,7 +9611,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":709 + /* "pycrfsuite/_pycrfsuite.pyx":716 * try: * os.close(fd) * except OSError: # <<<<<<<<<<<<<< @@ -9225,7 +9626,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx goto __pyx_L9_except_error; __pyx_L9_except_error:; - /* "pycrfsuite/_pycrfsuite.pyx":707 + /* "pycrfsuite/_pycrfsuite.pyx":714 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< @@ -9275,16 +9676,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx __Pyx_XGOTREF(__pyx_t_19); /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":708 + /* "pycrfsuite/_pycrfsuite.pyx":715 * finally: * try: * os.close(fd) # <<<<<<<<<<<<<< * except OSError: * pass # already closed by Tagger::dump */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 708, __pyx_L15_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 715, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 708, __pyx_L15_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -9299,12 +9700,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx } __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_v_fd) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fd); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 708, __pyx_L15_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":707 + /* "pycrfsuite/_pycrfsuite.pyx":714 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< @@ -9323,7 +9724,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":709 + /* "pycrfsuite/_pycrfsuite.pyx":716 * try: * os.close(fd) * except OSError: # <<<<<<<<<<<<<< @@ -9338,7 +9739,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx goto __pyx_L17_except_error; __pyx_L17_except_error:; - /* "pycrfsuite/_pycrfsuite.pyx":707 + /* "pycrfsuite/_pycrfsuite.pyx":714 * self.c_tagger.dump(fd) * finally: * try: # <<<<<<<<<<<<<< @@ -9389,7 +9790,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx } __pyx_L3:; - /* "pycrfsuite/_pycrfsuite.pyx":690 + /* "pycrfsuite/_pycrfsuite.pyx":697 * self.c_tagger.set(to_seq(xseq)) * * def dump(self, filename=None): # <<<<<<<<<<<<<< @@ -9415,7 +9816,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_16dump(struct __pyx return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":712 +/* "pycrfsuite/_pycrfsuite.pyx":719 * pass # already closed by Tagger::dump * * def info(self): # <<<<<<<<<<<<<< @@ -9469,18 +9870,21 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; int __pyx_t_24; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("info", 0); - /* "pycrfsuite/_pycrfsuite.pyx":716 + /* "pycrfsuite/_pycrfsuite.pyx":723 * Return a :class:`~.ParsedDump` structure with model internal information. * """ * parser = _dumpparser.CRFsuiteDumpParser() # <<<<<<<<<<<<<< * fd, name = tempfile.mkstemp() * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_dumpparser); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 716, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_dumpparser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __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_ERR(1, 716, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_CRFsuiteDumpParser); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -9495,22 +9899,22 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 716, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __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":717 + /* "pycrfsuite/_pycrfsuite.pyx":724 * """ * parser = _dumpparser.CRFsuiteDumpParser() * fd, name = tempfile.mkstemp() # <<<<<<<<<<<<<< * try: * self.c_tagger.dump(fd) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_tempfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 717, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_tempfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __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_ERR(1, 717, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_mkstemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -9525,7 +9929,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 717, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -9534,7 +9938,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 717, __pyx_L1_error) + __PYX_ERR(0, 724, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -9547,15 +9951,15 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(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_ERR(1, 717, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 717, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __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_ERR(1, 717, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __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; @@ -9563,7 +9967,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(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_ERR(1, 717, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 724, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; @@ -9571,7 +9975,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 717, __pyx_L1_error) + __PYX_ERR(0, 724, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_fd = __pyx_t_2; @@ -9579,7 +9983,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __pyx_v_name = __pyx_t_3; __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":718 + /* "pycrfsuite/_pycrfsuite.pyx":725 * parser = _dumpparser.CRFsuiteDumpParser() * fd, name = tempfile.mkstemp() * try: # <<<<<<<<<<<<<< @@ -9588,22 +9992,22 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx */ /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":719 + /* "pycrfsuite/_pycrfsuite.pyx":726 * 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_ERR(1, 719, __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, 726, __pyx_L6_error) try { __pyx_v_self->c_tagger.dump(__pyx_t_6); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(1, 719, __pyx_L6_error) + __PYX_ERR(0, 726, __pyx_L6_error) } - /* "pycrfsuite/_pycrfsuite.pyx":720 + /* "pycrfsuite/_pycrfsuite.pyx":727 * try: * self.c_tagger.dump(fd) * with open(name, 'rb') as f: # <<<<<<<<<<<<<< @@ -9611,7 +10015,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx * parser.feed(line.decode('utf8')) */ /*with:*/ { - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 720, __pyx_L6_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); @@ -9619,12 +10023,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(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_ERR(1, 720, __pyx_L6_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 727, __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_ERR(1, 720, __pyx_L6_error) + __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 727, __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_ERR(1, 720, __pyx_L8_error) + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -9638,7 +10042,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 720, __pyx_L8_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __pyx_t_1; @@ -9656,7 +10060,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __pyx_v_f = __pyx_t_2; __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":721 + /* "pycrfsuite/_pycrfsuite.pyx":728 * self.c_tagger.dump(fd) * with open(name, 'rb') as f: * for line in f: # <<<<<<<<<<<<<< @@ -9667,26 +10071,26 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(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_ERR(1, 721, __pyx_L12_error) + __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 721, __pyx_L12_error) + __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 728, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 721, __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, 728, __pyx_L12_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 721, __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, 728, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(1, 721, __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, 728, __pyx_L12_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 721, __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, 728, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_3); #endif } @@ -9696,7 +10100,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 721, __pyx_L12_error) + else __PYX_ERR(0, 728, __pyx_L12_error) } break; } @@ -9705,16 +10109,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":722 + /* "pycrfsuite/_pycrfsuite.pyx":729 * with open(name, 'rb') as f: * for line in f: * parser.feed(line.decode('utf8')) # <<<<<<<<<<<<<< * finally: * try: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parser, __pyx_n_s_feed); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 722, __pyx_L12_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parser, __pyx_n_s_feed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_decode); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 722, __pyx_L12_error) + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_decode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 729, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { @@ -9728,7 +10132,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx } __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_n_s_utf8); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 722, __pyx_L12_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 729, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = NULL; @@ -9744,12 +10148,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_13, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 722, __pyx_L12_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 729, __pyx_L12_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":721 + /* "pycrfsuite/_pycrfsuite.pyx":728 * self.c_tagger.dump(fd) * with open(name, 'rb') as f: * for line in f: # <<<<<<<<<<<<<< @@ -9759,7 +10163,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":720 + /* "pycrfsuite/_pycrfsuite.pyx":727 * try: * self.c_tagger.dump(fd) * with open(name, 'rb') as f: # <<<<<<<<<<<<<< @@ -9780,20 +10184,20 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_ERR(1, 720, __pyx_L14_except_error) + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 727, __pyx_L14_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 720, __pyx_L14_except_error) + __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 727, __pyx_L14_except_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 720, __pyx_L14_except_error) + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 727, __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_ERR(1, 720, __pyx_L14_except_error) + if (__pyx_t_16 < 0) __PYX_ERR(0, 727, __pyx_L14_except_error) __pyx_t_17 = ((!(__pyx_t_16 != 0)) != 0); if (__pyx_t_17) { __Pyx_GIVEREF(__pyx_t_2); @@ -9801,7 +10205,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __Pyx_XGIVEREF(__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_ERR(1, 720, __pyx_L14_except_error) + __PYX_ERR(0, 727, __pyx_L14_except_error) } __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -9827,7 +10231,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx if (__pyx_t_7) { __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__7, NULL); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 720, __pyx_L6_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 727, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } @@ -9843,7 +10247,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx } } - /* "pycrfsuite/_pycrfsuite.pyx":724 + /* "pycrfsuite/_pycrfsuite.pyx":731 * parser.feed(line.decode('utf8')) * finally: * try: # <<<<<<<<<<<<<< @@ -9861,16 +10265,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":725 + /* "pycrfsuite/_pycrfsuite.pyx":732 * finally: * try: * os.unlink(name) # <<<<<<<<<<<<<< * except OSError: * pass */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 725, __pyx_L24_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L24_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_ERR(1, 725, __pyx_L24_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_unlink); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __pyx_L24_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -9885,12 +10289,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_name); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 725, __pyx_L24_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L24_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":724 + /* "pycrfsuite/_pycrfsuite.pyx":731 * parser.feed(line.decode('utf8')) * finally: * try: # <<<<<<<<<<<<<< @@ -9910,7 +10314,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":726 + /* "pycrfsuite/_pycrfsuite.pyx":733 * try: * os.unlink(name) * except OSError: # <<<<<<<<<<<<<< @@ -9925,7 +10329,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx goto __pyx_L26_except_error; __pyx_L26_except_error:; - /* "pycrfsuite/_pycrfsuite.pyx":724 + /* "pycrfsuite/_pycrfsuite.pyx":731 * parser.feed(line.decode('utf8')) * finally: * try: # <<<<<<<<<<<<<< @@ -9976,16 +10380,16 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __Pyx_XGOTREF(__pyx_t_23); /*try:*/ { - /* "pycrfsuite/_pycrfsuite.pyx":725 + /* "pycrfsuite/_pycrfsuite.pyx":732 * finally: * try: * os.unlink(name) # <<<<<<<<<<<<<< * except OSError: * pass */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 725, __pyx_L32_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __pyx_L32_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unlink); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 725, __pyx_L32_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_unlink); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L32_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -10000,12 +10404,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_name); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 725, __pyx_L32_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L32_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":724 + /* "pycrfsuite/_pycrfsuite.pyx":731 * parser.feed(line.decode('utf8')) * finally: * try: # <<<<<<<<<<<<<< @@ -10025,7 +10429,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":726 + /* "pycrfsuite/_pycrfsuite.pyx":733 * try: * os.unlink(name) * except OSError: # <<<<<<<<<<<<<< @@ -10040,7 +10444,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx goto __pyx_L34_except_error; __pyx_L34_except_error:; - /* "pycrfsuite/_pycrfsuite.pyx":724 + /* "pycrfsuite/_pycrfsuite.pyx":731 * parser.feed(line.decode('utf8')) * finally: * try: # <<<<<<<<<<<<<< @@ -10089,7 +10493,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx __pyx_L7:; } - /* "pycrfsuite/_pycrfsuite.pyx":728 + /* "pycrfsuite/_pycrfsuite.pyx":735 * except OSError: * pass * return parser.result # <<<<<<<<<<<<<< @@ -10097,13 +10501,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx * 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_ERR(1, 728, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parser, __pyx_n_s_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pycrfsuite/_pycrfsuite.pyx":712 + /* "pycrfsuite/_pycrfsuite.pyx":719 * pass # already closed by Tagger::dump * * def info(self): # <<<<<<<<<<<<<< @@ -10132,7 +10536,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_18info(struct __pyx return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":730 +/* "pycrfsuite/_pycrfsuite.pyx":737 * return parser.result * * def _check_model(self, name): # <<<<<<<<<<<<<< @@ -10173,9 +10577,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_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":733 + /* "pycrfsuite/_pycrfsuite.pyx":740 * # See https://github.com/chokkan/crfsuite/pull/24 * # 1. Check that the file can be opened. * with open(name, 'rb') as f: # <<<<<<<<<<<<<< @@ -10183,7 +10590,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH * # 2. Check that file magic is correct. */ /*with:*/ { - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 733, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); @@ -10191,12 +10598,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_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_ERR(1, 733, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __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_ERR(1, 733, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 740, __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_ERR(1, 733, __pyx_L3_error) + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -10210,7 +10617,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 733, __pyx_L3_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __pyx_t_1; @@ -10228,14 +10635,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH __pyx_v_f = __pyx_t_4; __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":736 + /* "pycrfsuite/_pycrfsuite.pyx":743 * * # 2. Check that file magic is correct. * magic = f.read(4) # <<<<<<<<<<<<<< * if magic != b'lCRF': * raise ValueError("Invalid model file %r" % name) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 736, __pyx_L7_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -10249,39 +10656,39 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH } __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_int_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_4); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 736, __pyx_L7_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_magic = __pyx_t_4; __pyx_t_4 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":737 + /* "pycrfsuite/_pycrfsuite.pyx":744 * # 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_ERR(1, 737, __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, 744, __pyx_L7_error) if (unlikely(__pyx_t_9)) { - /* "pycrfsuite/_pycrfsuite.pyx":738 + /* "pycrfsuite/_pycrfsuite.pyx":745 * 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_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_model_file_r, __pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 738, __pyx_L7_error) + __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_model_file_r, __pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 738, __pyx_L7_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __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_ERR(1, 738, __pyx_L7_error) + __PYX_ERR(0, 745, __pyx_L7_error) - /* "pycrfsuite/_pycrfsuite.pyx":737 + /* "pycrfsuite/_pycrfsuite.pyx":744 * # 2. Check that file magic is correct. * magic = f.read(4) * if magic != b'lCRF': # <<<<<<<<<<<<<< @@ -10290,18 +10697,18 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH */ } - /* "pycrfsuite/_pycrfsuite.pyx":742 + /* "pycrfsuite/_pycrfsuite.pyx":749 * # 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_ERR(1, 742, __pyx_L7_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L7_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __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_ERR(1, 742, __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, 749, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -10319,7 +10726,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_int_0, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 742, __pyx_L7_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L7_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -10328,14 +10735,14 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_int_0, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 742, __pyx_L7_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L7_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { - __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 742, __pyx_L7_error) + __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 749, __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; @@ -10346,21 +10753,21 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_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_ERR(1, 742, __pyx_L7_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __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":743 + /* "pycrfsuite/_pycrfsuite.pyx":750 * # 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_ERR(1, 743, __pyx_L7_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_tell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { @@ -10374,41 +10781,41 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH } __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 743, __pyx_L7_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __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":744 + /* "pycrfsuite/_pycrfsuite.pyx":751 * 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_ERR(1, 744, __pyx_L7_error) - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 744, __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, 751, __pyx_L7_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 751, __pyx_L7_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_9)) { - /* "pycrfsuite/_pycrfsuite.pyx":745 + /* "pycrfsuite/_pycrfsuite.pyx":752 * size = f.tell() * if size <= 48: # header size * raise ValueError("Model file %r doesn't have a complete header" % name) # <<<<<<<<<<<<<< * * def _check_inmemory_model(self, bytes value): */ - __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Model_file_r_doesn_t_have_a_comp, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 745, __pyx_L7_error) + __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Model_file_r_doesn_t_have_a_comp, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 745, __pyx_L7_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 752, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 745, __pyx_L7_error) + __PYX_ERR(0, 752, __pyx_L7_error) - /* "pycrfsuite/_pycrfsuite.pyx":744 + /* "pycrfsuite/_pycrfsuite.pyx":751 * f.seek(0, os.SEEK_END) * size = f.tell() * if size <= 48: # header size # <<<<<<<<<<<<<< @@ -10417,7 +10824,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH */ } - /* "pycrfsuite/_pycrfsuite.pyx":733 + /* "pycrfsuite/_pycrfsuite.pyx":740 * # See https://github.com/chokkan/crfsuite/pull/24 * # 1. Check that the file can be opened. * with open(name, 'rb') as f: # <<<<<<<<<<<<<< @@ -10437,20 +10844,20 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { __Pyx_AddTraceback("pycrfsuite._pycrfsuite.Tagger._check_model", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(1, 733, __pyx_L9_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 740, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 733, __pyx_L9_except_error) + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 740, __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_ERR(1, 733, __pyx_L9_except_error) + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 740, __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_ERR(1, 733, __pyx_L9_except_error) + if (__pyx_t_9 < 0) __PYX_ERR(0, 740, __pyx_L9_except_error) __pyx_t_13 = ((!(__pyx_t_9 != 0)) != 0); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_4); @@ -10458,7 +10865,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_2, __pyx_t_11); __pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_11 = 0; - __PYX_ERR(1, 733, __pyx_L9_except_error) + __PYX_ERR(0, 740, __pyx_L9_except_error) } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -10484,7 +10891,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__7, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 733, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } @@ -10499,7 +10906,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH __pyx_L18:; } - /* "pycrfsuite/_pycrfsuite.pyx":730 + /* "pycrfsuite/_pycrfsuite.pyx":737 * return parser.result * * def _check_model(self, name): # <<<<<<<<<<<<<< @@ -10527,7 +10934,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH return __pyx_r; } -/* "pycrfsuite/_pycrfsuite.pyx":747 +/* "pycrfsuite/_pycrfsuite.pyx":754 * raise ValueError("Model file %r doesn't have a complete header" % name) * * def _check_inmemory_model(self, bytes value): # <<<<<<<<<<<<<< @@ -10539,10 +10946,13 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_20_check_model(CYTH static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_23_check_inmemory_model(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static char __pyx_doc_10pycrfsuite_11_pycrfsuite_6Tagger_22_check_inmemory_model[] = "Tagger._check_inmemory_model(self, bytes value)"; static PyObject *__pyx_pw_10pycrfsuite_11_pycrfsuite_6Tagger_23_check_inmemory_model(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_check_inmemory_model (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyBytes_Type), 1, "value", 1))) __PYX_ERR(1, 747, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyBytes_Type), 1, "value", 1))) __PYX_ERR(0, 754, __pyx_L1_error) __pyx_r = __pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_22_check_inmemory_model(((struct __pyx_obj_10pycrfsuite_11_pycrfsuite_Tagger *)__pyx_v_self), ((PyObject*)__pyx_v_value)); /* function exit code */ @@ -10562,9 +10972,12 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_22_check_inmemory_m int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_check_inmemory_model", 0); - /* "pycrfsuite/_pycrfsuite.pyx":748 + /* "pycrfsuite/_pycrfsuite.pyx":755 * * def _check_inmemory_model(self, bytes value): * magic = value[:4] # <<<<<<<<<<<<<< @@ -10573,38 +10986,38 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_22_check_inmemory_m */ if (unlikely(__pyx_v_value == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 748, __pyx_L1_error) + __PYX_ERR(0, 755, __pyx_L1_error) } - __pyx_t_1 = PySequence_GetSlice(__pyx_v_value, 0, 4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error) + __pyx_t_1 = PySequence_GetSlice(__pyx_v_value, 0, 4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_magic = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pycrfsuite/_pycrfsuite.pyx":749 + /* "pycrfsuite/_pycrfsuite.pyx":756 * def _check_inmemory_model(self, bytes value): * magic = value[:4] * if magic != b'lCRF': # <<<<<<<<<<<<<< * raise ValueError("Invalid model") * */ - __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_magic, __pyx_n_b_lCRF, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 749, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_magic, __pyx_n_b_lCRF, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 756, __pyx_L1_error) __pyx_t_3 = (__pyx_t_2 != 0); if (unlikely(__pyx_t_3)) { - /* "pycrfsuite/_pycrfsuite.pyx":750 + /* "pycrfsuite/_pycrfsuite.pyx":757 * magic = value[:4] * if magic != b'lCRF': * raise ValueError("Invalid model") # <<<<<<<<<<<<<< * * if len(value) < 48: */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 757, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 750, __pyx_L1_error) + __PYX_ERR(0, 757, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":749 + /* "pycrfsuite/_pycrfsuite.pyx":756 * def _check_inmemory_model(self, bytes value): * magic = value[:4] * if magic != b'lCRF': # <<<<<<<<<<<<<< @@ -10613,7 +11026,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_22_check_inmemory_m */ } - /* "pycrfsuite/_pycrfsuite.pyx":752 + /* "pycrfsuite/_pycrfsuite.pyx":759 * raise ValueError("Invalid model") * * if len(value) < 48: # <<<<<<<<<<<<<< @@ -10621,24 +11034,24 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_22_check_inmemory_m */ if (unlikely(__pyx_v_value == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 752, __pyx_L1_error) + __PYX_ERR(0, 759, __pyx_L1_error) } - __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_value); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 752, __pyx_L1_error) + __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_value); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 759, __pyx_L1_error) __pyx_t_3 = ((__pyx_t_4 < 48) != 0); if (unlikely(__pyx_t_3)) { - /* "pycrfsuite/_pycrfsuite.pyx":753 + /* "pycrfsuite/_pycrfsuite.pyx":760 * * if len(value) < 48: * raise ValueError("Invalid model: incomplete header") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 753, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 753, __pyx_L1_error) + __PYX_ERR(0, 760, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":752 + /* "pycrfsuite/_pycrfsuite.pyx":759 * raise ValueError("Invalid model") * * if len(value) < 48: # <<<<<<<<<<<<<< @@ -10646,7 +11059,7 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_22_check_inmemory_m */ } - /* "pycrfsuite/_pycrfsuite.pyx":747 + /* "pycrfsuite/_pycrfsuite.pyx":754 * raise ValueError("Model file %r doesn't have a complete header" % name) * * def _check_inmemory_model(self, bytes value): # <<<<<<<<<<<<<< @@ -10692,6 +11105,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_24__reduce_cython__ 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("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -10700,11 +11116,11 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_24__reduce_cython__ * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_tagger cannot be converted to a Python object for pickling") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 2, __pyx_L1_error) + __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< @@ -10747,6 +11163,9 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_26__setstate_cython 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("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -10754,11 +11173,11 @@ static PyObject *__pyx_pf_10pycrfsuite_11_pycrfsuite_6Tagger_26__setstate_cython * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_tagger cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 4, __pyx_L1_error) + __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -10789,6 +11208,9 @@ 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 @@ -10799,7 +11221,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_strin * cdef object __Pyx_PyUnicode_FromStringAndSize(const 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_ERR(0, 32, __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; @@ -10836,6 +11258,9 @@ 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 @@ -10846,7 +11271,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_stri * cdef object __Pyx_PyStr_FromStringAndSize(const 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_ERR(0, 38, __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; @@ -10883,6 +11308,9 @@ 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 @@ -10893,7 +11321,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(s * cdef object __Pyx_PyBytes_FromStringAndSize(const 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_ERR(0, 44, __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; @@ -10930,6 +11358,9 @@ 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 @@ -10940,7 +11371,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string * cdef object __Pyx_PyByteArray_FromStringAndSize(const 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_ERR(0, 50, __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; @@ -10977,6 +11408,9 @@ 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 @@ -10986,7 +11420,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_ERR(0, 56, __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; @@ -11025,6 +11459,9 @@ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v std::string __pyx_r; __Pyx_RefNannyDeclarations char const *__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":14 @@ -11043,7 +11480,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 == ((char const *)NULL))) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error) __pyx_v_data = __pyx_t_1; /* "string.from_py":16 @@ -11091,6 +11528,9 @@ 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":47 @@ -11104,26 +11544,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_ERR(0, 47, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(0, 47, __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, 47, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __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, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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(0, 47, __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, 47, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __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, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -11133,7 +11573,7 @@ static std::vector __pyx_convert_vector_from_py_std_3a__3a_string( PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 47, __pyx_L1_error) + else __PYX_ERR(1, 47, __pyx_L1_error) } break; } @@ -11149,7 +11589,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_ERR(0, 48, __pyx_L1_error) + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) __pyx_v_v.push_back(((std::string)__pyx_t_5)); /* "vector.from_py":47 @@ -11209,6 +11649,9 @@ static PyObject *__pyx_convert_vector_to_py_std_3a__3a_string(const std::vector< size_t __pyx_t_3; size_t __pyx_t_4; PyObject *__pyx_t_5 = 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":61 @@ -11219,15 +11662,15 @@ 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_ERR(0, 61, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_v_v.size(); __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - __pyx_t_5 = __pyx_convert_PyStr_string_to_py_std__in_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_5 = __pyx_convert_PyStr_string_to_py_std__in_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 61, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_r = __pyx_t_1; @@ -11926,6 +12369,7 @@ 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, __pyx_k_Error_opening_model, sizeof(__pyx_k_Error_opening_model), 0, 0, 1, 0}, {&__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_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}, @@ -11933,7 +12377,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_Invalid_model_incomplete_header, __pyx_k_Invalid_model_incomplete_header, sizeof(__pyx_k_Invalid_model_incomplete_header), 0, 0, 1, 0}, {&__pyx_n_s_ItemSequence, __pyx_k_ItemSequence, sizeof(__pyx_k_ItemSequence), 0, 0, 1, 1}, - {&__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}, @@ -11998,6 +12442,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}, @@ -12011,6 +12456,7 @@ 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}, @@ -12102,6 +12548,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}, @@ -12110,12 +12557,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 2, __pyx_L1_error) - __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(1, 289, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 335, __pyx_L1_error) - __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(1, 709, __pyx_L1_error) - __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(1, 720, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 61, __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_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __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, 716, __pyx_L1_error) + __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 727, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 61, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -12131,7 +12579,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_seq cannot be converted to a Python object for pickling") */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_self_c_seq_cannot_be_converted_t); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_self_c_seq_cannot_be_converted_t); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); @@ -12140,7 +12588,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_seq cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_self_c_seq_cannot_be_converted_t); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_self_c_seq_cannot_be_converted_t); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); @@ -12150,7 +12598,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); @@ -12159,49 +12607,49 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - /* "pycrfsuite/_pycrfsuite.pyx":589 + /* "pycrfsuite/_pycrfsuite.pyx":596 * cdef const char *v = value * if not self.c_tagger.open(v, len(value)): * raise ValueError("Error opening model") # <<<<<<<<<<<<<< * return contextlib.closing(self) * */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Error_opening_model); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 589, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Error_opening_model); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "pycrfsuite/_pycrfsuite.pyx":720 + /* "pycrfsuite/_pycrfsuite.pyx":727 * try: * self.c_tagger.dump(fd) * with open(name, 'rb') as f: # <<<<<<<<<<<<<< * for line in f: * parser.feed(line.decode('utf8')) */ - __pyx_tuple__7 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 720, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 727, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "pycrfsuite/_pycrfsuite.pyx":750 + /* "pycrfsuite/_pycrfsuite.pyx":757 * magic = value[:4] * if magic != b'lCRF': * raise ValueError("Invalid model") # <<<<<<<<<<<<<< * * if len(value) < 48: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Invalid_model); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Invalid_model); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 757, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - /* "pycrfsuite/_pycrfsuite.pyx":753 + /* "pycrfsuite/_pycrfsuite.pyx":760 * * if len(value) < 48: * raise ValueError("Invalid model: incomplete header") # <<<<<<<<<<<<<< */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Invalid_model_incomplete_header); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 753, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Invalid_model_incomplete_header); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); @@ -12211,7 +12659,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_tagger cannot be converted to a Python object for pickling") */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_self_c_tagger_cannot_be_converte); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_self_c_tagger_cannot_be_converte); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); @@ -12220,7 +12668,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_tagger cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_self_c_tagger_cannot_be_converte); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_self_c_tagger_cannot_be_converte); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); @@ -12231,142 +12679,142 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.code = code * Exception.__init__(self._messages.get(self.code, "Unexpected error")) */ - __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_code); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 32, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_code); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_init, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(1, 32, __pyx_L1_error) + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_init, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 32, __pyx_L1_error) - /* "pycrfsuite/_pycrfsuite.pyx":197 + /* "pycrfsuite/_pycrfsuite.pyx":204 * * * def _intbool(txt): # <<<<<<<<<<<<<< * return bool(int(txt)) * */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_txt); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 197, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_txt); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_intbool, 197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(1, 197, __pyx_L1_error) + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_intbool, 204, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __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__17 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 495, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_before_train, 495, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(1, 495, __pyx_L1_error) + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_before_train, 502, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __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__19 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_event, __pyx_n_s_log); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 498, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_event, __pyx_n_s_log); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_message, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(1, 498, __pyx_L1_error) + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_message, 505, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __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__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 524, __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, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_start, 524, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(1, 524, __pyx_L1_error) + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_start, 531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __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__23 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_log, __pyx_n_s_percent); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 527, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_log, __pyx_n_s_percent); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_featgen_progress, 527, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(1, 527, __pyx_L1_error) + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_featgen_progress, 534, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __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__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 530, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_featgen_end, 530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(1, 530, __pyx_L1_error) + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_featgen_end, 537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __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__27 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 533, __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, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_prepared, 533, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(1, 533, __pyx_L1_error) + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_prepared, 540, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __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__29 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 536, __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, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_prepare_error, 536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(1, 536, __pyx_L1_error) + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_prepare_error, 543, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __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__31 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_log, __pyx_n_s_info); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 539, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_log, __pyx_n_s_info); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_iteration, 539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(1, 539, __pyx_L1_error) + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_iteration, 546, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __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__33 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 542, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_optimization_end, 542, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(1, 542, __pyx_L1_error) + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_optimization_end, 549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __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__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 545, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_log); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_end, 545, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(1, 545, __pyx_L1_error) + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pycrfsuite__pycrfsuite_pyx, __pyx_n_s_on_end, 552, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -12375,10 +12823,11 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { } static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_int_48 = PyInt_FromLong(48); if (unlikely(!__pyx_int_48)) __PYX_ERR(1, 1, __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; @@ -12418,45 +12867,48 @@ static int __Pyx_modinit_function_export_code(void) { static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) __PYX_ERR(1, 113, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) __PYX_ERR(0, 120, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence.tp_dictoffset && __pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ItemSequence, (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) __PYX_ERR(1, 113, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) __PYX_ERR(1, 113, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ItemSequence, (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_ItemSequence) < 0) __PYX_ERR(0, 120, __pyx_L1_error) + if (__Pyx_setup_reduce((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_ERR(1, 201, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) __PYX_ERR(0, 208, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer.tp_dictoffset && __pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer.tp_dict, __pyx_vtabptr_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) __PYX_ERR(1, 201, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BaseTrainer, (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) __PYX_ERR(1, 201, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) __PYX_ERR(1, 201, __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_SetAttr(__pyx_m, __pyx_n_s_BaseTrainer, (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_BaseTrainer) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (__Pyx_setup_reduce((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_ERR(1, 549, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger) < 0) __PYX_ERR(0, 556, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_10pycrfsuite_11_pycrfsuite_Tagger.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger.tp_dictoffset && __pyx_type_10pycrfsuite_11_pycrfsuite_Tagger.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_10pycrfsuite_11_pycrfsuite_Tagger.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger.tp_dict, __pyx_vtabptr_10pycrfsuite_11_pycrfsuite_Tagger) < 0) __PYX_ERR(1, 549, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Tagger, (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger) < 0) __PYX_ERR(1, 549, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger) < 0) __PYX_ERR(1, 549, __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_SetAttr(__pyx_m, __pyx_n_s_Tagger, (PyObject *)&__pyx_type_10pycrfsuite_11_pycrfsuite_Tagger) < 0) __PYX_ERR(0, 556, __pyx_L1_error) + if (__Pyx_setup_reduce((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_ERR(1, 392, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params) < 0) __PYX_ERR(0, 399, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params.tp_print = 0; #endif @@ -12464,7 +12916,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct__get_params.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __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_ERR(1, 403, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 410, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_10pycrfsuite_11_pycrfsuite___pyx_scope_struct_1_genexpr.tp_print = 0; #endif @@ -12504,17 +12956,19 @@ static int __Pyx_modinit_function_import_code(void) { } -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else +#ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void #endif #else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif @@ -12601,6 +13055,9 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__pycrfsuite(PyObject *__pyx_pyinit 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_PEP489_MULTI_PHASE_INIT if (__pyx_m) { @@ -12621,30 +13078,30 @@ if (!__Pyx_RefNanny) { } #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__pycrfsuite(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pxy_PyFrame_Initialize_Offsets __Pxy_PyFrame_Initialize_Offsets(); #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 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_ERR(1, 1, __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_ERR(1, 1, __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_ERR(1, 1, __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_ERR(1, 1, __pyx_L1_error) + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -12663,46 +13120,46 @@ if (!__Pyx_RefNanny) { #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 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_ERR(1, 1, __pyx_L1_error) + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __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_ERR(1, 1, __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_ERR(1, 1, __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_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __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_ERR(1, 1, __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_ERR(1, 1, __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) goto __pyx_L1_error; + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error; + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; + if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_type_import_code(); (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /* "pycrfsuite/_pycrfsuite.pyx":9 @@ -12712,9 +13169,9 @@ if (!__Pyx_RefNanny) { * import os * import contextlib */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __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_ERR(1, 9, __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 @@ -12724,9 +13181,9 @@ if (!__Pyx_RefNanny) { * import contextlib * import tempfile */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __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_ERR(1, 10, __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 @@ -12736,9 +13193,9 @@ if (!__Pyx_RefNanny) { * import tempfile * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_contextlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __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_ERR(1, 11, __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 @@ -12748,9 +13205,9 @@ if (!__Pyx_RefNanny) { * * from pycrfsuite import _dumpparser */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_tempfile, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __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_ERR(1, 12, __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 @@ -12758,19 +13215,19 @@ if (!__Pyx_RefNanny) { * * 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_ERR(1, 14, __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_ERR(1, 14, __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_ERR(1, 14, __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_ERR(1, 14, __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; @@ -12778,50 +13235,71 @@ if (!__Pyx_RefNanny) { * * 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_ERR(1, 15, __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_ERR(1, 15, __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_ERR(1, 15, __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_ERR(1, 15, __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_ERR(1, 17, __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_ERR(1, 17, __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_ERR(1, 20, __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(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __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_ERR(1, 20, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __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 @@ -12831,11 +13309,11 @@ if (!__Pyx_RefNanny) { * crfsuite_api.CRFSUITEERR_OUTOFMEMORY: "Insufficient memory", * crfsuite_api.CRFSUITEERR_NOTSUPPORTED: "Unsupported operation", */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 23, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(7); 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_ERR(1, 23, __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_ERR(1, 23, __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 @@ -12845,9 +13323,9 @@ if (!__Pyx_RefNanny) { * 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_ERR(1, 24, __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_ERR(1, 23, __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 @@ -12857,9 +13335,9 @@ if (!__Pyx_RefNanny) { * 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_ERR(1, 25, __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_ERR(1, 23, __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 @@ -12869,9 +13347,9 @@ if (!__Pyx_RefNanny) { * 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_ERR(1, 26, __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_ERR(1, 23, __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 @@ -12881,9 +13359,9 @@ if (!__Pyx_RefNanny) { * 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_ERR(1, 27, __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_ERR(1, 23, __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 @@ -12893,9 +13371,9 @@ if (!__Pyx_RefNanny) { * crfsuite_api.CRFSUITEERR_NOTIMPLEMENTED: "Not implemented", * } */ - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_OVERFLOW); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 28, __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_ERR(1, 23, __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 @@ -12905,11 +13383,11 @@ if (!__Pyx_RefNanny) { * } * */ - __pyx_t_5 = __Pyx_PyInt_From_int(CRFSUITEERR_NOTIMPLEMENTED); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 29, __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_ERR(1, 23, __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 (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_4) < 0) __PYX_ERR(1, 22, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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 @@ -12919,25 +13397,25 @@ if (!__Pyx_RefNanny) { * 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__13)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 32, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__13)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(1, 32, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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_ERR(1, 20, __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_ERR(1, 20, __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 * @@ -12946,431 +13424,431 @@ if (!__Pyx_RefNanny) { * * cdef crfsuite_api.Item to_item(x) except+: */ - __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__14); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L1_error) + __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b__14); 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_ERR(1, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_intbool, __pyx_t_1) < 0) __PYX_ERR(1, 197, __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 = __Pyx_PyDict_NewPresized(23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_feature_minfreq, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(1, 224, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(23); 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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_intbool); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 225, __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_ERR(1, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_intbool); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __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_ERR(1, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 224, __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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_intbool); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_error_sensitive, __pyx_t_2) < 0) __PYX_ERR(1, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_intbool); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_averaging, __pyx_t_2) < 0) __PYX_ERR(1, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __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_ERR(1, 224, __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_ERR(1, 224, __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_ERR(1, 223, __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 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 250, __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_ERR(1, 250, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_pa, __pyx_kp_s_passive_aggressive) < 0) __PYX_ERR(1, 250, __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_ERR(1, 249, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); 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_ERR(1, 473, __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_ERR(1, 473, __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_ERR(1, 473, __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 (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_logparser_2, Py_None) < 0) __PYX_ERR(1, 493, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__18)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 495, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__18)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_before_train, __pyx_t_4) < 0) __PYX_ERR(1, 495, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__20)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 498, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pycrfsuite_11_pycrfsuite_7Trainer_3message, 0, __pyx_n_s_Trainer_message, NULL, __pyx_n_s_pycrfsuite__pycrfsuite, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_message, __pyx_t_4) < 0) __PYX_ERR(1, 498, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__22)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 524, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__22)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_on_start, __pyx_t_4) < 0) __PYX_ERR(1, 524, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__24)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 527, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__24)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_on_featgen_progress, __pyx_t_4) < 0) __PYX_ERR(1, 527, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 530, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_on_featgen_end, __pyx_t_4) < 0) __PYX_ERR(1, 530, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 533, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_on_prepared, __pyx_t_4) < 0) __PYX_ERR(1, 533, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__30)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 536, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__30)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_on_prepare_error, __pyx_t_4) < 0) __PYX_ERR(1, 536, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 539, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_on_iteration, __pyx_t_4) < 0) __PYX_ERR(1, 539, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 542, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_on_optimization_end, __pyx_t_4) < 0) __PYX_ERR(1, 542, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 545, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__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__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_on_end, __pyx_t_4) < 0) __PYX_ERR(1, 545, __pyx_L1_error) + if (__Pyx_SetNameInClass(__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_ERR(1, 473, __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_ERR(1, 473, __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 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __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_ERR(1, 1, __pyx_L1_error) - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); 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":60 * @@ -13516,7 +13994,7 @@ static int __Pyx_ParseOptionalKeywords( } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + if (likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { @@ -13543,7 +14021,7 @@ static int __Pyx_ParseOptionalKeywords( while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; @@ -13559,7 +14037,7 @@ static int __Pyx_ParseOptionalKeywords( while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; @@ -13885,6 +14363,191 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { } #endif +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyIntBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { + (void)inplace; + (void)zerodivision_check; + #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 + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a, x; +#ifdef HAVE_LONG_LONG + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla, llx; +#endif + 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; +#ifdef HAVE_LONG_LONG + } 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; +#endif + } + CYTHON_FALLTHROUGH; + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; +#ifdef HAVE_LONG_LONG + } 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; +#endif + } + CYTHON_FALLTHROUGH; + 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; +#ifdef HAVE_LONG_LONG + } 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; +#endif + } + CYTHON_FALLTHROUGH; + 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; +#ifdef HAVE_LONG_LONG + } 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; +#endif + } + CYTHON_FALLTHROUGH; + 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; +#ifdef HAVE_LONG_LONG + } 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; +#endif + } + CYTHON_FALLTHROUGH; + 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; +#ifdef HAVE_LONG_LONG + } 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; +#endif + } + CYTHON_FALLTHROUGH; + default: return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + } + x = a + b; + return PyLong_FromLong(x); +#ifdef HAVE_LONG_LONG + long_long: + llx = lla + llb; + return PyLong_FromLongLong(llx); +#endif + + + } + #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, @@ -13901,9 +14564,9 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( } if (stop > length) stop = length; + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_empty_unicode); length = stop - start; - if (unlikely(length <= 0)) - return PyUnicode_FromUnicode(NULL, 0); cstring += start; if (decode_func) { return decode_func(cstring, length, errors); @@ -14157,67 +14820,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { } #endif -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, @@ -14809,6 +15411,28 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam } #endif +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; @@ -14854,15 +15478,23 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { #endif reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD; - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD; - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } } PyType_Modified((PyTypeObject*)type_obj); } @@ -14933,7 +15565,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { { #if PY_MAJOR_VERSION >= 3 if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); if (!module) { @@ -15060,7 +15692,7 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { goto done; } -/* CythonFunction */ +/* CythonFunctionShared */ #include static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) @@ -15367,10 +15999,9 @@ static PyMethodDef __pyx_CyFunction_methods[] = { #else #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) #endif -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + if (unlikely(op == NULL)) return NULL; op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; @@ -15391,12 +16022,12 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f Py_XINCREF(code); op->func_code = code; op->defaults_pyobjects = 0; + op->defaults_size = 0; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; - PyObject_GC_Track(op); return (PyObject *) op; } static int @@ -15459,6 +16090,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, } static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) { +#if PY_MAJOR_VERSION < 3 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { Py_INCREF(func); @@ -15471,6 +16103,7 @@ static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObj } if (obj == Py_None) obj = NULL; +#endif return __Pyx_PyMethod_New(func, obj, type); } static PyObject* @@ -15644,6 +16277,7 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t return PyErr_NoMemory(); memset(m->defaults, 0, size); m->defaults_pyobjects = pyobjects; + m->defaults_size = size; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { @@ -15662,6 +16296,19 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py Py_INCREF(dict); } +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + /* Py3ClassCreate */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { @@ -15731,7 +16378,7 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON @@ -15835,7 +16482,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } diff --git a/pycrfsuite/_pycrfsuite.pyx b/pycrfsuite/_pycrfsuite.pyx index 989b54f..eb08000 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