add back legacy python support (#122)

This commit is contained in:
Max Bachmann 2021-09-11 12:25:31 +02:00 committed by GitHub
parent 802c2f36c8
commit a9e7bd703f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 488 additions and 339 deletions

View File

@ -8,6 +8,72 @@ on:
- published
jobs:
build_legacy:
name: Build wheel for legacy Python versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
CIBW_BUILD: cp27-* cp35-* pp27-*
CIBW_BUILD_VERBOSITY: 3
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: Build wheels
uses: pypa/cibuildwheel@v1.12.0
with:
output-dir: wheelhouse
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_windows_27_legacy:
name: Build wheel on windows-latest/auto/2.7
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: ilammy/msvc-dev-cmd@v1
- name: Build 64-bit wheel
uses: pypa/cibuildwheel@v1.12.0
with:
output-dir: wheelhouse
env:
CIBW_BUILD: cp27-win_amd64
DISTUTILS_USE_SDK: 1
CIBW_BUILD_VERBOSITY: 3
MSSdk: 1
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: Build 32-bit wheel
uses: pypa/cibuildwheel@v1.12.0
with:
output-dir: wheelhouse
env:
CIBW_BUILD: cp27-win32
DISTUTILS_USE_SDK: 1
CIBW_BUILD_VERBOSITY: 3
MSSdk: 1
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_wheels:
name: Build wheel on ${{ matrix.os }}/auto/${{matrix.python_tag}}
runs-on: ${{ matrix.os }}
@ -155,7 +221,7 @@ jobs:
deploy-wheels:
if: github.event_name == 'release' && github.event.action == 'published'
needs: [build_wheels, build_wheels_apple_silicon, build_wheels_manylinux, build_wheels_pypy, build_sdist]
needs: [build_legacy, build_windows_27_legacy, build_wheels, build_wheels_apple_silicon, build_wheels_manylinux, build_wheels_pypy, build_sdist]
name: deploy wheels to pypi
runs-on: ubuntu-18.04

View File

@ -48,7 +48,7 @@ RapidFuzz is a fast string matching library for Python and C++, which is using t
## Requirements
- Python 3.5 or later
- Python 2.7 or later
- On Windows the [Visual C++ 2019 redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) is required
## Installation

View File

@ -2,6 +2,7 @@
requires = [
"setuptools",
"wheel",
"oldest-supported-numpy"
"numpy==1.13.3; python_version=='2.7'",
"oldest-supported-numpy; python_version>='3.5'"
]
build-backend = "setuptools.build_meta"

View File

@ -11,6 +11,8 @@ long_description_content_type = text/markdown
license = MIT
license_file = LICENSE
classifiers =
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
@ -25,7 +27,7 @@ include_package_data = True
package_dir=
=src
packages = find:
python_requires = >=3.5
python_requires = >=2.7
install_requires =
numpy

View File

@ -26,12 +26,20 @@ private:
char const* m_error;
};
#if PY_VERSION_HEX > PYTHON_VERSION(3, 0, 0)
#define LIST_OF_CASES(...) \
X_ENUM(RAPIDFUZZ_UINT8, uint8_t , (__VA_ARGS__)) \
X_ENUM(RAPIDFUZZ_UINT16, uint16_t , (__VA_ARGS__)) \
X_ENUM(RAPIDFUZZ_UINT32, uint32_t , (__VA_ARGS__)) \
X_ENUM(RAPIDFUZZ_UINT64, uint64_t , (__VA_ARGS__)) \
X_ENUM(RAPIDFUZZ_INT64, int64_t , (__VA_ARGS__))
#else /* Python2 */
#define LIST_OF_CASES(...) \
X_ENUM(RAPIDFUZZ_CHAR, char , (__VA_ARGS__)) \
X_ENUM(RAPIDFUZZ_UNICODE, Py_UNICODE , (__VA_ARGS__)) \
X_ENUM(RAPIDFUZZ_UINT64, uint64_t , (__VA_ARGS__)) \
X_ENUM(RAPIDFUZZ_INT64, int64_t , (__VA_ARGS__))
#endif
enum RapidfuzzType {
@ -109,6 +117,7 @@ static inline bool is_valid_string(PyObject* py_str)
{
bool is_string = false;
#if PY_VERSION_HEX > PYTHON_VERSION(3, 0, 0)
if (PyBytes_Check(py_str)) {
is_string = true;
}
@ -123,12 +132,21 @@ static inline bool is_valid_string(PyObject* py_str)
#endif
is_string = true;
}
#else /* Python2 */
if (PyObject_TypeCheck(py_str, &PyString_Type)) {
is_string = true;
}
else if (PyObject_TypeCheck(py_str, &PyUnicode_Type)) {
is_string = true;
}
#endif
return is_string;
}
static inline void validate_string(PyObject* py_str, const char* err)
{
#if PY_VERSION_HEX > PYTHON_VERSION(3, 0, 0)
if (PyBytes_Check(py_str)) {
return;
}
@ -143,12 +161,21 @@ static inline void validate_string(PyObject* py_str, const char* err)
#endif
return;
}
#else /* Python2 */
if (PyObject_TypeCheck(py_str, &PyString_Type)) {
return;
}
else if (PyObject_TypeCheck(py_str, &PyUnicode_Type)) {
return;
}
#endif
throw PythonTypeError(err);
}
static inline proc_string convert_string(PyObject* py_str)
{
#if PY_VERSION_HEX > PYTHON_VERSION(3, 0, 0)
if (PyBytes_Check(py_str)) {
return {
RAPIDFUZZ_UINT8,
@ -157,26 +184,47 @@ static inline proc_string convert_string(PyObject* py_str)
static_cast<std::size_t>(PyBytes_GET_SIZE(py_str))
};
} else {
RapidfuzzType kind;
switch(PyUnicode_KIND(py_str)) {
case PyUnicode_1BYTE_KIND:
RapidfuzzType kind;
switch(PyUnicode_KIND(py_str)) {
case PyUnicode_1BYTE_KIND:
kind = RAPIDFUZZ_UINT8;
break;
case PyUnicode_2BYTE_KIND:
case PyUnicode_2BYTE_KIND:
kind = RAPIDFUZZ_UINT16;
break;
default:
default:
kind = RAPIDFUZZ_UINT32;
break;
}
}
return proc_string(
kind,
false,
PyUnicode_DATA(py_str),
static_cast<std::size_t>(PyUnicode_GET_LENGTH(py_str))
);
return proc_string(
kind,
false,
PyUnicode_DATA(py_str),
static_cast<std::size_t>(PyUnicode_GET_LENGTH(py_str))
);
}
#else /* Python2 */
if (PyObject_TypeCheck(py_str, &PyString_Type)) {
return {
RAPIDFUZZ_CHAR,
false,
PyString_AS_STRING(py_str),
static_cast<std::size_t>(PyString_GET_SIZE(py_str))
};
}
else if (PyObject_TypeCheck(py_str, &PyUnicode_Type)) {
return {
RAPIDFUZZ_UNICODE,
false,
PyUnicode_AS_UNICODE(py_str),
static_cast<std::size_t>(PyUnicode_GET_SIZE(py_str))
};
}
else {
throw PythonTypeError("choice must be a String, Unicode or None");
}
#endif
}
@ -315,7 +363,6 @@ PyObject* RATIO##_default_process(const proc_string& s1, const proc_string& s2,
return dist_to_long(result); \
}
template <typename CharT>
proc_string default_process_func_impl(proc_string sentence) {
CharT* str = static_cast<CharT*>(sentence.data);
@ -346,4 +393,4 @@ proc_string default_process_func(proc_string sentence) {
throw std::logic_error("Reached end of control flow in default_process_func");
# undef X_ENUM
}
}
}

