From c6eebb70a55be3f15431b016d44662506bbd3fd1 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Wed, 3 Mar 2021 15:20:31 +0100 Subject: [PATCH] fix incorrect ref counting --- .github/workflows/pythonbuild.yml | 2 +- VERSION | 2 +- setup.py | 4 +- src/cpp_process.cpp | 2895 +++++++++++++++-------------- src/cpp_process.pyx | 15 +- src/rapidfuzz-cpp | 2 +- src/rapidfuzz/__init__.py | 2 +- tests/test_process.py | 7 + 8 files changed, 1474 insertions(+), 1455 deletions(-) diff --git a/.github/workflows/pythonbuild.yml b/.github/workflows/pythonbuild.yml index 479d147..02d8a59 100644 --- a/.github/workflows/pythonbuild.yml +++ b/.github/workflows/pythonbuild.yml @@ -43,7 +43,7 @@ jobs: - name: Run Unit Tests run: | pip install . - pip install pytest hypothesis + pip install pytest hypothesis pandas pytest diff --git a/VERSION b/VERSION index 8cfbc90..8428158 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.1 \ No newline at end of file +1.1.2 \ No newline at end of file diff --git a/setup.py b/setup.py index 754d358..bcde3f6 100644 --- a/setup.py +++ b/setup.py @@ -38,8 +38,8 @@ class BuildExt(build_ext): elif ct == 'msvc': opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version()) for ext in self.extensions: - ext.extra_compile_args = opts - ext.extra_link_args = link_opts + ext.extra_compile_args += opts + ext.extra_link_args += link_opts build_ext.build_extensions(self) setup( diff --git a/src/cpp_process.cpp b/src/cpp_process.cpp index 6f40deb..cc79cef 100644 --- a/src/cpp_process.cpp +++ b/src/cpp_process.cpp @@ -861,7 +861,7 @@ struct __pyx_defaults2 { PyObject *__pyx_arg_processor; }; -/* "cpp_process.pyx":589 +/* "cpp_process.pyx":599 * * * def extract_iter(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< @@ -1232,13 +1232,6 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { @@ -1692,7 +1685,7 @@ static PyObject *__pyx_codeobj__3; static PyObject *__pyx_codeobj__5; /* Late includes */ -/* "cpp_process.pyx":62 +/* "cpp_process.pyx":63 * * * cdef inline extractOne_dict(scorer_context context, choices, processor, double score_cutoff): # <<<<<<<<<<<<<< @@ -1724,7 +1717,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extractOne_dict", 0); - /* "cpp_process.pyx":64 + /* "cpp_process.pyx":65 * cdef inline extractOne_dict(scorer_context context, choices, processor, double score_cutoff): * cdef double score * result_choice = None # <<<<<<<<<<<<<< @@ -1734,7 +1727,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_INCREF(Py_None); __pyx_v_result_choice = Py_None; - /* "cpp_process.pyx":65 + /* "cpp_process.pyx":66 * cdef double score * result_choice = None * result_key = None # <<<<<<<<<<<<<< @@ -1744,7 +1737,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_INCREF(Py_None); __pyx_v_result_key = Py_None; - /* "cpp_process.pyx":67 + /* "cpp_process.pyx":68 * result_key = None * * if processor is not None: # <<<<<<<<<<<<<< @@ -1755,7 +1748,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":68 + /* "cpp_process.pyx":69 * * if processor is not None: * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -1765,9 +1758,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_4 = 0; if (unlikely(__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 68, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) } - __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_7; @@ -1775,7 +1768,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_4, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 68, __pyx_L1_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_choice_key, __pyx_t_7); @@ -1783,7 +1776,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":69 + /* "cpp_process.pyx":70 * if processor is not None: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -1794,7 +1787,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":70 + /* "cpp_process.pyx":71 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -1803,7 +1796,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ goto __pyx_L4_continue; - /* "cpp_process.pyx":69 + /* "cpp_process.pyx":70 * if processor is not None: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -1812,7 +1805,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ } - /* "cpp_process.pyx":72 + /* "cpp_process.pyx":73 * continue * * score = context.scorer(context.context, processor(choice), score_cutoff) # <<<<<<<<<<<<<< @@ -1832,20 +1825,20 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont } __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; try { __pyx_t_11 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_t_8, __pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 72, __pyx_L1_error) + __PYX_ERR(0, 73, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_score = __pyx_t_11; - /* "cpp_process.pyx":74 + /* "cpp_process.pyx":75 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -1855,7 +1848,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_1 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":75 + /* "cpp_process.pyx":76 * * if score >= score_cutoff: * score_cutoff = score # <<<<<<<<<<<<<< @@ -1864,7 +1857,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ __pyx_v_score_cutoff = __pyx_v_score; - /* "cpp_process.pyx":76 + /* "cpp_process.pyx":77 * if score >= score_cutoff: * score_cutoff = score * result_choice = choice # <<<<<<<<<<<<<< @@ -1874,7 +1867,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_INCREF(__pyx_v_choice); __Pyx_DECREF_SET(__pyx_v_result_choice, __pyx_v_choice); - /* "cpp_process.pyx":77 + /* "cpp_process.pyx":78 * score_cutoff = score * result_choice = choice * result_key = choice_key # <<<<<<<<<<<<<< @@ -1884,7 +1877,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_INCREF(__pyx_v_choice_key); __Pyx_DECREF_SET(__pyx_v_result_key, __pyx_v_choice_key); - /* "cpp_process.pyx":79 + /* "cpp_process.pyx":80 * result_key = choice_key * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -1894,7 +1887,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_1 = ((__pyx_v_score_cutoff == 100.0) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":80 + /* "cpp_process.pyx":81 * * if score_cutoff == 100: * break # <<<<<<<<<<<<<< @@ -1903,7 +1896,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ goto __pyx_L5_break; - /* "cpp_process.pyx":79 + /* "cpp_process.pyx":80 * result_key = choice_key * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -1912,7 +1905,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ } - /* "cpp_process.pyx":74 + /* "cpp_process.pyx":75 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -1925,7 +1918,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_L5_break:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":67 + /* "cpp_process.pyx":68 * result_key = None * * if processor is not None: # <<<<<<<<<<<<<< @@ -1935,7 +1928,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont goto __pyx_L3; } - /* "cpp_process.pyx":82 + /* "cpp_process.pyx":83 * break * else: * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -1946,9 +1939,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_5 = 0; if (unlikely(__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 82, __pyx_L1_error) + __PYX_ERR(0, 83, __pyx_L1_error) } - __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_6)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_6)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_8; @@ -1956,7 +1949,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_4, &__pyx_t_5, &__pyx_t_8, &__pyx_t_7, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 82, __pyx_L1_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_choice_key, __pyx_t_8); @@ -1964,7 +1957,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_7); __pyx_t_7 = 0; - /* "cpp_process.pyx":83 + /* "cpp_process.pyx":84 * else: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -1975,7 +1968,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":84 + /* "cpp_process.pyx":85 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -1984,7 +1977,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ goto __pyx_L9_continue; - /* "cpp_process.pyx":83 + /* "cpp_process.pyx":84 * else: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -1993,7 +1986,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ } - /* "cpp_process.pyx":86 + /* "cpp_process.pyx":87 * continue * * score = context.scorer(context.context, choice, score_cutoff) # <<<<<<<<<<<<<< @@ -2002,14 +1995,14 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ try { __pyx_t_11 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_v_choice, __pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 86, __pyx_L1_error) + __PYX_ERR(0, 87, __pyx_L1_error) } __pyx_v_score = __pyx_t_11; - /* "cpp_process.pyx":88 + /* "cpp_process.pyx":89 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -2019,7 +2012,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_2 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":89 + /* "cpp_process.pyx":90 * * if score >= score_cutoff: * score_cutoff = score # <<<<<<<<<<<<<< @@ -2028,7 +2021,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ __pyx_v_score_cutoff = __pyx_v_score; - /* "cpp_process.pyx":90 + /* "cpp_process.pyx":91 * if score >= score_cutoff: * score_cutoff = score * result_choice = choice # <<<<<<<<<<<<<< @@ -2038,7 +2031,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_INCREF(__pyx_v_choice); __Pyx_DECREF_SET(__pyx_v_result_choice, __pyx_v_choice); - /* "cpp_process.pyx":91 + /* "cpp_process.pyx":92 * score_cutoff = score * result_choice = choice * result_key = choice_key # <<<<<<<<<<<<<< @@ -2048,7 +2041,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_INCREF(__pyx_v_choice_key); __Pyx_DECREF_SET(__pyx_v_result_key, __pyx_v_choice_key); - /* "cpp_process.pyx":93 + /* "cpp_process.pyx":94 * result_key = choice_key * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -2058,7 +2051,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_2 = ((__pyx_v_score_cutoff == 100.0) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":94 + /* "cpp_process.pyx":95 * * if score_cutoff == 100: * break # <<<<<<<<<<<<<< @@ -2067,7 +2060,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ goto __pyx_L10_break; - /* "cpp_process.pyx":93 + /* "cpp_process.pyx":94 * result_key = choice_key * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -2076,7 +2069,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont */ } - /* "cpp_process.pyx":88 + /* "cpp_process.pyx":89 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -2091,7 +2084,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont } __pyx_L3:; - /* "cpp_process.pyx":96 + /* "cpp_process.pyx":97 * break * * return (result_choice, score_cutoff, result_key) if result_choice is not None else None # <<<<<<<<<<<<<< @@ -2101,9 +2094,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __Pyx_XDECREF(__pyx_r); __pyx_t_2 = (__pyx_v_result_choice != Py_None); if ((__pyx_t_2 != 0)) { - __pyx_t_7 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_result_choice); __Pyx_GIVEREF(__pyx_v_result_choice); @@ -2124,7 +2117,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont __pyx_t_3 = 0; goto __pyx_L0; - /* "cpp_process.pyx":62 + /* "cpp_process.pyx":63 * * * cdef inline extractOne_dict(scorer_context context, choices, processor, double score_cutoff): # <<<<<<<<<<<<<< @@ -2150,7 +2143,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_dict(scorer_cont return __pyx_r; } -/* "cpp_process.pyx":99 +/* "cpp_process.pyx":100 * * * cdef inline extractOne_list(scorer_context context, choices, processor, double score_cutoff): # <<<<<<<<<<<<<< @@ -2180,7 +2173,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extractOne_list", 0); - /* "cpp_process.pyx":100 + /* "cpp_process.pyx":101 * * cdef inline extractOne_list(scorer_context context, choices, processor, double score_cutoff): * cdef double score = 0.0 # <<<<<<<<<<<<<< @@ -2189,7 +2182,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_score = 0.0; - /* "cpp_process.pyx":101 + /* "cpp_process.pyx":102 * cdef inline extractOne_list(scorer_context context, choices, processor, double score_cutoff): * cdef double score = 0.0 * cdef int index = 0 # <<<<<<<<<<<<<< @@ -2198,7 +2191,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_index = 0; - /* "cpp_process.pyx":102 + /* "cpp_process.pyx":103 * cdef double score = 0.0 * cdef int index = 0 * cdef int result_index = 0 # <<<<<<<<<<<<<< @@ -2207,7 +2200,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_result_index = 0; - /* "cpp_process.pyx":103 + /* "cpp_process.pyx":104 * cdef int index = 0 * cdef int result_index = 0 * result_choice = None # <<<<<<<<<<<<<< @@ -2217,7 +2210,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __Pyx_INCREF(Py_None); __pyx_v_result_choice = Py_None; - /* "cpp_process.pyx":105 + /* "cpp_process.pyx":106 * result_choice = None * * if processor is not None: # <<<<<<<<<<<<<< @@ -2228,7 +2221,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":106 + /* "cpp_process.pyx":107 * * if processor is not None: * for choice in choices: # <<<<<<<<<<<<<< @@ -2239,26 +2232,26 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_3 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 107, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 107, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } @@ -2268,7 +2261,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 106, __pyx_L1_error) + else __PYX_ERR(0, 107, __pyx_L1_error) } break; } @@ -2277,7 +2270,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6); __pyx_t_6 = 0; - /* "cpp_process.pyx":107 + /* "cpp_process.pyx":108 * if processor is not None: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -2288,7 +2281,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":108 + /* "cpp_process.pyx":109 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< @@ -2297,7 +2290,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ goto __pyx_L4_continue; - /* "cpp_process.pyx":107 + /* "cpp_process.pyx":108 * if processor is not None: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -2306,7 +2299,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ } - /* "cpp_process.pyx":110 + /* "cpp_process.pyx":111 * continue * * score = context.scorer(context.context, processor(choice), score_cutoff) # <<<<<<<<<<<<<< @@ -2326,20 +2319,20 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont } __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; try { __pyx_t_9 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_t_6, __pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 110, __pyx_L1_error) + __PYX_ERR(0, 111, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_score = __pyx_t_9; - /* "cpp_process.pyx":112 + /* "cpp_process.pyx":113 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -2349,7 +2342,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_1 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":113 + /* "cpp_process.pyx":114 * * if score >= score_cutoff: * score_cutoff = score # <<<<<<<<<<<<<< @@ -2358,7 +2351,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_score_cutoff = __pyx_v_score; - /* "cpp_process.pyx":114 + /* "cpp_process.pyx":115 * if score >= score_cutoff: * score_cutoff = score * result_choice = choice # <<<<<<<<<<<<<< @@ -2368,7 +2361,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __Pyx_INCREF(__pyx_v_choice); __Pyx_DECREF_SET(__pyx_v_result_choice, __pyx_v_choice); - /* "cpp_process.pyx":115 + /* "cpp_process.pyx":116 * score_cutoff = score * result_choice = choice * result_index = index # <<<<<<<<<<<<<< @@ -2377,7 +2370,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_result_index = __pyx_v_index; - /* "cpp_process.pyx":117 + /* "cpp_process.pyx":118 * result_index = index * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -2387,7 +2380,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_1 = ((__pyx_v_score_cutoff == 100.0) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":118 + /* "cpp_process.pyx":119 * * if score_cutoff == 100: * break # <<<<<<<<<<<<<< @@ -2396,7 +2389,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ goto __pyx_L5_break; - /* "cpp_process.pyx":117 + /* "cpp_process.pyx":118 * result_index = index * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -2405,7 +2398,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ } - /* "cpp_process.pyx":112 + /* "cpp_process.pyx":113 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -2414,7 +2407,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ } - /* "cpp_process.pyx":119 + /* "cpp_process.pyx":120 * if score_cutoff == 100: * break * index += 1 # <<<<<<<<<<<<<< @@ -2423,7 +2416,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_index = (__pyx_v_index + 1); - /* "cpp_process.pyx":106 + /* "cpp_process.pyx":107 * * if processor is not None: * for choice in choices: # <<<<<<<<<<<<<< @@ -2435,7 +2428,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_L5_break:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":105 + /* "cpp_process.pyx":106 * result_choice = None * * if processor is not None: # <<<<<<<<<<<<<< @@ -2445,7 +2438,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont goto __pyx_L3; } - /* "cpp_process.pyx":121 + /* "cpp_process.pyx":122 * index += 1 * else: * for choice in choices: # <<<<<<<<<<<<<< @@ -2457,26 +2450,26 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_3 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 122, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 122, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } @@ -2486,7 +2479,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 121, __pyx_L1_error) + else __PYX_ERR(0, 122, __pyx_L1_error) } break; } @@ -2495,7 +2488,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6); __pyx_t_6 = 0; - /* "cpp_process.pyx":122 + /* "cpp_process.pyx":123 * else: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -2506,7 +2499,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":123 + /* "cpp_process.pyx":124 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< @@ -2515,7 +2508,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ goto __pyx_L9_continue; - /* "cpp_process.pyx":122 + /* "cpp_process.pyx":123 * else: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -2524,7 +2517,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ } - /* "cpp_process.pyx":125 + /* "cpp_process.pyx":126 * continue * * score = context.scorer(context.context, choice, score_cutoff) # <<<<<<<<<<<<<< @@ -2533,14 +2526,14 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ try { __pyx_t_9 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_v_choice, __pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 125, __pyx_L1_error) + __PYX_ERR(0, 126, __pyx_L1_error) } __pyx_v_score = __pyx_t_9; - /* "cpp_process.pyx":127 + /* "cpp_process.pyx":128 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -2550,7 +2543,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_2 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":128 + /* "cpp_process.pyx":129 * * if score >= score_cutoff: * score_cutoff = score # <<<<<<<<<<<<<< @@ -2559,7 +2552,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_score_cutoff = __pyx_v_score; - /* "cpp_process.pyx":129 + /* "cpp_process.pyx":130 * if score >= score_cutoff: * score_cutoff = score * result_choice = choice # <<<<<<<<<<<<<< @@ -2569,7 +2562,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __Pyx_INCREF(__pyx_v_choice); __Pyx_DECREF_SET(__pyx_v_result_choice, __pyx_v_choice); - /* "cpp_process.pyx":130 + /* "cpp_process.pyx":131 * score_cutoff = score * result_choice = choice * result_index = index # <<<<<<<<<<<<<< @@ -2578,7 +2571,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_result_index = __pyx_v_index; - /* "cpp_process.pyx":132 + /* "cpp_process.pyx":133 * result_index = index * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -2588,7 +2581,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_2 = ((__pyx_v_score_cutoff == 100.0) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":133 + /* "cpp_process.pyx":134 * * if score_cutoff == 100: * break # <<<<<<<<<<<<<< @@ -2597,7 +2590,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ goto __pyx_L10_break; - /* "cpp_process.pyx":132 + /* "cpp_process.pyx":133 * result_index = index * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -2606,7 +2599,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ } - /* "cpp_process.pyx":127 + /* "cpp_process.pyx":128 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -2615,7 +2608,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ } - /* "cpp_process.pyx":134 + /* "cpp_process.pyx":135 * if score_cutoff == 100: * break * index += 1 # <<<<<<<<<<<<<< @@ -2624,7 +2617,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont */ __pyx_v_index = (__pyx_v_index + 1); - /* "cpp_process.pyx":121 + /* "cpp_process.pyx":122 * index += 1 * else: * for choice in choices: # <<<<<<<<<<<<<< @@ -2638,7 +2631,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont } __pyx_L3:; - /* "cpp_process.pyx":136 + /* "cpp_process.pyx":137 * index += 1 * * return (result_choice, score_cutoff, result_index) if result_choice is not None else None # <<<<<<<<<<<<<< @@ -2648,11 +2641,11 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __Pyx_XDECREF(__pyx_r); __pyx_t_2 = (__pyx_v_result_choice != Py_None); if ((__pyx_t_2 != 0)) { - __pyx_t_6 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_6 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_result_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_result_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_result_choice); __Pyx_GIVEREF(__pyx_v_result_choice); @@ -2673,7 +2666,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont __pyx_t_3 = 0; goto __pyx_L0; - /* "cpp_process.pyx":99 + /* "cpp_process.pyx":100 * * * cdef inline extractOne_list(scorer_context context, choices, processor, double score_cutoff): # <<<<<<<<<<<<<< @@ -2697,7 +2690,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extractOne_list(scorer_cont return __pyx_r; } -/* "cpp_process.pyx":139 +/* "cpp_process.pyx":140 * * * cdef inline py_extractOne_dict(query, choices, scorer, processor, double score_cutoff, kwargs): # <<<<<<<<<<<<<< @@ -2731,7 +2724,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("py_extractOne_dict", 0); - /* "cpp_process.pyx":140 + /* "cpp_process.pyx":141 * * cdef inline py_extractOne_dict(query, choices, scorer, processor, double score_cutoff, kwargs): * result_score = 0 # <<<<<<<<<<<<<< @@ -2741,7 +2734,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(__pyx_int_0); __pyx_v_result_score = __pyx_int_0; - /* "cpp_process.pyx":141 + /* "cpp_process.pyx":142 * cdef inline py_extractOne_dict(query, choices, scorer, processor, double score_cutoff, kwargs): * result_score = 0 * result_choice = None # <<<<<<<<<<<<<< @@ -2751,7 +2744,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(Py_None); __pyx_v_result_choice = Py_None; - /* "cpp_process.pyx":142 + /* "cpp_process.pyx":143 * result_score = 0 * result_choice = None * result_key = None # <<<<<<<<<<<<<< @@ -2761,7 +2754,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(Py_None); __pyx_v_result_key = Py_None; - /* "cpp_process.pyx":144 + /* "cpp_process.pyx":145 * result_key = None * * if processor is not None: # <<<<<<<<<<<<<< @@ -2772,7 +2765,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":145 + /* "cpp_process.pyx":146 * * if processor is not None: * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -2782,9 +2775,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_t_4 = 0; if (unlikely(__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 145, __pyx_L1_error) + __PYX_ERR(0, 146, __pyx_L1_error) } - __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_7; @@ -2792,7 +2785,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_4, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 145, __pyx_L1_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_choice_key, __pyx_t_7); @@ -2800,7 +2793,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":146 + /* "cpp_process.pyx":147 * if processor is not None: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -2811,7 +2804,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":147 + /* "cpp_process.pyx":148 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -2820,7 +2813,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject */ goto __pyx_L4_continue; - /* "cpp_process.pyx":146 + /* "cpp_process.pyx":147 * if processor is not None: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -2829,7 +2822,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject */ } - /* "cpp_process.pyx":149 + /* "cpp_process.pyx":150 * continue * * score = scorer(query, processor(choice), # <<<<<<<<<<<<<< @@ -2849,10 +2842,10 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject } __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); @@ -2861,65 +2854,65 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":150 + /* "cpp_process.pyx":151 * * score = scorer(query, processor(choice), * processor=None, score_cutoff=score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if score > result_score: */ - __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 150, __pyx_L1_error) - __pyx_t_11 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 150, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_score_cutoff, __pyx_t_11) < 0) __PYX_ERR(0, 150, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_score_cutoff, __pyx_t_11) < 0) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_8 = __pyx_t_10; __pyx_t_10 = 0; if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 150, __pyx_L1_error) + __PYX_ERR(0, 151, __pyx_L1_error) } - if (__Pyx_MergeKeywords(__pyx_t_8, __pyx_v_kwargs) < 0) __PYX_ERR(0, 150, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_8, __pyx_v_kwargs) < 0) __PYX_ERR(0, 151, __pyx_L1_error) - /* "cpp_process.pyx":149 + /* "cpp_process.pyx":150 * continue * * score = scorer(query, processor(choice), # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF_SET(__pyx_v_score, __pyx_t_10); __pyx_t_10 = 0; - /* "cpp_process.pyx":152 + /* "cpp_process.pyx":153 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if score > result_score: # <<<<<<<<<<<<<< * score_cutoff = score * result_score = score */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_score, __pyx_v_result_score, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 152, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_10 = PyObject_RichCompare(__pyx_v_score, __pyx_v_result_score, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_1) { - /* "cpp_process.pyx":153 + /* "cpp_process.pyx":154 * * if score > result_score: * score_cutoff = score # <<<<<<<<<<<<<< * result_score = score * result_choice = choice */ - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_score); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_score); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error) __pyx_v_score_cutoff = __pyx_t_12; - /* "cpp_process.pyx":154 + /* "cpp_process.pyx":155 * if score > result_score: * score_cutoff = score * result_score = score # <<<<<<<<<<<<<< @@ -2929,7 +2922,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(__pyx_v_score); __Pyx_DECREF_SET(__pyx_v_result_score, __pyx_v_score); - /* "cpp_process.pyx":155 + /* "cpp_process.pyx":156 * score_cutoff = score * result_score = score * result_choice = choice # <<<<<<<<<<<<<< @@ -2939,7 +2932,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(__pyx_v_choice); __Pyx_DECREF_SET(__pyx_v_result_choice, __pyx_v_choice); - /* "cpp_process.pyx":156 + /* "cpp_process.pyx":157 * result_score = score * result_choice = choice * result_key = choice_key # <<<<<<<<<<<<<< @@ -2949,7 +2942,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(__pyx_v_choice_key); __Pyx_DECREF_SET(__pyx_v_result_key, __pyx_v_choice_key); - /* "cpp_process.pyx":158 + /* "cpp_process.pyx":159 * result_key = choice_key * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -2959,7 +2952,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_t_1 = ((__pyx_v_score_cutoff == 100.0) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":159 + /* "cpp_process.pyx":160 * * if score_cutoff == 100: * break # <<<<<<<<<<<<<< @@ -2968,7 +2961,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject */ goto __pyx_L5_break; - /* "cpp_process.pyx":158 + /* "cpp_process.pyx":159 * result_key = choice_key * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -2977,7 +2970,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject */ } - /* "cpp_process.pyx":152 + /* "cpp_process.pyx":153 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if score > result_score: # <<<<<<<<<<<<<< @@ -2990,7 +2983,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_L5_break:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":144 + /* "cpp_process.pyx":145 * result_key = None * * if processor is not None: # <<<<<<<<<<<<<< @@ -3000,7 +2993,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject goto __pyx_L3; } - /* "cpp_process.pyx":161 + /* "cpp_process.pyx":162 * break * else: * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -3011,9 +3004,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_t_5 = 0; if (unlikely(__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 161, __pyx_L1_error) + __PYX_ERR(0, 162, __pyx_L1_error) } - __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_6)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_6)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_10; @@ -3021,7 +3014,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_4, &__pyx_t_5, &__pyx_t_10, &__pyx_t_8, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 161, __pyx_L1_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_choice_key, __pyx_t_10); @@ -3029,7 +3022,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":162 + /* "cpp_process.pyx":163 * else: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -3040,7 +3033,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":163 + /* "cpp_process.pyx":164 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -3049,7 +3042,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject */ goto __pyx_L9_continue; - /* "cpp_process.pyx":162 + /* "cpp_process.pyx":163 * else: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -3058,14 +3051,14 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject */ } - /* "cpp_process.pyx":165 + /* "cpp_process.pyx":166 * continue * * score = scorer(query, choice, # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); @@ -3074,65 +3067,65 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_GIVEREF(__pyx_v_choice); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_choice); - /* "cpp_process.pyx":166 + /* "cpp_process.pyx":167 * * score = scorer(query, choice, * processor=None, score_cutoff=score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if score > result_score: */ - __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 166, __pyx_L1_error) - __pyx_t_11 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 166, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_score_cutoff, __pyx_t_11) < 0) __PYX_ERR(0, 166, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_score_cutoff, __pyx_t_11) < 0) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_10 = __pyx_t_7; __pyx_t_7 = 0; if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 166, __pyx_L1_error) + __PYX_ERR(0, 167, __pyx_L1_error) } - if (__Pyx_MergeKeywords(__pyx_t_10, __pyx_v_kwargs) < 0) __PYX_ERR(0, 166, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_10, __pyx_v_kwargs) < 0) __PYX_ERR(0, 167, __pyx_L1_error) - /* "cpp_process.pyx":165 + /* "cpp_process.pyx":166 * continue * * score = scorer(query, choice, # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF_SET(__pyx_v_score, __pyx_t_7); __pyx_t_7 = 0; - /* "cpp_process.pyx":168 + /* "cpp_process.pyx":169 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if score > result_score: # <<<<<<<<<<<<<< * score_cutoff = score * result_score = score */ - __pyx_t_7 = PyObject_RichCompare(__pyx_v_score, __pyx_v_result_score, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 168, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_7 = PyObject_RichCompare(__pyx_v_score, __pyx_v_result_score, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { - /* "cpp_process.pyx":169 + /* "cpp_process.pyx":170 * * if score > result_score: * score_cutoff = score # <<<<<<<<<<<<<< * result_score = score * result_choice = choice */ - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_score); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_score); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error) __pyx_v_score_cutoff = __pyx_t_12; - /* "cpp_process.pyx":170 + /* "cpp_process.pyx":171 * if score > result_score: * score_cutoff = score * result_score = score # <<<<<<<<<<<<<< @@ -3142,7 +3135,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(__pyx_v_score); __Pyx_DECREF_SET(__pyx_v_result_score, __pyx_v_score); - /* "cpp_process.pyx":171 + /* "cpp_process.pyx":172 * score_cutoff = score * result_score = score * result_choice = choice # <<<<<<<<<<<<<< @@ -3152,7 +3145,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(__pyx_v_choice); __Pyx_DECREF_SET(__pyx_v_result_choice, __pyx_v_choice); - /* "cpp_process.pyx":172 + /* "cpp_process.pyx":173 * result_score = score * result_choice = choice * result_key = choice_key # <<<<<<<<<<<<<< @@ -3162,7 +3155,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_INCREF(__pyx_v_choice_key); __Pyx_DECREF_SET(__pyx_v_result_key, __pyx_v_choice_key); - /* "cpp_process.pyx":174 + /* "cpp_process.pyx":175 * result_key = choice_key * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -3172,7 +3165,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_t_2 = ((__pyx_v_score_cutoff == 100.0) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":175 + /* "cpp_process.pyx":176 * * if score_cutoff == 100: * break # <<<<<<<<<<<<<< @@ -3181,7 +3174,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject */ goto __pyx_L10_break; - /* "cpp_process.pyx":174 + /* "cpp_process.pyx":175 * result_key = choice_key * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -3190,7 +3183,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject */ } - /* "cpp_process.pyx":168 + /* "cpp_process.pyx":169 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if score > result_score: # <<<<<<<<<<<<<< @@ -3205,7 +3198,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject } __pyx_L3:; - /* "cpp_process.pyx":177 + /* "cpp_process.pyx":178 * break * * return (result_choice, result_score, result_key) if result_choice is not None else None # <<<<<<<<<<<<<< @@ -3215,7 +3208,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __Pyx_XDECREF(__pyx_r); __pyx_t_2 = (__pyx_v_result_choice != Py_None); if ((__pyx_t_2 != 0)) { - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_result_choice); __Pyx_GIVEREF(__pyx_v_result_choice); @@ -3236,7 +3229,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject __pyx_t_3 = 0; goto __pyx_L0; - /* "cpp_process.pyx":139 + /* "cpp_process.pyx":140 * * * cdef inline py_extractOne_dict(query, choices, scorer, processor, double score_cutoff, kwargs): # <<<<<<<<<<<<<< @@ -3265,7 +3258,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_dict(PyObject return __pyx_r; } -/* "cpp_process.pyx":180 +/* "cpp_process.pyx":181 * * * cdef inline py_extractOne_list(query, choices, scorer, processor, double score_cutoff, kwargs): # <<<<<<<<<<<<<< @@ -3297,7 +3290,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("py_extractOne_list", 0); - /* "cpp_process.pyx":181 + /* "cpp_process.pyx":182 * * cdef inline py_extractOne_list(query, choices, scorer, processor, double score_cutoff, kwargs): * cdef int result_index = 0 # <<<<<<<<<<<<<< @@ -3306,7 +3299,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ __pyx_v_result_index = 0; - /* "cpp_process.pyx":182 + /* "cpp_process.pyx":183 * cdef inline py_extractOne_list(query, choices, scorer, processor, double score_cutoff, kwargs): * cdef int result_index = 0 * cdef int index = 0 # <<<<<<<<<<<<<< @@ -3315,7 +3308,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ __pyx_v_index = 0; - /* "cpp_process.pyx":183 + /* "cpp_process.pyx":184 * cdef int result_index = 0 * cdef int index = 0 * result_score = 0 # <<<<<<<<<<<<<< @@ -3325,7 +3318,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_INCREF(__pyx_int_0); __pyx_v_result_score = __pyx_int_0; - /* "cpp_process.pyx":184 + /* "cpp_process.pyx":185 * cdef int index = 0 * result_score = 0 * result_choice = None # <<<<<<<<<<<<<< @@ -3335,7 +3328,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_INCREF(Py_None); __pyx_v_result_choice = Py_None; - /* "cpp_process.pyx":186 + /* "cpp_process.pyx":187 * result_choice = None * * if processor is not None: # <<<<<<<<<<<<<< @@ -3346,7 +3339,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":187 + /* "cpp_process.pyx":188 * * if processor is not None: * for choice in choices: # <<<<<<<<<<<<<< @@ -3357,26 +3350,26 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_t_3 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 188, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 188, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 188, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } @@ -3386,7 +3379,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 187, __pyx_L1_error) + else __PYX_ERR(0, 188, __pyx_L1_error) } break; } @@ -3395,7 +3388,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6); __pyx_t_6 = 0; - /* "cpp_process.pyx":188 + /* "cpp_process.pyx":189 * if processor is not None: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -3406,7 +3399,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":189 + /* "cpp_process.pyx":190 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< @@ -3415,7 +3408,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ goto __pyx_L4_continue; - /* "cpp_process.pyx":188 + /* "cpp_process.pyx":189 * if processor is not None: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -3424,7 +3417,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ } - /* "cpp_process.pyx":191 + /* "cpp_process.pyx":192 * continue * * score = scorer(query, processor(choice), # <<<<<<<<<<<<<< @@ -3444,10 +3437,10 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject } __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); @@ -3456,65 +3449,65 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); __pyx_t_6 = 0; - /* "cpp_process.pyx":192 + /* "cpp_process.pyx":193 * * score = scorer(query, processor(choice), * processor=None, score_cutoff=score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if score > result_score: */ - __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 192, __pyx_L1_error) - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_score_cutoff, __pyx_t_9) < 0) __PYX_ERR(0, 192, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_score_cutoff, __pyx_t_9) < 0) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_6 = __pyx_t_8; __pyx_t_8 = 0; if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 192, __pyx_L1_error) + __PYX_ERR(0, 193, __pyx_L1_error) } - if (__Pyx_MergeKeywords(__pyx_t_6, __pyx_v_kwargs) < 0) __PYX_ERR(0, 192, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_6, __pyx_v_kwargs) < 0) __PYX_ERR(0, 193, __pyx_L1_error) - /* "cpp_process.pyx":191 + /* "cpp_process.pyx":192 * continue * * score = scorer(query, processor(choice), # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_score, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":194 + /* "cpp_process.pyx":195 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if score > result_score: # <<<<<<<<<<<<<< * score_cutoff = score * result_score = score */ - __pyx_t_8 = PyObject_RichCompare(__pyx_v_score, __pyx_v_result_score, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 194, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_8 = PyObject_RichCompare(__pyx_v_score, __pyx_v_result_score, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_1) { - /* "cpp_process.pyx":195 + /* "cpp_process.pyx":196 * * if score > result_score: * score_cutoff = score # <<<<<<<<<<<<<< * result_score = score * result_choice = choice */ - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_score); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_score); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L1_error) __pyx_v_score_cutoff = __pyx_t_10; - /* "cpp_process.pyx":196 + /* "cpp_process.pyx":197 * if score > result_score: * score_cutoff = score * result_score = score # <<<<<<<<<<<<<< @@ -3524,7 +3517,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_INCREF(__pyx_v_score); __Pyx_DECREF_SET(__pyx_v_result_score, __pyx_v_score); - /* "cpp_process.pyx":197 + /* "cpp_process.pyx":198 * score_cutoff = score * result_score = score * result_choice = choice # <<<<<<<<<<<<<< @@ -3534,7 +3527,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_INCREF(__pyx_v_choice); __Pyx_DECREF_SET(__pyx_v_result_choice, __pyx_v_choice); - /* "cpp_process.pyx":198 + /* "cpp_process.pyx":199 * result_score = score * result_choice = choice * result_index = index # <<<<<<<<<<<<<< @@ -3543,7 +3536,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ __pyx_v_result_index = __pyx_v_index; - /* "cpp_process.pyx":200 + /* "cpp_process.pyx":201 * result_index = index * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -3553,7 +3546,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_t_1 = ((__pyx_v_score_cutoff == 100.0) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":201 + /* "cpp_process.pyx":202 * * if score_cutoff == 100: * break # <<<<<<<<<<<<<< @@ -3562,7 +3555,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ goto __pyx_L5_break; - /* "cpp_process.pyx":200 + /* "cpp_process.pyx":201 * result_index = index * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -3571,7 +3564,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ } - /* "cpp_process.pyx":194 + /* "cpp_process.pyx":195 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if score > result_score: # <<<<<<<<<<<<<< @@ -3580,7 +3573,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ } - /* "cpp_process.pyx":202 + /* "cpp_process.pyx":203 * if score_cutoff == 100: * break * index += 1 # <<<<<<<<<<<<<< @@ -3589,7 +3582,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ __pyx_v_index = (__pyx_v_index + 1); - /* "cpp_process.pyx":187 + /* "cpp_process.pyx":188 * * if processor is not None: * for choice in choices: # <<<<<<<<<<<<<< @@ -3601,7 +3594,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_L5_break:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":186 + /* "cpp_process.pyx":187 * result_choice = None * * if processor is not None: # <<<<<<<<<<<<<< @@ -3611,7 +3604,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject goto __pyx_L3; } - /* "cpp_process.pyx":204 + /* "cpp_process.pyx":205 * index += 1 * else: * for choice in choices: # <<<<<<<<<<<<<< @@ -3623,26 +3616,26 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_t_3 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 205, __pyx_L1_error) #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 205, __pyx_L1_error) #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } @@ -3652,7 +3645,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 204, __pyx_L1_error) + else __PYX_ERR(0, 205, __pyx_L1_error) } break; } @@ -3661,7 +3654,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":205 + /* "cpp_process.pyx":206 * else: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -3672,7 +3665,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":206 + /* "cpp_process.pyx":207 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< @@ -3681,7 +3674,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ goto __pyx_L9_continue; - /* "cpp_process.pyx":205 + /* "cpp_process.pyx":206 * else: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -3690,14 +3683,14 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ } - /* "cpp_process.pyx":208 + /* "cpp_process.pyx":209 * continue * * score = scorer(query, choice, # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); @@ -3706,65 +3699,65 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_GIVEREF(__pyx_v_choice); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_choice); - /* "cpp_process.pyx":209 + /* "cpp_process.pyx":210 * * score = scorer(query, choice, * processor=None, score_cutoff=score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if score > result_score: */ - __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 209, __pyx_L1_error) - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_score_cutoff, __pyx_t_9) < 0) __PYX_ERR(0, 209, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_score_cutoff, __pyx_t_9) < 0) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_6 = __pyx_t_7; __pyx_t_7 = 0; if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 209, __pyx_L1_error) + __PYX_ERR(0, 210, __pyx_L1_error) } - if (__Pyx_MergeKeywords(__pyx_t_6, __pyx_v_kwargs) < 0) __PYX_ERR(0, 209, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_6, __pyx_v_kwargs) < 0) __PYX_ERR(0, 210, __pyx_L1_error) - /* "cpp_process.pyx":208 + /* "cpp_process.pyx":209 * continue * * score = scorer(query, choice, # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_score, __pyx_t_7); __pyx_t_7 = 0; - /* "cpp_process.pyx":211 + /* "cpp_process.pyx":212 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if score > result_score: # <<<<<<<<<<<<<< * score_cutoff = score * result_score = score */ - __pyx_t_7 = PyObject_RichCompare(__pyx_v_score, __pyx_v_result_score, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_7 = PyObject_RichCompare(__pyx_v_score, __pyx_v_result_score, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { - /* "cpp_process.pyx":212 + /* "cpp_process.pyx":213 * * if score > result_score: * score_cutoff = score # <<<<<<<<<<<<<< * result_score = score * result_choice = choice */ - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_score); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_score); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) __pyx_v_score_cutoff = __pyx_t_10; - /* "cpp_process.pyx":213 + /* "cpp_process.pyx":214 * if score > result_score: * score_cutoff = score * result_score = score # <<<<<<<<<<<<<< @@ -3774,7 +3767,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_INCREF(__pyx_v_score); __Pyx_DECREF_SET(__pyx_v_result_score, __pyx_v_score); - /* "cpp_process.pyx":214 + /* "cpp_process.pyx":215 * score_cutoff = score * result_score = score * result_choice = choice # <<<<<<<<<<<<<< @@ -3784,7 +3777,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_INCREF(__pyx_v_choice); __Pyx_DECREF_SET(__pyx_v_result_choice, __pyx_v_choice); - /* "cpp_process.pyx":215 + /* "cpp_process.pyx":216 * result_score = score * result_choice = choice * result_index = index # <<<<<<<<<<<<<< @@ -3793,7 +3786,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ __pyx_v_result_index = __pyx_v_index; - /* "cpp_process.pyx":217 + /* "cpp_process.pyx":218 * result_index = index * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -3803,7 +3796,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_t_2 = ((__pyx_v_score_cutoff == 100.0) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":218 + /* "cpp_process.pyx":219 * * if score_cutoff == 100: * break # <<<<<<<<<<<<<< @@ -3812,7 +3805,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ goto __pyx_L10_break; - /* "cpp_process.pyx":217 + /* "cpp_process.pyx":218 * result_index = index * * if score_cutoff == 100: # <<<<<<<<<<<<<< @@ -3821,7 +3814,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ } - /* "cpp_process.pyx":211 + /* "cpp_process.pyx":212 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if score > result_score: # <<<<<<<<<<<<<< @@ -3830,7 +3823,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ } - /* "cpp_process.pyx":219 + /* "cpp_process.pyx":220 * if score_cutoff == 100: * break * index += 1 # <<<<<<<<<<<<<< @@ -3839,7 +3832,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject */ __pyx_v_index = (__pyx_v_index + 1); - /* "cpp_process.pyx":204 + /* "cpp_process.pyx":205 * index += 1 * else: * for choice in choices: # <<<<<<<<<<<<<< @@ -3853,7 +3846,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject } __pyx_L3:; - /* "cpp_process.pyx":221 + /* "cpp_process.pyx":222 * index += 1 * * return (result_choice, result_score, result_index) if result_choice is not None else None # <<<<<<<<<<<<<< @@ -3863,9 +3856,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __Pyx_XDECREF(__pyx_r); __pyx_t_2 = (__pyx_v_result_choice != Py_None); if ((__pyx_t_2 != 0)) { - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_result_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_result_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_result_choice); __Pyx_GIVEREF(__pyx_v_result_choice); @@ -3886,7 +3879,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject __pyx_t_3 = 0; goto __pyx_L0; - /* "cpp_process.pyx":180 + /* "cpp_process.pyx":181 * * * cdef inline py_extractOne_list(query, choices, scorer, processor, double score_cutoff, kwargs): # <<<<<<<<<<<<<< @@ -3913,7 +3906,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extractOne_list(PyObject return __pyx_r; } -/* "cpp_process.pyx":224 +/* "cpp_process.pyx":225 * * * cdef inline scorer_context CachedScorerInit(object scorer, object query, int def_process): # <<<<<<<<<<<<<< @@ -3934,25 +3927,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("CachedScorerInit", 0); - /* "cpp_process.pyx":227 + /* "cpp_process.pyx":228 * cdef scorer_context context * * if scorer == fuzz.ratio: # <<<<<<<<<<<<<< * context = cached_ratio_init(query, def_process) * elif scorer == fuzz.partial_ratio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":228 + /* "cpp_process.pyx":229 * * if scorer == fuzz.ratio: * context = cached_ratio_init(query, def_process) # <<<<<<<<<<<<<< @@ -3961,14 +3954,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_ratio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 228, __pyx_L1_error) + __PYX_ERR(0, 229, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":227 + /* "cpp_process.pyx":228 * cdef scorer_context context * * if scorer == fuzz.ratio: # <<<<<<<<<<<<<< @@ -3978,25 +3971,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":229 + /* "cpp_process.pyx":230 * if scorer == fuzz.ratio: * context = cached_ratio_init(query, def_process) * elif scorer == fuzz.partial_ratio: # <<<<<<<<<<<<<< * context = cached_partial_ratio_init(query, def_process) * elif scorer == fuzz.token_sort_ratio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":230 + /* "cpp_process.pyx":231 * context = cached_ratio_init(query, def_process) * elif scorer == fuzz.partial_ratio: * context = cached_partial_ratio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4005,14 +3998,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_partial_ratio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 230, __pyx_L1_error) + __PYX_ERR(0, 231, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":229 + /* "cpp_process.pyx":230 * if scorer == fuzz.ratio: * context = cached_ratio_init(query, def_process) * elif scorer == fuzz.partial_ratio: # <<<<<<<<<<<<<< @@ -4022,25 +4015,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":231 + /* "cpp_process.pyx":232 * elif scorer == fuzz.partial_ratio: * context = cached_partial_ratio_init(query, def_process) * elif scorer == fuzz.token_sort_ratio: # <<<<<<<<<<<<<< * context = cached_token_sort_ratio_init(query, def_process) * elif scorer == fuzz.token_set_ratio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_token_sort_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_token_sort_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":232 + /* "cpp_process.pyx":233 * context = cached_partial_ratio_init(query, def_process) * elif scorer == fuzz.token_sort_ratio: * context = cached_token_sort_ratio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4049,14 +4042,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_token_sort_ratio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 232, __pyx_L1_error) + __PYX_ERR(0, 233, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":231 + /* "cpp_process.pyx":232 * elif scorer == fuzz.partial_ratio: * context = cached_partial_ratio_init(query, def_process) * elif scorer == fuzz.token_sort_ratio: # <<<<<<<<<<<<<< @@ -4066,25 +4059,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":233 + /* "cpp_process.pyx":234 * elif scorer == fuzz.token_sort_ratio: * context = cached_token_sort_ratio_init(query, def_process) * elif scorer == fuzz.token_set_ratio: # <<<<<<<<<<<<<< * context = cached_token_set_ratio_init(query, def_process) * elif scorer == fuzz.token_ratio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_token_set_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_token_set_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":234 + /* "cpp_process.pyx":235 * context = cached_token_sort_ratio_init(query, def_process) * elif scorer == fuzz.token_set_ratio: * context = cached_token_set_ratio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4093,14 +4086,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_token_set_ratio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 234, __pyx_L1_error) + __PYX_ERR(0, 235, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":233 + /* "cpp_process.pyx":234 * elif scorer == fuzz.token_sort_ratio: * context = cached_token_sort_ratio_init(query, def_process) * elif scorer == fuzz.token_set_ratio: # <<<<<<<<<<<<<< @@ -4110,25 +4103,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":235 + /* "cpp_process.pyx":236 * elif scorer == fuzz.token_set_ratio: * context = cached_token_set_ratio_init(query, def_process) * elif scorer == fuzz.token_ratio: # <<<<<<<<<<<<<< * context = cached_token_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_sort_ratio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_token_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_token_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":236 + /* "cpp_process.pyx":237 * context = cached_token_set_ratio_init(query, def_process) * elif scorer == fuzz.token_ratio: * context = cached_token_ratio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4137,14 +4130,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_token_ratio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 236, __pyx_L1_error) + __PYX_ERR(0, 237, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":235 + /* "cpp_process.pyx":236 * elif scorer == fuzz.token_set_ratio: * context = cached_token_set_ratio_init(query, def_process) * elif scorer == fuzz.token_ratio: # <<<<<<<<<<<<<< @@ -4154,25 +4147,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":237 + /* "cpp_process.pyx":238 * elif scorer == fuzz.token_ratio: * context = cached_token_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_sort_ratio: # <<<<<<<<<<<<<< * context = cached_partial_token_sort_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_set_ratio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial_token_sort_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial_token_sort_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":238 + /* "cpp_process.pyx":239 * context = cached_token_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_sort_ratio: * context = cached_partial_token_sort_ratio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4181,14 +4174,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_partial_token_sort_ratio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 238, __pyx_L1_error) + __PYX_ERR(0, 239, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":237 + /* "cpp_process.pyx":238 * elif scorer == fuzz.token_ratio: * context = cached_token_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_sort_ratio: # <<<<<<<<<<<<<< @@ -4198,25 +4191,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":239 + /* "cpp_process.pyx":240 * elif scorer == fuzz.partial_token_sort_ratio: * context = cached_partial_token_sort_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_set_ratio: # <<<<<<<<<<<<<< * context = cached_partial_token_set_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_ratio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial_token_set_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial_token_set_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":240 + /* "cpp_process.pyx":241 * context = cached_partial_token_sort_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_set_ratio: * context = cached_partial_token_set_ratio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4225,14 +4218,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_partial_token_set_ratio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 240, __pyx_L1_error) + __PYX_ERR(0, 241, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":239 + /* "cpp_process.pyx":240 * elif scorer == fuzz.partial_token_sort_ratio: * context = cached_partial_token_sort_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_set_ratio: # <<<<<<<<<<<<<< @@ -4242,25 +4235,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":241 + /* "cpp_process.pyx":242 * elif scorer == fuzz.partial_token_set_ratio: * context = cached_partial_token_set_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_ratio: # <<<<<<<<<<<<<< * context = cached_partial_token_ratio_init(query, def_process) * elif scorer == fuzz.WRatio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial_token_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial_token_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":242 + /* "cpp_process.pyx":243 * context = cached_partial_token_set_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_ratio: * context = cached_partial_token_ratio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4269,14 +4262,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_partial_token_ratio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 242, __pyx_L1_error) + __PYX_ERR(0, 243, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":241 + /* "cpp_process.pyx":242 * elif scorer == fuzz.partial_token_set_ratio: * context = cached_partial_token_set_ratio_init(query, def_process) * elif scorer == fuzz.partial_token_ratio: # <<<<<<<<<<<<<< @@ -4286,25 +4279,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":243 + /* "cpp_process.pyx":244 * elif scorer == fuzz.partial_token_ratio: * context = cached_partial_token_ratio_init(query, def_process) * elif scorer == fuzz.WRatio: # <<<<<<<<<<<<<< * context = cached_WRatio_init(query, def_process) * elif scorer == fuzz.QRatio: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":244 + /* "cpp_process.pyx":245 * context = cached_partial_token_ratio_init(query, def_process) * elif scorer == fuzz.WRatio: * context = cached_WRatio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4313,14 +4306,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_WRatio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 244, __pyx_L1_error) + __PYX_ERR(0, 245, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":243 + /* "cpp_process.pyx":244 * elif scorer == fuzz.partial_token_ratio: * context = cached_partial_token_ratio_init(query, def_process) * elif scorer == fuzz.WRatio: # <<<<<<<<<<<<<< @@ -4330,25 +4323,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":245 + /* "cpp_process.pyx":246 * elif scorer == fuzz.WRatio: * context = cached_WRatio_init(query, def_process) * elif scorer == fuzz.QRatio: # <<<<<<<<<<<<<< * context = cached_QRatio_init(query, def_process) * elif scorer == string_metric.normalized_hamming: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_QRatio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_QRatio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":246 + /* "cpp_process.pyx":247 * context = cached_WRatio_init(query, def_process) * elif scorer == fuzz.QRatio: * context = cached_QRatio_init(query, def_process) # <<<<<<<<<<<<<< @@ -4357,14 +4350,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_QRatio_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 246, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 246, __pyx_L1_error) + __PYX_ERR(0, 247, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":245 + /* "cpp_process.pyx":246 * elif scorer == fuzz.WRatio: * context = cached_WRatio_init(query, def_process) * elif scorer == fuzz.QRatio: # <<<<<<<<<<<<<< @@ -4374,25 +4367,25 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":247 + /* "cpp_process.pyx":248 * elif scorer == fuzz.QRatio: * context = cached_QRatio_init(query, def_process) * elif scorer == string_metric.normalized_hamming: # <<<<<<<<<<<<<< * context = cached_normalized_hamming_init(query, def_process) * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_string_metric); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_string_metric); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_normalized_hamming); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_normalized_hamming); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_scorer, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":248 + /* "cpp_process.pyx":249 * context = cached_QRatio_init(query, def_process) * elif scorer == string_metric.normalized_hamming: * context = cached_normalized_hamming_init(query, def_process) # <<<<<<<<<<<<<< @@ -4401,14 +4394,14 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj */ try { __pyx_t_4 = cached_normalized_hamming_init(__pyx_v_query, __pyx_v_def_process); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 249, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 248, __pyx_L1_error) + __PYX_ERR(0, 249, __pyx_L1_error) } __pyx_v_context = __pyx_t_4; - /* "cpp_process.pyx":247 + /* "cpp_process.pyx":248 * elif scorer == fuzz.QRatio: * context = cached_QRatio_init(query, def_process) * elif scorer == string_metric.normalized_hamming: # <<<<<<<<<<<<<< @@ -4418,7 +4411,7 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj goto __pyx_L3; } - /* "cpp_process.pyx":250 + /* "cpp_process.pyx":251 * context = cached_normalized_hamming_init(query, def_process) * else: * context.context = NULL # <<<<<<<<<<<<<< @@ -4430,7 +4423,7 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj } __pyx_L3:; - /* "cpp_process.pyx":251 + /* "cpp_process.pyx":252 * else: * context.context = NULL * return context # <<<<<<<<<<<<<< @@ -4440,7 +4433,7 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj __pyx_r = __pyx_v_context; goto __pyx_L0; - /* "cpp_process.pyx":224 + /* "cpp_process.pyx":225 * * * cdef inline scorer_context CachedScorerInit(object scorer, object query, int def_process): # <<<<<<<<<<<<<< @@ -4459,7 +4452,7 @@ static CYTHON_INLINE scorer_context __pyx_f_11cpp_process_CachedScorerInit(PyObj return __pyx_r; } -/* "cpp_process.pyx":254 +/* "cpp_process.pyx":255 * * * def extractOne(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< @@ -4477,9 +4470,9 @@ static PyObject *__pyx_pf_11cpp_process_7__defaults__(CYTHON_UNUSED PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_scorer); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_scorer); @@ -4490,7 +4483,7 @@ static PyObject *__pyx_pf_11cpp_process_7__defaults__(CYTHON_UNUSED PyObject *__ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); @@ -4565,7 +4558,7 @@ static PyObject *__pyx_pw_11cpp_process_1extractOne(PyObject *__pyx_self, PyObje case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_choices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("extractOne", 0, 2, 5, 1); __PYX_ERR(0, 254, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("extractOne", 0, 2, 5, 1); __PYX_ERR(0, 255, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4587,7 +4580,7 @@ static PyObject *__pyx_pw_11cpp_process_1extractOne(PyObject *__pyx_self, PyObje } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "extractOne") < 0)) __PYX_ERR(0, 254, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "extractOne") < 0)) __PYX_ERR(0, 255, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4608,14 +4601,14 @@ static PyObject *__pyx_pw_11cpp_process_1extractOne(PyObject *__pyx_self, PyObje __pyx_v_scorer = values[2]; __pyx_v_processor = values[3]; if (values[4]) { - __pyx_v_score_cutoff = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_score_cutoff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 254, __pyx_L3_error) + __pyx_v_score_cutoff = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_score_cutoff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L3_error) } else { __pyx_v_score_cutoff = ((double)((double)0.0)); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("extractOne", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 254, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("extractOne", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 255, __pyx_L3_error) __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("cpp_process.extractOne", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -4656,7 +4649,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx __Pyx_INCREF(__pyx_v_query); __Pyx_INCREF(__pyx_v_processor); - /* "cpp_process.pyx":289 + /* "cpp_process.pyx":290 * """ * * cdef int def_process = 0 # <<<<<<<<<<<<<< @@ -4665,7 +4658,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ __pyx_v_def_process = 0; - /* "cpp_process.pyx":292 + /* "cpp_process.pyx":293 * cdef scorer_context context * * if query is None: # <<<<<<<<<<<<<< @@ -4676,7 +4669,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":293 + /* "cpp_process.pyx":294 * * if query is None: * return None # <<<<<<<<<<<<<< @@ -4687,7 +4680,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "cpp_process.pyx":292 + /* "cpp_process.pyx":293 * cdef scorer_context context * * if query is None: # <<<<<<<<<<<<<< @@ -4696,25 +4689,25 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ } - /* "cpp_process.pyx":296 + /* "cpp_process.pyx":297 * * # preprocess the query * if processor == utils.default_process: # <<<<<<<<<<<<<< * def_process = 1 * # since this call is only performed once it is not very expensive to */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) { - /* "cpp_process.pyx":297 + /* "cpp_process.pyx":298 * # preprocess the query * if processor == utils.default_process: * def_process = 1 # <<<<<<<<<<<<<< @@ -4723,7 +4716,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ __pyx_v_def_process = 1; - /* "cpp_process.pyx":300 + /* "cpp_process.pyx":301 * # since this call is only performed once it is not very expensive to * # make it in Python * query = processor(query) # <<<<<<<<<<<<<< @@ -4743,13 +4736,13 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_query); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":301 + /* "cpp_process.pyx":302 * # make it in Python * query = processor(query) * processor = None # <<<<<<<<<<<<<< @@ -4759,7 +4752,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx __Pyx_INCREF(Py_None); __Pyx_DECREF_SET(__pyx_v_processor, Py_None); - /* "cpp_process.pyx":296 + /* "cpp_process.pyx":297 * * # preprocess the query * if processor == utils.default_process: # <<<<<<<<<<<<<< @@ -4769,18 +4762,18 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx goto __pyx_L4; } - /* "cpp_process.pyx":302 + /* "cpp_process.pyx":303 * query = processor(query) * processor = None * elif callable(processor): # <<<<<<<<<<<<<< * query = processor(query) * elif processor: */ - __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 302, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 303, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":303 + /* "cpp_process.pyx":304 * processor = None * elif callable(processor): * query = processor(query) # <<<<<<<<<<<<<< @@ -4800,13 +4793,13 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_query); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":302 + /* "cpp_process.pyx":303 * query = processor(query) * processor = None * elif callable(processor): # <<<<<<<<<<<<<< @@ -4816,17 +4809,17 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx goto __pyx_L4; } - /* "cpp_process.pyx":304 + /* "cpp_process.pyx":305 * elif callable(processor): * query = processor(query) * elif processor: # <<<<<<<<<<<<<< * def_process = 1 * # since this call is only performed once it is not very expensive to */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_processor); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 304, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_processor); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 305, __pyx_L1_error) if (__pyx_t_1) { - /* "cpp_process.pyx":305 + /* "cpp_process.pyx":306 * query = processor(query) * elif processor: * def_process = 1 # <<<<<<<<<<<<<< @@ -4835,16 +4828,16 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ __pyx_v_def_process = 1; - /* "cpp_process.pyx":308 + /* "cpp_process.pyx":309 * # since this call is only performed once it is not very expensive to * # make it in Python * query = utils.default_process(query) # <<<<<<<<<<<<<< * processor = None * # query might be e.g. False */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_utils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_utils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 308, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -4859,13 +4852,13 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_query); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":309 + /* "cpp_process.pyx":310 * # make it in Python * query = utils.default_process(query) * processor = None # <<<<<<<<<<<<<< @@ -4875,7 +4868,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx __Pyx_INCREF(Py_None); __Pyx_DECREF_SET(__pyx_v_processor, Py_None); - /* "cpp_process.pyx":304 + /* "cpp_process.pyx":305 * elif callable(processor): * query = processor(query) * elif processor: # <<<<<<<<<<<<<< @@ -4885,7 +4878,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx goto __pyx_L4; } - /* "cpp_process.pyx":312 + /* "cpp_process.pyx":313 * # query might be e.g. False * else: * processor = None # <<<<<<<<<<<<<< @@ -4898,7 +4891,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx } __pyx_L4:; - /* "cpp_process.pyx":315 + /* "cpp_process.pyx":316 * * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) # <<<<<<<<<<<<<< @@ -4907,7 +4900,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ __pyx_v_context = __pyx_f_11cpp_process_CachedScorerInit(__pyx_v_scorer, __pyx_v_query, __pyx_v_def_process); - /* "cpp_process.pyx":316 + /* "cpp_process.pyx":317 * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: # <<<<<<<<<<<<<< @@ -4917,7 +4910,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx __pyx_t_1 = ((__pyx_v_context.context != NULL) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":317 + /* "cpp_process.pyx":318 * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: * try: # <<<<<<<<<<<<<< @@ -4926,18 +4919,18 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ /*try:*/ { - /* "cpp_process.pyx":318 + /* "cpp_process.pyx":319 * if context.context != NULL: * try: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< * return extractOne_dict(context, choices, processor, score_cutoff) * else: */ - __pyx_t_1 = __Pyx_HasAttr(__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 318, __pyx_L7_error) + __pyx_t_1 = __Pyx_HasAttr(__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 319, __pyx_L7_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":319 + /* "cpp_process.pyx":320 * try: * if hasattr(choices, "items"): * return extractOne_dict(context, choices, processor, score_cutoff) # <<<<<<<<<<<<<< @@ -4945,13 +4938,13 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx * return extractOne_list(context, choices, processor, score_cutoff) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_11cpp_process_extractOne_dict(__pyx_v_context, __pyx_v_choices, __pyx_v_processor, __pyx_v_score_cutoff); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L7_error) + __pyx_t_3 = __pyx_f_11cpp_process_extractOne_dict(__pyx_v_context, __pyx_v_choices, __pyx_v_processor, __pyx_v_score_cutoff); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L6_return; - /* "cpp_process.pyx":318 + /* "cpp_process.pyx":319 * if context.context != NULL: * try: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -4960,7 +4953,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ } - /* "cpp_process.pyx":321 + /* "cpp_process.pyx":322 * return extractOne_dict(context, choices, processor, score_cutoff) * else: * return extractOne_list(context, choices, processor, score_cutoff) # <<<<<<<<<<<<<< @@ -4969,7 +4962,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_11cpp_process_extractOne_list(__pyx_v_context, __pyx_v_choices, __pyx_v_processor, __pyx_v_score_cutoff); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L7_error) + __pyx_t_3 = __pyx_f_11cpp_process_extractOne_list(__pyx_v_context, __pyx_v_choices, __pyx_v_processor, __pyx_v_score_cutoff); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -4977,7 +4970,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx } } - /* "cpp_process.pyx":324 + /* "cpp_process.pyx":325 * finally: * # part of the context is dynamically allocated, so it has to be freed in any case * context.deinit(context.context) # <<<<<<<<<<<<<< @@ -5007,7 +5000,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx __pyx_v_context.deinit(__pyx_v_context.context); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 324, __pyx_L11_error) + __PYX_ERR(0, 325, __pyx_L11_error) } } if (PY_MAJOR_VERSION >= 3) { @@ -5043,7 +5036,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx __pyx_v_context.deinit(__pyx_v_context.context); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 324, __pyx_L1_error) + __PYX_ERR(0, 325, __pyx_L1_error) } __pyx_r = __pyx_t_14; __pyx_t_14 = 0; @@ -5051,7 +5044,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx } } - /* "cpp_process.pyx":316 + /* "cpp_process.pyx":317 * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: # <<<<<<<<<<<<<< @@ -5060,7 +5053,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ } - /* "cpp_process.pyx":327 + /* "cpp_process.pyx":328 * # the scorer has to be called through Python * else: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -5068,11 +5061,11 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx * else: */ /*else*/ { - __pyx_t_2 = __Pyx_HasAttr(__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_t_2 = __Pyx_HasAttr(__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 328, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":328 + /* "cpp_process.pyx":329 * else: * if hasattr(choices, "items"): * return py_extractOne_dict(query, choices, scorer, processor, score_cutoff, kwargs) # <<<<<<<<<<<<<< @@ -5080,13 +5073,13 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx * return py_extractOne_list(query, choices, scorer, processor, score_cutoff, kwargs) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_11cpp_process_py_extractOne_dict(__pyx_v_query, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_v_score_cutoff, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error) + __pyx_t_3 = __pyx_f_11cpp_process_py_extractOne_dict(__pyx_v_query, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_v_score_cutoff, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "cpp_process.pyx":327 + /* "cpp_process.pyx":328 * # the scorer has to be called through Python * else: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -5095,7 +5088,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ } - /* "cpp_process.pyx":330 + /* "cpp_process.pyx":331 * return py_extractOne_dict(query, choices, scorer, processor, score_cutoff, kwargs) * else: * return py_extractOne_list(query, choices, scorer, processor, score_cutoff, kwargs) # <<<<<<<<<<<<<< @@ -5104,7 +5097,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_f_11cpp_process_py_extractOne_list(__pyx_v_query, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_v_score_cutoff, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_3 = __pyx_f_11cpp_process_py_extractOne_list(__pyx_v_query, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_v_score_cutoff, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -5112,7 +5105,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx } } - /* "cpp_process.pyx":254 + /* "cpp_process.pyx":255 * * * def extractOne(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< @@ -5135,7 +5128,7 @@ static PyObject *__pyx_pf_11cpp_process_extractOne(CYTHON_UNUSED PyObject *__pyx return __pyx_r; } -/* "cpp_process.pyx":333 +/* "cpp_process.pyx":334 * * * cdef inline extract_dict(scorer_context context, choices, processor, size_t limit, double score_cutoff): # <<<<<<<<<<<<<< @@ -5170,12 +5163,14 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context size_t __pyx_t_15; size_t __pyx_t_16; PyObject *__pyx_t_17; + std::vector ::size_type __pyx_t_18; + std::vector ::size_type __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extract_dict", 0); - /* "cpp_process.pyx":334 + /* "cpp_process.pyx":335 * * cdef inline extract_dict(scorer_context context, choices, processor, size_t limit, double score_cutoff): * cdef double score = 0.0 # <<<<<<<<<<<<<< @@ -5184,7 +5179,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ __pyx_v_score = 0.0; - /* "cpp_process.pyx":335 + /* "cpp_process.pyx":336 * cdef inline extract_dict(scorer_context context, choices, processor, size_t limit, double score_cutoff): * cdef double score = 0.0 * cdef size_t index = 0 # <<<<<<<<<<<<<< @@ -5193,7 +5188,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ __pyx_v_index = 0; - /* "cpp_process.pyx":336 + /* "cpp_process.pyx":337 * cdef double score = 0.0 * cdef size_t index = 0 * cdef size_t i = 0 # <<<<<<<<<<<<<< @@ -5202,17 +5197,17 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ __pyx_v_i = 0; - /* "cpp_process.pyx":340 + /* "cpp_process.pyx":341 * # maybe store only key and access the corresponding element when building the list * cdef vector[DictMatchElem] results * results.reserve(len(choices)) # <<<<<<<<<<<<<< * cdef list result_list * */ - __pyx_t_1 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 341, __pyx_L1_error) __pyx_v_results.reserve(((size_t)__pyx_t_1)); - /* "cpp_process.pyx":343 + /* "cpp_process.pyx":344 * cdef list result_list * * if processor is not None: # <<<<<<<<<<<<<< @@ -5223,7 +5218,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":344 + /* "cpp_process.pyx":345 * * if processor is not None: * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -5233,9 +5228,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_t_1 = 0; if (unlikely(__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 344, __pyx_L1_error) + __PYX_ERR(0, 345, __pyx_L1_error) } - __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 344, __pyx_L1_error) + __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = __pyx_t_7; @@ -5243,7 +5238,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_5, &__pyx_t_1, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 344, __pyx_L1_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_choice_key, __pyx_t_7); @@ -5251,7 +5246,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":345 + /* "cpp_process.pyx":346 * if processor is not None: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -5262,7 +5257,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":346 + /* "cpp_process.pyx":347 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -5271,7 +5266,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ goto __pyx_L4_continue; - /* "cpp_process.pyx":345 + /* "cpp_process.pyx":346 * if processor is not None: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -5280,7 +5275,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ } - /* "cpp_process.pyx":348 + /* "cpp_process.pyx":349 * continue * * score = context.scorer(context.context, processor(choice), score_cutoff) # <<<<<<<<<<<<<< @@ -5300,20 +5295,20 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context } __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 348, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; try { __pyx_t_11 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_t_8, __pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 348, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 348, __pyx_L1_error) + __PYX_ERR(0, 349, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_score = __pyx_t_11; - /* "cpp_process.pyx":350 + /* "cpp_process.pyx":351 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -5323,7 +5318,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_t_2 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":351 + /* "cpp_process.pyx":352 * * if score >= score_cutoff: * results.push_back(DictMatchElem(score, i, choice, choice_key)) # <<<<<<<<<<<<<< @@ -5338,10 +5333,10 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_v_results.push_back(__pyx_t_12); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 351, __pyx_L1_error) + __PYX_ERR(0, 352, __pyx_L1_error) } - /* "cpp_process.pyx":350 + /* "cpp_process.pyx":351 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -5350,7 +5345,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ } - /* "cpp_process.pyx":352 + /* "cpp_process.pyx":353 * if score >= score_cutoff: * results.push_back(DictMatchElem(score, i, choice, choice_key)) * index += 1 # <<<<<<<<<<<<<< @@ -5362,7 +5357,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":343 + /* "cpp_process.pyx":344 * cdef list result_list * * if processor is not None: # <<<<<<<<<<<<<< @@ -5372,7 +5367,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context goto __pyx_L3; } - /* "cpp_process.pyx":354 + /* "cpp_process.pyx":355 * index += 1 * else: * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -5383,9 +5378,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_t_5 = 0; if (unlikely(__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 354, __pyx_L1_error) + __PYX_ERR(0, 355, __pyx_L1_error) } - __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_1), (&__pyx_t_6)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_1), (&__pyx_t_6)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = __pyx_t_8; @@ -5393,7 +5388,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_1, &__pyx_t_5, &__pyx_t_8, &__pyx_t_7, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 354, __pyx_L1_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_choice_key, __pyx_t_8); @@ -5401,7 +5396,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_7); __pyx_t_7 = 0; - /* "cpp_process.pyx":355 + /* "cpp_process.pyx":356 * else: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -5412,7 +5407,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":356 + /* "cpp_process.pyx":357 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -5421,7 +5416,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ goto __pyx_L8_continue; - /* "cpp_process.pyx":355 + /* "cpp_process.pyx":356 * else: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -5430,7 +5425,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ } - /* "cpp_process.pyx":358 + /* "cpp_process.pyx":359 * continue * * score = context.scorer(context.context, choice, score_cutoff) # <<<<<<<<<<<<<< @@ -5439,26 +5434,44 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ try { __pyx_t_11 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_v_choice, __pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 358, __pyx_L1_error) + __PYX_ERR(0, 359, __pyx_L1_error) } __pyx_v_score = __pyx_t_11; - /* "cpp_process.pyx":360 + /* "cpp_process.pyx":361 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< - * results.push_back(DictMatchElem(score, i, choice, choice_key)) - * index += 1 + * # especially the key object might be created on the fly by e.g. pandas.Dataframe + * # so we need to ensure Python does not deallocate it */ __pyx_t_3 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":361 - * - * if score >= score_cutoff: + /* "cpp_process.pyx":364 + * # especially the key object might be created on the fly by e.g. pandas.Dataframe + * # so we need to ensure Python does not deallocate it + * Py_INCREF(choice) # <<<<<<<<<<<<<< + * Py_INCREF(choice_key) + * results.push_back(DictMatchElem(score, i, choice, choice_key)) + */ + Py_INCREF(__pyx_v_choice); + + /* "cpp_process.pyx":365 + * # so we need to ensure Python does not deallocate it + * Py_INCREF(choice) + * Py_INCREF(choice_key) # <<<<<<<<<<<<<< + * results.push_back(DictMatchElem(score, i, choice, choice_key)) + * index += 1 + */ + Py_INCREF(__pyx_v_choice_key); + + /* "cpp_process.pyx":366 + * Py_INCREF(choice) + * Py_INCREF(choice_key) * results.push_back(DictMatchElem(score, i, choice, choice_key)) # <<<<<<<<<<<<<< * index += 1 * @@ -5471,20 +5484,20 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_v_results.push_back(__pyx_t_12); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 361, __pyx_L1_error) + __PYX_ERR(0, 366, __pyx_L1_error) } - /* "cpp_process.pyx":360 + /* "cpp_process.pyx":361 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< - * results.push_back(DictMatchElem(score, i, choice, choice_key)) - * index += 1 + * # especially the key object might be created on the fly by e.g. pandas.Dataframe + * # so we need to ensure Python does not deallocate it */ } - /* "cpp_process.pyx":362 - * if score >= score_cutoff: + /* "cpp_process.pyx":367 + * Py_INCREF(choice_key) * results.push_back(DictMatchElem(score, i, choice, choice_key)) * index += 1 # <<<<<<<<<<<<<< * @@ -5497,7 +5510,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context } __pyx_L3:; - /* "cpp_process.pyx":365 + /* "cpp_process.pyx":370 * * # due to score_cutoff not always completely filled * if limit > results.size(): # <<<<<<<<<<<<<< @@ -5507,7 +5520,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_t_3 = ((__pyx_v_limit > __pyx_v_results.size()) != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":366 + /* "cpp_process.pyx":371 * # due to score_cutoff not always completely filled * if limit > results.size(): * limit = results.size() # <<<<<<<<<<<<<< @@ -5516,7 +5529,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ __pyx_v_limit = __pyx_v_results.size(); - /* "cpp_process.pyx":365 + /* "cpp_process.pyx":370 * * # due to score_cutoff not always completely filled * if limit > results.size(): # <<<<<<<<<<<<<< @@ -5525,7 +5538,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ } - /* "cpp_process.pyx":368 + /* "cpp_process.pyx":373 * limit = results.size() * * if limit >= results.size(): # <<<<<<<<<<<<<< @@ -5535,7 +5548,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_t_3 = ((__pyx_v_limit >= __pyx_v_results.size()) != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":369 + /* "cpp_process.pyx":374 * * if limit >= results.size(): * algorithm.sort(results.begin(), results.end(), ExtractComp()) # <<<<<<<<<<<<<< @@ -5544,7 +5557,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context */ std::sort ::iterator,ExtractComp>(__pyx_v_results.begin(), __pyx_v_results.end(), __pyx_t_13); - /* "cpp_process.pyx":368 + /* "cpp_process.pyx":373 * limit = results.size() * * if limit >= results.size(): # <<<<<<<<<<<<<< @@ -5554,7 +5567,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context goto __pyx_L13; } - /* "cpp_process.pyx":371 + /* "cpp_process.pyx":376 * algorithm.sort(results.begin(), results.end(), ExtractComp()) * else: * algorithm.partial_sort(results.begin(), results.begin() + limit, results.end(), ExtractComp()) # <<<<<<<<<<<<<< @@ -5566,19 +5579,19 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context } __pyx_L13:; - /* "cpp_process.pyx":374 + /* "cpp_process.pyx":379 * * # copy elements into Python List * result_list = PyList_New(limit) # <<<<<<<<<<<<<< * for i in range(limit): * # PyList_SET_ITEM steals a reference */ - __pyx_t_4 = PyList_New(__pyx_v_limit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_t_4 = PyList_New(__pyx_v_limit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_result_list = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":375 + /* "cpp_process.pyx":380 * # copy elements into Python List * result_list = PyList_New(limit) * for i in range(limit): # <<<<<<<<<<<<<< @@ -5590,39 +5603,60 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_i = __pyx_t_16; - /* "cpp_process.pyx":382 - * PyList_SET_ITEM(result_list, i, - * Py_BuildValue("OdO", - * choices[results[i].key], # <<<<<<<<<<<<<< - * results[i].score, - * results[i].key)) - */ - __pyx_t_17 = (__pyx_v_results[__pyx_v_i]).key; - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_choices, ((PyObject *)__pyx_t_17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 382, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "cpp_process.pyx":381 + /* "cpp_process.pyx":386 * # https://stackoverflow.com/questions/43553763/cythonize-list-of-all-splits-of-a-string/43557675#43557675 * PyList_SET_ITEM(result_list, i, * Py_BuildValue("OdO", # <<<<<<<<<<<<<< - * choices[results[i].key], + * results[i].choice, * results[i].score, */ - __pyx_t_17 = Py_BuildValue(((char const *)"OdO"), ((PyObject *)__pyx_t_4), (__pyx_v_results[__pyx_v_i]).score, ((PyObject *)(__pyx_v_results[__pyx_v_i]).key)); if (unlikely(__pyx_t_17 == ((PyObject *)NULL))) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_17 = Py_BuildValue(((char const *)"OdO"), ((PyObject *)(__pyx_v_results[__pyx_v_i]).choice), (__pyx_v_results[__pyx_v_i]).score, ((PyObject *)(__pyx_v_results[__pyx_v_i]).key)); if (unlikely(__pyx_t_17 == ((PyObject *)NULL))) __PYX_ERR(0, 386, __pyx_L1_error) - /* "cpp_process.pyx":380 + /* "cpp_process.pyx":385 * # decref the result of Py_BuildValue * # https://stackoverflow.com/questions/43553763/cythonize-list-of-all-splits-of-a-string/43557675#43557675 * PyList_SET_ITEM(result_list, i, # <<<<<<<<<<<<<< * Py_BuildValue("OdO", - * choices[results[i].key], + * results[i].choice, */ PyList_SET_ITEM(__pyx_v_result_list, __pyx_v_i, ((PyObject *)__pyx_t_17)); } - /* "cpp_process.pyx":386 - * results[i].key)) + /* "cpp_process.pyx":392 + * + * # decref all reference counts + * for i in range(results.size()): # <<<<<<<<<<<<<< + * Py_DECREF(results[i].choice) + * Py_DECREF(results[i].key) + */ + __pyx_t_18 = __pyx_v_results.size(); + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_19; __pyx_t_14+=1) { + __pyx_v_i = __pyx_t_14; + + /* "cpp_process.pyx":393 + * # decref all reference counts + * for i in range(results.size()): + * Py_DECREF(results[i].choice) # <<<<<<<<<<<<<< + * Py_DECREF(results[i].key) + * + */ + __pyx_t_17 = (__pyx_v_results[__pyx_v_i]).choice; + Py_DECREF(((PyObject *)__pyx_t_17)); + + /* "cpp_process.pyx":394 + * for i in range(results.size()): + * Py_DECREF(results[i].choice) + * Py_DECREF(results[i].key) # <<<<<<<<<<<<<< + * + * return result_list + */ + __pyx_t_17 = (__pyx_v_results[__pyx_v_i]).key; + Py_DECREF(((PyObject *)__pyx_t_17)); + } + + /* "cpp_process.pyx":396 + * Py_DECREF(results[i].key) * * return result_list # <<<<<<<<<<<<<< * @@ -5633,7 +5667,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context __pyx_r = __pyx_v_result_list; goto __pyx_L0; - /* "cpp_process.pyx":333 + /* "cpp_process.pyx":334 * * * cdef inline extract_dict(scorer_context context, choices, processor, size_t limit, double score_cutoff): # <<<<<<<<<<<<<< @@ -5658,7 +5692,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_dict(scorer_context return __pyx_r; } -/* "cpp_process.pyx":389 +/* "cpp_process.pyx":399 * * * cdef inline extract_list(scorer_context context, choices, processor, size_t limit, double score_cutoff): # <<<<<<<<<<<<<< @@ -5696,7 +5730,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extract_list", 0); - /* "cpp_process.pyx":390 + /* "cpp_process.pyx":400 * * cdef inline extract_list(scorer_context context, choices, processor, size_t limit, double score_cutoff): * cdef double score = 0.0 # <<<<<<<<<<<<<< @@ -5705,7 +5739,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context */ __pyx_v_score = 0.0; - /* "cpp_process.pyx":391 + /* "cpp_process.pyx":401 * cdef inline extract_list(scorer_context context, choices, processor, size_t limit, double score_cutoff): * cdef double score = 0.0 * cdef size_t index = 0 # <<<<<<<<<<<<<< @@ -5714,7 +5748,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context */ __pyx_v_index = 0; - /* "cpp_process.pyx":392 + /* "cpp_process.pyx":402 * cdef double score = 0.0 * cdef size_t index = 0 * cdef size_t i = 0 # <<<<<<<<<<<<<< @@ -5723,18 +5757,18 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context */ __pyx_v_i = 0; - /* "cpp_process.pyx":395 + /* "cpp_process.pyx":405 * # todo possibly a smaller vector would be good to reduce memory usage * cdef vector[ListMatchElem] results * results.reserve(len(choices)) # <<<<<<<<<<<<<< - * cdef object result_list + * cdef list result_list * */ - __pyx_t_1 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 405, __pyx_L1_error) __pyx_v_results.reserve(((size_t)__pyx_t_1)); - /* "cpp_process.pyx":398 - * cdef object result_list + /* "cpp_process.pyx":408 + * cdef list result_list * * if processor is not None: # <<<<<<<<<<<<<< * for choice in choices: @@ -5744,190 +5778,13 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":399 + /* "cpp_process.pyx":409 * * if processor is not None: * for choice in choices: # <<<<<<<<<<<<<< * if choice is None: * continue */ - if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) { - __pyx_t_4 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __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(0, 399, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_1 >= 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_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } else { - if (__pyx_t_1 >= 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_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } - } else { - __pyx_t_6 = __pyx_t_5(__pyx_t_4); - 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, 399, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6); - __pyx_t_6 = 0; - - /* "cpp_process.pyx":400 - * if processor is not None: - * for choice in choices: - * if choice is None: # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_t_3 = (__pyx_v_choice == Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "cpp_process.pyx":401 - * for choice in choices: - * if choice is None: - * continue # <<<<<<<<<<<<<< - * - * score = context.scorer(context.context, processor(choice), score_cutoff) - */ - goto __pyx_L4_continue; - - /* "cpp_process.pyx":400 - * if processor is not None: - * for choice in choices: - * if choice is None: # <<<<<<<<<<<<<< - * continue - * - */ - } - - /* "cpp_process.pyx":403 - * continue - * - * score = context.scorer(context.context, processor(choice), score_cutoff) # <<<<<<<<<<<<<< - * - * if score >= score_cutoff: - */ - __Pyx_INCREF(__pyx_v_processor); - __pyx_t_7 = __pyx_v_processor; __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - try { - __pyx_t_9 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_t_6, __pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 403, __pyx_L1_error) - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 403, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_score = __pyx_t_9; - - /* "cpp_process.pyx":405 - * score = context.scorer(context.context, processor(choice), score_cutoff) - * - * if score >= score_cutoff: # <<<<<<<<<<<<<< - * results.push_back(ListMatchElem(score, index)) - * index += 1 - */ - __pyx_t_2 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); - if (__pyx_t_2) { - - /* "cpp_process.pyx":406 - * - * if score >= score_cutoff: - * results.push_back(ListMatchElem(score, index)) # <<<<<<<<<<<<<< - * index += 1 - * else: - */ - __pyx_t_10.score = __pyx_v_score; - __pyx_t_10.index = __pyx_v_index; - try { - __pyx_v_results.push_back(__pyx_t_10); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 406, __pyx_L1_error) - } - - /* "cpp_process.pyx":405 - * score = context.scorer(context.context, processor(choice), score_cutoff) - * - * if score >= score_cutoff: # <<<<<<<<<<<<<< - * results.push_back(ListMatchElem(score, index)) - * index += 1 - */ - } - - /* "cpp_process.pyx":407 - * if score >= score_cutoff: - * results.push_back(ListMatchElem(score, index)) - * index += 1 # <<<<<<<<<<<<<< - * else: - * for choice in choices: - */ - __pyx_v_index = (__pyx_v_index + 1); - - /* "cpp_process.pyx":399 - * - * if processor is not None: - * for choice in choices: # <<<<<<<<<<<<<< - * if choice is None: - * continue - */ - __pyx_L4_continue:; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "cpp_process.pyx":398 - * cdef object result_list - * - * if processor is not None: # <<<<<<<<<<<<<< - * for choice in choices: - * if choice is None: - */ - goto __pyx_L3; - } - - /* "cpp_process.pyx":409 - * index += 1 - * else: - * for choice in choices: # <<<<<<<<<<<<<< - * if choice is None: - * continue - */ - /*else*/ { if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) { __pyx_t_4 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_5 = NULL; @@ -5971,27 +5828,27 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context __pyx_t_6 = 0; /* "cpp_process.pyx":410 - * else: + * if processor is not None: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_2 = (__pyx_v_choice == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_3 = (__pyx_v_choice == Py_None); + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { /* "cpp_process.pyx":411 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< * - * score = context.scorer(context.context, choice, score_cutoff) + * score = context.scorer(context.context, processor(choice), score_cutoff) */ - goto __pyx_L8_continue; + goto __pyx_L4_continue; /* "cpp_process.pyx":410 - * else: + * if processor is not None: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< * continue @@ -6002,20 +5859,197 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context /* "cpp_process.pyx":413 * continue * + * score = context.scorer(context.context, processor(choice), score_cutoff) # <<<<<<<<<<<<<< + * + * if score >= score_cutoff: + */ + __Pyx_INCREF(__pyx_v_processor); + __pyx_t_7 = __pyx_v_processor; __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + try { + __pyx_t_9 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_t_6, __pyx_v_score_cutoff); + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L1_error) + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 413, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_score = __pyx_t_9; + + /* "cpp_process.pyx":415 + * score = context.scorer(context.context, processor(choice), score_cutoff) + * + * if score >= score_cutoff: # <<<<<<<<<<<<<< + * results.push_back(ListMatchElem(score, index)) + * index += 1 + */ + __pyx_t_2 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); + if (__pyx_t_2) { + + /* "cpp_process.pyx":416 + * + * if score >= score_cutoff: + * results.push_back(ListMatchElem(score, index)) # <<<<<<<<<<<<<< + * index += 1 + * else: + */ + __pyx_t_10.score = __pyx_v_score; + __pyx_t_10.index = __pyx_v_index; + try { + __pyx_v_results.push_back(__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 416, __pyx_L1_error) + } + + /* "cpp_process.pyx":415 + * score = context.scorer(context.context, processor(choice), score_cutoff) + * + * if score >= score_cutoff: # <<<<<<<<<<<<<< + * results.push_back(ListMatchElem(score, index)) + * index += 1 + */ + } + + /* "cpp_process.pyx":417 + * if score >= score_cutoff: + * results.push_back(ListMatchElem(score, index)) + * index += 1 # <<<<<<<<<<<<<< + * else: + * for choice in choices: + */ + __pyx_v_index = (__pyx_v_index + 1); + + /* "cpp_process.pyx":409 + * + * if processor is not None: + * for choice in choices: # <<<<<<<<<<<<<< + * if choice is None: + * continue + */ + __pyx_L4_continue:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cpp_process.pyx":408 + * cdef list result_list + * + * if processor is not None: # <<<<<<<<<<<<<< + * for choice in choices: + * if choice is None: + */ + goto __pyx_L3; + } + + /* "cpp_process.pyx":419 + * index += 1 + * else: + * for choice in choices: # <<<<<<<<<<<<<< + * if choice is None: + * continue + */ + /*else*/ { + if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) { + __pyx_t_4 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __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(0, 419, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_1 >= 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_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 419, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_1 >= 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_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 419, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_5(__pyx_t_4); + 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, 419, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6); + __pyx_t_6 = 0; + + /* "cpp_process.pyx":420 + * else: + * for choice in choices: + * if choice is None: # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_2 = (__pyx_v_choice == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "cpp_process.pyx":421 + * for choice in choices: + * if choice is None: + * continue # <<<<<<<<<<<<<< + * + * score = context.scorer(context.context, choice, score_cutoff) + */ + goto __pyx_L8_continue; + + /* "cpp_process.pyx":420 + * else: + * for choice in choices: + * if choice is None: # <<<<<<<<<<<<<< + * continue + * + */ + } + + /* "cpp_process.pyx":423 + * continue + * * score = context.scorer(context.context, choice, score_cutoff) # <<<<<<<<<<<<<< * * if score >= score_cutoff: */ try { __pyx_t_9 = __pyx_v_context.scorer(__pyx_v_context.context, __pyx_v_choice, __pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L1_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 413, __pyx_L1_error) + __PYX_ERR(0, 423, __pyx_L1_error) } __pyx_v_score = __pyx_t_9; - /* "cpp_process.pyx":415 + /* "cpp_process.pyx":425 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -6025,7 +6059,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context __pyx_t_3 = ((__pyx_v_score >= __pyx_v_score_cutoff) != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":416 + /* "cpp_process.pyx":426 * * if score >= score_cutoff: * results.push_back(ListMatchElem(score, index)) # <<<<<<<<<<<<<< @@ -6038,10 +6072,10 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context __pyx_v_results.push_back(__pyx_t_10); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 416, __pyx_L1_error) + __PYX_ERR(0, 426, __pyx_L1_error) } - /* "cpp_process.pyx":415 + /* "cpp_process.pyx":425 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -6050,7 +6084,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context */ } - /* "cpp_process.pyx":417 + /* "cpp_process.pyx":427 * if score >= score_cutoff: * results.push_back(ListMatchElem(score, index)) * index += 1 # <<<<<<<<<<<<<< @@ -6059,7 +6093,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context */ __pyx_v_index = (__pyx_v_index + 1); - /* "cpp_process.pyx":409 + /* "cpp_process.pyx":419 * index += 1 * else: * for choice in choices: # <<<<<<<<<<<<<< @@ -6072,7 +6106,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context } __pyx_L3:; - /* "cpp_process.pyx":420 + /* "cpp_process.pyx":430 * * # due to score_cutoff not always completely filled * if limit > results.size(): # <<<<<<<<<<<<<< @@ -6082,7 +6116,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context __pyx_t_3 = ((__pyx_v_limit > __pyx_v_results.size()) != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":421 + /* "cpp_process.pyx":431 * # due to score_cutoff not always completely filled * if limit > results.size(): * limit = results.size() # <<<<<<<<<<<<<< @@ -6091,7 +6125,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context */ __pyx_v_limit = __pyx_v_results.size(); - /* "cpp_process.pyx":420 + /* "cpp_process.pyx":430 * * # due to score_cutoff not always completely filled * if limit > results.size(): # <<<<<<<<<<<<<< @@ -6100,7 +6134,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context */ } - /* "cpp_process.pyx":423 + /* "cpp_process.pyx":433 * limit = results.size() * * if limit >= results.size(): # <<<<<<<<<<<<<< @@ -6110,7 +6144,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context __pyx_t_3 = ((__pyx_v_limit >= __pyx_v_results.size()) != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":424 + /* "cpp_process.pyx":434 * * if limit >= results.size(): * algorithm.sort(results.begin(), results.end(), ExtractComp()) # <<<<<<<<<<<<<< @@ -6119,7 +6153,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context */ std::sort ::iterator,ExtractComp>(__pyx_v_results.begin(), __pyx_v_results.end(), __pyx_t_11); - /* "cpp_process.pyx":423 + /* "cpp_process.pyx":433 * limit = results.size() * * if limit >= results.size(): # <<<<<<<<<<<<<< @@ -6129,7 +6163,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context goto __pyx_L13; } - /* "cpp_process.pyx":426 + /* "cpp_process.pyx":436 * algorithm.sort(results.begin(), results.end(), ExtractComp()) * else: * algorithm.partial_sort(results.begin(), results.begin() + limit, results.end(), ExtractComp()) # <<<<<<<<<<<<<< @@ -6141,19 +6175,19 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context } __pyx_L13:; - /* "cpp_process.pyx":429 + /* "cpp_process.pyx":439 * * # copy elements into Python List * result_list = PyList_New(limit) # <<<<<<<<<<<<<< * for i in range(limit): * # PyList_SET_ITEM steals a reference */ - __pyx_t_4 = PyList_New(__pyx_v_limit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_4 = PyList_New(__pyx_v_limit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_v_result_list = __pyx_t_4; + __pyx_v_result_list = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":430 + /* "cpp_process.pyx":440 * # copy elements into Python List * result_list = PyList_New(limit) * for i in range(limit): # <<<<<<<<<<<<<< @@ -6165,7 +6199,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_i = __pyx_t_14; - /* "cpp_process.pyx":437 + /* "cpp_process.pyx":447 * PyList_SET_ITEM(result_list, i, * Py_BuildValue("Odn", * choices[results[i].index], # <<<<<<<<<<<<<< @@ -6173,20 +6207,20 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context * results[i].index)) */ __pyx_t_15 = (__pyx_v_results[__pyx_v_i]).index; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_choices, __pyx_t_15, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_choices, __pyx_t_15, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "cpp_process.pyx":436 + /* "cpp_process.pyx":446 * # https://stackoverflow.com/questions/43553763/cythonize-list-of-all-splits-of-a-string/43557675#43557675 * PyList_SET_ITEM(result_list, i, * Py_BuildValue("Odn", # <<<<<<<<<<<<<< * choices[results[i].index], * results[i].score, */ - __pyx_t_16 = Py_BuildValue(((char const *)"Odn"), ((PyObject *)__pyx_t_4), (__pyx_v_results[__pyx_v_i]).score, (__pyx_v_results[__pyx_v_i]).index); if (unlikely(__pyx_t_16 == ((PyObject *)NULL))) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_16 = Py_BuildValue(((char const *)"Odn"), ((PyObject *)__pyx_t_4), (__pyx_v_results[__pyx_v_i]).score, (__pyx_v_results[__pyx_v_i]).index); if (unlikely(__pyx_t_16 == ((PyObject *)NULL))) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":435 + /* "cpp_process.pyx":445 * # decref the result of Py_BuildValue * # https://stackoverflow.com/questions/43553763/cythonize-list-of-all-splits-of-a-string/43557675#43557675 * PyList_SET_ITEM(result_list, i, # <<<<<<<<<<<<<< @@ -6196,7 +6230,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context PyList_SET_ITEM(__pyx_v_result_list, __pyx_v_i, ((PyObject *)__pyx_t_16)); } - /* "cpp_process.pyx":441 + /* "cpp_process.pyx":451 * results[i].index)) * * return result_list # <<<<<<<<<<<<<< @@ -6208,7 +6242,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context __pyx_r = __pyx_v_result_list; goto __pyx_L0; - /* "cpp_process.pyx":389 + /* "cpp_process.pyx":399 * * * cdef inline extract_list(scorer_context context, choices, processor, size_t limit, double score_cutoff): # <<<<<<<<<<<<<< @@ -6232,7 +6266,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_extract_list(scorer_context return __pyx_r; } -/* "cpp_process.pyx":470 +/* "cpp_process.pyx":480 * result_list.append((choice, score, choice_key)) * * return heapq.nlargest(limit, result_list, key=lambda i: i[1]) # <<<<<<<<<<<<<< @@ -6263,7 +6297,7 @@ static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_i, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_i, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6280,7 +6314,7 @@ static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "cpp_process.pyx":444 +/* "cpp_process.pyx":454 * * * cdef inline py_extract_dict(query, choices, scorer, processor, size_t limit, double score_cutoff, kwargs): # <<<<<<<<<<<<<< @@ -6311,7 +6345,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("py_extract_dict", 0); - /* "cpp_process.pyx":445 + /* "cpp_process.pyx":455 * * cdef inline py_extract_dict(query, choices, scorer, processor, size_t limit, double score_cutoff, kwargs): * cdef object score = None # <<<<<<<<<<<<<< @@ -6321,19 +6355,19 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __Pyx_INCREF(Py_None); __pyx_v_score = Py_None; - /* "cpp_process.pyx":449 + /* "cpp_process.pyx":459 * # also it is not very memory efficient to allocate space for all elements even when only * # a part is used. This should be optimised in the future * cdef list result_list = [] # <<<<<<<<<<<<<< * * if processor is not None: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result_list = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "cpp_process.pyx":451 + /* "cpp_process.pyx":461 * cdef list result_list = [] * * if processor is not None: # <<<<<<<<<<<<<< @@ -6344,7 +6378,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":452 + /* "cpp_process.pyx":462 * * if processor is not None: * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -6354,9 +6388,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __pyx_t_4 = 0; if (unlikely(__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 452, __pyx_L1_error) + __PYX_ERR(0, 462, __pyx_L1_error) } - __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_7; @@ -6364,7 +6398,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_5, &__pyx_t_4, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 452, __pyx_L1_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_choice_key, __pyx_t_7); @@ -6372,7 +6406,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":453 + /* "cpp_process.pyx":463 * if processor is not None: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -6383,7 +6417,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":454 + /* "cpp_process.pyx":464 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -6392,7 +6426,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ */ goto __pyx_L4_continue; - /* "cpp_process.pyx":453 + /* "cpp_process.pyx":463 * if processor is not None: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -6401,7 +6435,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ */ } - /* "cpp_process.pyx":456 + /* "cpp_process.pyx":466 * continue * * score = scorer(query, processor(choice), score_cutoff, **kwargs) # <<<<<<<<<<<<<< @@ -6421,12 +6455,12 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ } __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 456, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 456, __pyx_L1_error) + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 456, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); @@ -6439,45 +6473,45 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __pyx_t_7 = 0; if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 456, __pyx_L1_error) + __PYX_ERR(0, 466, __pyx_L1_error) } if (likely(PyDict_CheckExact(__pyx_v_kwargs))) { - __pyx_t_7 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 456, __pyx_L1_error) + __pyx_t_7 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } else { - __pyx_t_7 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 456, __pyx_L1_error) + __pyx_t_7 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 456, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF_SET(__pyx_v_score, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":458 + /* "cpp_process.pyx":468 * score = scorer(query, processor(choice), score_cutoff, **kwargs) * * if score >= score_cutoff: # <<<<<<<<<<<<<< * result_list.append((choice, score, choice_key)) * else: */ - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_RichCompare(__pyx_v_score, __pyx_t_8, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_7 = PyObject_RichCompare(__pyx_v_score, __pyx_t_8, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { - /* "cpp_process.pyx":459 + /* "cpp_process.pyx":469 * * if score >= score_cutoff: * result_list.append((choice, score, choice_key)) # <<<<<<<<<<<<<< * else: * for choice_key, choice in choices.items(): */ - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 459, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_choice); __Pyx_GIVEREF(__pyx_v_choice); @@ -6488,10 +6522,10 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __Pyx_INCREF(__pyx_v_choice_key); __Pyx_GIVEREF(__pyx_v_choice_key); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_choice_key); - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_t_7); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 459, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_t_7); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "cpp_process.pyx":458 + /* "cpp_process.pyx":468 * score = scorer(query, processor(choice), score_cutoff, **kwargs) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -6503,7 +6537,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "cpp_process.pyx":451 + /* "cpp_process.pyx":461 * cdef list result_list = [] * * if processor is not None: # <<<<<<<<<<<<<< @@ -6513,7 +6547,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ goto __pyx_L3; } - /* "cpp_process.pyx":461 + /* "cpp_process.pyx":471 * result_list.append((choice, score, choice_key)) * else: * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -6524,9 +6558,9 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __pyx_t_5 = 0; if (unlikely(__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 461, __pyx_L1_error) + __PYX_ERR(0, 471, __pyx_L1_error) } - __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 461, __pyx_L1_error) + __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_7; @@ -6534,7 +6568,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_5, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 461, __pyx_L1_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_choice_key, __pyx_t_7); @@ -6542,7 +6576,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":462 + /* "cpp_process.pyx":472 * else: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -6553,7 +6587,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":463 + /* "cpp_process.pyx":473 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -6562,7 +6596,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ */ goto __pyx_L8_continue; - /* "cpp_process.pyx":462 + /* "cpp_process.pyx":472 * else: * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -6571,16 +6605,16 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ */ } - /* "cpp_process.pyx":465 + /* "cpp_process.pyx":475 * continue * * score = scorer(query, choice, score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if score >= score_cutoff: */ - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 465, __pyx_L1_error) + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 465, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); @@ -6593,45 +6627,45 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __pyx_t_8 = 0; if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 465, __pyx_L1_error) + __PYX_ERR(0, 475, __pyx_L1_error) } if (likely(PyDict_CheckExact(__pyx_v_kwargs))) { - __pyx_t_8 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 465, __pyx_L1_error) + __pyx_t_8 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } else { - __pyx_t_8 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 465, __pyx_L1_error) + __pyx_t_8 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 465, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_score, __pyx_t_10); __pyx_t_10 = 0; - /* "cpp_process.pyx":467 + /* "cpp_process.pyx":477 * score = scorer(query, choice, score_cutoff, **kwargs) * * if score >= score_cutoff: # <<<<<<<<<<<<<< * result_list.append((choice, score, choice_key)) * */ - __pyx_t_10 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 467, __pyx_L1_error) + __pyx_t_10 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = PyObject_RichCompare(__pyx_v_score, __pyx_t_10, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 467, __pyx_L1_error) + __pyx_t_8 = PyObject_RichCompare(__pyx_v_score, __pyx_t_10, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 467, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 477, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":468 + /* "cpp_process.pyx":478 * * if score >= score_cutoff: * result_list.append((choice, score, choice_key)) # <<<<<<<<<<<<<< * * return heapq.nlargest(limit, result_list, key=lambda i: i[1]) */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 468, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_choice); __Pyx_GIVEREF(__pyx_v_choice); @@ -6642,10 +6676,10 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __Pyx_INCREF(__pyx_v_choice_key); __Pyx_GIVEREF(__pyx_v_choice_key); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_choice_key); - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_t_8); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 468, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_t_8); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":467 + /* "cpp_process.pyx":477 * score = scorer(query, choice, score_cutoff, **kwargs) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -6659,7 +6693,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ } __pyx_L3:; - /* "cpp_process.pyx":470 + /* "cpp_process.pyx":480 * result_list.append((choice, score, choice_key)) * * return heapq.nlargest(limit, result_list, key=lambda i: i[1]) # <<<<<<<<<<<<<< @@ -6667,14 +6701,14 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ * */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_heapq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_heapq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nlargest); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nlargest); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_limit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_limit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); @@ -6682,13 +6716,13 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __Pyx_GIVEREF(__pyx_v_result_list); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_result_list); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_15py_extract_dict_lambda, 0, __pyx_n_s_py_extract_dict_locals_lambda, NULL, __pyx_n_s_cpp_process, __pyx_d, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_15py_extract_dict_lambda, 0, __pyx_n_s_py_extract_dict_locals_lambda, NULL, __pyx_n_s_cpp_process, __pyx_d, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_7) < 0) __PYX_ERR(0, 470, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_7) < 0) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; @@ -6697,7 +6731,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ __pyx_t_7 = 0; goto __pyx_L0; - /* "cpp_process.pyx":444 + /* "cpp_process.pyx":454 * * * cdef inline py_extract_dict(query, choices, scorer, processor, size_t limit, double score_cutoff, kwargs): # <<<<<<<<<<<<<< @@ -6723,7 +6757,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_dict(PyObject *_ return __pyx_r; } -/* "cpp_process.pyx":502 +/* "cpp_process.pyx":512 * index += 1 * * return heapq.nlargest(limit, result_list, key=lambda i: i[1]) # <<<<<<<<<<<<<< @@ -6754,7 +6788,7 @@ static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda1", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_i, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_i, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6771,7 +6805,7 @@ static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self return __pyx_r; } -/* "cpp_process.pyx":473 +/* "cpp_process.pyx":483 * * * cdef inline py_extract_list(query, choices, scorer, processor, size_t limit, double score_cutoff, kwargs): # <<<<<<<<<<<<<< @@ -6800,7 +6834,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("py_extract_list", 0); - /* "cpp_process.pyx":474 + /* "cpp_process.pyx":484 * * cdef inline py_extract_list(query, choices, scorer, processor, size_t limit, double score_cutoff, kwargs): * cdef object score = None # <<<<<<<<<<<<<< @@ -6810,19 +6844,19 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ __Pyx_INCREF(Py_None); __pyx_v_score = Py_None; - /* "cpp_process.pyx":478 + /* "cpp_process.pyx":488 * # also it is not very memory efficient to allocate space for all elements even when only * # a part is used. This should be optimised in the future * cdef list result_list = [] # <<<<<<<<<<<<<< * cdef size_t index = 0 * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result_list = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "cpp_process.pyx":479 + /* "cpp_process.pyx":489 * # a part is used. This should be optimised in the future * cdef list result_list = [] * cdef size_t index = 0 # <<<<<<<<<<<<<< @@ -6831,7 +6865,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ */ __pyx_v_index = 0; - /* "cpp_process.pyx":481 + /* "cpp_process.pyx":491 * cdef size_t index = 0 * * if processor is not None: # <<<<<<<<<<<<<< @@ -6842,223 +6876,13 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":482 + /* "cpp_process.pyx":492 * * if processor is not None: * for choice in choices: # <<<<<<<<<<<<<< * if choice is None: * continue */ - if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) { - __pyx_t_1 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } - } else { - __pyx_t_6 = __pyx_t_5(__pyx_t_1); - 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, 482, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6); - __pyx_t_6 = 0; - - /* "cpp_process.pyx":483 - * if processor is not None: - * for choice in choices: - * if choice is None: # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_t_3 = (__pyx_v_choice == Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "cpp_process.pyx":484 - * for choice in choices: - * if choice is None: - * continue # <<<<<<<<<<<<<< - * - * score = scorer(query, processor(choice), score_cutoff, **kwargs) - */ - goto __pyx_L4_continue; - - /* "cpp_process.pyx":483 - * if processor is not None: - * for choice in choices: - * if choice is None: # <<<<<<<<<<<<<< - * continue - * - */ - } - - /* "cpp_process.pyx":486 - * continue - * - * score = scorer(query, processor(choice), score_cutoff, **kwargs) # <<<<<<<<<<<<<< - * - * if score >= score_cutoff: - */ - __Pyx_INCREF(__pyx_v_processor); - __pyx_t_7 = __pyx_v_processor; __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_query); - __Pyx_GIVEREF(__pyx_v_query); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_query); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 486, __pyx_L1_error) - } - if (likely(PyDict_CheckExact(__pyx_v_kwargs))) { - __pyx_t_7 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - } else { - __pyx_t_7 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - } - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF_SET(__pyx_v_score, __pyx_t_6); - __pyx_t_6 = 0; - - /* "cpp_process.pyx":488 - * score = scorer(query, processor(choice), score_cutoff, **kwargs) - * - * if score >= score_cutoff: # <<<<<<<<<<<<<< - * result_list.append((choice, score, index)) - * index += 1 - */ - __pyx_t_6 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_RichCompare(__pyx_v_score, __pyx_t_6, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_2) { - - /* "cpp_process.pyx":489 - * - * if score >= score_cutoff: - * result_list.append((choice, score, index)) # <<<<<<<<<<<<<< - * index += 1 - * else: - */ - __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_choice); - __Pyx_GIVEREF(__pyx_v_choice); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_choice); - __Pyx_INCREF(__pyx_v_score); - __Pyx_GIVEREF(__pyx_v_score); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_score); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "cpp_process.pyx":488 - * score = scorer(query, processor(choice), score_cutoff, **kwargs) - * - * if score >= score_cutoff: # <<<<<<<<<<<<<< - * result_list.append((choice, score, index)) - * index += 1 - */ - } - - /* "cpp_process.pyx":490 - * if score >= score_cutoff: - * result_list.append((choice, score, index)) - * index += 1 # <<<<<<<<<<<<<< - * else: - * for choice in choices: - */ - __pyx_v_index = (__pyx_v_index + 1); - - /* "cpp_process.pyx":482 - * - * if processor is not None: - * for choice in choices: # <<<<<<<<<<<<<< - * if choice is None: - * continue - */ - __pyx_L4_continue:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "cpp_process.pyx":481 - * cdef size_t index = 0 - * - * if processor is not None: # <<<<<<<<<<<<<< - * for choice in choices: - * if choice is None: - */ - goto __pyx_L3; - } - - /* "cpp_process.pyx":492 - * index += 1 - * else: - * for choice in choices: # <<<<<<<<<<<<<< - * if choice is None: - * continue - */ - /*else*/ { if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) { __pyx_t_1 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_5 = NULL; @@ -7102,27 +6926,27 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ __pyx_t_6 = 0; /* "cpp_process.pyx":493 - * else: + * if processor is not None: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_2 = (__pyx_v_choice == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_3 = (__pyx_v_choice == Py_None); + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { /* "cpp_process.pyx":494 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< * - * score = scorer(query, choice, index, **kwargs) + * score = scorer(query, processor(choice), score_cutoff, **kwargs) */ - goto __pyx_L8_continue; + goto __pyx_L4_continue; /* "cpp_process.pyx":493 - * else: + * if processor is not None: * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< * continue @@ -7133,13 +6957,223 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ /* "cpp_process.pyx":496 * continue * + * score = scorer(query, processor(choice), score_cutoff, **kwargs) # <<<<<<<<<<<<<< + * + * if score >= score_cutoff: + */ + __Pyx_INCREF(__pyx_v_processor); + __pyx_t_7 = __pyx_v_processor; __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_choice); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_query); + __Pyx_GIVEREF(__pyx_v_query); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_query); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(0, 496, __pyx_L1_error) + } + if (likely(PyDict_CheckExact(__pyx_v_kwargs))) { + __pyx_t_7 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } else { + __pyx_t_7 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_score, __pyx_t_6); + __pyx_t_6 = 0; + + /* "cpp_process.pyx":498 + * score = scorer(query, processor(choice), score_cutoff, **kwargs) + * + * if score >= score_cutoff: # <<<<<<<<<<<<<< + * result_list.append((choice, score, index)) + * index += 1 + */ + __pyx_t_6 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_v_score, __pyx_t_6, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 498, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 498, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_2) { + + /* "cpp_process.pyx":499 + * + * if score >= score_cutoff: + * result_list.append((choice, score, index)) # <<<<<<<<<<<<<< + * index += 1 + * else: + */ + __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_choice); + __Pyx_GIVEREF(__pyx_v_choice); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_choice); + __Pyx_INCREF(__pyx_v_score); + __Pyx_GIVEREF(__pyx_v_score); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_score); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "cpp_process.pyx":498 + * score = scorer(query, processor(choice), score_cutoff, **kwargs) + * + * if score >= score_cutoff: # <<<<<<<<<<<<<< + * result_list.append((choice, score, index)) + * index += 1 + */ + } + + /* "cpp_process.pyx":500 + * if score >= score_cutoff: + * result_list.append((choice, score, index)) + * index += 1 # <<<<<<<<<<<<<< + * else: + * for choice in choices: + */ + __pyx_v_index = (__pyx_v_index + 1); + + /* "cpp_process.pyx":492 + * + * if processor is not None: + * for choice in choices: # <<<<<<<<<<<<<< + * if choice is None: + * continue + */ + __pyx_L4_continue:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cpp_process.pyx":491 + * cdef size_t index = 0 + * + * if processor is not None: # <<<<<<<<<<<<<< + * for choice in choices: + * if choice is None: + */ + goto __pyx_L3; + } + + /* "cpp_process.pyx":502 + * index += 1 + * else: + * for choice in choices: # <<<<<<<<<<<<<< + * if choice is None: + * continue + */ + /*else*/ { + if (likely(PyList_CheckExact(__pyx_v_choices)) || PyTuple_CheckExact(__pyx_v_choices)) { + __pyx_t_1 = __pyx_v_choices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_choices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 502, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 502, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_5(__pyx_t_1); + 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, 502, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_XDECREF_SET(__pyx_v_choice, __pyx_t_6); + __pyx_t_6 = 0; + + /* "cpp_process.pyx":503 + * else: + * for choice in choices: + * if choice is None: # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_2 = (__pyx_v_choice == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "cpp_process.pyx":504 + * for choice in choices: + * if choice is None: + * continue # <<<<<<<<<<<<<< + * + * score = scorer(query, choice, index, **kwargs) + */ + goto __pyx_L8_continue; + + /* "cpp_process.pyx":503 + * else: + * for choice in choices: + * if choice is None: # <<<<<<<<<<<<<< + * continue + * + */ + } + + /* "cpp_process.pyx":506 + * continue + * * score = scorer(query, choice, index, **kwargs) # <<<<<<<<<<<<<< * * if score >= score_cutoff: */ - __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); @@ -7152,47 +7186,47 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ __pyx_t_6 = 0; if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 496, __pyx_L1_error) + __PYX_ERR(0, 506, __pyx_L1_error) } if (likely(PyDict_CheckExact(__pyx_v_kwargs))) { - __pyx_t_6 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_6 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } else { - __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_6 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 496, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_scorer, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF_SET(__pyx_v_score, __pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":498 + /* "cpp_process.pyx":508 * score = scorer(query, choice, index, **kwargs) * * if score >= score_cutoff: # <<<<<<<<<<<<<< * result_list.append((choice, score, index)) * index += 1 */ - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 498, __pyx_L1_error) + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_score_cutoff); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyObject_RichCompare(__pyx_v_score, __pyx_t_8, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 498, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_v_score, __pyx_t_8, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 498, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_3) { - /* "cpp_process.pyx":499 + /* "cpp_process.pyx":509 * * if score >= score_cutoff: * result_list.append((choice, score, index)) # <<<<<<<<<<<<<< * index += 1 * */ - __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_choice); __Pyx_GIVEREF(__pyx_v_choice); @@ -7203,10 +7237,10 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "cpp_process.pyx":498 + /* "cpp_process.pyx":508 * score = scorer(query, choice, index, **kwargs) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -7215,7 +7249,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ */ } - /* "cpp_process.pyx":500 + /* "cpp_process.pyx":510 * if score >= score_cutoff: * result_list.append((choice, score, index)) * index += 1 # <<<<<<<<<<<<<< @@ -7224,7 +7258,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ */ __pyx_v_index = (__pyx_v_index + 1); - /* "cpp_process.pyx":492 + /* "cpp_process.pyx":502 * index += 1 * else: * for choice in choices: # <<<<<<<<<<<<<< @@ -7237,7 +7271,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ } __pyx_L3:; - /* "cpp_process.pyx":502 + /* "cpp_process.pyx":512 * index += 1 * * return heapq.nlargest(limit, result_list, key=lambda i: i[1]) # <<<<<<<<<<<<<< @@ -7245,14 +7279,14 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ * */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_heapq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_heapq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nlargest); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nlargest); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_limit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_limit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); @@ -7260,13 +7294,13 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ __Pyx_GIVEREF(__pyx_v_result_list); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_result_list); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_15py_extract_list_lambda1, 0, __pyx_n_s_py_extract_list_locals_lambda, NULL, __pyx_n_s_cpp_process, __pyx_d, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_15py_extract_list_lambda1, 0, __pyx_n_s_py_extract_list_locals_lambda, NULL, __pyx_n_s_cpp_process, __pyx_d, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_7) < 0) __PYX_ERR(0, 502, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_7) < 0) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -7275,7 +7309,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ __pyx_t_7 = 0; goto __pyx_L0; - /* "cpp_process.pyx":473 + /* "cpp_process.pyx":483 * * * cdef inline py_extract_list(query, choices, scorer, processor, size_t limit, double score_cutoff, kwargs): # <<<<<<<<<<<<<< @@ -7300,7 +7334,7 @@ static CYTHON_INLINE PyObject *__pyx_f_11cpp_process_py_extract_list(PyObject *_ return __pyx_r; } -/* "cpp_process.pyx":505 +/* "cpp_process.pyx":515 * * * def extract(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, limit=5, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< @@ -7318,9 +7352,9 @@ static PyObject *__pyx_pf_11cpp_process_9__defaults__(CYTHON_UNUSED PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_scorer); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_scorer); @@ -7334,7 +7368,7 @@ static PyObject *__pyx_pf_11cpp_process_9__defaults__(CYTHON_UNUSED PyObject *__ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); @@ -7413,7 +7447,7 @@ static PyObject *__pyx_pw_11cpp_process_3extract(PyObject *__pyx_self, PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_choices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("extract", 0, 2, 6, 1); __PYX_ERR(0, 505, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("extract", 0, 2, 6, 1); __PYX_ERR(0, 515, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -7441,7 +7475,7 @@ static PyObject *__pyx_pw_11cpp_process_3extract(PyObject *__pyx_self, PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "extract") < 0)) __PYX_ERR(0, 505, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "extract") < 0)) __PYX_ERR(0, 515, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7465,14 +7499,14 @@ static PyObject *__pyx_pw_11cpp_process_3extract(PyObject *__pyx_self, PyObject __pyx_v_processor = values[3]; __pyx_v_limit = values[4]; if (values[5]) { - __pyx_v_score_cutoff = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_score_cutoff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L3_error) + __pyx_v_score_cutoff = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_score_cutoff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 515, __pyx_L3_error) } else { __pyx_v_score_cutoff = ((double)((double)0.0)); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("extract", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 505, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("extract", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 515, __pyx_L3_error) __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("cpp_process.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -7517,7 +7551,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __Pyx_INCREF(__pyx_v_processor); __Pyx_INCREF(__pyx_v_limit); - /* "cpp_process.pyx":541 + /* "cpp_process.pyx":551 * * """ * cdef int def_process = 0 # <<<<<<<<<<<<<< @@ -7526,7 +7560,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ __pyx_v_def_process = 0; - /* "cpp_process.pyx":544 + /* "cpp_process.pyx":554 * cdef scorer_context context * * if query is None: # <<<<<<<<<<<<<< @@ -7537,7 +7571,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":545 + /* "cpp_process.pyx":555 * * if query is None: * return None # <<<<<<<<<<<<<< @@ -7548,7 +7582,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "cpp_process.pyx":544 + /* "cpp_process.pyx":554 * cdef scorer_context context * * if query is None: # <<<<<<<<<<<<<< @@ -7557,7 +7591,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ } - /* "cpp_process.pyx":547 + /* "cpp_process.pyx":557 * return None * * if limit is None or limit > len(choices): # <<<<<<<<<<<<<< @@ -7571,31 +7605,31 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __pyx_t_2 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } - __pyx_t_4 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 547, __pyx_L1_error) - __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error) + __pyx_t_4 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 557, __pyx_L1_error) + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_RichCompare(__pyx_v_limit, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 547, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_v_limit, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 547, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_3; __pyx_L5_bool_binop_done:; if (__pyx_t_2) { - /* "cpp_process.pyx":548 + /* "cpp_process.pyx":558 * * if limit is None or limit > len(choices): * limit = len(choices) # <<<<<<<<<<<<<< * * # preprocess the query */ - __pyx_t_4 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 548, __pyx_L1_error) - __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 548, __pyx_L1_error) + __pyx_t_4 = PyObject_Length(__pyx_v_choices); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 558, __pyx_L1_error) + __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF_SET(__pyx_v_limit, __pyx_t_6); __pyx_t_6 = 0; - /* "cpp_process.pyx":547 + /* "cpp_process.pyx":557 * return None * * if limit is None or limit > len(choices): # <<<<<<<<<<<<<< @@ -7604,25 +7638,25 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ } - /* "cpp_process.pyx":551 + /* "cpp_process.pyx":561 * * # preprocess the query * if processor == utils.default_process: # <<<<<<<<<<<<<< * def_process = 1 * # since this call is only performed once it is not very expensive to */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_utils); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_utils); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_default_process); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 551, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_default_process); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 551, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_v_processor, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 551, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_2) { - /* "cpp_process.pyx":552 + /* "cpp_process.pyx":562 * # preprocess the query * if processor == utils.default_process: * def_process = 1 # <<<<<<<<<<<<<< @@ -7631,7 +7665,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ __pyx_v_def_process = 1; - /* "cpp_process.pyx":555 + /* "cpp_process.pyx":565 * # since this call is only performed once it is not very expensive to * # make it in Python * query = processor(query) # <<<<<<<<<<<<<< @@ -7651,13 +7685,13 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s } __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_query); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 555, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_6); __pyx_t_6 = 0; - /* "cpp_process.pyx":556 + /* "cpp_process.pyx":566 * # make it in Python * query = processor(query) * processor = None # <<<<<<<<<<<<<< @@ -7667,7 +7701,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __Pyx_INCREF(Py_None); __Pyx_DECREF_SET(__pyx_v_processor, Py_None); - /* "cpp_process.pyx":551 + /* "cpp_process.pyx":561 * * # preprocess the query * if processor == utils.default_process: # <<<<<<<<<<<<<< @@ -7677,18 +7711,18 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s goto __pyx_L7; } - /* "cpp_process.pyx":557 + /* "cpp_process.pyx":567 * query = processor(query) * processor = None * elif callable(processor): # <<<<<<<<<<<<<< * query = processor(query) * elif processor: */ - __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 557, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 567, __pyx_L1_error) __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":558 + /* "cpp_process.pyx":568 * processor = None * elif callable(processor): * query = processor(query) # <<<<<<<<<<<<<< @@ -7708,13 +7742,13 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s } __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_query); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 558, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_6); __pyx_t_6 = 0; - /* "cpp_process.pyx":557 + /* "cpp_process.pyx":567 * query = processor(query) * processor = None * elif callable(processor): # <<<<<<<<<<<<<< @@ -7724,17 +7758,17 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s goto __pyx_L7; } - /* "cpp_process.pyx":559 + /* "cpp_process.pyx":569 * elif callable(processor): * query = processor(query) * elif processor: # <<<<<<<<<<<<<< * def_process = 1 * # since this call is only performed once it is not very expensive to */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_processor); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 559, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_processor); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 569, __pyx_L1_error) if (__pyx_t_3) { - /* "cpp_process.pyx":560 + /* "cpp_process.pyx":570 * query = processor(query) * elif processor: * def_process = 1 # <<<<<<<<<<<<<< @@ -7743,16 +7777,16 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ __pyx_v_def_process = 1; - /* "cpp_process.pyx":563 + /* "cpp_process.pyx":573 * # since this call is only performed once it is not very expensive to * # make it in Python * query = utils.default_process(query) # <<<<<<<<<<<<<< * processor = None * # query might be e.g. False */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_utils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_default_process); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_default_process); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; @@ -7767,13 +7801,13 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s } __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_query); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 563, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_6); __pyx_t_6 = 0; - /* "cpp_process.pyx":564 + /* "cpp_process.pyx":574 * # make it in Python * query = utils.default_process(query) * processor = None # <<<<<<<<<<<<<< @@ -7783,7 +7817,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __Pyx_INCREF(Py_None); __Pyx_DECREF_SET(__pyx_v_processor, Py_None); - /* "cpp_process.pyx":559 + /* "cpp_process.pyx":569 * elif callable(processor): * query = processor(query) * elif processor: # <<<<<<<<<<<<<< @@ -7793,7 +7827,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s goto __pyx_L7; } - /* "cpp_process.pyx":567 + /* "cpp_process.pyx":577 * # query might be e.g. False * else: * processor = None # <<<<<<<<<<<<<< @@ -7806,7 +7840,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s } __pyx_L7:; - /* "cpp_process.pyx":570 + /* "cpp_process.pyx":580 * * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) # <<<<<<<<<<<<<< @@ -7815,7 +7849,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ __pyx_v_context = __pyx_f_11cpp_process_CachedScorerInit(__pyx_v_scorer, __pyx_v_query, __pyx_v_def_process); - /* "cpp_process.pyx":571 + /* "cpp_process.pyx":581 * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: # <<<<<<<<<<<<<< @@ -7825,7 +7859,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __pyx_t_3 = ((__pyx_v_context.context != NULL) != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":572 + /* "cpp_process.pyx":582 * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: * try: # <<<<<<<<<<<<<< @@ -7834,18 +7868,18 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ /*try:*/ { - /* "cpp_process.pyx":573 + /* "cpp_process.pyx":583 * if context.context != NULL: * try: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< * return extract_dict(context, choices, processor, limit, score_cutoff) * else: */ - __pyx_t_3 = __Pyx_HasAttr(__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 573, __pyx_L10_error) + __pyx_t_3 = __Pyx_HasAttr(__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 583, __pyx_L10_error) __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":574 + /* "cpp_process.pyx":584 * try: * if hasattr(choices, "items"): * return extract_dict(context, choices, processor, limit, score_cutoff) # <<<<<<<<<<<<<< @@ -7853,14 +7887,14 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s * return extract_list(context, choices, processor, limit, score_cutoff) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_limit); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 574, __pyx_L10_error) - __pyx_t_6 = __pyx_f_11cpp_process_extract_dict(__pyx_v_context, __pyx_v_choices, __pyx_v_processor, __pyx_t_8, __pyx_v_score_cutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 574, __pyx_L10_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_limit); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L10_error) + __pyx_t_6 = __pyx_f_11cpp_process_extract_dict(__pyx_v_context, __pyx_v_choices, __pyx_v_processor, __pyx_t_8, __pyx_v_score_cutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 584, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L9_return; - /* "cpp_process.pyx":573 + /* "cpp_process.pyx":583 * if context.context != NULL: * try: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -7869,7 +7903,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ } - /* "cpp_process.pyx":576 + /* "cpp_process.pyx":586 * return extract_dict(context, choices, processor, limit, score_cutoff) * else: * return extract_list(context, choices, processor, limit, score_cutoff) # <<<<<<<<<<<<<< @@ -7878,8 +7912,8 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_limit); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L10_error) - __pyx_t_6 = __pyx_f_11cpp_process_extract_list(__pyx_v_context, __pyx_v_choices, __pyx_v_processor, __pyx_t_8, __pyx_v_score_cutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 576, __pyx_L10_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_limit); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 586, __pyx_L10_error) + __pyx_t_6 = __pyx_f_11cpp_process_extract_list(__pyx_v_context, __pyx_v_choices, __pyx_v_processor, __pyx_t_8, __pyx_v_score_cutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 586, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; @@ -7887,7 +7921,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s } } - /* "cpp_process.pyx":580 + /* "cpp_process.pyx":590 * finally: * # part of the context is dynamically allocated, so it has to be freed in any case * context.deinit(context.context) # <<<<<<<<<<<<<< @@ -7917,7 +7951,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __pyx_v_context.deinit(__pyx_v_context.context); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 580, __pyx_L14_error) + __PYX_ERR(0, 590, __pyx_L14_error) } } if (PY_MAJOR_VERSION >= 3) { @@ -7953,7 +7987,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s __pyx_v_context.deinit(__pyx_v_context.context); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 580, __pyx_L1_error) + __PYX_ERR(0, 590, __pyx_L1_error) } __pyx_r = __pyx_t_17; __pyx_t_17 = 0; @@ -7961,7 +7995,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s } } - /* "cpp_process.pyx":571 + /* "cpp_process.pyx":581 * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: # <<<<<<<<<<<<<< @@ -7970,7 +8004,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ } - /* "cpp_process.pyx":583 + /* "cpp_process.pyx":593 * # the scorer has to be called through Python * else: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -7978,11 +8012,11 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s * else: */ /*else*/ { - __pyx_t_2 = __Pyx_HasAttr(__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 583, __pyx_L1_error) + __pyx_t_2 = __Pyx_HasAttr(__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 593, __pyx_L1_error) __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "cpp_process.pyx":584 + /* "cpp_process.pyx":594 * else: * if hasattr(choices, "items"): * return py_extract_dict(query, choices, scorer, processor, limit, score_cutoff, kwargs) # <<<<<<<<<<<<<< @@ -7990,14 +8024,14 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s * return py_extract_list(query, choices, scorer, processor, limit, score_cutoff, kwargs) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_limit); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L1_error) - __pyx_t_6 = __pyx_f_11cpp_process_py_extract_dict(__pyx_v_query, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_t_8, __pyx_v_score_cutoff, __pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 584, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_limit); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L1_error) + __pyx_t_6 = __pyx_f_11cpp_process_py_extract_dict(__pyx_v_query, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_t_8, __pyx_v_score_cutoff, __pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "cpp_process.pyx":583 + /* "cpp_process.pyx":593 * # the scorer has to be called through Python * else: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -8006,7 +8040,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ } - /* "cpp_process.pyx":586 + /* "cpp_process.pyx":596 * return py_extract_dict(query, choices, scorer, processor, limit, score_cutoff, kwargs) * else: * return py_extract_list(query, choices, scorer, processor, limit, score_cutoff, kwargs) # <<<<<<<<<<<<<< @@ -8015,8 +8049,8 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_limit); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 586, __pyx_L1_error) - __pyx_t_6 = __pyx_f_11cpp_process_py_extract_list(__pyx_v_query, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_t_8, __pyx_v_score_cutoff, __pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 586, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_v_limit); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) + __pyx_t_6 = __pyx_f_11cpp_process_py_extract_list(__pyx_v_query, __pyx_v_choices, __pyx_v_scorer, __pyx_v_processor, __pyx_t_8, __pyx_v_score_cutoff, __pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; @@ -8024,7 +8058,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s } } - /* "cpp_process.pyx":505 + /* "cpp_process.pyx":515 * * * def extract(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, limit=5, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< @@ -8049,7 +8083,7 @@ static PyObject *__pyx_pf_11cpp_process_2extract(CYTHON_UNUSED PyObject *__pyx_s } static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "cpp_process.pyx":589 +/* "cpp_process.pyx":599 * * * def extract_iter(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< @@ -8067,9 +8101,9 @@ static PyObject *__pyx_pf_11cpp_process_11__defaults__(CYTHON_UNUSED PyObject *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_scorer); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_scorer); @@ -8080,7 +8114,7 @@ static PyObject *__pyx_pf_11cpp_process_11__defaults__(CYTHON_UNUSED PyObject *_ __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); @@ -8155,7 +8189,7 @@ static PyObject *__pyx_pw_11cpp_process_5extract_iter(PyObject *__pyx_self, PyOb case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_choices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("extract_iter", 0, 2, 5, 1); __PYX_ERR(0, 589, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("extract_iter", 0, 2, 5, 1); __PYX_ERR(0, 599, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -8177,7 +8211,7 @@ static PyObject *__pyx_pw_11cpp_process_5extract_iter(PyObject *__pyx_self, PyOb } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "extract_iter") < 0)) __PYX_ERR(0, 589, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "extract_iter") < 0)) __PYX_ERR(0, 599, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -8198,14 +8232,14 @@ static PyObject *__pyx_pw_11cpp_process_5extract_iter(PyObject *__pyx_self, PyOb __pyx_v_scorer = values[2]; __pyx_v_processor = values[3]; if (values[4]) { - __pyx_v_score_cutoff = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_score_cutoff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L3_error) + __pyx_v_score_cutoff = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_score_cutoff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 599, __pyx_L3_error) } else { __pyx_v_score_cutoff = ((double)((double)0.0)); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("extract_iter", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 589, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("extract_iter", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 599, __pyx_L3_error) __pyx_L3_error:; __Pyx_CLEAR(__pyx_v_kwargs); __Pyx_AddTraceback("cpp_process.extract_iter", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -8232,7 +8266,7 @@ static PyObject *__pyx_pf_11cpp_process_4extract_iter(CYTHON_UNUSED PyObject *__ if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_11cpp_process___pyx_scope_struct__extract_iter *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 589, __pyx_L1_error) + __PYX_ERR(0, 599, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -8253,7 +8287,7 @@ static PyObject *__pyx_pf_11cpp_process_4extract_iter(CYTHON_UNUSED PyObject *__ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_kwargs); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_kwargs); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11cpp_process_6generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_extract_iter, __pyx_n_s_extract_iter, __pyx_n_s_cpp_process); if (unlikely(!gen)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_11cpp_process_6generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_extract_iter, __pyx_n_s_extract_iter, __pyx_n_s_cpp_process); if (unlikely(!gen)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -8313,9 +8347,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 589, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 599, __pyx_L1_error) - /* "cpp_process.pyx":623 + /* "cpp_process.pyx":633 * Matches with a similarity, that is smaller than score_cutoff are skipped. * """ * cdef int def_process = 0 # <<<<<<<<<<<<<< @@ -8324,7 +8358,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ __pyx_cur_scope->__pyx_v_def_process = 0; - /* "cpp_process.pyx":625 + /* "cpp_process.pyx":635 * cdef int def_process = 0 * cdef scorer_context context * cdef double score = 0.0 # <<<<<<<<<<<<<< @@ -8333,7 +8367,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ __pyx_cur_scope->__pyx_v_score = 0.0; - /* "cpp_process.pyx":629 + /* "cpp_process.pyx":639 * cdef size_t index * * if query is None: # <<<<<<<<<<<<<< @@ -8344,7 +8378,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":630 + /* "cpp_process.pyx":640 * * if query is None: * return None # <<<<<<<<<<<<<< @@ -8355,7 +8389,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_r = NULL; goto __pyx_L0; - /* "cpp_process.pyx":629 + /* "cpp_process.pyx":639 * cdef size_t index * * if query is None: # <<<<<<<<<<<<<< @@ -8364,25 +8398,25 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":633 + /* "cpp_process.pyx":643 * * # preprocess the query * if processor == utils.default_process: # <<<<<<<<<<<<<< * def_process = 1 * # since this call is only performed once it is not very expensive to */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_processor, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_processor, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 633, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) { - /* "cpp_process.pyx":634 + /* "cpp_process.pyx":644 * # preprocess the query * if processor == utils.default_process: * def_process = 1 # <<<<<<<<<<<<<< @@ -8391,7 +8425,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ __pyx_cur_scope->__pyx_v_def_process = 1; - /* "cpp_process.pyx":637 + /* "cpp_process.pyx":647 * # since this call is only performed once it is not very expensive to * # make it in Python * query = processor(query) # <<<<<<<<<<<<<< @@ -8411,7 +8445,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_cur_scope->__pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_query); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_query); @@ -8419,7 +8453,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":638 + /* "cpp_process.pyx":648 * # make it in Python * query = processor(query) * processor = None # <<<<<<<<<<<<<< @@ -8431,7 +8465,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_processor, Py_None); __Pyx_GIVEREF(Py_None); - /* "cpp_process.pyx":633 + /* "cpp_process.pyx":643 * * # preprocess the query * if processor == utils.default_process: # <<<<<<<<<<<<<< @@ -8441,18 +8475,18 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L5; } - /* "cpp_process.pyx":639 + /* "cpp_process.pyx":649 * query = processor(query) * processor = None * elif callable(processor): # <<<<<<<<<<<<<< * query = processor(query) * elif processor: */ - __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_cur_scope->__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 639, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_cur_scope->__pyx_v_processor); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 649, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":640 + /* "cpp_process.pyx":650 * processor = None * elif callable(processor): * query = processor(query) # <<<<<<<<<<<<<< @@ -8472,7 +8506,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_cur_scope->__pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_query); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 640, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 650, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_query); @@ -8480,7 +8514,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":639 + /* "cpp_process.pyx":649 * query = processor(query) * processor = None * elif callable(processor): # <<<<<<<<<<<<<< @@ -8490,17 +8524,17 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L5; } - /* "cpp_process.pyx":641 + /* "cpp_process.pyx":651 * elif callable(processor): * query = processor(query) * elif processor: # <<<<<<<<<<<<<< * def_process = 1 * # since this call is only performed once it is not very expensive to */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_processor); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 641, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_processor); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 651, __pyx_L1_error) if (__pyx_t_1) { - /* "cpp_process.pyx":642 + /* "cpp_process.pyx":652 * query = processor(query) * elif processor: * def_process = 1 # <<<<<<<<<<<<<< @@ -8509,16 +8543,16 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ __pyx_cur_scope->__pyx_v_def_process = 1; - /* "cpp_process.pyx":645 + /* "cpp_process.pyx":655 * # since this call is only performed once it is not very expensive to * # make it in Python * query = utils.default_process(query) # <<<<<<<<<<<<<< * processor = None * # query might be e.g. False */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_utils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_utils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_default_process); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -8533,7 +8567,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_cur_scope->__pyx_v_query) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_query); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 645, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_query); @@ -8541,7 +8575,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":646 + /* "cpp_process.pyx":656 * # make it in Python * query = utils.default_process(query) * processor = None # <<<<<<<<<<<<<< @@ -8553,7 +8587,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_processor, Py_None); __Pyx_GIVEREF(Py_None); - /* "cpp_process.pyx":641 + /* "cpp_process.pyx":651 * elif callable(processor): * query = processor(query) * elif processor: # <<<<<<<<<<<<<< @@ -8563,7 +8597,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L5; } - /* "cpp_process.pyx":649 + /* "cpp_process.pyx":659 * # query might be e.g. False * else: * processor = None # <<<<<<<<<<<<<< @@ -8578,7 +8612,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_L5:; - /* "cpp_process.pyx":652 + /* "cpp_process.pyx":662 * * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) # <<<<<<<<<<<<<< @@ -8587,7 +8621,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ __pyx_cur_scope->__pyx_v_context = __pyx_f_11cpp_process_CachedScorerInit(__pyx_cur_scope->__pyx_v_scorer, __pyx_cur_scope->__pyx_v_query, __pyx_cur_scope->__pyx_v_def_process); - /* "cpp_process.pyx":653 + /* "cpp_process.pyx":663 * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: # <<<<<<<<<<<<<< @@ -8597,7 +8631,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_context.context != NULL) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":654 + /* "cpp_process.pyx":664 * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: * try: # <<<<<<<<<<<<<< @@ -8606,18 +8640,18 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ /*try:*/ { - /* "cpp_process.pyx":655 + /* "cpp_process.pyx":665 * if context.context != NULL: * try: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< * if processor is not None: * # c func + dict + python processor */ - __pyx_t_1 = __Pyx_HasAttr(__pyx_cur_scope->__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 655, __pyx_L8_error) + __pyx_t_1 = __Pyx_HasAttr(__pyx_cur_scope->__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 665, __pyx_L8_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":656 + /* "cpp_process.pyx":666 * try: * if hasattr(choices, "items"): * if processor is not None: # <<<<<<<<<<<<<< @@ -8628,7 +8662,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":658 + /* "cpp_process.pyx":668 * if processor is not None: * # c func + dict + python processor * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -8638,9 +8672,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_6 = 0; if (unlikely(__pyx_cur_scope->__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 658, __pyx_L8_error) + __PYX_ERR(0, 668, __pyx_L8_error) } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 658, __pyx_L8_error) + __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 668, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_5; @@ -8648,7 +8682,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_7, &__pyx_t_6, &__pyx_t_5, &__pyx_t_4, NULL, __pyx_t_8); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 658, __pyx_L8_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 668, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_choice_key); @@ -8660,7 +8694,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":659 + /* "cpp_process.pyx":669 * # c func + dict + python processor * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -8671,7 +8705,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":660 + /* "cpp_process.pyx":670 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -8680,7 +8714,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ goto __pyx_L12_continue; - /* "cpp_process.pyx":659 + /* "cpp_process.pyx":669 * # c func + dict + python processor * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -8689,7 +8723,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":662 + /* "cpp_process.pyx":672 * continue * * score = context.scorer(context.context, processor(choice), score_cutoff) # <<<<<<<<<<<<<< @@ -8709,20 +8743,20 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_cur_scope->__pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_choice); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L8_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 672, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; try { __pyx_t_11 = __pyx_cur_scope->__pyx_v_context.scorer(__pyx_cur_scope->__pyx_v_context.context, __pyx_t_4, __pyx_cur_scope->__pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L8_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 672, __pyx_L8_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 662, __pyx_L8_error) + __PYX_ERR(0, 672, __pyx_L8_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_cur_scope->__pyx_v_score = __pyx_t_11; - /* "cpp_process.pyx":664 + /* "cpp_process.pyx":674 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -8732,16 +8766,16 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_score >= __pyx_cur_scope->__pyx_v_score_cutoff) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":665 + /* "cpp_process.pyx":675 * * if score >= score_cutoff: * yield (choice, score, choice_key) # <<<<<<<<<<<<<< * else: * # c func + dict + no python processor */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 665, __pyx_L8_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L8_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_choice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); @@ -8772,9 +8806,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_7 = __pyx_cur_scope->__pyx_t_2; __pyx_t_8 = __pyx_cur_scope->__pyx_t_3; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 665, __pyx_L8_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 675, __pyx_L8_error) - /* "cpp_process.pyx":664 + /* "cpp_process.pyx":674 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -8786,7 +8820,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":656 + /* "cpp_process.pyx":666 * try: * if hasattr(choices, "items"): * if processor is not None: # <<<<<<<<<<<<<< @@ -8796,7 +8830,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L11; } - /* "cpp_process.pyx":668 + /* "cpp_process.pyx":678 * else: * # c func + dict + no python processor * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -8807,9 +8841,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_7 = 0; if (unlikely(__pyx_cur_scope->__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 668, __pyx_L8_error) + __PYX_ERR(0, 678, __pyx_L8_error) } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_6), (&__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 668, __pyx_L8_error) + __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_6), (&__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 678, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_5; @@ -8817,7 +8851,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_6, &__pyx_t_7, &__pyx_t_5, &__pyx_t_4, NULL, __pyx_t_8); if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 668, __pyx_L8_error) + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 678, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_choice_key); @@ -8829,7 +8863,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":669 + /* "cpp_process.pyx":679 * # c func + dict + no python processor * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -8840,7 +8874,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":670 + /* "cpp_process.pyx":680 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -8849,7 +8883,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ goto __pyx_L17_continue; - /* "cpp_process.pyx":669 + /* "cpp_process.pyx":679 * # c func + dict + no python processor * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -8858,7 +8892,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":672 + /* "cpp_process.pyx":682 * continue * * score = context.scorer(context.context, choice, score_cutoff) # <<<<<<<<<<<<<< @@ -8867,14 +8901,14 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ try { __pyx_t_11 = __pyx_cur_scope->__pyx_v_context.scorer(__pyx_cur_scope->__pyx_v_context.context, __pyx_cur_scope->__pyx_v_choice, __pyx_cur_scope->__pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 672, __pyx_L8_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L8_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 672, __pyx_L8_error) + __PYX_ERR(0, 682, __pyx_L8_error) } __pyx_cur_scope->__pyx_v_score = __pyx_t_11; - /* "cpp_process.pyx":674 + /* "cpp_process.pyx":684 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -8884,16 +8918,16 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_score >= __pyx_cur_scope->__pyx_v_score_cutoff) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":675 + /* "cpp_process.pyx":685 * * if score >= score_cutoff: * yield (choice, score, choice_key) # <<<<<<<<<<<<<< * else: * index = 0 */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L8_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L8_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 685, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_choice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); @@ -8924,9 +8958,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_7 = __pyx_cur_scope->__pyx_t_2; __pyx_t_8 = __pyx_cur_scope->__pyx_t_3; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 675, __pyx_L8_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 685, __pyx_L8_error) - /* "cpp_process.pyx":674 + /* "cpp_process.pyx":684 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -8940,7 +8974,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_L11:; - /* "cpp_process.pyx":655 + /* "cpp_process.pyx":665 * if context.context != NULL: * try: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -8950,7 +8984,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L10; } - /* "cpp_process.pyx":677 + /* "cpp_process.pyx":687 * yield (choice, score, choice_key) * else: * index = 0 # <<<<<<<<<<<<<< @@ -8960,7 +8994,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ /*else*/ { __pyx_cur_scope->__pyx_v_index = 0; - /* "cpp_process.pyx":678 + /* "cpp_process.pyx":688 * else: * index = 0 * if processor is not None: # <<<<<<<<<<<<<< @@ -8971,7 +9005,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":680 + /* "cpp_process.pyx":690 * if processor is not None: * # c func + list + python processor * for choice in choices: # <<<<<<<<<<<<<< @@ -8982,26 +9016,26 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_3 = __pyx_cur_scope->__pyx_v_choices; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 680, __pyx_L8_error) + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 690, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 680, __pyx_L8_error) + __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 690, __pyx_L8_error) } for (;;) { if (likely(!__pyx_t_12)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 680, __pyx_L8_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 690, __pyx_L8_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 680, __pyx_L8_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 690, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 680, __pyx_L8_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 690, __pyx_L8_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 680, __pyx_L8_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 690, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -9011,7 +9045,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 680, __pyx_L8_error) + else __PYX_ERR(0, 690, __pyx_L8_error) } break; } @@ -9022,7 +9056,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - /* "cpp_process.pyx":681 + /* "cpp_process.pyx":691 * # c func + list + python processor * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -9033,7 +9067,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":682 + /* "cpp_process.pyx":692 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< @@ -9042,7 +9076,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ goto __pyx_L23_continue; - /* "cpp_process.pyx":681 + /* "cpp_process.pyx":691 * # c func + list + python processor * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -9051,7 +9085,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":684 + /* "cpp_process.pyx":694 * continue * * score = context.scorer(context.context, processor(choice), score_cutoff) # <<<<<<<<<<<<<< @@ -9071,20 +9105,20 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_cur_scope->__pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_choice); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 684, __pyx_L8_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; try { __pyx_t_11 = __pyx_cur_scope->__pyx_v_context.scorer(__pyx_cur_scope->__pyx_v_context.context, __pyx_t_5, __pyx_cur_scope->__pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 684, __pyx_L8_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L8_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 684, __pyx_L8_error) + __PYX_ERR(0, 694, __pyx_L8_error) } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_cur_scope->__pyx_v_score = __pyx_t_11; - /* "cpp_process.pyx":686 + /* "cpp_process.pyx":696 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -9094,18 +9128,18 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_score >= __pyx_cur_scope->__pyx_v_score_cutoff) != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":687 + /* "cpp_process.pyx":697 * * if score >= score_cutoff: * yield (choice, score, index) # <<<<<<<<<<<<<< * index += 1 * else: */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 687, __pyx_L8_error) + __pyx_t_5 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L8_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 697, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 687, __pyx_L8_error) + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 697, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_choice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); @@ -9134,9 +9168,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_XGOTREF(__pyx_t_3); __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_12 = __pyx_cur_scope->__pyx_t_4; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 687, __pyx_L8_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 697, __pyx_L8_error) - /* "cpp_process.pyx":686 + /* "cpp_process.pyx":696 * score = context.scorer(context.context, processor(choice), score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -9145,7 +9179,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":688 + /* "cpp_process.pyx":698 * if score >= score_cutoff: * yield (choice, score, index) * index += 1 # <<<<<<<<<<<<<< @@ -9154,7 +9188,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ __pyx_cur_scope->__pyx_v_index = (__pyx_cur_scope->__pyx_v_index + 1); - /* "cpp_process.pyx":680 + /* "cpp_process.pyx":690 * if processor is not None: * # c func + list + python processor * for choice in choices: # <<<<<<<<<<<<<< @@ -9165,7 +9199,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":678 + /* "cpp_process.pyx":688 * else: * index = 0 * if processor is not None: # <<<<<<<<<<<<<< @@ -9175,7 +9209,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L22; } - /* "cpp_process.pyx":691 + /* "cpp_process.pyx":701 * else: * # c func + list + no python processor * for choice in choices: # <<<<<<<<<<<<<< @@ -9187,26 +9221,26 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_3 = __pyx_cur_scope->__pyx_v_choices; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 691, __pyx_L8_error) + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 701, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L8_error) + __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 701, __pyx_L8_error) } for (;;) { if (likely(!__pyx_t_12)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 691, __pyx_L8_error) + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 701, __pyx_L8_error) #else - __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 691, __pyx_L8_error) + __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 701, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_10); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 691, __pyx_L8_error) + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 701, __pyx_L8_error) #else - __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 691, __pyx_L8_error) + __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 701, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_10); #endif } @@ -9216,7 +9250,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 691, __pyx_L8_error) + else __PYX_ERR(0, 701, __pyx_L8_error) } break; } @@ -9227,7 +9261,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - /* "cpp_process.pyx":692 + /* "cpp_process.pyx":702 * # c func + list + no python processor * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -9238,7 +9272,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":693 + /* "cpp_process.pyx":703 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< @@ -9247,7 +9281,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ goto __pyx_L28_continue; - /* "cpp_process.pyx":692 + /* "cpp_process.pyx":702 * # c func + list + no python processor * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -9256,7 +9290,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":695 + /* "cpp_process.pyx":705 * continue * * score = context.scorer(context.context, choice, score_cutoff) # <<<<<<<<<<<<<< @@ -9265,14 +9299,14 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ try { __pyx_t_11 = __pyx_cur_scope->__pyx_v_context.scorer(__pyx_cur_scope->__pyx_v_context.context, __pyx_cur_scope->__pyx_v_choice, __pyx_cur_scope->__pyx_v_score_cutoff); - if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 695, __pyx_L8_error) + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 705, __pyx_L8_error) } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 695, __pyx_L8_error) + __PYX_ERR(0, 705, __pyx_L8_error) } __pyx_cur_scope->__pyx_v_score = __pyx_t_11; - /* "cpp_process.pyx":697 + /* "cpp_process.pyx":707 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -9282,18 +9316,18 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_score >= __pyx_cur_scope->__pyx_v_score_cutoff) != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":698 + /* "cpp_process.pyx":708 * * if score >= score_cutoff: * yield (choice, score, index) # <<<<<<<<<<<<<< * index += 1 * finally: */ - __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 698, __pyx_L8_error) + __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 708, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L8_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L8_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_choice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); @@ -9322,9 +9356,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_XGOTREF(__pyx_t_3); __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_12 = __pyx_cur_scope->__pyx_t_4; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 698, __pyx_L8_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 708, __pyx_L8_error) - /* "cpp_process.pyx":697 + /* "cpp_process.pyx":707 * score = context.scorer(context.context, choice, score_cutoff) * * if score >= score_cutoff: # <<<<<<<<<<<<<< @@ -9333,7 +9367,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":699 + /* "cpp_process.pyx":709 * if score >= score_cutoff: * yield (choice, score, index) * index += 1 # <<<<<<<<<<<<<< @@ -9342,7 +9376,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ __pyx_cur_scope->__pyx_v_index = (__pyx_cur_scope->__pyx_v_index + 1); - /* "cpp_process.pyx":691 + /* "cpp_process.pyx":701 * else: * # c func + list + no python processor * for choice in choices: # <<<<<<<<<<<<<< @@ -9358,7 +9392,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_L10:; } - /* "cpp_process.pyx":702 + /* "cpp_process.pyx":712 * finally: * # part of the context is dynamically allocated, so it has to be freed in any case * context.deinit(context.context) # <<<<<<<<<<<<<< @@ -9371,7 +9405,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_cur_scope->__pyx_v_context.deinit(__pyx_cur_scope->__pyx_v_context.context); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 702, __pyx_L1_error) + __PYX_ERR(0, 712, __pyx_L1_error) } goto __pyx_L9; } @@ -9397,7 +9431,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_cur_scope->__pyx_v_context.deinit(__pyx_cur_scope->__pyx_v_context.context); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 702, __pyx_L34_error) + __PYX_ERR(0, 712, __pyx_L34_error) } } if (PY_MAJOR_VERSION >= 3) { @@ -9429,7 +9463,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_L9:; } - /* "cpp_process.pyx":653 + /* "cpp_process.pyx":663 * # directly use the C++ implementation if possible * context = CachedScorerInit(scorer, query, def_process) * if context.context != NULL: # <<<<<<<<<<<<<< @@ -9439,7 +9473,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L6; } - /* "cpp_process.pyx":705 + /* "cpp_process.pyx":715 * # the scorer has to be called through Python * else: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -9447,11 +9481,11 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ * # python func + dict + python processor */ /*else*/ { - __pyx_t_2 = __Pyx_HasAttr(__pyx_cur_scope->__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 705, __pyx_L1_error) + __pyx_t_2 = __Pyx_HasAttr(__pyx_cur_scope->__pyx_v_choices, __pyx_n_u_items); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 715, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":706 + /* "cpp_process.pyx":716 * else: * if hasattr(choices, "items"): * if processor is not None: # <<<<<<<<<<<<<< @@ -9462,7 +9496,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":708 + /* "cpp_process.pyx":718 * if processor is not None: * # python func + dict + python processor * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -9472,9 +9506,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_6 = 0; if (unlikely(__pyx_cur_scope->__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 708, __pyx_L1_error) + __PYX_ERR(0, 718, __pyx_L1_error) } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_9)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error) + __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_9)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_5; @@ -9482,7 +9516,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ while (1) { __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_7, &__pyx_t_6, &__pyx_t_5, &__pyx_t_4, NULL, __pyx_t_9); if (unlikely(__pyx_t_8 == 0)) break; - if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 708, __pyx_L1_error) + if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_choice_key); @@ -9494,7 +9528,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":709 + /* "cpp_process.pyx":719 * # python func + dict + python processor * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -9505,7 +9539,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":710 + /* "cpp_process.pyx":720 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -9514,7 +9548,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ goto __pyx_L37_continue; - /* "cpp_process.pyx":709 + /* "cpp_process.pyx":719 * # python func + dict + python processor * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -9523,7 +9557,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":712 + /* "cpp_process.pyx":722 * continue * * py_score = scorer(query, processor(choice), # <<<<<<<<<<<<<< @@ -9543,10 +9577,10 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_cur_scope->__pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_choice); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 712, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 712, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_query); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_query); @@ -9555,32 +9589,32 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":713 + /* "cpp_process.pyx":723 * * py_score = scorer(query, processor(choice), * processor=None, score_cutoff=score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if py_score >= score_cutoff: */ - __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 713, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 723, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 713, __pyx_L1_error) - __pyx_t_20 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 713, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_20 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 723, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_score_cutoff, __pyx_t_20) < 0) __PYX_ERR(0, 713, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_score_cutoff, __pyx_t_20) < 0) __PYX_ERR(0, 723, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __pyx_t_4 = __pyx_t_10; __pyx_t_10 = 0; - if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 713, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 723, __pyx_L1_error) - /* "cpp_process.pyx":712 + /* "cpp_process.pyx":722 * continue * * py_score = scorer(query, processor(choice), # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_scorer, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 712, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_scorer, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9589,29 +9623,29 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - /* "cpp_process.pyx":715 + /* "cpp_process.pyx":725 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if py_score >= score_cutoff: # <<<<<<<<<<<<<< * yield (choice, py_score, choice_key) * else: */ - __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 715, __pyx_L1_error) + __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 725, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_py_score, __pyx_t_10, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_py_score, __pyx_t_10, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 725, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 715, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 725, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "cpp_process.pyx":716 + /* "cpp_process.pyx":726 * * if py_score >= score_cutoff: * yield (choice, py_score, choice_key) # <<<<<<<<<<<<<< * else: * # python func + dict + no python processor */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_choice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); @@ -9642,9 +9676,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_7 = __pyx_cur_scope->__pyx_t_2; __pyx_t_9 = __pyx_cur_scope->__pyx_t_3; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 716, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 726, __pyx_L1_error) - /* "cpp_process.pyx":715 + /* "cpp_process.pyx":725 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if py_score >= score_cutoff: # <<<<<<<<<<<<<< @@ -9656,7 +9690,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":706 + /* "cpp_process.pyx":716 * else: * if hasattr(choices, "items"): * if processor is not None: # <<<<<<<<<<<<<< @@ -9666,7 +9700,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L36; } - /* "cpp_process.pyx":719 + /* "cpp_process.pyx":729 * else: * # python func + dict + no python processor * for choice_key, choice in choices.items(): # <<<<<<<<<<<<<< @@ -9677,9 +9711,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_7 = 0; if (unlikely(__pyx_cur_scope->__pyx_v_choices == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 719, __pyx_L1_error) + __PYX_ERR(0, 729, __pyx_L1_error) } - __pyx_t_4 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_6), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error) + __pyx_t_4 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_choices, 0, __pyx_n_s_items, (&__pyx_t_6), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 729, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_4; @@ -9687,7 +9721,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ while (1) { __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_6, &__pyx_t_7, &__pyx_t_4, &__pyx_t_10, NULL, __pyx_t_9); if (unlikely(__pyx_t_8 == 0)) break; - if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 719, __pyx_L1_error) + if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 729, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_choice_key); @@ -9699,7 +9733,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - /* "cpp_process.pyx":720 + /* "cpp_process.pyx":730 * # python func + dict + no python processor * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -9710,7 +9744,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":721 + /* "cpp_process.pyx":731 * for choice_key, choice in choices.items(): * if choice is None: * continue # <<<<<<<<<<<<<< @@ -9719,7 +9753,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ goto __pyx_L42_continue; - /* "cpp_process.pyx":720 + /* "cpp_process.pyx":730 * # python func + dict + no python processor * for choice_key, choice in choices.items(): * if choice is None: # <<<<<<<<<<<<<< @@ -9728,14 +9762,14 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":723 + /* "cpp_process.pyx":733 * continue * * py_score = scorer(query, choice, # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_query); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_query); @@ -9744,32 +9778,32 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_cur_scope->__pyx_v_choice); - /* "cpp_process.pyx":724 + /* "cpp_process.pyx":734 * * py_score = scorer(query, choice, * processor=None, score_cutoff=score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if py_score >= score_cutoff: */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 734, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 724, __pyx_L1_error) - __pyx_t_20 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 724, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 734, __pyx_L1_error) + __pyx_t_20 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 734, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_score_cutoff, __pyx_t_20) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_score_cutoff, __pyx_t_20) < 0) __PYX_ERR(0, 734, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __pyx_t_4 = __pyx_t_5; __pyx_t_5 = 0; - if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 734, __pyx_L1_error) - /* "cpp_process.pyx":723 + /* "cpp_process.pyx":733 * continue * * py_score = scorer(query, choice, # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_scorer, __pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_scorer, __pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9778,29 +9812,29 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - /* "cpp_process.pyx":726 + /* "cpp_process.pyx":736 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if py_score >= score_cutoff: # <<<<<<<<<<<<<< * yield (choice, py_score, choice_key) * else: */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error) + __pyx_t_5 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_py_score, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_py_score, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 726, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "cpp_process.pyx":727 + /* "cpp_process.pyx":737 * * if py_score >= score_cutoff: * yield (choice, py_score, choice_key) # <<<<<<<<<<<<<< * else: * index = 0 */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 727, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 737, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_choice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); @@ -9831,9 +9865,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_7 = __pyx_cur_scope->__pyx_t_2; __pyx_t_9 = __pyx_cur_scope->__pyx_t_3; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 727, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 737, __pyx_L1_error) - /* "cpp_process.pyx":726 + /* "cpp_process.pyx":736 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if py_score >= score_cutoff: # <<<<<<<<<<<<<< @@ -9847,7 +9881,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_L36:; - /* "cpp_process.pyx":705 + /* "cpp_process.pyx":715 * # the scorer has to be called through Python * else: * if hasattr(choices, "items"): # <<<<<<<<<<<<<< @@ -9857,7 +9891,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L35; } - /* "cpp_process.pyx":729 + /* "cpp_process.pyx":739 * yield (choice, py_score, choice_key) * else: * index = 0 # <<<<<<<<<<<<<< @@ -9867,7 +9901,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ /*else*/ { __pyx_cur_scope->__pyx_v_index = 0; - /* "cpp_process.pyx":730 + /* "cpp_process.pyx":740 * else: * index = 0 * if processor is not None: # <<<<<<<<<<<<<< @@ -9878,7 +9912,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":732 + /* "cpp_process.pyx":742 * if processor is not None: * # python func + list + python processor * for choice in choices: # <<<<<<<<<<<<<< @@ -9889,26 +9923,26 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_3 = __pyx_cur_scope->__pyx_v_choices; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 742, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_12)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 742, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 742, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -9918,7 +9952,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 732, __pyx_L1_error) + else __PYX_ERR(0, 742, __pyx_L1_error) } break; } @@ -9929,7 +9963,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":733 + /* "cpp_process.pyx":743 * # python func + list + python processor * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -9940,7 +9974,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "cpp_process.pyx":734 + /* "cpp_process.pyx":744 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< @@ -9949,7 +9983,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ goto __pyx_L48_continue; - /* "cpp_process.pyx":733 + /* "cpp_process.pyx":743 * # python func + list + python processor * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -9958,7 +9992,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":736 + /* "cpp_process.pyx":746 * continue * * py_score = scorer(query, processor(choice), # <<<<<<<<<<<<<< @@ -9978,10 +10012,10 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_cur_scope->__pyx_v_choice) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_choice); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 736, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_query); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_query); @@ -9990,32 +10024,32 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); __pyx_t_4 = 0; - /* "cpp_process.pyx":737 + /* "cpp_process.pyx":747 * * py_score = scorer(query, processor(choice), * processor=None, score_cutoff=score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if py_score >= score_cutoff: */ - __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 737, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 737, __pyx_L1_error) - __pyx_t_20 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 737, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 747, __pyx_L1_error) + __pyx_t_20 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_score_cutoff, __pyx_t_20) < 0) __PYX_ERR(0, 737, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_score_cutoff, __pyx_t_20) < 0) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __pyx_t_4 = __pyx_t_10; __pyx_t_10 = 0; - if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 737, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 747, __pyx_L1_error) - /* "cpp_process.pyx":736 + /* "cpp_process.pyx":746 * continue * * py_score = scorer(query, processor(choice), # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_scorer, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 736, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_scorer, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -10024,31 +10058,31 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - /* "cpp_process.pyx":739 + /* "cpp_process.pyx":749 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if py_score >= score_cutoff: # <<<<<<<<<<<<<< * yield(choice, py_score, index) * index += 1 */ - __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 739, __pyx_L1_error) + __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_py_score, __pyx_t_10, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 739, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_py_score, __pyx_t_10, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 739, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "cpp_process.pyx":740 + /* "cpp_process.pyx":750 * * if py_score >= score_cutoff: * yield(choice, py_score, index) # <<<<<<<<<<<<<< * index += 1 * else: */ - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 740, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_choice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); @@ -10077,9 +10111,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_XGOTREF(__pyx_t_3); __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_12 = __pyx_cur_scope->__pyx_t_4; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 740, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 750, __pyx_L1_error) - /* "cpp_process.pyx":739 + /* "cpp_process.pyx":749 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if py_score >= score_cutoff: # <<<<<<<<<<<<<< @@ -10088,7 +10122,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":741 + /* "cpp_process.pyx":751 * if py_score >= score_cutoff: * yield(choice, py_score, index) * index += 1 # <<<<<<<<<<<<<< @@ -10097,7 +10131,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ __pyx_cur_scope->__pyx_v_index = (__pyx_cur_scope->__pyx_v_index + 1); - /* "cpp_process.pyx":732 + /* "cpp_process.pyx":742 * if processor is not None: * # python func + list + python processor * for choice in choices: # <<<<<<<<<<<<<< @@ -10108,7 +10142,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpp_process.pyx":730 + /* "cpp_process.pyx":740 * else: * index = 0 * if processor is not None: # <<<<<<<<<<<<<< @@ -10118,7 +10152,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ goto __pyx_L47; } - /* "cpp_process.pyx":744 + /* "cpp_process.pyx":754 * else: * # python func + list + no python processor * for choice in choices: # <<<<<<<<<<<<<< @@ -10130,26 +10164,26 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_3 = __pyx_cur_scope->__pyx_v_choices; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_choices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 754, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_12)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 754, __pyx_L1_error) #else - __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 754, __pyx_L1_error) #else - __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif } @@ -10159,7 +10193,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 744, __pyx_L1_error) + else __PYX_ERR(0, 754, __pyx_L1_error) } break; } @@ -10170,7 +10204,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - /* "cpp_process.pyx":745 + /* "cpp_process.pyx":755 * # python func + list + no python processor * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -10181,7 +10215,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "cpp_process.pyx":746 + /* "cpp_process.pyx":756 * for choice in choices: * if choice is None: * continue # <<<<<<<<<<<<<< @@ -10190,7 +10224,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ goto __pyx_L53_continue; - /* "cpp_process.pyx":745 + /* "cpp_process.pyx":755 * # python func + list + no python processor * for choice in choices: * if choice is None: # <<<<<<<<<<<<<< @@ -10199,14 +10233,14 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":748 + /* "cpp_process.pyx":758 * continue * * py_score = scorer(query, choice, # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_query); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_query); @@ -10215,32 +10249,32 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_cur_scope->__pyx_v_choice); - /* "cpp_process.pyx":749 + /* "cpp_process.pyx":759 * * py_score = scorer(query, choice, * processor=None, score_cutoff=score_cutoff, **kwargs) # <<<<<<<<<<<<<< * * if py_score >= score_cutoff: */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 749, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 759, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 749, __pyx_L1_error) - __pyx_t_20 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 749, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_processor, Py_None) < 0) __PYX_ERR(0, 759, __pyx_L1_error) + __pyx_t_20 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 759, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_score_cutoff, __pyx_t_20) < 0) __PYX_ERR(0, 749, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_score_cutoff, __pyx_t_20) < 0) __PYX_ERR(0, 759, __pyx_L1_error) __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __pyx_t_4 = __pyx_t_5; __pyx_t_5 = 0; - if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 749, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 759, __pyx_L1_error) - /* "cpp_process.pyx":748 + /* "cpp_process.pyx":758 * continue * * py_score = scorer(query, choice, # <<<<<<<<<<<<<< * processor=None, score_cutoff=score_cutoff, **kwargs) * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_scorer, __pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_scorer, __pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -10249,31 +10283,30 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - /* "cpp_process.pyx":751 + /* "cpp_process.pyx":761 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if py_score >= score_cutoff: # <<<<<<<<<<<<<< * yield(choice, py_score, index) * index += 1 */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 751, __pyx_L1_error) + __pyx_t_5 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_score_cutoff); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_py_score, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 751, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_py_score, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 751, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "cpp_process.pyx":752 + /* "cpp_process.pyx":762 * * if py_score >= score_cutoff: * yield(choice, py_score, index) # <<<<<<<<<<<<<< * index += 1 - * */ - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 752, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 752, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_choice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_choice); @@ -10302,9 +10335,9 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __Pyx_XGOTREF(__pyx_t_3); __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_t_12 = __pyx_cur_scope->__pyx_t_4; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 752, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 762, __pyx_L1_error) - /* "cpp_process.pyx":751 + /* "cpp_process.pyx":761 * processor=None, score_cutoff=score_cutoff, **kwargs) * * if py_score >= score_cutoff: # <<<<<<<<<<<<<< @@ -10313,15 +10346,14 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ */ } - /* "cpp_process.pyx":753 + /* "cpp_process.pyx":763 * if py_score >= score_cutoff: * yield(choice, py_score, index) * index += 1 # <<<<<<<<<<<<<< - * */ __pyx_cur_scope->__pyx_v_index = (__pyx_cur_scope->__pyx_v_index + 1); - /* "cpp_process.pyx":744 + /* "cpp_process.pyx":754 * else: * # python func + list + no python processor * for choice in choices: # <<<<<<<<<<<<<< @@ -10339,7 +10371,7 @@ static PyObject *__pyx_gb_11cpp_process_6generator(__pyx_CoroutineObject *__pyx_ __pyx_L6:; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "cpp_process.pyx":589 + /* "cpp_process.pyx":599 * * * def extract_iter(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< @@ -10607,7 +10639,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 380, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -10617,41 +10649,41 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "cpp_process.pyx":254 + /* "cpp_process.pyx":255 * * * def extractOne(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< * """ * Find the best match in a list of choices */ - __pyx_tuple__2 = PyTuple_Pack(8, __pyx_n_s_query, __pyx_n_s_choices, __pyx_n_s_scorer, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_kwargs, __pyx_n_s_def_process, __pyx_n_s_context); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(8, __pyx_n_s_query, __pyx_n_s_choices, __pyx_n_s_scorer, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_kwargs, __pyx_n_s_def_process, __pyx_n_s_context); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_cpp_process_pyx, __pyx_n_s_extractOne, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_cpp_process_pyx, __pyx_n_s_extractOne, 255, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 255, __pyx_L1_error) - /* "cpp_process.pyx":505 + /* "cpp_process.pyx":515 * * * def extract(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, limit=5, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< * """ * Find the best matches in a list of choices */ - __pyx_tuple__4 = PyTuple_Pack(9, __pyx_n_s_query, __pyx_n_s_choices, __pyx_n_s_scorer, __pyx_n_s_processor, __pyx_n_s_limit, __pyx_n_s_score_cutoff, __pyx_n_s_kwargs, __pyx_n_s_def_process, __pyx_n_s_context); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(9, __pyx_n_s_query, __pyx_n_s_choices, __pyx_n_s_scorer, __pyx_n_s_processor, __pyx_n_s_limit, __pyx_n_s_score_cutoff, __pyx_n_s_kwargs, __pyx_n_s_def_process, __pyx_n_s_context); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_cpp_process_pyx, __pyx_n_s_extract, 505, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_cpp_process_pyx, __pyx_n_s_extract, 515, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 515, __pyx_L1_error) - /* "cpp_process.pyx":589 + /* "cpp_process.pyx":599 * * * def extract_iter(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< * """ * Find the best match in a list of choices */ - __pyx_tuple__6 = PyTuple_Pack(13, __pyx_n_s_query, __pyx_n_s_choices, __pyx_n_s_scorer, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_kwargs, __pyx_n_s_def_process, __pyx_n_s_context, __pyx_n_s_score, __pyx_n_s_py_score, __pyx_n_s_index, __pyx_n_s_choice_key, __pyx_n_s_choice); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(13, __pyx_n_s_query, __pyx_n_s_choices, __pyx_n_s_scorer, __pyx_n_s_processor, __pyx_n_s_score_cutoff, __pyx_n_s_kwargs, __pyx_n_s_def_process, __pyx_n_s_context, __pyx_n_s_score, __pyx_n_s_py_score, __pyx_n_s_index, __pyx_n_s_choice_key, __pyx_n_s_choice); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_cpp_process_pyx, __pyx_n_s_extract_iter, 589, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_cpp_process_pyx, __pyx_n_s_extract_iter, 599, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -10707,7 +10739,7 @@ static int __Pyx_modinit_type_init_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_11cpp_process___pyx_scope_struct__extract_iter) < 0) __PYX_ERR(0, 589, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_11cpp_process___pyx_scope_struct__extract_iter) < 0) __PYX_ERR(0, 599, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_11cpp_process___pyx_scope_struct__extract_iter.tp_print = 0; #endif @@ -11004,106 +11036,106 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "cpp_process.pyx":15 - * from cpython.ref cimport Py_INCREF + /* "cpp_process.pyx":16 + * from cpython.ref cimport Py_DECREF * * import heapq # <<<<<<<<<<<<<< * * cdef extern from "Python.h": */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_heapq, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_heapq, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_heapq, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_heapq, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "cpp_process.pyx":254 + /* "cpp_process.pyx":255 * * * def extractOne(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< * """ * Find the best match in a list of choices */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_1extractOne, 0, __pyx_n_s_extractOne, NULL, __pyx_n_s_cpp_process, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_1extractOne, 0, __pyx_n_s_extractOne, NULL, __pyx_n_s_cpp_process, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 255, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_2)->__pyx_arg_scorer = __pyx_t_3; __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_2)->__pyx_arg_processor = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_11cpp_process_7__defaults__); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_extractOne, __pyx_t_2) < 0) __PYX_ERR(0, 254, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_extractOne, __pyx_t_2) < 0) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "cpp_process.pyx":505 + /* "cpp_process.pyx":515 * * * def extract(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, limit=5, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< * """ * Find the best matches in a list of choices */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_3extract, 0, __pyx_n_s_extract, NULL, __pyx_n_s_cpp_process, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_3extract, 0, __pyx_n_s_extract, NULL, __pyx_n_s_cpp_process, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults1), 2)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults1), 2)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_2)->__pyx_arg_scorer = __pyx_t_3; __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_2)->__pyx_arg_processor = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_11cpp_process_9__defaults__); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_extract, __pyx_t_2) < 0) __PYX_ERR(0, 505, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_extract, __pyx_t_2) < 0) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "cpp_process.pyx":589 + /* "cpp_process.pyx":599 * * * def extract_iter(query, choices, scorer=fuzz.WRatio, processor=utils.default_process, double score_cutoff=0.0, **kwargs): # <<<<<<<<<<<<<< * """ * Find the best match in a list of choices */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_5extract_iter, 0, __pyx_n_s_extract_iter, NULL, __pyx_n_s_cpp_process, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11cpp_process_5extract_iter, 0, __pyx_n_s_extract_iter, NULL, __pyx_n_s_cpp_process, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults2), 2)) __PYX_ERR(0, 589, __pyx_L1_error) - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults2), 2)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WRatio); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_2)->__pyx_arg_scorer = __pyx_t_3; __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_default_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_2)->__pyx_arg_processor = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_11cpp_process_11__defaults__); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_extract_iter, __pyx_t_2) < 0) __PYX_ERR(0, 589, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_extract_iter, __pyx_t_2) < 0) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "cpp_process.pyx":1 @@ -12408,35 +12440,6 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, key); -} -#endif - /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; diff --git a/src/cpp_process.pyx b/src/cpp_process.pyx index fd42f3a..d2151db 100644 --- a/src/cpp_process.pyx +++ b/src/cpp_process.pyx @@ -11,6 +11,7 @@ from cpython.list cimport PyList_New from cpython.list cimport PyList_SET_ITEM from cpython.object cimport PyObject from cpython.ref cimport Py_INCREF +from cpython.ref cimport Py_DECREF import heapq @@ -358,6 +359,10 @@ cdef inline extract_dict(scorer_context context, choices, processor, size_t limi score = context.scorer(context.context, choice, score_cutoff) if score >= score_cutoff: + # especially the key object might be created on the fly by e.g. pandas.Dataframe + # so we need to ensure Python does not deallocate it + Py_INCREF(choice) + Py_INCREF(choice_key) results.push_back(DictMatchElem(score, i, choice, choice_key)) index += 1 @@ -379,10 +384,15 @@ cdef inline extract_dict(scorer_context context, choices, processor, size_t limi # https://stackoverflow.com/questions/43553763/cythonize-list-of-all-splits-of-a-string/43557675#43557675 PyList_SET_ITEM(result_list, i, Py_BuildValue("OdO", - choices[results[i].key], + results[i].choice, results[i].score, results[i].key)) + # decref all reference counts + for i in range(results.size()): + Py_DECREF(results[i].choice) + Py_DECREF(results[i].key) + return result_list @@ -393,7 +403,7 @@ cdef inline extract_list(scorer_context context, choices, processor, size_t limi # todo possibly a smaller vector would be good to reduce memory usage cdef vector[ListMatchElem] results results.reserve(len(choices)) - cdef object result_list + cdef list result_list if processor is not None: for choice in choices: @@ -751,4 +761,3 @@ def extract_iter(query, choices, scorer=fuzz.WRatio, processor=utils.default_pro if py_score >= score_cutoff: yield(choice, py_score, index) index += 1 - \ No newline at end of file diff --git a/src/rapidfuzz-cpp b/src/rapidfuzz-cpp index ea6f17d..91f20cd 160000 --- a/src/rapidfuzz-cpp +++ b/src/rapidfuzz-cpp @@ -1 +1 @@ -Subproject commit ea6f17dd4d3af1f15f46ff608da7cfa28625ed5a +Subproject commit 91f20cd9930e620c7c250381bcca640570480dbd diff --git a/src/rapidfuzz/__init__.py b/src/rapidfuzz/__init__.py index 5ab4c6c..caf7e08 100644 --- a/src/rapidfuzz/__init__.py +++ b/src/rapidfuzz/__init__.py @@ -3,6 +3,6 @@ rapid string matching library """ __author__ = "Max Bachmann" __license__ = "MIT" -__version__ = "1.1.1" +__version__ = "1.1.2" from rapidfuzz import process, fuzz, utils, levenshtein, string_metric diff --git a/tests/test_process.py b/tests/test_process.py index 74511fa..946c120 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -5,6 +5,7 @@ import unittest import pytest from rapidfuzz import process, fuzz, utils +import pandas as pd class ProcessTest(unittest.TestCase): def setUp(self): @@ -187,6 +188,12 @@ class ProcessTest(unittest.TestCase): best = process.extractOne(query, choices) self.assertEqual(best[0], choices[1]) + def testIssue81(self): + # this mostly tests whether this segfaults due to incorrect ref counting + choices = pd.Series(['test color brightness', 'test lemon', 'test lavender'], index=[67478, 67479, 67480]) + matches = process.extract("test", choices) + assert matches == [('test color brightness', 90.0, 67478), ('test lemon', 90.0, 67479), ('test lavender', 90.0, 67480)] + def custom_scorer(s1, s2, processor=None, score_cutoff=0): return fuzz.ratio(s1, s2, processor=processor, score_cutoff=score_cutoff)