Merge pull request #377 from maxbachmann-forks/master
use rapidfuzz instead of fuzzywuzzypull/1/head
commit
457085a115
|
@ -1,7 +1,7 @@
|
||||||
os: linux
|
os: linux
|
||||||
language: python
|
language: python
|
||||||
cache: pip
|
cache: pip
|
||||||
dist: xenial
|
dist: bionic
|
||||||
python:
|
python:
|
||||||
- "3.5"
|
- "3.5"
|
||||||
- "3.6"
|
- "3.6"
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -61,6 +61,6 @@ setup(
|
||||||
},
|
},
|
||||||
extras_require={
|
extras_require={
|
||||||
'taxii': ['taxii2-client'],
|
'taxii': ['taxii2-client'],
|
||||||
'semantic': ['haversine', 'fuzzywuzzy'],
|
'semantic': ['haversine', 'rapidfuzz'],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -364,8 +364,8 @@ def partial_string_based(str1, str2):
|
||||||
float: Number between 0.0 and 1.0 depending on match criteria.
|
float: Number between 0.0 and 1.0 depending on match criteria.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from fuzzywuzzy import fuzz
|
from rapidfuzz import fuzz
|
||||||
result = fuzz.token_sort_ratio(str1, str2, force_ascii=False)
|
result = round(fuzz.token_sort_ratio(str1, str2))
|
||||||
logger.debug("--\t\tpartial_string_based '%s' '%s'\tresult: '%s'", str1, str2, result)
|
logger.debug("--\t\tpartial_string_based '%s' '%s'\tresult: '%s'", str1, str2, result)
|
||||||
return result / 100.0
|
return result / 100.0
|
||||||
|
|
||||||
|
|
3
tox.ini
3
tox.ini
|
@ -9,9 +9,8 @@ deps =
|
||||||
pytest-cov
|
pytest-cov
|
||||||
coverage
|
coverage
|
||||||
taxii2-client
|
taxii2-client
|
||||||
fuzzywuzzy
|
rapidfuzz
|
||||||
haversine
|
haversine
|
||||||
python-Levenshtein
|
|
||||||
medallion
|
medallion
|
||||||
commands =
|
commands =
|
||||||
python -m pytest --cov=stix2 stix2/test/ --cov-report term-missing -W ignore::stix2.exceptions.STIXDeprecationWarning
|
python -m pytest --cov=stix2 stix2/test/ --cov-report term-missing -W ignore::stix2.exceptions.STIXDeprecationWarning
|
||||||
|
|
Loading…
Reference in New Issue