View File

@ -6,9 +6,6 @@ from libcpp cimport bool
cdef extern from "cpp_common.hpp":
ctypedef unsigned int RapidfuzzType
int RAPIDFUZZ_UINT8
int RAPIDFUZZ_UINT16
int RAPIDFUZZ_UINT32
int RAPIDFUZZ_UINT64
int RAPIDFUZZ_INT64

210
src/cpp_fuzz.cpp vendored
View File

@ -6364,7 +6364,7 @@ static PyObject *__pyx_pf_8cpp_fuzz_18QRatio(CYTHON_UNUSED PyObject *__pyx_self,
return __pyx_r;
}
/* "cpp_common.pxd":28
/* "cpp_common.pxd":25
* proc_string default_process_func(proc_string sentence) except +
*
* cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
@ -6407,30 +6407,30 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("hash_array", 0);
/* "cpp_common.pxd":31
/* "cpp_common.pxd":28
* # TODO on Cpython this does not require any copies
* cdef proc_string s_proc
* cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode # <<<<<<<<<<<<<<
* s_proc.length = <size_t>len(arr)
*
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_typecode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 31, __pyx_L1_error)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_typecode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 28, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 31, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 28, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_typecode = ((Py_UCS4)__pyx_t_2);
/* "cpp_common.pxd":32
/* "cpp_common.pxd":29
* cdef proc_string s_proc
* cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode
* s_proc.length = <size_t>len(arr) # <<<<<<<<<<<<<<
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*/
__pyx_t_3 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 32, __pyx_L1_error)
__pyx_t_3 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 29, __pyx_L1_error)
__pyx_v_s_proc.length = ((size_t)__pyx_t_3);
/* "cpp_common.pxd":34
/* "cpp_common.pxd":31
* s_proc.length = <size_t>len(arr)
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
@ -6439,7 +6439,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
/* "cpp_common.pxd":36
/* "cpp_common.pxd":33
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -6449,16 +6449,16 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_t_4 = ((__pyx_v_s_proc.data == NULL) != 0);
if (unlikely(__pyx_t_4)) {
/* "cpp_common.pxd":37
/* "cpp_common.pxd":34
*
* if s_proc.data == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
*
* try:
*/
PyErr_NoMemory(); __PYX_ERR(1, 37, __pyx_L1_error)
PyErr_NoMemory(); __PYX_ERR(1, 34, __pyx_L1_error)
/* "cpp_common.pxd":36
/* "cpp_common.pxd":33
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -6467,7 +6467,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
}
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -6483,7 +6483,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__Pyx_XGOTREF(__pyx_t_7);
/*try:*/ {
/* "cpp_common.pxd":41
/* "cpp_common.pxd":38
* try:
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
@ -6494,7 +6494,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
case 98:
case 66:
/* "cpp_common.pxd":42
/* "cpp_common.pxd":39
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6503,7 +6503,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":43
/* "cpp_common.pxd":40
* if typecode in {'b', 'B'}: # signed/unsigned char
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6515,21 +6515,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":44
/* "cpp_common.pxd":41
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 41, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 44, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 41, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":41
/* "cpp_common.pxd":38
* try:
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
@ -6539,7 +6539,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x75:
/* "cpp_common.pxd":46
/* "cpp_common.pxd":43
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6548,7 +6548,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":47
/* "cpp_common.pxd":44
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6560,21 +6560,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":48
/* "cpp_common.pxd":45
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 45, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L4_error)
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_2));
}
/* "cpp_common.pxd":45
/* "cpp_common.pxd":42
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode == 'u': # 'u' wchar_t # <<<<<<<<<<<<<<
@ -6584,7 +6584,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x68:
/* "cpp_common.pxd":49
/* "cpp_common.pxd":46
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
@ -6593,7 +6593,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 72:
/* "cpp_common.pxd":50
/* "cpp_common.pxd":47
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6602,7 +6602,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":51
/* "cpp_common.pxd":48
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6614,21 +6614,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":52
/* "cpp_common.pxd":49
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 52, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 52, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 49, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":49
/* "cpp_common.pxd":46
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
@ -6638,7 +6638,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x69:
/* "cpp_common.pxd":53
/* "cpp_common.pxd":50
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
@ -6647,7 +6647,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 73:
/* "cpp_common.pxd":54
/* "cpp_common.pxd":51
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6656,7 +6656,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":55
/* "cpp_common.pxd":52
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6668,21 +6668,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":56
/* "cpp_common.pxd":53
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 53, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 56, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 53, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":53
/* "cpp_common.pxd":50
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
@ -6692,7 +6692,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x6C:
/* "cpp_common.pxd":57
/* "cpp_common.pxd":54
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
@ -6701,7 +6701,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 76:
/* "cpp_common.pxd":58
/* "cpp_common.pxd":55
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6710,7 +6710,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":59
/* "cpp_common.pxd":56
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6722,21 +6722,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":60
/* "cpp_common.pxd":57
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 60, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 57, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 57, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":57
/* "cpp_common.pxd":54
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
@ -6746,7 +6746,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x71:
/* "cpp_common.pxd":61
/* "cpp_common.pxd":58
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
@ -6755,7 +6755,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 81:
/* "cpp_common.pxd":62
/* "cpp_common.pxd":59
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6764,7 +6764,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":63
/* "cpp_common.pxd":60
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6776,21 +6776,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":64
/* "cpp_common.pxd":61
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 64, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 64, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 61, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":61
/* "cpp_common.pxd":58
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
@ -6800,7 +6800,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
default:
/* "cpp_common.pxd":66
/* "cpp_common.pxd":63
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64 # <<<<<<<<<<<<<<
@ -6809,7 +6809,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_INT64;
/* "cpp_common.pxd":67
/* "cpp_common.pxd":64
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6821,23 +6821,23 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":68
/* "cpp_common.pxd":65
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i]) # <<<<<<<<<<<<<<
* except Exception as e:
* free(s_proc.data)
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 68, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_12 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_12 == ((Py_hash_t)-1))) __PYX_ERR(1, 68, __pyx_L4_error)
__pyx_t_12 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_12 == ((Py_hash_t)-1))) __PYX_ERR(1, 65, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_12);
}
break;
}
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -6852,7 +6852,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cpp_common.pxd":69
/* "cpp_common.pxd":66
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e: # <<<<<<<<<<<<<<
@ -6862,7 +6862,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
if (__pyx_t_13) {
__Pyx_AddTraceback("cpp_common.hash_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 69, __pyx_L6_except_error)
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 66, __pyx_L6_except_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_14);
__Pyx_GOTREF(__pyx_t_15);
@ -6870,7 +6870,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_v_e = __pyx_t_14;
/*try:*/ {
/* "cpp_common.pxd":70
/* "cpp_common.pxd":67
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e:
* free(s_proc.data) # <<<<<<<<<<<<<<
@ -6879,7 +6879,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
free(__pyx_v_s_proc.data);
/* "cpp_common.pxd":71
/* "cpp_common.pxd":68
* except Exception as e:
* free(s_proc.data)
* s_proc.data = NULL # <<<<<<<<<<<<<<
@ -6888,7 +6888,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.data = NULL;
/* "cpp_common.pxd":72
/* "cpp_common.pxd":69
* free(s_proc.data)
* s_proc.data = NULL
* raise # <<<<<<<<<<<<<<
@ -6900,10 +6900,10 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_14, __pyx_t_15);
__pyx_t_1 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
__PYX_ERR(1, 72, __pyx_L29_error)
__PYX_ERR(1, 69, __pyx_L29_error)
}
/* "cpp_common.pxd":69
/* "cpp_common.pxd":66
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e: # <<<<<<<<<<<<<<
@ -6947,7 +6947,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
goto __pyx_L6_except_error;
__pyx_L6_except_error:;
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -6962,7 +6962,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_L9_try_end:;
}
/* "cpp_common.pxd":74
/* "cpp_common.pxd":71
* raise
*
* s_proc.allocated = True # <<<<<<<<<<<<<<
@ -6971,7 +6971,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.allocated = 1;
/* "cpp_common.pxd":75
/* "cpp_common.pxd":72
*
* s_proc.allocated = True
* return move(s_proc) # <<<<<<<<<<<<<<
@ -6981,7 +6981,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
goto __pyx_L0;
/* "cpp_common.pxd":28
/* "cpp_common.pxd":25
* proc_string default_process_func(proc_string sentence) except +
*
* cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
@ -7002,7 +7002,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
return __pyx_r;
}
/* "cpp_common.pxd":78
/* "cpp_common.pxd":75
*
*
* cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
@ -7046,17 +7046,17 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("hash_sequence", 0);
/* "cpp_common.pxd":80
/* "cpp_common.pxd":77
* cdef inline proc_string hash_sequence(seq) except *:
* cdef proc_string s_proc
* s_proc.length = <size_t>len(seq) # <<<<<<<<<<<<<<
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*/
__pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 80, __pyx_L1_error)
__pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 77, __pyx_L1_error)
__pyx_v_s_proc.length = ((size_t)__pyx_t_1);
/* "cpp_common.pxd":82
/* "cpp_common.pxd":79
* s_proc.length = <size_t>len(seq)
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
@ -7065,7 +7065,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
/* "cpp_common.pxd":84
/* "cpp_common.pxd":81
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -7075,16 +7075,16 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_2 = ((__pyx_v_s_proc.data == NULL) != 0);
if (unlikely(__pyx_t_2)) {
/* "cpp_common.pxd":85
/* "cpp_common.pxd":82
*
* if s_proc.data == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
*
* try:
*/
PyErr_NoMemory(); __PYX_ERR(1, 85, __pyx_L1_error)
PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error)
/* "cpp_common.pxd":84
/* "cpp_common.pxd":81
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -7093,7 +7093,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
}
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -7109,7 +7109,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__Pyx_XGOTREF(__pyx_t_5);
/*try:*/ {
/* "cpp_common.pxd":88
/* "cpp_common.pxd":85
*
* try:
* s_proc.kind = RAPIDFUZZ_INT64 # <<<<<<<<<<<<<<
@ -7118,7 +7118,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_INT64;
/* "cpp_common.pxd":89
/* "cpp_common.pxd":86
* try:
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -7130,19 +7130,19 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
__pyx_v_i = __pyx_t_8;
/* "cpp_common.pxd":90
/* "cpp_common.pxd":87
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length):
* elem = seq[i] # <<<<<<<<<<<<<<
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1:
*/
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_seq, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 90, __pyx_L4_error)
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_seq, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 87, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_9);
__pyx_t_9 = 0;
/* "cpp_common.pxd":92
/* "cpp_common.pxd":89
* elem = seq[i]
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
@ -7156,23 +7156,23 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_2 = __pyx_t_11;
goto __pyx_L13_bool_binop_done;
}
__pyx_t_1 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 92, __pyx_L4_error)
__pyx_t_1 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 89, __pyx_L4_error)
__pyx_t_11 = ((__pyx_t_1 == 1) != 0);
__pyx_t_2 = __pyx_t_11;
__pyx_L13_bool_binop_done:;
if (__pyx_t_2) {
/* "cpp_common.pxd":93
/* "cpp_common.pxd":90
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1:
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem # <<<<<<<<<<<<<<
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
*/
__pyx_t_12 = __Pyx_PyObject_AsPy_UCS4(__pyx_v_elem); if (unlikely((__pyx_t_12 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 93, __pyx_L4_error)
__pyx_t_12 = __Pyx_PyObject_AsPy_UCS4(__pyx_v_elem); if (unlikely((__pyx_t_12 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 90, __pyx_L4_error)
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_12));
/* "cpp_common.pxd":92
/* "cpp_common.pxd":89
* elem = seq[i]
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
@ -7182,7 +7182,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
goto __pyx_L12;
}
/* "cpp_common.pxd":95
/* "cpp_common.pxd":92
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem) # <<<<<<<<<<<<<<
@ -7190,13 +7190,13 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
* free(s_proc.data)
*/
/*else*/ {
__pyx_t_13 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_13 == ((Py_hash_t)-1))) __PYX_ERR(1, 95, __pyx_L4_error)
__pyx_t_13 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_13 == ((Py_hash_t)-1))) __PYX_ERR(1, 92, __pyx_L4_error)
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_13);
}
__pyx_L12:;
}
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -7211,7 +7211,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
/* "cpp_common.pxd":96
/* "cpp_common.pxd":93
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e: # <<<<<<<<<<<<<<
@ -7221,7 +7221,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
if (__pyx_t_14) {
__Pyx_AddTraceback("cpp_common.hash_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(1, 96, __pyx_L6_except_error)
if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(1, 93, __pyx_L6_except_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_GOTREF(__pyx_t_15);
__Pyx_GOTREF(__pyx_t_16);
@ -7229,7 +7229,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_v_e = __pyx_t_15;
/*try:*/ {
/* "cpp_common.pxd":97
/* "cpp_common.pxd":94
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e:
* free(s_proc.data) # <<<<<<<<<<<<<<
@ -7238,7 +7238,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
free(__pyx_v_s_proc.data);
/* "cpp_common.pxd":98
/* "cpp_common.pxd":95
* except Exception as e:
* free(s_proc.data)
* s_proc.data = NULL # <<<<<<<<<<<<<<
@ -7247,7 +7247,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.data = NULL;
/* "cpp_common.pxd":99
/* "cpp_common.pxd":96
* free(s_proc.data)
* s_proc.data = NULL
* raise # <<<<<<<<<<<<<<
@ -7259,10 +7259,10 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_ErrRestoreWithState(__pyx_t_9, __pyx_t_15, __pyx_t_16);
__pyx_t_9 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__PYX_ERR(1, 99, __pyx_L20_error)
__PYX_ERR(1, 96, __pyx_L20_error)
}
/* "cpp_common.pxd":96
/* "cpp_common.pxd":93
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e: # <<<<<<<<<<<<<<
@ -7306,7 +7306,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
goto __pyx_L6_except_error;
__pyx_L6_except_error:;
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -7321,7 +7321,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_L9_try_end:;
}
/* "cpp_common.pxd":101
/* "cpp_common.pxd":98
* raise
*
* s_proc.allocated = True # <<<<<<<<<<<<<<
@ -7329,7 +7329,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.allocated = 1;
/* "cpp_common.pxd":102
/* "cpp_common.pxd":99
*
* s_proc.allocated = True
* return move(s_proc) # <<<<<<<<<<<<<<
@ -7337,7 +7337,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
goto __pyx_L0;
/* "cpp_common.pxd":78
/* "cpp_common.pxd":75
*
*
* cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
@ -7463,8 +7463,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
};
/* #### Code section: cached_builtins ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 37, __pyx_L1_error)
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 43, __pyx_L1_error)
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 34, __pyx_L1_error)
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 40, __pyx_L1_error)
return 0;
__pyx_L1_error:;
return -1;
@ -8252,7 +8252,7 @@ if (!__Pyx_RefNanny) {
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cpp_common.pxd":78
/* "cpp_common.pxd":75
*
*
* cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<

206
src/cpp_process.cpp vendored
View File

@ -24900,7 +24900,7 @@ static PyObject *__pyx_pf_11cpp_process_7cdist(CYTHON_UNUSED PyObject *__pyx_sel
return __pyx_r;
}
/* "cpp_common.pxd":28
/* "cpp_common.pxd":25
* proc_string default_process_func(proc_string sentence) except +
*
* cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
@ -24943,30 +24943,30 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("hash_array", 0);
/* "cpp_common.pxd":31
/* "cpp_common.pxd":28
* # TODO on Cpython this does not require any copies
* cdef proc_string s_proc
* cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode # <<<<<<<<<<<<<<
* s_proc.length = <size_t>len(arr)
*
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_typecode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 31, __pyx_L1_error)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_typecode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 28, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 31, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 28, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_typecode = ((Py_UCS4)__pyx_t_2);
/* "cpp_common.pxd":32
/* "cpp_common.pxd":29
* cdef proc_string s_proc
* cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode
* s_proc.length = <size_t>len(arr) # <<<<<<<<<<<<<<
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*/
__pyx_t_3 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 32, __pyx_L1_error)
__pyx_t_3 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 29, __pyx_L1_error)
__pyx_v_s_proc.length = ((size_t)__pyx_t_3);
/* "cpp_common.pxd":34
/* "cpp_common.pxd":31
* s_proc.length = <size_t>len(arr)
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
@ -24975,7 +24975,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
/* "cpp_common.pxd":36
/* "cpp_common.pxd":33
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -24985,16 +24985,16 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_t_4 = ((__pyx_v_s_proc.data == NULL) != 0);
if (unlikely(__pyx_t_4)) {
/* "cpp_common.pxd":37
/* "cpp_common.pxd":34
*
* if s_proc.data == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
*
* try:
*/
PyErr_NoMemory(); __PYX_ERR(1, 37, __pyx_L1_error)
PyErr_NoMemory(); __PYX_ERR(1, 34, __pyx_L1_error)
/* "cpp_common.pxd":36
/* "cpp_common.pxd":33
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -25003,7 +25003,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
}
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -25019,7 +25019,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__Pyx_XGOTREF(__pyx_t_7);
/*try:*/ {
/* "cpp_common.pxd":41
/* "cpp_common.pxd":38
* try:
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
@ -25030,7 +25030,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
case 98:
case 66:
/* "cpp_common.pxd":42
/* "cpp_common.pxd":39
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -25039,7 +25039,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":43
/* "cpp_common.pxd":40
* if typecode in {'b', 'B'}: # signed/unsigned char
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -25051,21 +25051,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":44
/* "cpp_common.pxd":41
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 41, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 44, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 41, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":41
/* "cpp_common.pxd":38
* try:
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
@ -25075,7 +25075,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x75:
/* "cpp_common.pxd":46
/* "cpp_common.pxd":43
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -25084,7 +25084,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":47
/* "cpp_common.pxd":44
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -25096,21 +25096,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":48
/* "cpp_common.pxd":45
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 45, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L4_error)
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_2));
}
/* "cpp_common.pxd":45
/* "cpp_common.pxd":42
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode == 'u': # 'u' wchar_t # <<<<<<<<<<<<<<
@ -25120,7 +25120,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x68:
/* "cpp_common.pxd":49
/* "cpp_common.pxd":46
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
@ -25129,7 +25129,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 72:
/* "cpp_common.pxd":50
/* "cpp_common.pxd":47
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -25138,7 +25138,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":51
/* "cpp_common.pxd":48
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -25150,21 +25150,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":52
/* "cpp_common.pxd":49
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 52, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 52, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 49, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":49
/* "cpp_common.pxd":46
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
@ -25174,7 +25174,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x69:
/* "cpp_common.pxd":53
/* "cpp_common.pxd":50
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
@ -25183,7 +25183,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 73:
/* "cpp_common.pxd":54
/* "cpp_common.pxd":51
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -25192,7 +25192,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":55
/* "cpp_common.pxd":52
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -25204,21 +25204,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":56
/* "cpp_common.pxd":53
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 53, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 56, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 53, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":53
/* "cpp_common.pxd":50
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
@ -25228,7 +25228,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x6C:
/* "cpp_common.pxd":57
/* "cpp_common.pxd":54
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
@ -25237,7 +25237,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 76:
/* "cpp_common.pxd":58
/* "cpp_common.pxd":55
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -25246,7 +25246,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":59
/* "cpp_common.pxd":56
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -25258,21 +25258,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":60
/* "cpp_common.pxd":57
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 60, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 57, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 57, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":57
/* "cpp_common.pxd":54
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
@ -25282,7 +25282,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x71:
/* "cpp_common.pxd":61
/* "cpp_common.pxd":58
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
@ -25291,7 +25291,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 81:
/* "cpp_common.pxd":62
/* "cpp_common.pxd":59
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -25300,7 +25300,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":63
/* "cpp_common.pxd":60
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -25312,21 +25312,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":64
/* "cpp_common.pxd":61
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 64, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 64, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 61, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":61
/* "cpp_common.pxd":58
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
@ -25336,7 +25336,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
default:
/* "cpp_common.pxd":66
/* "cpp_common.pxd":63
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64 # <<<<<<<<<<<<<<
@ -25345,7 +25345,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_INT64;
/* "cpp_common.pxd":67
/* "cpp_common.pxd":64
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -25357,23 +25357,23 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":68
/* "cpp_common.pxd":65
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i]) # <<<<<<<<<<<<<<
* except Exception as e:
* free(s_proc.data)
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 68, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_12 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_12 == ((Py_hash_t)-1))) __PYX_ERR(1, 68, __pyx_L4_error)
__pyx_t_12 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_12 == ((Py_hash_t)-1))) __PYX_ERR(1, 65, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_12);
}
break;
}
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -25388,7 +25388,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cpp_common.pxd":69
/* "cpp_common.pxd":66
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e: # <<<<<<<<<<<<<<
@ -25398,7 +25398,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
if (__pyx_t_13) {
__Pyx_AddTraceback("cpp_common.hash_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 69, __pyx_L6_except_error)
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 66, __pyx_L6_except_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_14);
__Pyx_GOTREF(__pyx_t_15);
@ -25406,7 +25406,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_v_e = __pyx_t_14;
/*try:*/ {
/* "cpp_common.pxd":70
/* "cpp_common.pxd":67
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e:
* free(s_proc.data) # <<<<<<<<<<<<<<
@ -25415,7 +25415,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
free(__pyx_v_s_proc.data);
/* "cpp_common.pxd":71
/* "cpp_common.pxd":68
* except Exception as e:
* free(s_proc.data)
* s_proc.data = NULL # <<<<<<<<<<<<<<
@ -25424,7 +25424,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.data = NULL;
/* "cpp_common.pxd":72
/* "cpp_common.pxd":69
* free(s_proc.data)
* s_proc.data = NULL
* raise # <<<<<<<<<<<<<<
@ -25436,10 +25436,10 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_14, __pyx_t_15);
__pyx_t_1 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
__PYX_ERR(1, 72, __pyx_L29_error)
__PYX_ERR(1, 69, __pyx_L29_error)
}
/* "cpp_common.pxd":69
/* "cpp_common.pxd":66
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e: # <<<<<<<<<<<<<<
@ -25483,7 +25483,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
goto __pyx_L6_except_error;
__pyx_L6_except_error:;
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -25498,7 +25498,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_L9_try_end:;
}
/* "cpp_common.pxd":74
/* "cpp_common.pxd":71
* raise
*
* s_proc.allocated = True # <<<<<<<<<<<<<<
@ -25507,7 +25507,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.allocated = 1;
/* "cpp_common.pxd":75
/* "cpp_common.pxd":72
*
* s_proc.allocated = True
* return move(s_proc) # <<<<<<<<<<<<<<
@ -25517,7 +25517,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
goto __pyx_L0;
/* "cpp_common.pxd":28
/* "cpp_common.pxd":25
* proc_string default_process_func(proc_string sentence) except +
*
* cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
@ -25538,7 +25538,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
return __pyx_r;
}
/* "cpp_common.pxd":78
/* "cpp_common.pxd":75
*
*
* cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
@ -25582,17 +25582,17 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("hash_sequence", 0);
/* "cpp_common.pxd":80
/* "cpp_common.pxd":77
* cdef inline proc_string hash_sequence(seq) except *:
* cdef proc_string s_proc
* s_proc.length = <size_t>len(seq) # <<<<<<<<<<<<<<
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*/
__pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 80, __pyx_L1_error)
__pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 77, __pyx_L1_error)
__pyx_v_s_proc.length = ((size_t)__pyx_t_1);
/* "cpp_common.pxd":82
/* "cpp_common.pxd":79
* s_proc.length = <size_t>len(seq)
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
@ -25601,7 +25601,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
/* "cpp_common.pxd":84
/* "cpp_common.pxd":81
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -25611,16 +25611,16 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_2 = ((__pyx_v_s_proc.data == NULL) != 0);
if (unlikely(__pyx_t_2)) {
/* "cpp_common.pxd":85
/* "cpp_common.pxd":82
*
* if s_proc.data == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
*
* try:
*/
PyErr_NoMemory(); __PYX_ERR(1, 85, __pyx_L1_error)
PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error)
/* "cpp_common.pxd":84
/* "cpp_common.pxd":81
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -25629,7 +25629,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
}
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -25645,7 +25645,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__Pyx_XGOTREF(__pyx_t_5);
/*try:*/ {
/* "cpp_common.pxd":88
/* "cpp_common.pxd":85
*
* try:
* s_proc.kind = RAPIDFUZZ_INT64 # <<<<<<<<<<<<<<
@ -25654,7 +25654,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_INT64;
/* "cpp_common.pxd":89
/* "cpp_common.pxd":86
* try:
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -25666,19 +25666,19 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
__pyx_v_i = __pyx_t_8;
/* "cpp_common.pxd":90
/* "cpp_common.pxd":87
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length):
* elem = seq[i] # <<<<<<<<<<<<<<
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1:
*/
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_seq, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 90, __pyx_L4_error)
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_seq, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 87, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_9);
__pyx_t_9 = 0;
/* "cpp_common.pxd":92
/* "cpp_common.pxd":89
* elem = seq[i]
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
@ -25692,23 +25692,23 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_2 = __pyx_t_11;
goto __pyx_L13_bool_binop_done;
}
__pyx_t_1 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 92, __pyx_L4_error)
__pyx_t_1 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 89, __pyx_L4_error)
__pyx_t_11 = ((__pyx_t_1 == 1) != 0);
__pyx_t_2 = __pyx_t_11;
__pyx_L13_bool_binop_done:;
if (__pyx_t_2) {
/* "cpp_common.pxd":93
/* "cpp_common.pxd":90
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1:
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem # <<<<<<<<<<<<<<
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
*/
__pyx_t_12 = __Pyx_PyObject_AsPy_UCS4(__pyx_v_elem); if (unlikely((__pyx_t_12 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 93, __pyx_L4_error)
__pyx_t_12 = __Pyx_PyObject_AsPy_UCS4(__pyx_v_elem); if (unlikely((__pyx_t_12 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 90, __pyx_L4_error)
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_12));
/* "cpp_common.pxd":92
/* "cpp_common.pxd":89
* elem = seq[i]
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
@ -25718,7 +25718,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
goto __pyx_L12;
}
/* "cpp_common.pxd":95
/* "cpp_common.pxd":92
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem) # <<<<<<<<<<<<<<
@ -25726,13 +25726,13 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
* free(s_proc.data)
*/
/*else*/ {
__pyx_t_13 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_13 == ((Py_hash_t)-1))) __PYX_ERR(1, 95, __pyx_L4_error)
__pyx_t_13 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_13 == ((Py_hash_t)-1))) __PYX_ERR(1, 92, __pyx_L4_error)
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_13);
}
__pyx_L12:;
}
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -25747,7 +25747,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
/* "cpp_common.pxd":96
/* "cpp_common.pxd":93
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e: # <<<<<<<<<<<<<<
@ -25757,7 +25757,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
if (__pyx_t_14) {
__Pyx_AddTraceback("cpp_common.hash_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(1, 96, __pyx_L6_except_error)
if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(1, 93, __pyx_L6_except_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_GOTREF(__pyx_t_15);
__Pyx_GOTREF(__pyx_t_16);
@ -25765,7 +25765,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_v_e = __pyx_t_15;
/*try:*/ {
/* "cpp_common.pxd":97
/* "cpp_common.pxd":94
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e:
* free(s_proc.data) # <<<<<<<<<<<<<<
@ -25774,7 +25774,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
free(__pyx_v_s_proc.data);
/* "cpp_common.pxd":98
/* "cpp_common.pxd":95
* except Exception as e:
* free(s_proc.data)
* s_proc.data = NULL # <<<<<<<<<<<<<<
@ -25783,7 +25783,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.data = NULL;
/* "cpp_common.pxd":99
/* "cpp_common.pxd":96
* free(s_proc.data)
* s_proc.data = NULL
* raise # <<<<<<<<<<<<<<
@ -25795,10 +25795,10 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_ErrRestoreWithState(__pyx_t_9, __pyx_t_15, __pyx_t_16);
__pyx_t_9 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__PYX_ERR(1, 99, __pyx_L20_error)
__PYX_ERR(1, 96, __pyx_L20_error)
}
/* "cpp_common.pxd":96
/* "cpp_common.pxd":93
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e: # <<<<<<<<<<<<<<
@ -25842,7 +25842,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
goto __pyx_L6_except_error;
__pyx_L6_except_error:;
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -25857,7 +25857,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_L9_try_end:;
}
/* "cpp_common.pxd":101
/* "cpp_common.pxd":98
* raise
*
* s_proc.allocated = True # <<<<<<<<<<<<<<
@ -25865,7 +25865,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.allocated = 1;
/* "cpp_common.pxd":102
/* "cpp_common.pxd":99
*
* s_proc.allocated = True
* return move(s_proc) # <<<<<<<<<<<<<<
@ -25873,7 +25873,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
goto __pyx_L0;
/* "cpp_common.pxd":78
/* "cpp_common.pxd":75
*
*
* cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
@ -28459,7 +28459,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 309, __pyx_L1_error)
__pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 636, __pyx_L1_error)
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 718, __pyx_L1_error)
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 37, __pyx_L1_error)
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 34, __pyx_L1_error)
__pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 989, __pyx_L1_error)
return 0;
__pyx_L1_error:;

View File

@ -6368,7 +6368,7 @@ static PyObject *__pyx_pf_17cpp_string_metric_12jaro_winkler_similarity(CYTHON_U
return __pyx_r;
}
/* "cpp_common.pxd":28
/* "cpp_common.pxd":25
* proc_string default_process_func(proc_string sentence) except +
*
* cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
@ -6411,30 +6411,30 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("hash_array", 0);
/* "cpp_common.pxd":31
/* "cpp_common.pxd":28
* # TODO on Cpython this does not require any copies
* cdef proc_string s_proc
* cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode # <<<<<<<<<<<<<<
* s_proc.length = <size_t>len(arr)
*
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_typecode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 31, __pyx_L1_error)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_typecode); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 28, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 31, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 28, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_typecode = ((Py_UCS4)__pyx_t_2);
/* "cpp_common.pxd":32
/* "cpp_common.pxd":29
* cdef proc_string s_proc
* cdef Py_UCS4 typecode = <Py_UCS4>arr.typecode
* s_proc.length = <size_t>len(arr) # <<<<<<<<<<<<<<
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*/
__pyx_t_3 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 32, __pyx_L1_error)
__pyx_t_3 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 29, __pyx_L1_error)
__pyx_v_s_proc.length = ((size_t)__pyx_t_3);
/* "cpp_common.pxd":34
/* "cpp_common.pxd":31
* s_proc.length = <size_t>len(arr)
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
@ -6443,7 +6443,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
/* "cpp_common.pxd":36
/* "cpp_common.pxd":33
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -6453,16 +6453,16 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_t_4 = ((__pyx_v_s_proc.data == NULL) != 0);
if (unlikely(__pyx_t_4)) {
/* "cpp_common.pxd":37
/* "cpp_common.pxd":34
*
* if s_proc.data == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
*
* try:
*/
PyErr_NoMemory(); __PYX_ERR(1, 37, __pyx_L1_error)
PyErr_NoMemory(); __PYX_ERR(1, 34, __pyx_L1_error)
/* "cpp_common.pxd":36
/* "cpp_common.pxd":33
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -6471,7 +6471,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
}
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -6487,7 +6487,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__Pyx_XGOTREF(__pyx_t_7);
/*try:*/ {
/* "cpp_common.pxd":41
/* "cpp_common.pxd":38
* try:
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
@ -6498,7 +6498,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
case 98:
case 66:
/* "cpp_common.pxd":42
/* "cpp_common.pxd":39
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6507,7 +6507,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":43
/* "cpp_common.pxd":40
* if typecode in {'b', 'B'}: # signed/unsigned char
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6519,21 +6519,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":44
/* "cpp_common.pxd":41
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 41, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 44, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 41, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":41
/* "cpp_common.pxd":38
* try:
* # ignore signed/unsigned, since it is not relevant in any of the algorithms
* if typecode in {'b', 'B'}: # signed/unsigned char # <<<<<<<<<<<<<<
@ -6543,7 +6543,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x75:
/* "cpp_common.pxd":46
/* "cpp_common.pxd":43
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6552,7 +6552,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":47
/* "cpp_common.pxd":44
* elif typecode == 'u': # 'u' wchar_t
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6564,21 +6564,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":48
/* "cpp_common.pxd":45
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 45, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L4_error)
__pyx_t_2 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_2));
}
/* "cpp_common.pxd":45
/* "cpp_common.pxd":42
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode == 'u': # 'u' wchar_t # <<<<<<<<<<<<<<
@ -6588,7 +6588,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x68:
/* "cpp_common.pxd":49
/* "cpp_common.pxd":46
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
@ -6597,7 +6597,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 72:
/* "cpp_common.pxd":50
/* "cpp_common.pxd":47
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6606,7 +6606,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":51
/* "cpp_common.pxd":48
* elif typecode in {'h', 'H'}: # signed/unsigned short
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6618,21 +6618,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":52
/* "cpp_common.pxd":49
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 52, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 52, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 49, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":49
/* "cpp_common.pxd":46
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>arr[i]
* elif typecode in {'h', 'H'}: # signed/unsigned short # <<<<<<<<<<<<<<
@ -6642,7 +6642,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x69:
/* "cpp_common.pxd":53
/* "cpp_common.pxd":50
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
@ -6651,7 +6651,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 73:
/* "cpp_common.pxd":54
/* "cpp_common.pxd":51
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6660,7 +6660,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":55
/* "cpp_common.pxd":52
* elif typecode in {'i', 'I'}: # signed/unsigned int
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6672,21 +6672,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":56
/* "cpp_common.pxd":53
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 53, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 56, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 53, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":53
/* "cpp_common.pxd":50
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'i', 'I'}: # signed/unsigned int # <<<<<<<<<<<<<<
@ -6696,7 +6696,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x6C:
/* "cpp_common.pxd":57
/* "cpp_common.pxd":54
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
@ -6705,7 +6705,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 76:
/* "cpp_common.pxd":58
/* "cpp_common.pxd":55
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6714,7 +6714,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":59
/* "cpp_common.pxd":56
* elif typecode in {'l', 'L'}: # signed/unsigned long
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6726,21 +6726,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":60
/* "cpp_common.pxd":57
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 60, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 57, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 57, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":57
/* "cpp_common.pxd":54
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'l', 'L'}: # signed/unsigned long # <<<<<<<<<<<<<<
@ -6750,7 +6750,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
case 0x71:
/* "cpp_common.pxd":61
/* "cpp_common.pxd":58
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
@ -6759,7 +6759,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
case 81:
/* "cpp_common.pxd":62
/* "cpp_common.pxd":59
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64 # <<<<<<<<<<<<<<
@ -6768,7 +6768,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_UINT64;
/* "cpp_common.pxd":63
/* "cpp_common.pxd":60
* elif typecode in {'q', 'Q'}: # signed/unsigned long long
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6780,21 +6780,21 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":64
/* "cpp_common.pxd":61
* s_proc.kind = RAPIDFUZZ_UINT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i] # <<<<<<<<<<<<<<
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 64, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 64, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 61, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_11);
}
/* "cpp_common.pxd":61
/* "cpp_common.pxd":58
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* elif typecode in {'q', 'Q'}: # signed/unsigned long long # <<<<<<<<<<<<<<
@ -6804,7 +6804,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
break;
default:
/* "cpp_common.pxd":66
/* "cpp_common.pxd":63
* (<uint64_t*>s_proc.data)[i] = <uint64_t>arr[i]
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64 # <<<<<<<<<<<<<<
@ -6813,7 +6813,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_INT64;
/* "cpp_common.pxd":67
/* "cpp_common.pxd":64
* else: # float/double are hashed
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -6825,23 +6825,23 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "cpp_common.pxd":68
/* "cpp_common.pxd":65
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i]) # <<<<<<<<<<<<<<
* except Exception as e:
* free(s_proc.data)
*/
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 68, __pyx_L4_error)
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arr, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_12 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_12 == ((Py_hash_t)-1))) __PYX_ERR(1, 68, __pyx_L4_error)
__pyx_t_12 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_12 == ((Py_hash_t)-1))) __PYX_ERR(1, 65, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_12);
}
break;
}
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -6856,7 +6856,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cpp_common.pxd":69
/* "cpp_common.pxd":66
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e: # <<<<<<<<<<<<<<
@ -6866,7 +6866,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
if (__pyx_t_13) {
__Pyx_AddTraceback("cpp_common.hash_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 69, __pyx_L6_except_error)
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(1, 66, __pyx_L6_except_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_14);
__Pyx_GOTREF(__pyx_t_15);
@ -6874,7 +6874,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_v_e = __pyx_t_14;
/*try:*/ {
/* "cpp_common.pxd":70
/* "cpp_common.pxd":67
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e:
* free(s_proc.data) # <<<<<<<<<<<<<<
@ -6883,7 +6883,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
free(__pyx_v_s_proc.data);
/* "cpp_common.pxd":71
/* "cpp_common.pxd":68
* except Exception as e:
* free(s_proc.data)
* s_proc.data = NULL # <<<<<<<<<<<<<<
@ -6892,7 +6892,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.data = NULL;
/* "cpp_common.pxd":72
/* "cpp_common.pxd":69
* free(s_proc.data)
* s_proc.data = NULL
* raise # <<<<<<<<<<<<<<
@ -6904,10 +6904,10 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_14, __pyx_t_15);
__pyx_t_1 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
__PYX_ERR(1, 72, __pyx_L29_error)
__PYX_ERR(1, 69, __pyx_L29_error)
}
/* "cpp_common.pxd":69
/* "cpp_common.pxd":66
* for i in range(s_proc.length):
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(arr[i])
* except Exception as e: # <<<<<<<<<<<<<<
@ -6951,7 +6951,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
goto __pyx_L6_except_error;
__pyx_L6_except_error:;
/* "cpp_common.pxd":39
/* "cpp_common.pxd":36
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -6966,7 +6966,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_L9_try_end:;
}
/* "cpp_common.pxd":74
/* "cpp_common.pxd":71
* raise
*
* s_proc.allocated = True # <<<<<<<<<<<<<<
@ -6975,7 +6975,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
*/
__pyx_v_s_proc.allocated = 1;
/* "cpp_common.pxd":75
/* "cpp_common.pxd":72
*
* s_proc.allocated = True
* return move(s_proc) # <<<<<<<<<<<<<<
@ -6985,7 +6985,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
__pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
goto __pyx_L0;
/* "cpp_common.pxd":28
/* "cpp_common.pxd":25
* proc_string default_process_func(proc_string sentence) except +
*
* cdef inline proc_string hash_array(arr) except *: # <<<<<<<<<<<<<<
@ -7006,7 +7006,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_array(PyObject *__pyx
return __pyx_r;
}
/* "cpp_common.pxd":78
/* "cpp_common.pxd":75
*
*
* cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
@ -7050,17 +7050,17 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("hash_sequence", 0);
/* "cpp_common.pxd":80
/* "cpp_common.pxd":77
* cdef inline proc_string hash_sequence(seq) except *:
* cdef proc_string s_proc
* s_proc.length = <size_t>len(seq) # <<<<<<<<<<<<<<
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*/
__pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 80, __pyx_L1_error)
__pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 77, __pyx_L1_error)
__pyx_v_s_proc.length = ((size_t)__pyx_t_1);
/* "cpp_common.pxd":82
/* "cpp_common.pxd":79
* s_proc.length = <size_t>len(seq)
*
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t)) # <<<<<<<<<<<<<<
@ -7069,7 +7069,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.data = malloc((__pyx_v_s_proc.length * (sizeof(uint64_t))));
/* "cpp_common.pxd":84
/* "cpp_common.pxd":81
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -7079,16 +7079,16 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_2 = ((__pyx_v_s_proc.data == NULL) != 0);
if (unlikely(__pyx_t_2)) {
/* "cpp_common.pxd":85
/* "cpp_common.pxd":82
*
* if s_proc.data == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
*
* try:
*/
PyErr_NoMemory(); __PYX_ERR(1, 85, __pyx_L1_error)
PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error)
/* "cpp_common.pxd":84
/* "cpp_common.pxd":81
* s_proc.data = malloc(s_proc.length * sizeof(uint64_t))
*
* if s_proc.data == NULL: # <<<<<<<<<<<<<<
@ -7097,7 +7097,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
}
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -7113,7 +7113,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__Pyx_XGOTREF(__pyx_t_5);
/*try:*/ {
/* "cpp_common.pxd":88
/* "cpp_common.pxd":85
*
* try:
* s_proc.kind = RAPIDFUZZ_INT64 # <<<<<<<<<<<<<<
@ -7122,7 +7122,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.kind = RAPIDFUZZ_INT64;
/* "cpp_common.pxd":89
/* "cpp_common.pxd":86
* try:
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length): # <<<<<<<<<<<<<<
@ -7134,19 +7134,19 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
__pyx_v_i = __pyx_t_8;
/* "cpp_common.pxd":90
/* "cpp_common.pxd":87
* s_proc.kind = RAPIDFUZZ_INT64
* for i in range(s_proc.length):
* elem = seq[i] # <<<<<<<<<<<<<<
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1:
*/
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_seq, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 90, __pyx_L4_error)
__pyx_t_9 = __Pyx_GetItemInt(__pyx_v_seq, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 87, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_9);
__pyx_t_9 = 0;
/* "cpp_common.pxd":92
/* "cpp_common.pxd":89
* elem = seq[i]
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
@ -7160,23 +7160,23 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_2 = __pyx_t_11;
goto __pyx_L13_bool_binop_done;
}
__pyx_t_1 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 92, __pyx_L4_error)
__pyx_t_1 = PyObject_Length(__pyx_v_elem); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 89, __pyx_L4_error)
__pyx_t_11 = ((__pyx_t_1 == 1) != 0);
__pyx_t_2 = __pyx_t_11;
__pyx_L13_bool_binop_done:;
if (__pyx_t_2) {
/* "cpp_common.pxd":93
/* "cpp_common.pxd":90
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1:
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem # <<<<<<<<<<<<<<
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
*/
__pyx_t_12 = __Pyx_PyObject_AsPy_UCS4(__pyx_v_elem); if (unlikely((__pyx_t_12 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 93, __pyx_L4_error)
__pyx_t_12 = __Pyx_PyObject_AsPy_UCS4(__pyx_v_elem); if (unlikely((__pyx_t_12 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(1, 90, __pyx_L4_error)
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)((Py_UCS4)__pyx_t_12));
/* "cpp_common.pxd":92
/* "cpp_common.pxd":89
* elem = seq[i]
* # this is required so e.g. a list of char can be compared to a string
* if isinstance(elem, str) and len(elem) == 1: # <<<<<<<<<<<<<<
@ -7186,7 +7186,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
goto __pyx_L12;
}
/* "cpp_common.pxd":95
/* "cpp_common.pxd":92
* (<uint64_t*>s_proc.data)[i] = <uint64_t><Py_UCS4>elem
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem) # <<<<<<<<<<<<<<
@ -7194,13 +7194,13 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
* free(s_proc.data)
*/
/*else*/ {
__pyx_t_13 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_13 == ((Py_hash_t)-1))) __PYX_ERR(1, 95, __pyx_L4_error)
__pyx_t_13 = PyObject_Hash(__pyx_v_elem); if (unlikely(__pyx_t_13 == ((Py_hash_t)-1))) __PYX_ERR(1, 92, __pyx_L4_error)
(((uint64_t *)__pyx_v_s_proc.data)[__pyx_v_i]) = ((uint64_t)__pyx_t_13);
}
__pyx_L12:;
}
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -7215,7 +7215,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
/* "cpp_common.pxd":96
/* "cpp_common.pxd":93
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e: # <<<<<<<<<<<<<<
@ -7225,7 +7225,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
if (__pyx_t_14) {
__Pyx_AddTraceback("cpp_common.hash_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(1, 96, __pyx_L6_except_error)
if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_15, &__pyx_t_16) < 0) __PYX_ERR(1, 93, __pyx_L6_except_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_GOTREF(__pyx_t_15);
__Pyx_GOTREF(__pyx_t_16);
@ -7233,7 +7233,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_v_e = __pyx_t_15;
/*try:*/ {
/* "cpp_common.pxd":97
/* "cpp_common.pxd":94
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e:
* free(s_proc.data) # <<<<<<<<<<<<<<
@ -7242,7 +7242,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
free(__pyx_v_s_proc.data);
/* "cpp_common.pxd":98
/* "cpp_common.pxd":95
* except Exception as e:
* free(s_proc.data)
* s_proc.data = NULL # <<<<<<<<<<<<<<
@ -7251,7 +7251,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.data = NULL;
/* "cpp_common.pxd":99
/* "cpp_common.pxd":96
* free(s_proc.data)
* s_proc.data = NULL
* raise # <<<<<<<<<<<<<<
@ -7263,10 +7263,10 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_ErrRestoreWithState(__pyx_t_9, __pyx_t_15, __pyx_t_16);
__pyx_t_9 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__PYX_ERR(1, 99, __pyx_L20_error)
__PYX_ERR(1, 96, __pyx_L20_error)
}
/* "cpp_common.pxd":96
/* "cpp_common.pxd":93
* else:
* (<uint64_t*>s_proc.data)[i] = <uint64_t>hash(elem)
* except Exception as e: # <<<<<<<<<<<<<<
@ -7310,7 +7310,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
goto __pyx_L6_except_error;
__pyx_L6_except_error:;
/* "cpp_common.pxd":87
/* "cpp_common.pxd":84
* raise MemoryError
*
* try: # <<<<<<<<<<<<<<
@ -7325,7 +7325,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_L9_try_end:;
}
/* "cpp_common.pxd":101
/* "cpp_common.pxd":98
* raise
*
* s_proc.allocated = True # <<<<<<<<<<<<<<
@ -7333,7 +7333,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
*/
__pyx_v_s_proc.allocated = 1;
/* "cpp_common.pxd":102
/* "cpp_common.pxd":99
*
* s_proc.allocated = True
* return move(s_proc) # <<<<<<<<<<<<<<
@ -7341,7 +7341,7 @@ static CYTHON_INLINE proc_string __pyx_f_10cpp_common_hash_sequence(PyObject *__
__pyx_r = cython_std::move<proc_string>(__pyx_v_s_proc);
goto __pyx_L0;
/* "cpp_common.pxd":78
/* "cpp_common.pxd":75
*
*
* cdef inline proc_string hash_sequence(seq) except *: # <<<<<<<<<<<<<<
@ -9515,7 +9515,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
/* #### Code section: cached_builtins ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 243, __pyx_L1_error)
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 37, __pyx_L1_error)
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 34, __pyx_L1_error)
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 29, __pyx_L1_error)
return 0;
__pyx_L1_error:;

15
src/cpp_utils.cpp vendored
View File

@ -2543,6 +2543,14 @@ if (!__Pyx_RefNanny) {
/* #### Code section: cleanup_globals ### */
/* #### Code section: cleanup_module ### */
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#if _MSC_VER
#pragma warning( push )
#pragma warning( disable : 4127 )
#endif
/* #### Code section: utility_code_def ### */
/* --- Runtime support code --- */
@ -5338,5 +5346,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
}
/* #### Code section: utility_code_pragmas_end ### */
#if _MSV_VER
#pragma warning( pop )
#endif
/* #### Code section: end ### */
#endif /* Py_PYTHON_H */

