sort imports
This commit is contained in:
parent
28f8c85f8c
commit
3c499d9dfd
|
@ -5,7 +5,6 @@ AccessModifierOffset: -4
|
|||
AllowShortIfStatementsOnASingleLine: true
|
||||
PointerAlignment: Left
|
||||
AllowShortBlocksOnASingleLine: Always
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortLambdasOnASingleLine: None
|
||||
BreakBeforeBraces: Custom
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from setuptools import build_meta as _orig
|
||||
import platform as _platform
|
||||
import subprocess as _subprocess
|
||||
|
||||
from packaging import version as _version
|
||||
from packaging.tags import sys_tags as _sys_tags
|
||||
from skbuild.exceptions import SKBuildError as _SKBuildError
|
||||
from setuptools import build_meta as _orig
|
||||
from skbuild.cmaker import get_cmake_version as _get_cmake_version
|
||||
import subprocess as _subprocess
|
||||
import platform as _platform
|
||||
from skbuild.exceptions import SKBuildError as _SKBuildError
|
||||
|
||||
prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel
|
||||
build_wheel = _orig.build_wheel
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import importlib
|
||||
import random
|
||||
from timeit import timeit
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib
|
||||
|
||||
import string
|
||||
from timeit import timeit
|
||||
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
random.seed(18)
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# todo combine benchmarks of scorers into common code base
|
||||
import timeit
|
||||
|
||||
import pandas
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
start = timeit.default_timer()
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# todo combine benchmarks of scorers into common code base
|
||||
import timeit
|
||||
import pandas
|
||||
|
||||
import numpy as np
|
||||
import pandas
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# todo combine benchmarks of scorers into common code base
|
||||
import timeit
|
||||
import pandas
|
||||
|
||||
import numpy as np
|
||||
import pandas
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# todo combine benchmarks of scorers into common code base
|
||||
import timeit
|
||||
import pandas
|
||||
|
||||
import numpy as np
|
||||
import pandas
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# todo combine benchmarks of scorers into common code base
|
||||
import timeit
|
||||
import pandas
|
||||
|
||||
import numpy as np
|
||||
import pandas
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# todo combine benchmarks of scorers into common code base
|
||||
import timeit
|
||||
import pandas
|
||||
|
||||
import numpy as np
|
||||
import pandas
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import pandas as pd
|
||||
import numpy as np
|
||||
import timeit
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
start = timeit.default_timer()
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import pandas as pd
|
||||
import numpy as np
|
||||
import timeit
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
start = timeit.default_timer()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import importlib
|
||||
import random
|
||||
from timeit import timeit
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib
|
||||
|
||||
import string
|
||||
from timeit import timeit
|
||||
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
random.seed(18)
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import timeit
|
||||
import pandas
|
||||
|
||||
import numpy as np
|
||||
import pandas
|
||||
|
||||
|
||||
def benchmark(name, func, setup, lengths, count):
|
||||
print(f"starting {name}")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
|
||||
df=pd.read_csv("results/levenshtein_damerau.csv")
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
docutils==0.18.1
|
||||
Sphinx
|
||||
furo
|
||||
numpy
|
||||
sphinxcontrib-bibtex
|
||||
m2r2
|
||||
numpy
|
||||
Sphinx
|
||||
sphinxcontrib-bibtex
|
||||
|
|
3
setup.py
3
setup.py
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
|
||||
|
||||
def show_message(*lines):
|
||||
print("=" * 74)
|
||||
for line in lines:
|
||||
|
@ -45,8 +46,8 @@ setup_args = {
|
|||
|
||||
def run_setup(with_binary):
|
||||
if with_binary:
|
||||
from skbuild import setup
|
||||
import rapidfuzz_capi
|
||||
from skbuild import setup
|
||||
|
||||
setup(
|
||||
**setup_args,
|
||||
|
|
|
@ -5,4 +5,4 @@ __author__: str = "Max Bachmann"
|
|||
__license__: str = "MIT"
|
||||
__version__: str = "2.10.3"
|
||||
|
||||
from rapidfuzz import process, distance, fuzz, string_metric, utils
|
||||
from rapidfuzz import distance, fuzz, process, string_metric, utils
|
||||
|
|
|
@ -2,10 +2,8 @@ __author__: str
|
|||
__license__: str
|
||||
__version__: str
|
||||
|
||||
from rapidfuzz import (
|
||||
process as process,
|
||||
distance as distance,
|
||||
fuzz as fuzz,
|
||||
string_metric as string_metric,
|
||||
utils as utils,
|
||||
)
|
||||
from rapidfuzz import distance as distance
|
||||
from rapidfuzz import fuzz as fuzz
|
||||
from rapidfuzz import process as process
|
||||
from rapidfuzz import string_metric as string_metric
|
||||
from rapidfuzz import utils as utils
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
# distutils: language=c++
|
||||
# cython: language_level=3, binding=True, linetrace=True
|
||||
|
||||
from libc.stdint cimport uint64_t, int64_t
|
||||
from libc.stdlib cimport malloc, free
|
||||
from libc.stddef cimport wchar_t
|
||||
from libcpp.utility cimport pair
|
||||
from libcpp cimport bool
|
||||
from libcpp.utility cimport move
|
||||
from cpython.object cimport PyObject
|
||||
from cpython.pycapsule cimport (PyCapsule_GetPointer, PyCapsule_IsValid,
|
||||
PyCapsule_New)
|
||||
from libc.stddef cimport wchar_t
|
||||
from libc.stdint cimport int64_t, uint64_t
|
||||
from libc.stdlib cimport free, malloc
|
||||
from libcpp cimport bool
|
||||
from libcpp.utility cimport move, pair
|
||||
from libcpp.vector cimport vector
|
||||
from cpython.pycapsule cimport PyCapsule_New, PyCapsule_IsValid, PyCapsule_GetPointer
|
||||
|
||||
from rapidfuzz_capi cimport (
|
||||
RF_Scorer, RF_StringType, RF_String, RF_Kwargs, RF_KwargsInit,
|
||||
SCORER_STRUCT_VERSION,
|
||||
RF_ScorerFlags, RF_Preprocessor, RF_GetScorerFlags, RF_ScorerFuncInit
|
||||
)
|
||||
from rapidfuzz_capi cimport (SCORER_STRUCT_VERSION, RF_GetScorerFlags,
|
||||
RF_Kwargs, RF_KwargsInit, RF_Preprocessor,
|
||||
RF_Scorer, RF_ScorerFlags, RF_ScorerFuncInit,
|
||||
RF_String, RF_StringType)
|
||||
|
||||
from array import array
|
||||
|
||||
|
||||
cdef extern from "rapidfuzz/details/types.hpp" namespace "rapidfuzz" nogil:
|
||||
cpdef enum class EditType:
|
||||
None = 0,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz._utils import (
|
||||
fallback_import as _fallback_import,
|
||||
default_distance_attribute as _dist_attr,
|
||||
default_similarity_attribute as _sim_attr,
|
||||
default_normalized_distance_attribute as _norm_dist_attr,
|
||||
default_normalized_similarity_attribute as _norm_sim_attr,
|
||||
)
|
||||
from rapidfuzz._utils import default_distance_attribute as _dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_distance_attribute as _norm_dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_similarity_attribute as _norm_sim_attr
|
||||
from rapidfuzz._utils import default_similarity_attribute as _sim_attr
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
_mod = "rapidfuzz.distance.DamerauLevenshtein"
|
||||
distance = _fallback_import(_mod, "distance")
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
_RF_ScorerPy: Dict
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance.metrics_cpp import (
|
||||
damerau_levenshtein_distance as distance,
|
||||
damerau_levenshtein_similarity as similarity,
|
||||
damerau_levenshtein_normalized_distance as normalized_distance,
|
||||
damerau_levenshtein_normalized_similarity as normalized_similarity,
|
||||
)
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
damerau_levenshtein_distance as distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
damerau_levenshtein_normalized_distance as normalized_distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
damerau_levenshtein_normalized_similarity as normalized_similarity
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
damerau_levenshtein_similarity as similarity
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz._utils import (
|
||||
fallback_import as _fallback_import,
|
||||
default_distance_attribute as _dist_attr,
|
||||
default_similarity_attribute as _sim_attr,
|
||||
default_normalized_distance_attribute as _norm_dist_attr,
|
||||
default_normalized_similarity_attribute as _norm_sim_attr,
|
||||
)
|
||||
from rapidfuzz._utils import default_distance_attribute as _dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_distance_attribute as _norm_dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_similarity_attribute as _norm_sim_attr
|
||||
from rapidfuzz._utils import default_similarity_attribute as _sim_attr
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
_mod = "rapidfuzz.distance.Hamming"
|
||||
distance = _fallback_import(_mod, "distance")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar
|
||||
from typing import Callable, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance.metrics_cpp import (
|
||||
hamming_distance as distance,
|
||||
hamming_similarity as similarity,
|
||||
hamming_normalized_distance as normalized_distance,
|
||||
hamming_normalized_similarity as normalized_similarity,
|
||||
hamming_editops as editops,
|
||||
hamming_opcodes as opcodes
|
||||
)
|
||||
from rapidfuzz.distance.metrics_cpp import hamming_distance as distance
|
||||
from rapidfuzz.distance.metrics_cpp import hamming_editops as editops
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
hamming_normalized_distance as normalized_distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
hamming_normalized_similarity as normalized_similarity
|
||||
from rapidfuzz.distance.metrics_cpp import hamming_opcodes as opcodes
|
||||
from rapidfuzz.distance.metrics_cpp import hamming_similarity as similarity
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz._utils import (
|
||||
fallback_import as _fallback_import,
|
||||
default_distance_attribute as _dist_attr,
|
||||
default_similarity_attribute as _sim_attr,
|
||||
default_normalized_distance_attribute as _norm_dist_attr,
|
||||
default_normalized_similarity_attribute as _norm_sim_attr,
|
||||
)
|
||||
from rapidfuzz._utils import default_distance_attribute as _dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_distance_attribute as _norm_dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_similarity_attribute as _norm_sim_attr
|
||||
from rapidfuzz._utils import default_similarity_attribute as _sim_attr
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
_mod = "rapidfuzz.distance.Indel"
|
||||
distance = _fallback_import(_mod, "distance")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar
|
||||
from typing import Callable, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance.metrics_cpp import (
|
||||
indel_distance as distance,
|
||||
indel_similarity as similarity,
|
||||
indel_normalized_distance as normalized_distance,
|
||||
indel_normalized_similarity as normalized_similarity,
|
||||
indel_editops as editops,
|
||||
indel_opcodes as opcodes,
|
||||
)
|
||||
from rapidfuzz.distance.metrics_cpp import indel_distance as distance
|
||||
from rapidfuzz.distance.metrics_cpp import indel_editops as editops
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
indel_normalized_distance as normalized_distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
indel_normalized_similarity as normalized_similarity
|
||||
from rapidfuzz.distance.metrics_cpp import indel_opcodes as opcodes
|
||||
from rapidfuzz.distance.metrics_cpp import indel_similarity as similarity
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from .LCSseq_py import (
|
||||
similarity as lcs_seq_similarity,
|
||||
_block_similarity as lcs_seq_block_similarity,
|
||||
)
|
||||
from .LCSseq_py import _block_similarity as lcs_seq_block_similarity
|
||||
from .LCSseq_py import similarity as lcs_seq_similarity
|
||||
|
||||
|
||||
def distance(s1, s2, *, processor=None, score_cutoff=None):
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
_RF_ScorerPy: Dict
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz._utils import (
|
||||
fallback_import as _fallback_import,
|
||||
default_distance_attribute as _dist_attr,
|
||||
default_similarity_attribute as _sim_attr,
|
||||
default_normalized_distance_attribute as _norm_dist_attr,
|
||||
default_normalized_similarity_attribute as _norm_sim_attr,
|
||||
)
|
||||
from rapidfuzz._utils import default_distance_attribute as _dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_distance_attribute as _norm_dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_similarity_attribute as _norm_sim_attr
|
||||
from rapidfuzz._utils import default_similarity_attribute as _sim_attr
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
_mod = "rapidfuzz.distance.Jaro"
|
||||
distance = _fallback_import(_mod, "distance")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz._utils import (
|
||||
fallback_import as _fallback_import,
|
||||
default_distance_attribute as _dist_attr,
|
||||
default_similarity_attribute as _sim_attr,
|
||||
default_normalized_distance_attribute as _norm_dist_attr,
|
||||
default_normalized_similarity_attribute as _norm_sim_attr,
|
||||
)
|
||||
from rapidfuzz._utils import default_distance_attribute as _dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_distance_attribute as _norm_dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_similarity_attribute as _norm_sim_attr
|
||||
from rapidfuzz._utils import default_similarity_attribute as _sim_attr
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
_mod = "rapidfuzz.distance.JaroWinkler"
|
||||
distance = _fallback_import(_mod, "distance")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance.metrics_cpp import (
|
||||
jaro_winkler_distance as distance,
|
||||
jaro_winkler_similarity as similarity,
|
||||
jaro_winkler_normalized_distance as normalized_distance,
|
||||
from rapidfuzz.distance.metrics_cpp import jaro_winkler_distance as distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
jaro_winkler_normalized_distance as normalized_distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
jaro_winkler_normalized_similarity as normalized_similarity
|
||||
)
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
jaro_winkler_similarity as similarity
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
from rapidfuzz.distance import Jaro
|
||||
|
||||
|
||||
def similarity(s1, s2, *, prefix_weight=0.1, processor=None, score_cutoff=None) -> float:
|
||||
"""
|
||||
Calculates the jaro winkler similarity
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance.metrics_cpp import (
|
||||
jaro_distance as distance,
|
||||
jaro_similarity as similarity,
|
||||
jaro_normalized_distance as normalized_distance,
|
||||
from rapidfuzz.distance.metrics_cpp import jaro_distance as distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
jaro_normalized_distance as normalized_distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
jaro_normalized_similarity as normalized_similarity
|
||||
)
|
||||
from rapidfuzz.distance.metrics_cpp import jaro_similarity as similarity
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz._utils import (
|
||||
fallback_import as _fallback_import,
|
||||
default_distance_attribute as _dist_attr,
|
||||
default_similarity_attribute as _sim_attr,
|
||||
default_normalized_distance_attribute as _norm_dist_attr,
|
||||
default_normalized_similarity_attribute as _norm_sim_attr,
|
||||
)
|
||||
from rapidfuzz._utils import default_distance_attribute as _dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_distance_attribute as _norm_dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_similarity_attribute as _norm_sim_attr
|
||||
from rapidfuzz._utils import default_similarity_attribute as _sim_attr
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
_mod = "rapidfuzz.distance.LCSseq"
|
||||
distance = _fallback_import(_mod, "distance")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar
|
||||
from typing import Callable, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance.metrics_cpp import (
|
||||
lcs_seq_distance as distance,
|
||||
lcs_seq_similarity as similarity,
|
||||
lcs_seq_normalized_distance as normalized_distance,
|
||||
lcs_seq_normalized_similarity as normalized_similarity,
|
||||
lcs_seq_editops as editops,
|
||||
lcs_seq_opcodes as opcodes,
|
||||
)
|
||||
from rapidfuzz.distance.metrics_cpp import lcs_seq_distance as distance
|
||||
from rapidfuzz.distance.metrics_cpp import lcs_seq_editops as editops
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
lcs_seq_normalized_distance as normalized_distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
lcs_seq_normalized_similarity as normalized_similarity
|
||||
from rapidfuzz.distance.metrics_cpp import lcs_seq_opcodes as opcodes
|
||||
from rapidfuzz.distance.metrics_cpp import lcs_seq_similarity as similarity
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
_RF_ScorerPy7: Dict
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ It's defined as the minimum number of insertions, deletions or
|
|||
substitutions required to transform s1 into s2.
|
||||
"""
|
||||
|
||||
from rapidfuzz._utils import (
|
||||
fallback_import as _fallback_import,
|
||||
default_distance_attribute as _dist_attr,
|
||||
default_similarity_attribute as _sim_attr,
|
||||
default_normalized_distance_attribute as _norm_dist_attr,
|
||||
default_normalized_similarity_attribute as _norm_sim_attr,
|
||||
)
|
||||
from rapidfuzz._utils import default_distance_attribute as _dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_distance_attribute as _norm_dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_similarity_attribute as _norm_sim_attr
|
||||
from rapidfuzz._utils import default_similarity_attribute as _sim_attr
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
_mod = "rapidfuzz.distance.Levenshtein"
|
||||
distance = _fallback_import(_mod, "distance")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Tuple
|
||||
from typing import Callable, Hashable, Optional, Sequence, Tuple, TypeVar
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance.metrics_cpp import (
|
||||
levenshtein_distance as distance,
|
||||
levenshtein_similarity as similarity,
|
||||
levenshtein_normalized_distance as normalized_distance,
|
||||
levenshtein_normalized_similarity as normalized_similarity,
|
||||
levenshtein_editops as editops,
|
||||
levenshtein_opcodes as opcodes,
|
||||
)
|
||||
from rapidfuzz.distance.metrics_cpp import levenshtein_distance as distance
|
||||
from rapidfuzz.distance.metrics_cpp import levenshtein_editops as editops
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
levenshtein_normalized_distance as normalized_distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
levenshtein_normalized_similarity as normalized_similarity
|
||||
from rapidfuzz.distance.metrics_cpp import levenshtein_opcodes as opcodes
|
||||
from rapidfuzz.distance.metrics_cpp import levenshtein_similarity as similarity
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Tuple, Any, Dict
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
from typing import (Any, Callable, Dict, Hashable, Optional, Sequence, Tuple,
|
||||
TypeVar)
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
_RF_ScorerPy: Dict
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz._utils import (
|
||||
fallback_import as _fallback_import,
|
||||
default_distance_attribute as _dist_attr,
|
||||
default_similarity_attribute as _sim_attr,
|
||||
default_normalized_distance_attribute as _norm_dist_attr,
|
||||
default_normalized_similarity_attribute as _norm_sim_attr,
|
||||
)
|
||||
from rapidfuzz._utils import default_distance_attribute as _dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_distance_attribute as _norm_dist_attr
|
||||
from rapidfuzz._utils import \
|
||||
default_normalized_similarity_attribute as _norm_sim_attr
|
||||
from rapidfuzz._utils import default_similarity_attribute as _sim_attr
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
_mod = "rapidfuzz.distance.OSA"
|
||||
distance = _fallback_import(_mod, "distance")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance.metrics_cpp import (
|
||||
osa_distance as distance,
|
||||
osa_similarity as similarity,
|
||||
osa_normalized_distance as normalized_distance,
|
||||
osa_normalized_similarity as normalized_similarity,
|
||||
)
|
||||
from rapidfuzz.distance.metrics_cpp import osa_distance as distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
osa_normalized_distance as normalized_distance
|
||||
from rapidfuzz.distance.metrics_cpp import \
|
||||
osa_normalized_similarity as normalized_similarity
|
||||
from rapidfuzz.distance.metrics_cpp import osa_similarity as similarity
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
|
|
|
@ -11,4 +11,5 @@ Opcodes = _fallback_import(_mod, "Opcodes", False)
|
|||
ScoreAlignment = _fallback_import(_mod, "ScoreAlignment", False)
|
||||
MatchingBlock = _fallback_import(_mod, "MatchingBlock", False)
|
||||
|
||||
from . import Hamming, Indel, Jaro, JaroWinkler, Levenshtein, LCSseq, DamerauLevenshtein
|
||||
from . import (DamerauLevenshtein, Hamming, Indel, Jaro, JaroWinkler, LCSseq,
|
||||
Levenshtein)
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
from typing import Tuple, List, Union
|
||||
from typing import List, Tuple, Union
|
||||
|
||||
from . import (
|
||||
Hamming as Hamming,
|
||||
Indel as Indel,
|
||||
Jaro as Jaro,
|
||||
JaroWinkler as JaroWinkler,
|
||||
Levenshtein as Levenshtein,
|
||||
LCSseq as LCSseq,
|
||||
DamerauLevenshtein as DamerauLevenshtein,
|
||||
)
|
||||
from . import DamerauLevenshtein as DamerauLevenshtein
|
||||
from . import Hamming as Hamming
|
||||
from . import Indel as Indel
|
||||
from . import Jaro as Jaro
|
||||
from . import JaroWinkler as JaroWinkler
|
||||
from . import LCSseq as LCSseq
|
||||
from . import Levenshtein as Levenshtein
|
||||
|
||||
_AnyOpList = Union[
|
||||
List[Union[Editop, Tuple[str, int, int]]],
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# distutils: language=c++
|
||||
# cython: language_level=3, binding=True, linetrace=True
|
||||
|
||||
from libcpp.vector cimport vector
|
||||
from libcpp cimport bool
|
||||
from cpp_common cimport RfEditops, RfOpcodes
|
||||
from libcpp cimport bool
|
||||
from libcpp.vector cimport vector
|
||||
|
||||
|
||||
cdef class Editops:
|
||||
cdef RfEditops editops
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
# distutils: language=c++
|
||||
# cython: language_level=3, binding=True, linetrace=True
|
||||
|
||||
from rapidfuzz_capi cimport RF_String
|
||||
from cpp_common cimport RfEditOp, RfOpcode, EditType, is_valid_string, convert_string
|
||||
|
||||
from libcpp cimport bool
|
||||
from libcpp.vector cimport vector
|
||||
from libcpp.utility cimport move
|
||||
from libc.stdlib cimport malloc, free
|
||||
from libc.stdint cimport uint32_t, int64_t
|
||||
from cpp_common cimport (EditType, RfEditOp, RfOpcode, convert_string,
|
||||
is_valid_string)
|
||||
from cpython.list cimport PyList_New, PyList_SET_ITEM
|
||||
from cpython.pycapsule cimport (PyCapsule_GetPointer, PyCapsule_IsValid,
|
||||
PyCapsule_New)
|
||||
from cpython.ref cimport Py_INCREF
|
||||
from cpython.pycapsule cimport PyCapsule_New, PyCapsule_IsValid, PyCapsule_GetPointer
|
||||
from libc.stdint cimport int64_t, uint32_t
|
||||
from libc.stdlib cimport free, malloc
|
||||
from libcpp cimport bool
|
||||
from libcpp.utility cimport move
|
||||
from libcpp.vector cimport vector
|
||||
from rapidfuzz_capi cimport RF_String
|
||||
|
||||
|
||||
cdef extern from "rapidfuzz/details/types.hpp" namespace "rapidfuzz" nogil:
|
||||
cdef struct LevenshteinWeightTable:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Tuple
|
||||
from typing import Callable, Hashable, Optional, Sequence, Tuple, TypeVar
|
||||
|
||||
from rapidfuzz.distance import Editops, Opcodes
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
|
|
|
@ -2,21 +2,28 @@
|
|||
# cython: language_level=3, binding=True, linetrace=True
|
||||
|
||||
from ._initialize_cpp import Editops
|
||||
|
||||
from rapidfuzz_capi cimport (RF_SCORER_FLAG_MULTI_STRING_CALL,
|
||||
RF_SCORER_FLAG_MULTI_STRING_INIT,
|
||||
RF_SCORER_FLAG_RESULT_F64,
|
||||
RF_SCORER_FLAG_RESULT_I64,
|
||||
RF_SCORER_FLAG_SYMMETRIC, RF_Kwargs,
|
||||
RF_Preprocess, RF_Scorer, RF_ScorerFlags,
|
||||
RF_ScorerFunc, RF_String)
|
||||
|
||||
from ._initialize_cpp cimport Editops, RfEditops
|
||||
|
||||
from rapidfuzz_capi cimport (
|
||||
RF_String, RF_Scorer, RF_Kwargs, RF_ScorerFunc, RF_Preprocess, RF_ScorerFlags,
|
||||
RF_SCORER_FLAG_RESULT_F64, RF_SCORER_FLAG_RESULT_I64, RF_SCORER_FLAG_SYMMETRIC,
|
||||
RF_SCORER_FLAG_MULTI_STRING_INIT, RF_SCORER_FLAG_MULTI_STRING_CALL
|
||||
)
|
||||
# required for preprocess_strings
|
||||
from array import array
|
||||
from cpp_common cimport RF_StringWrapper, preprocess_strings, NoKwargsInit, CreateScorerContext
|
||||
|
||||
from libcpp cimport bool
|
||||
from libc.stdlib cimport malloc, free
|
||||
from libc.stdint cimport INT64_MAX, int64_t
|
||||
from array import array
|
||||
|
||||
from cpp_common cimport (CreateScorerContext, NoKwargsInit, RF_StringWrapper,
|
||||
preprocess_strings)
|
||||
from cpython.pycapsule cimport PyCapsule_New
|
||||
from libc.stdint cimport INT64_MAX, int64_t
|
||||
from libc.stdlib cimport free, malloc
|
||||
from libcpp cimport bool
|
||||
|
||||
|
||||
cdef extern from "rapidfuzz/details/types.hpp" namespace "rapidfuzz" nogil:
|
||||
cdef struct LevenshteinWeightTable:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar
|
||||
from rapidfuzz.utils import default_process
|
||||
from typing import Callable, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from rapidfuzz.distance import ScoreAlignment
|
||||
from rapidfuzz.utils import default_process
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
_S1 = TypeVar("_S1")
|
||||
|
|
|
@ -3,25 +3,26 @@
|
|||
|
||||
from .distance._initialize_cpp import ScoreAlignment
|
||||
|
||||
from rapidfuzz_capi cimport (
|
||||
RF_String, RF_Scorer, RF_ScorerFunc, RF_Kwargs, RF_ScorerFlags,
|
||||
RF_SCORER_FLAG_RESULT_F64, RF_SCORER_FLAG_SYMMETRIC,
|
||||
RF_SCORER_FLAG_MULTI_STRING_INIT
|
||||
)
|
||||
from rapidfuzz_capi cimport (RF_SCORER_FLAG_MULTI_STRING_INIT,
|
||||
RF_SCORER_FLAG_RESULT_F64,
|
||||
RF_SCORER_FLAG_SYMMETRIC, RF_Kwargs, RF_Scorer,
|
||||
RF_ScorerFlags, RF_ScorerFunc, RF_String)
|
||||
|
||||
# required for preprocess_strings
|
||||
from rapidfuzz.utils import default_process
|
||||
from array import array
|
||||
from cpp_common cimport (
|
||||
RF_StringWrapper, preprocess_strings, RfScoreAlignment, NoKwargsInit,
|
||||
CreateScorerContext, CreateScorerContextPy, AddScorerContext
|
||||
)
|
||||
|
||||
from libc.stdint cimport uint32_t, int64_t
|
||||
from array import array
|
||||
|
||||
from rapidfuzz.utils import default_process
|
||||
|
||||
from cpp_common cimport (AddScorerContext, CreateScorerContext,
|
||||
CreateScorerContextPy, NoKwargsInit, RF_StringWrapper,
|
||||
RfScoreAlignment, preprocess_strings)
|
||||
from libc.stdint cimport int64_t, uint32_t
|
||||
from libcpp cimport bool
|
||||
|
||||
from array import array
|
||||
|
||||
|
||||
cdef extern from "fuzz_cpp.hpp":
|
||||
double ratio_func( const RF_String&, const RF_String&, double) nogil except +
|
||||
double partial_ratio_func( const RF_String&, const RF_String&, double) nogil except +
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
from rapidfuzz.utils_py import default_process
|
||||
from rapidfuzz.distance.Indel_py import (
|
||||
normalized_similarity as indel_normalized_similarity,
|
||||
_block_normalized_similarity as indel_block_normalized_similarity,
|
||||
distance as indel_distance,
|
||||
)
|
||||
from math import ceil
|
||||
|
||||
from rapidfuzz.distance.Indel_py import \
|
||||
_block_normalized_similarity as indel_block_normalized_similarity
|
||||
from rapidfuzz.distance.Indel_py import distance as indel_distance
|
||||
from rapidfuzz.distance.Indel_py import \
|
||||
normalized_similarity as indel_normalized_similarity
|
||||
from rapidfuzz.utils_py import default_process
|
||||
|
||||
from .distance._initialize_py import ScoreAlignment
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Any, Dict
|
||||
from rapidfuzz.utils import default_process
|
||||
from rapidfuzz.distance import ScoreAlignment
|
||||
from typing import Any, Callable, Dict, Hashable, Optional, Sequence, TypeVar
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from rapidfuzz.distance import ScoreAlignment
|
||||
from rapidfuzz.utils import default_process
|
||||
|
||||
class _ScorerAttributes(Protocol):
|
||||
_RF_ScorerPy: Dict
|
||||
|
||||
|
|
|
@ -1,19 +1,7 @@
|
|||
from typing import (
|
||||
Any,
|
||||
Collection,
|
||||
Mapping,
|
||||
Tuple,
|
||||
Callable,
|
||||
Hashable,
|
||||
Sequence,
|
||||
Iterable,
|
||||
Optional,
|
||||
Union,
|
||||
overload,
|
||||
TypeVar,
|
||||
List,
|
||||
Generator,
|
||||
)
|
||||
from typing import (Any, Callable, Collection, Generator, Hashable, Iterable,
|
||||
List, Mapping, Optional, Sequence, Tuple, TypeVar, Union,
|
||||
overload)
|
||||
|
||||
from rapidfuzz.fuzz import WRatio, ratio
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
from rapidfuzz.process_cpp_impl import (
|
||||
FLOAT32 as _FLOAT32,
|
||||
FLOAT64 as _FLOAT64,
|
||||
INT8 as _INT8,
|
||||
INT16 as _INT16,
|
||||
INT32 as _INT32,
|
||||
INT64 as _INT64,
|
||||
UINT8 as _UINT8,
|
||||
UINT16 as _UINT16,
|
||||
UINT32 as _UINT32,
|
||||
UINT64 as _UINT64,
|
||||
cdist as _cdist,
|
||||
extract as extract,
|
||||
extractOne as extractOne,
|
||||
extract_iter as extract_iter,
|
||||
)
|
||||
|
||||
from rapidfuzz.fuzz import ratio as _ratio
|
||||
from rapidfuzz.process_cpp_impl import FLOAT32 as _FLOAT32
|
||||
from rapidfuzz.process_cpp_impl import FLOAT64 as _FLOAT64
|
||||
from rapidfuzz.process_cpp_impl import INT8 as _INT8
|
||||
from rapidfuzz.process_cpp_impl import INT16 as _INT16
|
||||
from rapidfuzz.process_cpp_impl import INT32 as _INT32
|
||||
from rapidfuzz.process_cpp_impl import INT64 as _INT64
|
||||
from rapidfuzz.process_cpp_impl import UINT8 as _UINT8
|
||||
from rapidfuzz.process_cpp_impl import UINT16 as _UINT16
|
||||
from rapidfuzz.process_cpp_impl import UINT32 as _UINT32
|
||||
from rapidfuzz.process_cpp_impl import UINT64 as _UINT64
|
||||
from rapidfuzz.process_cpp_impl import cdist as _cdist
|
||||
from rapidfuzz.process_cpp_impl import extract as extract
|
||||
from rapidfuzz.process_cpp_impl import extract_iter as extract_iter
|
||||
from rapidfuzz.process_cpp_impl import extractOne as extractOne
|
||||
|
||||
|
||||
def _dtype_to_type_num(dtype):
|
||||
|
|
|
@ -1,19 +1,7 @@
|
|||
from typing import (
|
||||
Any,
|
||||
Collection,
|
||||
Mapping,
|
||||
Tuple,
|
||||
Callable,
|
||||
Hashable,
|
||||
Sequence,
|
||||
Iterable,
|
||||
Optional,
|
||||
Union,
|
||||
overload,
|
||||
TypeVar,
|
||||
List,
|
||||
Generator,
|
||||
)
|
||||
from typing import (Any, Callable, Collection, Generator, Hashable, Iterable,
|
||||
List, Mapping, Optional, Sequence, Tuple, TypeVar, Union,
|
||||
overload)
|
||||
|
||||
from rapidfuzz.fuzz import WRatio, ratio
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
|
|
|
@ -1,39 +1,35 @@
|
|||
# distutils: language=c++
|
||||
# cython: language_level=3, binding=True, linetrace=True
|
||||
|
||||
from rapidfuzz.utils import default_process
|
||||
from rapidfuzz.fuzz import WRatio, ratio
|
||||
from rapidfuzz.utils import default_process
|
||||
|
||||
from libcpp cimport bool
|
||||
from libcpp.vector cimport vector
|
||||
from libcpp cimport algorithm
|
||||
from libcpp.utility cimport move
|
||||
from libc.stdint cimport uint8_t, int32_t, uint64_t, int64_t
|
||||
from libc.math cimport floor
|
||||
|
||||
from cpython.list cimport PyList_New, PyList_SET_ITEM
|
||||
from cpython.ref cimport Py_INCREF
|
||||
cimport cython
|
||||
from cpython.exc cimport PyErr_CheckSignals
|
||||
from cpp_common cimport (PyObjectWrapper, RF_KwargsWrapper, RF_StringWrapper,
|
||||
conv_sequence, get_score_cutoff_f64,
|
||||
get_score_cutoff_i64)
|
||||
from cpython cimport Py_buffer
|
||||
from cpython.buffer cimport PyBUF_ND, PyBUF_SIMPLE, PyBUF_F_CONTIGUOUS
|
||||
from cpython.buffer cimport PyBUF_F_CONTIGUOUS, PyBUF_ND, PyBUF_SIMPLE
|
||||
from cpython.exc cimport PyErr_CheckSignals
|
||||
from cpython.list cimport PyList_New, PyList_SET_ITEM
|
||||
from cpython.object cimport PyObject
|
||||
|
||||
from cpp_common cimport (
|
||||
PyObjectWrapper, RF_StringWrapper, RF_KwargsWrapper,
|
||||
conv_sequence, get_score_cutoff_f64, get_score_cutoff_i64
|
||||
)
|
||||
from cpython.ref cimport Py_INCREF
|
||||
from libc.math cimport floor
|
||||
from libc.stdint cimport int32_t, int64_t, uint8_t, uint64_t
|
||||
from libcpp cimport algorithm, bool
|
||||
from libcpp.utility cimport move
|
||||
from libcpp.vector cimport vector
|
||||
|
||||
import heapq
|
||||
from array import array
|
||||
|
||||
from rapidfuzz_capi cimport (
|
||||
RF_Preprocess, RF_Kwargs, RF_String, RF_Scorer, RF_ScorerFunc,
|
||||
RF_Preprocessor, RF_ScorerFlags,
|
||||
RF_SCORER_FLAG_RESULT_F64, RF_SCORER_FLAG_RESULT_I64,
|
||||
RF_SCORER_FLAG_SYMMETRIC
|
||||
)
|
||||
from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
|
||||
from cpython.pycapsule cimport PyCapsule_GetPointer, PyCapsule_IsValid
|
||||
from rapidfuzz_capi cimport (RF_SCORER_FLAG_RESULT_F64,
|
||||
RF_SCORER_FLAG_RESULT_I64,
|
||||
RF_SCORER_FLAG_SYMMETRIC, RF_Kwargs,
|
||||
RF_Preprocess, RF_Preprocessor, RF_Scorer,
|
||||
RF_ScorerFlags, RF_ScorerFunc, RF_String)
|
||||
|
||||
|
||||
cdef extern from "process_cpp.hpp":
|
||||
cdef cppclass ExtractComp:
|
||||
|
@ -1225,6 +1221,7 @@ cdef inline MatrixType dtype_to_type_num_i64(dtype) except MatrixType.UNDEFINED:
|
|||
from cpython cimport Py_buffer
|
||||
from libcpp.vector cimport vector
|
||||
|
||||
|
||||
cdef class Matrix:
|
||||
cdef Py_ssize_t shape[2]
|
||||
cdef Py_ssize_t strides[2]
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.utils import default_process
|
||||
from rapidfuzz.fuzz import WRatio, ratio
|
||||
import heapq
|
||||
|
||||
from rapidfuzz.fuzz import WRatio, ratio
|
||||
from rapidfuzz.utils import default_process
|
||||
|
||||
|
||||
def _get_scorer_flags_py(scorer, kwargs):
|
||||
params = getattr(scorer, "_RF_ScorerPy", None)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2022 Max Bachmann
|
||||
|
||||
from rapidfuzz.distance import Levenshtein, Hamming, Jaro, JaroWinkler
|
||||
import warnings
|
||||
|
||||
from rapidfuzz.distance import Hamming, Jaro, JaroWinkler, Levenshtein
|
||||
|
||||
|
||||
def levenshtein(
|
||||
s1, s2, *, weights=(1, 1, 1), processor=None, max=None, score_cutoff=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Callable, Hashable, Sequence, Optional, TypeVar, Tuple, List
|
||||
from typing import Callable, Hashable, List, Optional, Sequence, Tuple, TypeVar
|
||||
|
||||
_StringType = Sequence[Hashable]
|
||||
_S1 = TypeVar("_S1")
|
||||
|
|
|
@ -3,5 +3,4 @@
|
|||
|
||||
from rapidfuzz._utils import fallback_import as _fallback_import
|
||||
|
||||
|
||||
default_process = _fallback_import("rapidfuzz.utils", "default_process")
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# distutils: language=c++
|
||||
# cython: language_level=3, binding=True, linetrace=True
|
||||
|
||||
from rapidfuzz_capi cimport RF_String, PREPROCESSOR_STRUCT_VERSION, RF_Preprocessor
|
||||
from cpp_common cimport (
|
||||
is_valid_string, convert_string, hash_array, hash_sequence,
|
||||
conv_sequence
|
||||
)
|
||||
|
||||
from cpp_common cimport (conv_sequence, convert_string, hash_array,
|
||||
hash_sequence, is_valid_string)
|
||||
from cpython.pycapsule cimport PyCapsule_New
|
||||
from libcpp cimport bool
|
||||
from rapidfuzz_capi cimport (PREPROCESSOR_STRUCT_VERSION, RF_Preprocessor,
|
||||
RF_String)
|
||||
|
||||
from array import array
|
||||
|
||||
|
||||
cdef extern from "utils_cpp.hpp":
|
||||
object default_process_impl(object) nogil except +
|
||||
void validate_string(object py_str, const char* err) except +
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
|
||||
import pytest
|
||||
|
||||
from rapidfuzz.distance import JaroWinkler_cpp, JaroWinkler_py
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
|
|
@ -4,13 +4,8 @@
|
|||
import unittest
|
||||
|
||||
from rapidfuzz import process
|
||||
from rapidfuzz.distance import (
|
||||
Opcodes,
|
||||
Opcode,
|
||||
Levenshtein_cpp,
|
||||
Levenshtein_py,
|
||||
Levenshtein as _Levenshtein,
|
||||
)
|
||||
from rapidfuzz.distance import Levenshtein as _Levenshtein
|
||||
from rapidfuzz.distance import Levenshtein_cpp, Levenshtein_py, Opcode, Opcodes
|
||||
|
||||
Levenshtein_cpp.distance._RF_ScorerPy = _Levenshtein.distance._RF_ScorerPy
|
||||
Levenshtein_cpp.normalized_distance._RF_ScorerPy = (
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
import unittest
|
||||
|
||||
from rapidfuzz import process
|
||||
from rapidfuzz.distance import (
|
||||
OSA_cpp,
|
||||
OSA_py,
|
||||
OSA as _OSA,
|
||||
)
|
||||
from rapidfuzz.distance import OSA as _OSA
|
||||
from rapidfuzz.distance import OSA_cpp, OSA_py
|
||||
|
||||
OSA_cpp.distance._RF_ScorerPy = _OSA.distance._RF_ScorerPy
|
||||
OSA_cpp.normalized_distance._RF_ScorerPy = (
|
||||
|
|
|
@ -1,22 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
import pytest
|
||||
|
||||
from hypothesis import given, settings
|
||||
import hypothesis.strategies as st
|
||||
|
||||
import random
|
||||
import unittest
|
||||
|
||||
from rapidfuzz.distance import (
|
||||
Levenshtein,
|
||||
Editops,
|
||||
Opcodes,
|
||||
Editop,
|
||||
Opcode,
|
||||
MatchingBlock,
|
||||
)
|
||||
import hypothesis.strategies as st
|
||||
import pytest
|
||||
from hypothesis import given, settings
|
||||
|
||||
from rapidfuzz.distance import (Editop, Editops, Levenshtein, MatchingBlock,
|
||||
Opcode, Opcodes)
|
||||
|
||||
|
||||
def test_editops_comparision():
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
import pytest
|
||||
from array import array
|
||||
|
||||
from rapidfuzz import fuzz_py, fuzz_cpp, utils
|
||||
import pytest
|
||||
|
||||
from rapidfuzz import fuzz_cpp, fuzz_py, utils
|
||||
from rapidfuzz.distance import ScoreAlignment
|
||||
|
||||
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
from itertools import product
|
||||
import random
|
||||
from functools import partial
|
||||
from itertools import product
|
||||
from string import ascii_letters, digits, punctuation
|
||||
|
||||
from hypothesis import given, assume, settings
|
||||
import hypothesis.strategies as st
|
||||
import numpy as np
|
||||
import pytest
|
||||
from hypothesis import assume, given, settings
|
||||
|
||||
from rapidfuzz import fuzz, process, utils
|
||||
from rapidfuzz.distance import (
|
||||
Levenshtein_cpp,
|
||||
Levenshtein_py,
|
||||
Levenshtein as _Levenshtein,
|
||||
Indel_cpp,
|
||||
Indel_py,
|
||||
Indel as _Indel,
|
||||
JaroWinkler_py,
|
||||
JaroWinkler_cpp,
|
||||
)
|
||||
import random
|
||||
import numpy as np
|
||||
from rapidfuzz.distance import Indel as _Indel
|
||||
from rapidfuzz.distance import (Indel_cpp, Indel_py, JaroWinkler_cpp,
|
||||
JaroWinkler_py)
|
||||
from rapidfuzz.distance import Levenshtein as _Levenshtein
|
||||
from rapidfuzz.distance import Levenshtein_cpp, Levenshtein_py
|
||||
|
||||
Levenshtein_cpp.distance._RF_ScorerPy = _Levenshtein.distance._RF_ScorerPy
|
||||
Levenshtein_cpp.normalized_distance._RF_ScorerPy = (
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
|
||||
import pytest
|
||||
|
||||
from rapidfuzz import process_py, process_cpp, fuzz
|
||||
from rapidfuzz import fuzz, process_cpp, process_py
|
||||
|
||||
|
||||
class process:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from rapidfuzz import process, fuzz, utils
|
||||
from rapidfuzz import fuzz, process, utils
|
||||
|
||||
|
||||
class UtilsTest(unittest.TestCase):
|
||||
|
|
Loading…
Reference in New Issue