Skip to content

Commit

Permalink
Merge branch 'rapidfuzz:main' into bvandercar/reduce-len-calls
Browse files Browse the repository at this point in the history
  • Loading branch information
bvandercar-vt authored Nov 14, 2024
2 parents ba243a8 + 268a382 commit 0323bc8
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/branchbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: |
git clone https://github.com/rapidfuzz/rapidfuzz-cpp.git
cd rapidfuzz-cpp
git checkout v3.0.5
git checkout v3.1.1
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
run: |
git clone https://github.com/rapidfuzz/rapidfuzz-cpp.git
cd rapidfuzz-cpp
git checkout v3.0.5
git checkout v3.1.1
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Changelog
---------

[3.10.1] - 2024-10-24
^^^^^^^^^^^^^^^^^^^^^
Fixed
~~~~~
- fix compilation on clang-19
- fix incorrect results in simd optimized implementation of Levenshtein and OSA on 32bit targets

Added
~~~~~
* added support for taskflow 3.8.0

[3.10.0] - 2024-09-21
^^^^^^^^^^^^^^^^^^^^^
Fixed
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ check_cpu_arch_x86(RAPIDFUZZ_ARCH_X86)

set(RF_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

find_package(Taskflow 3.7.0 QUIET)
find_package(Taskflow 3.8.0 QUIET)
if(NOT Taskflow_FOUND)
find_package(Taskflow 3.7.0 QUIET)
endif()
if(NOT Taskflow_FOUND)
find_package(Taskflow 3.6.0 QUIET)
endif()
Expand Down Expand Up @@ -107,7 +110,7 @@ else()
add_library(Taskflow::Taskflow ALIAS Taskflow)
endif()

find_package(rapidfuzz 3.0.5 QUIET)
find_package(rapidfuzz 3.1.1 QUIET)
if(rapidfuzz_FOUND)
message(STATUS "Using system supplied version of rapidfuzz-cpp")
else()
Expand Down
2 changes: 1 addition & 1 deletion extern/taskflow
Submodule taskflow updated 715 files
2 changes: 1 addition & 1 deletion src/rapidfuzz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

__author__: str = "Max Bachmann"
__license__: str = "MIT"
__version__: str = "3.10.0"
__version__: str = "3.10.1"

from rapidfuzz import distance, fuzz, process, utils

Expand Down
4 changes: 2 additions & 2 deletions src/rapidfuzz/cpp_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,15 +708,15 @@ static inline bool multi_normalized_distance_init(RF_ScorerFunc* self, int64_t s
static inline PyObject* opcodes_apply(const rf::Opcodes& ops, const RF_String& str1, const RF_String& str2)
{
return visitor(str1, str2, [&](auto s1, auto s2) {
auto proc_str = rf::opcodes_apply<uint32_t>(ops, s1, s2);
auto proc_str = rf::opcodes_apply_vec<uint32_t>(ops, s1, s2);
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
});
}

static inline PyObject* editops_apply(const rf::Editops& ops, const RF_String& str1, const RF_String& str2)
{
return visitor(str1, str2, [&](auto s1, auto s2) {
auto proc_str = rf::editops_apply<uint32_t>(ops, s1, s2);
auto proc_str = rf::editops_apply_vec<uint32_t>(ops, s1, s2);
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
});
}
2 changes: 1 addition & 1 deletion src/rapidfuzz/process_cpp.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "cpp_common.hpp"
#include "rapidfuzz.h"
#include "taskflow/algorithm/for_each.hpp"
#include "taskflow/taskflow.hpp"
#include "taskflow/algorithm/for_each.hpp"
#include <atomic>
#include <exception>
#include <stdexcept>
Expand Down
9 changes: 4 additions & 5 deletions src/rapidfuzz/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <cwctype>
#include <limits>
#include <stdint.h>
#include <string>
#include <vector>

uint32_t UnicodeDefaultProcess(uint32_t ch);

Expand Down Expand Up @@ -80,11 +80,10 @@ int64_t default_process(CharT* str, int64_t len)
}

template <typename CharT>
std::basic_string<CharT> default_process(std::basic_string<CharT> s)
std::vector<CharT> default_process_copy(CharT* str_, int64_t len_)
{
std::basic_string<CharT> str(s);

int64_t len = default_process(&str[0], str.size());
std::vector<CharT> str(str_, str_ + len_);
int64_t len = default_process(str.data(), str.size());
str.resize(len);
return str;
}
9 changes: 3 additions & 6 deletions src/rapidfuzz/utils_cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ static inline PyObject* default_process_impl(PyObject* sentence)
switch (c_sentence.kind) {
case RF_UINT8:
{
auto proc_str = default_process(
std::basic_string<uint8_t>(static_cast<uint8_t*>(c_sentence.data), c_sentence.length));
auto proc_str = default_process_copy(static_cast<uint8_t*>(c_sentence.data), c_sentence.length);
return PyUnicode_FromKindAndData(PyUnicode_1BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
}
case RF_UINT16:
{
auto proc_str = default_process(
std::basic_string<uint16_t>(static_cast<uint16_t*>(c_sentence.data), c_sentence.length));
auto proc_str = default_process_copy(static_cast<uint16_t*>(c_sentence.data), c_sentence.length);
return PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
}
case RF_UINT32:
{
auto proc_str = default_process(
std::basic_string<uint32_t>(static_cast<uint32_t*>(c_sentence.data), c_sentence.length));
auto proc_str = default_process_copy(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());
}
// ToDo: for now do not process these elements should be done in some way in the future
Expand Down

0 comments on commit 0323bc8

Please sign in to comment.