apply method
Apply the ratio calculation to sorted tokens
Implementation
double apply(
String s1,
String s2,
Applicable ratio, {
double scoreCutoff = 0.0,
}) {
// Handle edge cases according to RapidFuzz implementation
if (scoreCutoff > 100) return 0.0;
if (s1.isEmpty || s2.isEmpty) {
// RapidFuzz returns 0 when either string is empty
return 0.0;
}
var sorted1 = _sort(s1);
var sorted2 = _sort(s2);
return ratio.apply(sorted1, sorted2, scoreCutoff: scoreCutoff);
}