/* Generated by Cython 0.9.8.1.1 on Thu Sep 18 16:14:47 2008 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #include "structmember.h" #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; Py_ssize_t len; int readonly; const char *format; int ndim; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; Py_ssize_t itemsize; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_LOCK 0x0002 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyBytes_Type #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define PyBytes_Type PyString_Type #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #else #define _USE_MATH_DEFINES #endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #include #define __PYX_HAVE_API__Stemmer #include "libstemmer.h" #ifdef __GNUC__ #define INLINE __inline__ #elif _WIN32 #define INLINE __inline #else #define INLINE #endif typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ static int __pyx_skip_dispatch = 0; /* Type Conversion Predeclarations */ #if PY_MAJOR_VERSION < 3 #define __Pyx_PyBytes_FromString PyString_FromString #define __Pyx_PyBytes_AsString PyString_AsString #else #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_AsString PyBytes_AsString #endif #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static INLINE int __Pyx_PyObject_IsTrue(PyObject* x); static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x); static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x); static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b); #define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x)) #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x); static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x); static INLINE char __pyx_PyInt_char(PyObject* x); static INLINE short __pyx_PyInt_short(PyObject* x); static INLINE int __pyx_PyInt_int(PyObject* x); static INLINE long __pyx_PyInt_long(PyObject* x); static INLINE signed char __pyx_PyInt_signed_char(PyObject* x); static INLINE signed short __pyx_PyInt_signed_short(PyObject* x); static INLINE signed int __pyx_PyInt_signed_int(PyObject* x); static INLINE signed long __pyx_PyInt_signed_long(PyObject* x); static INLINE long double __pyx_PyInt_long_double(PyObject* x); #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char **__pyx_f; static INLINE void __Pyx_RaiseArgtupleTooLong(Py_ssize_t num_expected, Py_ssize_t num_found); /*proto*/ static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { if (PyList_Append(L, x) < 0) return NULL; Py_INCREF(Py_None); return Py_None; // this is just to have an accurate signature } else { return PyObject_CallMethod(L, "append", "(O)", x); } } static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) { PyObject *r; if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned)) r = PySequence_GetItem(o, i); else { PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); if (!j) return 0; r = PyObject_GetItem(o, j); Py_DECREF(j); } return r; } static INLINE int __Pyx_SetItemInt(PyObject *o, Py_ssize_t i, PyObject *v, int is_unsigned) { int r; if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { Py_DECREF(PyList_GET_ITEM(o, i)); Py_INCREF(v); PyList_SET_ITEM(o, i, v); return 1; } else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0) || !is_unsigned)) r = PySequence_SetItem(o, i, v); else { PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); if (!j) return -1; r = PyObject_SetItem(o, j, v); Py_DECREF(j); } return r; } static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_AddTraceback(const char *funcname); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Type declarations */ /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":77 * return '1.0.1' * * cdef class Stemmer: # <<<<<<<<<<<<<< * """An instance of a stemming algorithm. * */ struct __pyx_obj_7Stemmer_Stemmer { PyObject_HEAD struct sb_stemmer *cobj; PyObject *cache; PyObject *counter; int max_cache_size; }; /* Module declarations from Stemmer */ static PyTypeObject *__pyx_ptype_7Stemmer_Stemmer = 0; /* Implementation of Stemmer */ static char __pyx_k_1[] = "Maximum number of entries to allow in the cache.\n\n This may be set to zero to disable the cache entirely.\n\n The maximum cache size may be set at any point - setting the\n maximum size will purge entries from the cache if the new maximum\n size is smaller than the current size.\n\n "; static char __pyx_k_2[] = "restructuredtext en"; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static char __pyx_k___init__[] = "__init__"; static PyObject *__pyx_kp___init__; static char __pyx_k___dealloc__[] = "__dealloc__"; static PyObject *__pyx_kp___dealloc__; static char __pyx_k___purgeCache[] = "__purgeCache"; static PyObject *__pyx_kp___purgeCache; static char __pyx_k_stemWord[] = "stemWord"; static PyObject *__pyx_kp_stemWord; static char __pyx_k_stemWords[] = "stemWords"; static PyObject *__pyx_kp_stemWords; static char __pyx_k___docformat__[] = "__docformat__"; static PyObject *__pyx_kp___docformat__; static char __pyx_k_append[] = "append"; static PyObject *__pyx_kp_append; static char __pyx_k_KeyError[] = "KeyError"; static PyObject *__pyx_kp_KeyError; static char __pyx_k_iteritems[] = "iteritems"; static PyObject *__pyx_kp_iteritems; static char __pyx_k_encode[] = "encode"; static PyObject *__pyx_kp_encode; static char __pyx_k_decode[] = "decode"; static PyObject *__pyx_kp_decode; static PyObject *__pyx_kp_2; static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_kp_3; static char __pyx_k_3[] = "1.0.1"; static PyObject *__pyx_kp_5; static char __pyx_k_4[] = "UTF_8"; static char __pyx_k_5[] = "Stemming algorithm '%s' not found"; static PyObject *__pyx_kp_6; static PyObject *__pyx_kp_7; static char __pyx_k_6[] = "utf-8"; static char __pyx_k_7[] = "utf-8"; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":43 * cdef int sb_stemmer_length(sb_stemmer * stemmer) * * def algorithms(): # <<<<<<<<<<<<<< * """Get a list of the names of the available stemming algorithms. * */ static PyObject *__pyx_pf_7Stemmer_algorithms(PyObject *__pyx_self, PyObject *unused); /*proto*/ static char __pyx_doc_7Stemmer_algorithms[] = "Get a list of the names of the available stemming algorithms.\n \n Note that there are also aliases for these algorithm names, which are\n not included in this list. This list is guaranteed to contain\n precisely one entry for each available stemming algorithm.\n\n Note that the the classic Porter stemming algorithm for English is\n available by default: although this has been superceded by an improved\n algorithm, the original algorithm may be of interest to information\n retrieval researchers wishing to reproduce results of earlier\n experiments. Most users will want to use the \"english\" algorithm,\n instead of the \"porter\" algorithm.\n\n "; static PyObject *__pyx_pf_7Stemmer_algorithms(PyObject *__pyx_self, PyObject *unused) { char **__pyx_v_algs; int __pyx_v_i; PyObject *__pyx_v_py_algs; PyObject *__pyx_r; PyObject *__pyx_1 = 0; int __pyx_2; PyObject *__pyx_3 = 0; __pyx_self = __pyx_self; __pyx_v_py_algs = Py_None; Py_INCREF(Py_None); /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":60 * cdef char ** algs * cdef int i * py_algs = [] # <<<<<<<<<<<<<< * algs = sb_stemmer_list() * i = 0 */ __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_py_algs); __pyx_v_py_algs = ((PyObject *)__pyx_1); __pyx_1 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":61 * cdef int i * py_algs = [] * algs = sb_stemmer_list() # <<<<<<<<<<<<<< * i = 0 * while algs[i] != NULL: */ __pyx_v_algs = sb_stemmer_list(); /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":62 * py_algs = [] * algs = sb_stemmer_list() * i = 0 # <<<<<<<<<<<<<< * while algs[i] != NULL: * py_algs.append(algs[i]) */ __pyx_v_i = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":63 * algs = sb_stemmer_list() * i = 0 * while algs[i] != NULL: # <<<<<<<<<<<<<< * py_algs.append(algs[i]) * i = i + 1 */ while (1) { __pyx_2 = ((__pyx_v_algs[__pyx_v_i]) != NULL); if (!__pyx_2) break; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":64 * i = 0 * while algs[i] != NULL: * py_algs.append(algs[i]) # <<<<<<<<<<<<<< * i = i + 1 * return py_algs */ __pyx_1 = __Pyx_PyBytes_FromString((__pyx_v_algs[__pyx_v_i])); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = __Pyx_PyObject_Append(__pyx_v_py_algs, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":65 * while algs[i] != NULL: * py_algs.append(algs[i]) * i = i + 1 # <<<<<<<<<<<<<< * return py_algs * */ __pyx_v_i = (__pyx_v_i + 1); } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":66 * py_algs.append(algs[i]) * i = i + 1 * return py_algs # <<<<<<<<<<<<<< * * def version(): */ Py_INCREF(__pyx_v_py_algs); __pyx_r = __pyx_v_py_algs; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("Stemmer.algorithms"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_py_algs); return __pyx_r; } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":68 * return py_algs * * def version(): # <<<<<<<<<<<<<< * """Get the version string of the stemming module. * */ static PyObject *__pyx_pf_7Stemmer_version(PyObject *__pyx_self, PyObject *unused); /*proto*/ static char __pyx_doc_7Stemmer_version[] = "Get the version string of the stemming module.\n\n This version number is for the Stemmer module as a whole (not for an\n individual stemming algorithm).\n\n "; static PyObject *__pyx_pf_7Stemmer_version(PyObject *__pyx_self, PyObject *unused) { PyObject *__pyx_r; __pyx_self = __pyx_self; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":75 * * """ * return '1.0.1' # <<<<<<<<<<<<<< * * cdef class Stemmer: */ Py_INCREF(__pyx_kp_3); __pyx_r = __pyx_kp_3; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); __pyx_L0:; return __pyx_r; } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":110 * cdef int max_cache_size * * def __init__ (self, algorithm, int maxCacheSize = 10000): # <<<<<<<<<<<<<< * """Initialise a stemmer. * */ static int __pyx_pf_7Stemmer_7Stemmer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7Stemmer_7Stemmer___init__[] = "Initialise a stemmer.\n\n See the class documentation for details.\n\n "; static int __pyx_pf_7Stemmer_7Stemmer___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_algorithm = 0; int __pyx_v_maxCacheSize; int __pyx_r; char *__pyx_1; int __pyx_2; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; static char *__pyx_argnames[] = {"algorithm","maxCacheSize",0}; __pyx_v_maxCacheSize = 10000; if (likely(!__pyx_kwds) && likely(1 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 2)) { __pyx_v_algorithm = PyTuple_GET_ITEM(__pyx_args, 0); if (PyTuple_GET_SIZE(__pyx_args) > 1) { __pyx_v_maxCacheSize = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_maxCacheSize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|i", __pyx_argnames, &__pyx_v_algorithm, &__pyx_v_maxCacheSize))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4; __pyx_L3_error:; __Pyx_AddTraceback("Stemmer.Stemmer.__init__"); return -1; __pyx_L4:; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":116 * * """ * self.cobj = sb_stemmer_new(algorithm, 'UTF_8') # <<<<<<<<<<<<<< * if self.cobj == NULL: * raise KeyError("Stemming algorithm '%s' not found" % algorithm) */ __pyx_1 = __Pyx_PyBytes_AsString(__pyx_v_algorithm); if (unlikely((!__pyx_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cobj = sb_stemmer_new(__pyx_1, __pyx_k_4); /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":117 * """ * self.cobj = sb_stemmer_new(algorithm, 'UTF_8') * if self.cobj == NULL: # <<<<<<<<<<<<<< * raise KeyError("Stemming algorithm '%s' not found" % algorithm) * self.max_cache_size = maxCacheSize */ __pyx_2 = (((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cobj == NULL); if (__pyx_2) { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":118 * self.cobj = sb_stemmer_new(algorithm, 'UTF_8') * if self.cobj == NULL: * raise KeyError("Stemming algorithm '%s' not found" % algorithm) # <<<<<<<<<<<<<< * self.max_cache_size = maxCacheSize * self.counter = 0 */ __pyx_3 = PyNumber_Remainder(__pyx_kp_5, __pyx_v_algorithm); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3); __pyx_3 = 0; __pyx_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":119 * if self.cobj == NULL: * raise KeyError("Stemming algorithm '%s' not found" % algorithm) * self.max_cache_size = maxCacheSize # <<<<<<<<<<<<<< * self.counter = 0 * self.cache = {} */ ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->max_cache_size = __pyx_v_maxCacheSize; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":120 * raise KeyError("Stemming algorithm '%s' not found" % algorithm) * self.max_cache_size = maxCacheSize * self.counter = 0 # <<<<<<<<<<<<<< * self.cache = {} * */ Py_INCREF(__pyx_int_0); Py_DECREF(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter); ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter = __pyx_int_0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":121 * self.max_cache_size = maxCacheSize * self.counter = 0 * self.cache = {} # <<<<<<<<<<<<<< * * def __dealloc__ (self): */ __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache); ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache = ((PyObject *)__pyx_4); __pyx_4 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("Stemmer.Stemmer.__init__"); __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":123 * self.cache = {} * * def __dealloc__ (self): # <<<<<<<<<<<<<< * sb_stemmer_delete(self.cobj) * */ static void __pyx_pf_7Stemmer_7Stemmer___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_7Stemmer_7Stemmer___dealloc__(PyObject *__pyx_v_self) { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":124 * * def __dealloc__ (self): * sb_stemmer_delete(self.cobj) # <<<<<<<<<<<<<< * * property maxCacheSize: */ sb_stemmer_delete(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cobj); } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":136 * * """ * def __set__(self, int size): # <<<<<<<<<<<<<< * self.max_cache_size = size * if size == 0: */ static int __pyx_pf_7Stemmer_7Stemmer_12maxCacheSize___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/ static int __pyx_pf_7Stemmer_7Stemmer_12maxCacheSize___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) { int __pyx_v_size; int __pyx_r; int __pyx_1; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; assert(__pyx_arg_size); { __pyx_v_size = __pyx_PyInt_int(__pyx_arg_size); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4; __pyx_L3_error:; __Pyx_AddTraceback("Stemmer.Stemmer.maxCacheSize.__set__"); return -1; __pyx_L4:; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":137 * """ * def __set__(self, int size): * self.max_cache_size = size # <<<<<<<<<<<<<< * if size == 0: * self.cache = {} */ ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->max_cache_size = __pyx_v_size; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":138 * def __set__(self, int size): * self.max_cache_size = size * if size == 0: # <<<<<<<<<<<<<< * self.cache = {} * self.counter = 0 */ __pyx_1 = (__pyx_v_size == 0); if (__pyx_1) { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":139 * self.max_cache_size = size * if size == 0: * self.cache = {} # <<<<<<<<<<<<<< * self.counter = 0 * else: */ __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache); ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache = ((PyObject *)__pyx_2); __pyx_2 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":140 * if size == 0: * self.cache = {} * self.counter = 0 # <<<<<<<<<<<<<< * else: * self.__purgeCache() */ Py_INCREF(__pyx_int_0); Py_DECREF(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter); ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter = __pyx_int_0; goto __pyx_L5; } /*else*/ { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":142 * self.counter = 0 * else: * self.__purgeCache() # <<<<<<<<<<<<<< * def __get__(self): * return self.max_cache_size */ __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___purgeCache); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; } __pyx_L5:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("Stemmer.Stemmer.maxCacheSize.__set__"); __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":143 * else: * self.__purgeCache() * def __get__(self): # <<<<<<<<<<<<<< * return self.max_cache_size * */ static PyObject *__pyx_pf_7Stemmer_7Stemmer_12maxCacheSize___get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_7Stemmer_7Stemmer_12maxCacheSize___get__(PyObject *__pyx_v_self) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":144 * self.__purgeCache() * def __get__(self): * return self.max_cache_size # <<<<<<<<<<<<<< * * def __purgeCache (self): */ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->max_cache_size); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_1; __pyx_1 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); __Pyx_AddTraceback("Stemmer.Stemmer.maxCacheSize.__get__"); __pyx_r = NULL; __pyx_L0:; return __pyx_r; } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":146 * return self.max_cache_size * * def __purgeCache (self): # <<<<<<<<<<<<<< * if len(self.cache) < self.max_cache_size: * return */ static PyObject *__pyx_pf_7Stemmer_7Stemmer___purgeCache(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_7Stemmer_7Stemmer___purgeCache(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_v_newcache; PyObject *__pyx_v_mincounter; PyObject *__pyx_v_word; PyObject *__pyx_v_cacheditem; PyObject *__pyx_r; Py_ssize_t __pyx_1 = 0; int __pyx_2; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; PyObject *__pyx_6 = 0; __pyx_v_newcache = Py_None; Py_INCREF(Py_None); __pyx_v_mincounter = Py_None; Py_INCREF(Py_None); __pyx_v_word = Py_None; Py_INCREF(Py_None); __pyx_v_cacheditem = Py_None; Py_INCREF(Py_None); /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":147 * * def __purgeCache (self): * if len(self.cache) < self.max_cache_size: # <<<<<<<<<<<<<< * return * newcache = {} */ __pyx_1 = PyObject_Length(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache); if (unlikely(__pyx_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = (__pyx_1 < ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->max_cache_size); if (__pyx_2) { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":148 * def __purgeCache (self): * if len(self.cache) < self.max_cache_size: * return # <<<<<<<<<<<<<< * newcache = {} * mincounter = self.counter - int(self.max_cache_size * 8 / 10) */ __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":149 * if len(self.cache) < self.max_cache_size: * return * newcache = {} # <<<<<<<<<<<<<< * mincounter = self.counter - int(self.max_cache_size * 8 / 10) * for (word, cacheditem) in self.cache.iteritems(): */ __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_newcache); __pyx_v_newcache = ((PyObject *)__pyx_3); __pyx_3 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":150 * return * newcache = {} * mincounter = self.counter - int(self.max_cache_size * 8 / 10) # <<<<<<<<<<<<<< * for (word, cacheditem) in self.cache.iteritems(): * if cacheditem[1] > mincounter: */ __pyx_3 = PyInt_FromLong(((((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->max_cache_size * 8) / 10)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3); __pyx_3 = 0; __pyx_3 = PyObject_Call(((PyObject*)&PyInt_Type), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; __pyx_4 = PyNumber_Subtract(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_v_mincounter); __pyx_v_mincounter = __pyx_4; __pyx_4 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":151 * newcache = {} * mincounter = self.counter - int(self.max_cache_size * 8 / 10) * for (word, cacheditem) in self.cache.iteritems(): # <<<<<<<<<<<<<< * if cacheditem[1] > mincounter: * newcache[word] = cacheditem */ __pyx_3 = PyObject_GetAttr(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache, __pyx_kp_iteritems); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; if (PyList_CheckExact(__pyx_4) || PyTuple_CheckExact(__pyx_4)) { __pyx_1 = 0; __pyx_3 = __pyx_4; Py_INCREF(__pyx_3); } else { __pyx_1 = -1; __pyx_3 = PyObject_GetIter(__pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } Py_DECREF(__pyx_4); __pyx_4 = 0; for (;;) { if (likely(PyList_CheckExact(__pyx_3))) { if (__pyx_1 >= PyList_GET_SIZE(__pyx_3)) break; __pyx_4 = PyList_GET_ITEM(__pyx_3, __pyx_1); Py_INCREF(__pyx_4); __pyx_1++; } else if (likely(PyTuple_CheckExact(__pyx_3))) { if (__pyx_1 >= PyTuple_GET_SIZE(__pyx_3)) break; __pyx_4 = PyTuple_GET_ITEM(__pyx_3, __pyx_1); Py_INCREF(__pyx_4); __pyx_1++; } else { __pyx_4 = PyIter_Next(__pyx_3); if (!__pyx_4) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } } if (PyTuple_CheckExact(__pyx_4) && PyTuple_GET_SIZE(__pyx_4) == 2) { PyObject* tuple = __pyx_4; __pyx_6 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(__pyx_6); Py_DECREF(__pyx_v_word); __pyx_v_word = __pyx_6; __pyx_6 = 0; __pyx_6 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(__pyx_6); Py_DECREF(__pyx_v_cacheditem); __pyx_v_cacheditem = __pyx_6; __pyx_6 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; } else { __pyx_5 = PyObject_GetIter(__pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_6 = __Pyx_UnpackItem(__pyx_5, 0); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_word); __pyx_v_word = __pyx_6; __pyx_6 = 0; __pyx_6 = __Pyx_UnpackItem(__pyx_5, 1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_cacheditem); __pyx_v_cacheditem = __pyx_6; __pyx_6 = 0; if (__Pyx_EndUnpack(__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_5); __pyx_5 = 0; } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":152 * mincounter = self.counter - int(self.max_cache_size * 8 / 10) * for (word, cacheditem) in self.cache.iteritems(): * if cacheditem[1] > mincounter: # <<<<<<<<<<<<<< * newcache[word] = cacheditem * self.cache = newcache */ __pyx_6 = __Pyx_GetItemInt(__pyx_v_cacheditem, 1, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyObject_RichCompare(__pyx_6, __pyx_v_mincounter, Py_GT); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_6); __pyx_6 = 0; __pyx_2 = __Pyx_PyObject_IsTrue(__pyx_4); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_4); __pyx_4 = 0; if (__pyx_2) { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":153 * for (word, cacheditem) in self.cache.iteritems(): * if cacheditem[1] > mincounter: * newcache[word] = cacheditem # <<<<<<<<<<<<<< * self.cache = newcache * */ if (PyObject_SetItem(__pyx_v_newcache, __pyx_v_word, __pyx_v_cacheditem) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; } Py_DECREF(__pyx_3); __pyx_3 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":154 * if cacheditem[1] > mincounter: * newcache[word] = cacheditem * self.cache = newcache # <<<<<<<<<<<<<< * * def stemWord (self, word): */ Py_INCREF(__pyx_v_newcache); Py_DECREF(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache); ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache = __pyx_v_newcache; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); Py_XDECREF(__pyx_6); __Pyx_AddTraceback("Stemmer.Stemmer.__purgeCache"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_newcache); Py_DECREF(__pyx_v_mincounter); Py_DECREF(__pyx_v_word); Py_DECREF(__pyx_v_cacheditem); return __pyx_r; } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":156 * self.cache = newcache * * def stemWord (self, word): # <<<<<<<<<<<<<< * """Stem a word. * */ static PyObject *__pyx_pf_7Stemmer_7Stemmer_stemWord(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ static char __pyx_doc_7Stemmer_7Stemmer_stemWord[] = "Stem a word.\n\n This takes a single argument, ``word``, which should either be a UTF-8\n encoded string, or a unicode object.\n\n The result is the stemmed form of the word. If the word supplied\n was a unicode object, the result will be a unicode object: if the\n word supplied was a string, the result will be a UTF-8 encoded\n string.\n\n "; static PyObject *__pyx_pf_7Stemmer_7Stemmer_stemWord(PyObject *__pyx_v_self, PyObject *__pyx_v_word) { char *__pyx_v_c_word; PyObject *__pyx_v_was_unicode; PyObject *__pyx_v_cacheditem; PyObject *__pyx_v_result; PyObject *__pyx_v_length; PyObject *__pyx_r; int __pyx_1; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; int __pyx_5; char *__pyx_6; Py_ssize_t __pyx_7 = 0; PyObject *__pyx_8 = 0; PyObject *__pyx_9 = 0; Py_INCREF(__pyx_v_word); __pyx_v_was_unicode = Py_None; Py_INCREF(Py_None); __pyx_v_cacheditem = Py_None; Py_INCREF(Py_None); __pyx_v_result = Py_None; Py_INCREF(Py_None); __pyx_v_length = Py_None; Py_INCREF(Py_None); /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":169 * """ * cdef char * c_word * was_unicode = 0 # <<<<<<<<<<<<<< * if isinstance(word, unicode): * was_unicode = 1 */ Py_INCREF(__pyx_int_0); Py_DECREF(__pyx_v_was_unicode); __pyx_v_was_unicode = __pyx_int_0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":170 * cdef char * c_word * was_unicode = 0 * if isinstance(word, unicode): # <<<<<<<<<<<<<< * was_unicode = 1 * word = word.encode('utf-8'); */ __pyx_1 = PyObject_IsInstance(__pyx_v_word, ((PyObject*)&PyUnicode_Type)); if (unlikely(__pyx_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_1) { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":171 * was_unicode = 0 * if isinstance(word, unicode): * was_unicode = 1 # <<<<<<<<<<<<<< * word = word.encode('utf-8'); * */ Py_INCREF(__pyx_int_1); Py_DECREF(__pyx_v_was_unicode); __pyx_v_was_unicode = __pyx_int_1; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":172 * if isinstance(word, unicode): * was_unicode = 1 * word = word.encode('utf-8'); # <<<<<<<<<<<<<< * * if self.max_cache_size > 0: */ __pyx_2 = PyObject_GetAttr(__pyx_v_word, __pyx_kp_encode); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_kp_6); PyTuple_SET_ITEM(__pyx_3, 0, __pyx_kp_6); __pyx_4 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; Py_DECREF(__pyx_v_word); __pyx_v_word = __pyx_4; __pyx_4 = 0; goto __pyx_L5; } __pyx_L5:; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":174 * word = word.encode('utf-8'); * * if self.max_cache_size > 0: # <<<<<<<<<<<<<< * try: * cacheditem = self.cache[word] */ __pyx_1 = (((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->max_cache_size > 0); if (__pyx_1) { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":175 * * if self.max_cache_size > 0: * try: # <<<<<<<<<<<<<< * cacheditem = self.cache[word] * result = cacheditem[0] */ /*try:*/ { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":176 * if self.max_cache_size > 0: * try: * cacheditem = self.cache[word] # <<<<<<<<<<<<<< * result = cacheditem[0] * cacheditem[1] = self.counter */ __pyx_2 = PyObject_GetItem(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache, __pyx_v_word); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L7_error;} Py_DECREF(__pyx_v_cacheditem); __pyx_v_cacheditem = __pyx_2; __pyx_2 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":177 * try: * cacheditem = self.cache[word] * result = cacheditem[0] # <<<<<<<<<<<<<< * cacheditem[1] = self.counter * self.counter = self.counter + 1 */ __pyx_3 = __Pyx_GetItemInt(__pyx_v_cacheditem, 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L7_error;} Py_DECREF(__pyx_v_result); __pyx_v_result = __pyx_3; __pyx_3 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":178 * cacheditem = self.cache[word] * result = cacheditem[0] * cacheditem[1] = self.counter # <<<<<<<<<<<<<< * self.counter = self.counter + 1 * except KeyError: */ if (__Pyx_SetItemInt(__pyx_v_cacheditem, 1, ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L7_error;} /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":179 * result = cacheditem[0] * cacheditem[1] = self.counter * self.counter = self.counter + 1 # <<<<<<<<<<<<<< * except KeyError: * c_word = word */ __pyx_4 = PyNumber_Add(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter, __pyx_int_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L7_error;} Py_DECREF(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter); ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter = __pyx_4; __pyx_4 = 0; } goto __pyx_L8; __pyx_L7_error:; Py_XDECREF(__pyx_2); __pyx_2 = 0; Py_XDECREF(__pyx_3); __pyx_3 = 0; Py_XDECREF(__pyx_4); __pyx_4 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":180 * cacheditem[1] = self.counter * self.counter = self.counter + 1 * except KeyError: # <<<<<<<<<<<<<< * c_word = word * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) */ __pyx_5 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_5) { __Pyx_AddTraceback("Stemmer.stemWord"); if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":181 * self.counter = self.counter + 1 * except KeyError: * c_word = word # <<<<<<<<<<<<<< * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) * length = sb_stemmer_length(self.cobj) */ __pyx_6 = __Pyx_PyBytes_AsString(__pyx_v_word); if (unlikely((!__pyx_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_c_word = __pyx_6; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":182 * except KeyError: * c_word = word * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) # <<<<<<<<<<<<<< * length = sb_stemmer_length(self.cobj) * result = PyString_FromStringAndSize (c_word, length) */ __pyx_7 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_c_word = ((char *)sb_stemmer_stem(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cobj, ((sb_symbol *)__pyx_v_c_word), __pyx_7)); /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":183 * c_word = word * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) * length = sb_stemmer_length(self.cobj) # <<<<<<<<<<<<<< * result = PyString_FromStringAndSize (c_word, length) * self.cache[word] = [result, self.counter] */ __pyx_8 = PyInt_FromLong(sb_stemmer_length(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cobj)); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_length); __pyx_v_length = __pyx_8; __pyx_8 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":184 * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) * length = sb_stemmer_length(self.cobj) * result = PyString_FromStringAndSize (c_word, length) # <<<<<<<<<<<<<< * self.cache[word] = [result, self.counter] * self.counter = self.counter + 1 */ __pyx_5 = __pyx_PyInt_int(__pyx_v_length); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_8 = PyString_FromStringAndSize(__pyx_v_c_word, __pyx_5); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_result); __pyx_v_result = __pyx_8; __pyx_8 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":185 * length = sb_stemmer_length(self.cobj) * result = PyString_FromStringAndSize (c_word, length) * self.cache[word] = [result, self.counter] # <<<<<<<<<<<<<< * self.counter = self.counter + 1 * self.__purgeCache() */ __pyx_8 = PyList_New(2); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_result); PyList_SET_ITEM(__pyx_8, 0, __pyx_v_result); Py_INCREF(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter); PyList_SET_ITEM(__pyx_8, 1, ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter); if (PyObject_SetItem(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cache, __pyx_v_word, ((PyObject *)__pyx_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_8)); __pyx_8 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":186 * result = PyString_FromStringAndSize (c_word, length) * self.cache[word] = [result, self.counter] * self.counter = self.counter + 1 # <<<<<<<<<<<<<< * self.__purgeCache() * else: */ __pyx_8 = PyNumber_Add(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter, __pyx_int_1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter); ((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->counter = __pyx_8; __pyx_8 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":187 * self.cache[word] = [result, self.counter] * self.counter = self.counter + 1 * self.__purgeCache() # <<<<<<<<<<<<<< * else: * c_word = word */ __pyx_8 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___purgeCache); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_9 = PyObject_Call(__pyx_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_8); __pyx_8 = 0; Py_DECREF(__pyx_9); __pyx_9 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; goto __pyx_L8; } goto __pyx_L1_error; __pyx_L8:; goto __pyx_L6; } /*else*/ { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":189 * self.__purgeCache() * else: * c_word = word # <<<<<<<<<<<<<< * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) * length = sb_stemmer_length(self.cobj) */ __pyx_6 = __Pyx_PyBytes_AsString(__pyx_v_word); if (unlikely((!__pyx_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_c_word = __pyx_6; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":190 * else: * c_word = word * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) # <<<<<<<<<<<<<< * length = sb_stemmer_length(self.cobj) * result = PyString_FromStringAndSize (c_word, length) */ __pyx_7 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_c_word = ((char *)sb_stemmer_stem(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cobj, ((sb_symbol *)__pyx_v_c_word), __pyx_7)); /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":191 * c_word = word * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) * length = sb_stemmer_length(self.cobj) # <<<<<<<<<<<<<< * result = PyString_FromStringAndSize (c_word, length) * */ __pyx_8 = PyInt_FromLong(sb_stemmer_length(((struct __pyx_obj_7Stemmer_Stemmer *)__pyx_v_self)->cobj)); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_length); __pyx_v_length = __pyx_8; __pyx_8 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":192 * c_word = sb_stemmer_stem(self.cobj, c_word, len(word)) * length = sb_stemmer_length(self.cobj) * result = PyString_FromStringAndSize (c_word, length) # <<<<<<<<<<<<<< * * if was_unicode: */ __pyx_5 = __pyx_PyInt_int(__pyx_v_length); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_9 = PyString_FromStringAndSize(__pyx_v_c_word, __pyx_5); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_result); __pyx_v_result = __pyx_9; __pyx_9 = 0; } __pyx_L6:; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":194 * result = PyString_FromStringAndSize (c_word, length) * * if was_unicode: # <<<<<<<<<<<<<< * return result.decode('utf-8') * return result */ __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_was_unicode); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_1) { /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":195 * * if was_unicode: * return result.decode('utf-8') # <<<<<<<<<<<<<< * return result * */ __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_kp_decode); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_kp_7); PyTuple_SET_ITEM(__pyx_3, 0, __pyx_kp_7); __pyx_4 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; __pyx_r = __pyx_4; __pyx_4 = 0; goto __pyx_L0; goto __pyx_L9; } __pyx_L9:; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":196 * if was_unicode: * return result.decode('utf-8') * return result # <<<<<<<<<<<<<< * * def stemWords (self, words): */ Py_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_8); Py_XDECREF(__pyx_9); __Pyx_AddTraceback("Stemmer.Stemmer.stemWord"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_was_unicode); Py_DECREF(__pyx_v_cacheditem); Py_DECREF(__pyx_v_result); Py_DECREF(__pyx_v_length); Py_DECREF(__pyx_v_word); return __pyx_r; } /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":198 * return result * * def stemWords (self, words): # <<<<<<<<<<<<<< * """Stem a list of words. * */ static PyObject *__pyx_pf_7Stemmer_7Stemmer_stemWords(PyObject *__pyx_v_self, PyObject *__pyx_v_words); /*proto*/ static char __pyx_doc_7Stemmer_7Stemmer_stemWords[] = "Stem a list of words.\n\n This takes a single argument, ``words``, which must be a sequence,\n iterator, generator or similar.\n\n The entries in ``words`` should either be UTF-8 encoded strings, or a\n unicode objects.\n\n The result is a list of the stemmed forms of the words. If the\n word supplied was a unicode object, the stemmed form will be a\n unicode object: if the word supplied was a string, the stemmed form\n will be a UTF-8 encoded string.\n\n "; static PyObject *__pyx_pf_7Stemmer_7Stemmer_stemWords(PyObject *__pyx_v_self, PyObject *__pyx_v_words) { PyObject *__pyx_v_result; PyObject *__pyx_v_word; PyObject *__pyx_r; PyObject *__pyx_1 = 0; Py_ssize_t __pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; __pyx_v_result = Py_None; Py_INCREF(Py_None); __pyx_v_word = Py_None; Py_INCREF(Py_None); /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":213 * * """ * result = [] # <<<<<<<<<<<<<< * for word in words: * result.append(self.stemWord(word)) */ __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_result); __pyx_v_result = ((PyObject *)__pyx_1); __pyx_1 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":214 * """ * result = [] * for word in words: # <<<<<<<<<<<<<< * result.append(self.stemWord(word)) * return result */ if (PyList_CheckExact(__pyx_v_words) || PyTuple_CheckExact(__pyx_v_words)) { __pyx_2 = 0; __pyx_1 = __pyx_v_words; Py_INCREF(__pyx_1); } else { __pyx_2 = -1; __pyx_1 = PyObject_GetIter(__pyx_v_words); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } for (;;) { if (likely(PyList_CheckExact(__pyx_1))) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_2); Py_INCREF(__pyx_3); __pyx_2++; } else if (likely(PyTuple_CheckExact(__pyx_1))) { if (__pyx_2 >= PyTuple_GET_SIZE(__pyx_1)) break; __pyx_3 = PyTuple_GET_ITEM(__pyx_1, __pyx_2); Py_INCREF(__pyx_3); __pyx_2++; } else { __pyx_3 = PyIter_Next(__pyx_1); if (!__pyx_3) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } } Py_DECREF(__pyx_v_word); __pyx_v_word = __pyx_3; __pyx_3 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":215 * result = [] * for word in words: * result.append(self.stemWord(word)) # <<<<<<<<<<<<<< * return result */ __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_stemWord); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_word); PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_word); __pyx_5 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; __pyx_3 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_5); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_5); __pyx_5 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; } Py_DECREF(__pyx_1); __pyx_1 = 0; /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":216 * for word in words: * result.append(self.stemWord(word)) * return result # <<<<<<<<<<<<<< */ Py_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("Stemmer.Stemmer.stemWords"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_result); Py_DECREF(__pyx_v_word); return __pyx_r; } static PyObject *__pyx_tp_new_7Stemmer_Stemmer(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_7Stemmer_Stemmer *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_7Stemmer_Stemmer *)o); p->cache = Py_None; Py_INCREF(Py_None); p->counter = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_7Stemmer_Stemmer(PyObject *o) { struct __pyx_obj_7Stemmer_Stemmer *p = (struct __pyx_obj_7Stemmer_Stemmer *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_7Stemmer_7Stemmer___dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_XDECREF(p->cache); Py_XDECREF(p->counter); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_7Stemmer_Stemmer(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_7Stemmer_Stemmer *p = (struct __pyx_obj_7Stemmer_Stemmer *)o; if (p->cache) { e = (*v)(p->cache, a); if (e) return e; } if (p->counter) { e = (*v)(p->counter, a); if (e) return e; } return 0; } static int __pyx_tp_clear_7Stemmer_Stemmer(PyObject *o) { struct __pyx_obj_7Stemmer_Stemmer *p = (struct __pyx_obj_7Stemmer_Stemmer *)o; PyObject* tmp; tmp = ((PyObject*)p->cache); p->cache = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->counter); p->counter = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_getprop_7Stemmer_7Stemmer_maxCacheSize(PyObject *o, void *x) { return __pyx_pf_7Stemmer_7Stemmer_12maxCacheSize___get__(o); } static int __pyx_setprop_7Stemmer_7Stemmer_maxCacheSize(PyObject *o, PyObject *v, void *x) { if (v) { return __pyx_pf_7Stemmer_7Stemmer_12maxCacheSize___set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static struct PyMethodDef __pyx_methods_7Stemmer_Stemmer[] = { {"__purgeCache", (PyCFunction)__pyx_pf_7Stemmer_7Stemmer___purgeCache, METH_NOARGS, 0}, {"stemWord", (PyCFunction)__pyx_pf_7Stemmer_7Stemmer_stemWord, METH_O, __pyx_doc_7Stemmer_7Stemmer_stemWord}, {"stemWords", (PyCFunction)__pyx_pf_7Stemmer_7Stemmer_stemWords, METH_O, __pyx_doc_7Stemmer_7Stemmer_stemWords}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_7Stemmer_Stemmer[] = { {"maxCacheSize", __pyx_getprop_7Stemmer_7Stemmer_maxCacheSize, __pyx_setprop_7Stemmer_7Stemmer_maxCacheSize, __pyx_k_1, 0}, {0, 0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_Stemmer = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_Stemmer = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_Stemmer = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_Stemmer = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_NEWBUFFER) 0, /*bf_getbuffer*/ #endif #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_NEWBUFFER) 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_7Stemmer_Stemmer = { PyVarObject_HEAD_INIT(0, 0) "Stemmer.Stemmer", /*tp_name*/ sizeof(struct __pyx_obj_7Stemmer_Stemmer), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7Stemmer_Stemmer, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_Stemmer, /*tp_as_number*/ &__pyx_tp_as_sequence_Stemmer, /*tp_as_sequence*/ &__pyx_tp_as_mapping_Stemmer, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_Stemmer, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "An instance of a stemming algorithm.\n\n The algorithm has internal state, so must not be called concurrently.\n ie, only a single thread should access the instance at any given time.\n\n When creating a `Stemmer` object, there is one required argument: the\n name of the algorithm to use in the new stemmer. A list of the valid\n algorithm names may be obtained by calling the `algorithms()` function\n in this module. In addition, the appropriate stemming algorithm for a\n given language may be obtained by using the 2 or 3 letter ISO 639\n language codes.\n\n A second optional argument to the constructor for `Stemmer` is the size\n of cache to use. The cache implemented in this module is not terribly\n efficient, but benchmarks show that it approximately doubles\n performance for typical text processing operations, without too much\n memory overhead. The cache may be disabled by passing a size of 0.\n The default size (10000 words) is probably appropriate in most\n situations. In pathological cases (for example, when no word is\n presented to the stemming algorithm more than once, so the cache is\n useless), the cache can severely damage performance.\n\n The \"benchmark.py\" script supplied with the PyStemmer distribution can\n be used to test the performance of the stemming algorithms with various\n cache sizes.\n\n ", /*tp_doc*/ __pyx_tp_traverse_7Stemmer_Stemmer, /*tp_traverse*/ __pyx_tp_clear_7Stemmer_Stemmer, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_7Stemmer_Stemmer, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_7Stemmer_Stemmer, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_7Stemmer_7Stemmer___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_7Stemmer_Stemmer, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static struct PyMethodDef __pyx_methods[] = { {"algorithms", (PyCFunction)__pyx_pf_7Stemmer_algorithms, METH_NOARGS, __pyx_doc_7Stemmer_algorithms}, {"version", (PyCFunction)__pyx_pf_7Stemmer_version, METH_NOARGS, __pyx_doc_7Stemmer_version}, {0, 0, 0, 0} }; static void __pyx_init_filenames(void); /*proto*/ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, "Stemmer", 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 0, 1, 1}, {&__pyx_kp___dealloc__, __pyx_k___dealloc__, sizeof(__pyx_k___dealloc__), 0, 1, 1}, {&__pyx_kp___purgeCache, __pyx_k___purgeCache, sizeof(__pyx_k___purgeCache), 0, 1, 1}, {&__pyx_kp_stemWord, __pyx_k_stemWord, sizeof(__pyx_k_stemWord), 0, 1, 1}, {&__pyx_kp_stemWords, __pyx_k_stemWords, sizeof(__pyx_k_stemWords), 0, 1, 1}, {&__pyx_kp___docformat__, __pyx_k___docformat__, sizeof(__pyx_k___docformat__), 1, 1, 1}, {&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1}, {&__pyx_kp_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 1, 1, 1}, {&__pyx_kp_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 1, 1, 1}, {&__pyx_kp_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 1, 1, 1}, {&__pyx_kp_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 1, 1, 1}, {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 0}, {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, {&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0}, {&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 0}, {0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_kp_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initStemmer(void); /*proto*/ PyMODINIT_FUNC initStemmer(void) #else PyMODINIT_FUNC PyInit_Stemmer(void); /*proto*/ PyMODINIT_FUNC PyInit_Stemmer(void) #endif { __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Libary function declarations ---*/ __pyx_init_filenames(); /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("Stemmer", __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_7Stemmer_Stemmer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttrString(__pyx_m, "Stemmer", (PyObject *)&__pyx_type_7Stemmer_Stemmer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7Stemmer_Stemmer = &__pyx_type_7Stemmer_Stemmer; /*--- Type import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":25 * * """ * __docformat__ = "restructuredtext en" # <<<<<<<<<<<<<< * # Note: formatted documentation can be retrieved from this file using the * # "epydoc" tool. Invoke it by compiling this module and then running: */ if (PyObject_SetAttr(__pyx_m, __pyx_kp___docformat__, __pyx_kp_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "C:\cygwin\home\uschmitt\temp\PyStemmer-1.0.1\src/Stemmer.pyx":198 * return result * * def stemWords (self, words): # <<<<<<<<<<<<<< * """Stem a list of words. * */ #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif __pyx_L1_error:; __Pyx_AddTraceback("Stemmer"); #if PY_MAJOR_VERSION >= 3 return NULL; #endif } static const char *__pyx_filenames[] = { "Stemmer.pyx", }; /* Runtime support code */ static void __pyx_init_filenames(void) { __pyx_f = __pyx_filenames; } static INLINE void __Pyx_RaiseArgtupleTooLong( Py_ssize_t num_expected, Py_ssize_t num_found) { const char* error_message = #if PY_VERSION_HEX < 0x02050000 "function takes at most %d positional arguments (%d given)"; #else "function takes at most %zd positional arguments (%zd given)"; #endif PyErr_Format(PyExc_TypeError, error_message, num_expected, num_found); } static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) PyErr_SetObject(PyExc_NameError, name); return result; } static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } PyErr_Restore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { PyObject *item; if (!(item = PyIter_Next(iter))) { if (!PyErr_Occurred()) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d values to unpack", (int)index); #else "need more than %zd values to unpack", index); #endif } } return item; } static int __Pyx_EndUnpack(PyObject *iter) { PyObject *item; if ((item = PyIter_Next(iter))) { Py_DECREF(item); PyErr_SetString(PyExc_ValueError, "too many values to unpack"); return -1; } else if (!PyErr_Occurred()) return 0; else return -1; } static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_Get(); PyErr_Fetch(type, value, tb); PyErr_NormalizeException(type, value, tb); if (PyErr_Occurred()) goto bad; Py_INCREF(*type); Py_INCREF(*value); Py_INCREF(*tb); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; /* Make sure tstate is in a consistent state when we XDECREF these objects (XDECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); return 0; bad: Py_XDECREF(*type); Py_XDECREF(*value); Py_XDECREF(*tb); return -1; } #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; #if PY_MAJOR_VERSION < 3 empty_string = PyString_FromStringAndSize("", 0); #else empty_string = PyBytes_FromStringAndSize("", 0); #endif if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ empty_string, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ empty_string /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_Get(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode && (!t->is_identifier)) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_identifier || (t->is_unicode && t->intern)) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->is_unicode) { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if (x == Py_False) return 0; else return PyObject_IsTrue(x); } static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { if (PyInt_CheckExact(x)) { return PyInt_AS_LONG(x); } else if (PyLong_CheckExact(x)) { return PyLong_AsLongLong(x); } else { PY_LONG_LONG val; PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { if (PyInt_CheckExact(x)) { long val = PyInt_AS_LONG(x); if (unlikely(val < 0)) { PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); return (unsigned PY_LONG_LONG)-1; } return val; } else if (PyLong_CheckExact(x)) { return PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { if (sizeof(unsigned char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); unsigned char val = (unsigned char)long_val; if (unlikely((val != long_val) || (long_val < 0))) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); return (unsigned char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { if (sizeof(unsigned short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); unsigned short val = (unsigned short)long_val; if (unlikely((val != long_val) || (long_val < 0))) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); return (unsigned short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE char __pyx_PyInt_char(PyObject* x) { if (sizeof(char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); char val = (char)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); return (char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE short __pyx_PyInt_short(PyObject* x) { if (sizeof(short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); short val = (short)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); return (short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE int __pyx_PyInt_int(PyObject* x) { if (sizeof(int) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); int val = (int)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE long __pyx_PyInt_long(PyObject* x) { if (sizeof(long) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); long val = (long)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { if (sizeof(signed char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed char val = (signed char)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); return (signed char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { if (sizeof(signed short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed short val = (signed short)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); return (signed short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { if (sizeof(signed int) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed int val = (signed int)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); return (signed int)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { if (sizeof(signed long) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed long val = (signed long)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); return (signed long)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE long double __pyx_PyInt_long_double(PyObject* x) { if (sizeof(long double) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); long double val = (long double)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); return (long double)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } }