wyndow / fuzzywuzzy Goto Github PK
View Code? Open in Web Editor NEWFuzzy string matching for PHP
Fuzzy string matching for PHP
Hi,
great library but I notice difference compared to the python library. I also use it in nodjs and the result there are same as the python library but this is not the case in PHP.
This is the example result using python library
choices = ["ACOB751", "ACAB5861"]
process.extract("ACO8751", choices, scorer=fuzz.partial_ratio)
[('ACOB751', 86), ('ACAB5861', 53)]
And same example in PHP
$choices = ["ACOB751", "ACAB5861"];
$this->fuzzProcess->extract(
$choices,
"ACO8751",
null,
[$this->fuzz, 'partialRatio']
);
Collection {#1081
-elements: array:2 [
0 => array:2 [
0 => "ACOB751"
1 => 42
]
1 => array:2 [
0 => "ACAB5861"
1 => 30
]
]
}
Any advice? Thanks.
Can you please provide a simple usage example? The one you provided is for python I guess. I'm not getting any output on my screen.
Thanks.
Hi,Thanks for this wonderful library. I am using token_set_ratio for my task. If there is a match beyond a threshold, I want to get the matching tokens also. Is there a way to get the matching tokens list from token_set_ratio?
Some documentation and up to date library (like the original one) would be greatly appreciated
Use FuzzyWuzzy
as the root namespace to more closely match the original library
I would like to pass the unicode text to scorer, but no success.
May I know how to do it in "$process->extract"?
Thanks.
Deployed fuzzywuzzy in my php code, but matches loading sort of slow. Short string approx 2s longer takes 6s and more
What trick I can use to speed it up? Resources are pretty fat.. mysql dbase with plenty of mem
$stringA = 'Alpin 4 Grnx';
$stringB = 'AGILIS+ GRNX';
$fuzzy = FuzzyWuzzy::getFuzzy();
echo $fuzzy->tokenSortRatio($stringA, $stringB) . "\n"; // 69
echo $fuzzy->tokenSortRatio($stringB, $stringA) . "\n"; // 60
I don't presume this is the intended behaviour, as when testing this with the javascript port of the original python library, the results on tokenSort-ing are the same.
In PHP 8.2.8 I'm getting the following error:
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of FuzzyWuzzy\Collection::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/config/bootstrap.php:25
Stack trace:
#0 /var/www/html/vendor/wyndow/fuzzywuzzy/lib/Collection.php(10): {closure}()
#1 /var/www/html/vendor/composer/ClassLoader.php(576): include('...')
#2 /var/www/html/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}()
#3 /var/www/html/vendor/wyndow/fuzzywuzzy/lib/StringProcessor.php(56): Composer\Autoload\ClassLoader->loadClass()
#4 /var/www/html/vendor/wyndow/fuzzywuzzy/lib/Fuzz.php(272): FuzzyWuzzy\StringProcessor::split()
#5 /var/www/html/vendor/wyndow/fuzzywuzzy/lib/Fuzz.php(255): FuzzyWuzzy\Fuzz->processAndSort()
#6 /var/www/html/vendor/wyndow/fuzzywuzzy/lib/Fuzz.php(180): FuzzyWuzzy\Fuzz->tokenSort()
#7 /var/www/html/src/Library/FullTitleMatcher.php(98): FuzzyWuzzy\Fuzz->tokenSortRatio()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.