View File

@ -4,6 +4,7 @@ PyObject* default_process_impl(PyObject* sentence) {
proc_string c_sentence = convert_string(sentence);
switch (c_sentence.kind) {
#if PY_VERSION_HEX > PYTHON_VERSION(3, 0, 0)
case RAPIDFUZZ_UINT8:
{
auto proc_str = utils::default_process(
@ -22,6 +23,20 @@ PyObject* default_process_impl(PyObject* sentence) {
rapidfuzz::basic_string_view<uint32_t>(static_cast<uint32_t*>(c_sentence.data), c_sentence.length));
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
}
#else
case RAPIDFUZZ_CHAR:
{
auto proc_str = utils::default_process(
rapidfuzz::basic_string_view<char>(static_cast<char*>(c_sentence.data), c_sentence.length));
return PyString_FromStringAndSize(proc_str.data(), (Py_ssize_t)proc_str.size());
}
case RAPIDFUZZ_UNICODE:
{
auto proc_str = utils::default_process(
rapidfuzz::basic_string_view<Py_UNICODE>(static_cast<Py_UNICODE*>(c_sentence.data), c_sentence.length));
return PyUnicode_FromUnicode(proc_str.data(), (Py_ssize_t)proc_str.size());
}
#endif
// ToDo: for now do not process these elements should be done in some way in the future
default:
return sentence;

View File

@ -4,6 +4,7 @@
import unittest
import pytest
from array import array
import sys
from rapidfuzz import fuzz, utils
@ -122,9 +123,10 @@ def test_array(scorer):
"""
arrays should be supported and treated in a compatible way to strings
"""
assert scorer(array('u', RatioTest.s3), array('u', RatioTest.s3))
assert scorer(RatioTest.s3, array('u', RatioTest.s3))
assert scorer(array('u', RatioTest.s3), RatioTest.s3)
if sys.version_info[0] > 2:
assert scorer(array('u', RatioTest.s3), array('u', RatioTest.s3))
assert scorer(RatioTest.s3, array('u', RatioTest.s3))
assert scorer(array('u', RatioTest.s3), RatioTest.s3)
@pytest.mark.parametrize("scorer", scorers)
def test_none_string(scorer):

View File

@ -8,9 +8,11 @@ import pytest
from rapidfuzz import fuzz, process, utils, string_metric
import random
from math import isclose
import numpy as np
def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):
return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)
def levenshtein(s1, s2, weights=(1, 1, 1)):
"""
python implementation of a generic Levenshtein distance
@ -63,7 +65,7 @@ def normalize_distance(dist, s1, s2, weights=(1, 1, 1)):
len(s1) * substitute + (len(s2) - len(s1)) * insert
])
return 100 - 100 * dist / max_dist if max_dist else 100
return 100 - 100 * float(dist) / float(max_dist) if max_dist else 100
def partial_ratio_short_needle(s1, s2):
if not s1 and not s2:

View File

@ -3,6 +3,7 @@
import unittest
import pytest
import sys
from rapidfuzz import string_metric
@ -21,8 +22,9 @@ def test_cross_type_matching():
strings should always be interpreted in the same way
"""
assert string_metric.levenshtein("aaaa", "aaaa") == 0
assert string_metric.levenshtein("aaaa", ["a", "a", "a", "a"]) == 0
assert string_metric.levenshtein("aaaa", [ord("a"), ord("a"), "a", "a"]) == 0
if sys.version_info[0] > 2:
assert string_metric.levenshtein("aaaa", ["a", "a", "a", "a"]) == 0
assert string_metric.levenshtein("aaaa", [ord("a"), ord("a"), "a", "a"]) == 0
def test_word_error_rate():
"""