Closed Lakhankumawat closed 1 year ago
No Updates ?
:eyes:
Same error here. I have around 300 000 choices. The issue goes away with a shorter choices list.
Hello @Lakhankumawat @vjamrich, sorry for the inactivity. Could either of you send me a sample list that can reproduce the problem? Thanks.
I'm seeing this:
Error thrown by handler. RangeError (index): Invalid value: Not in inclusive range 0..214: 216 dart:core List.[] DiffUtils.levEditDistance package:fuzzywuzzy/diffutils/diff_utils.dart:600 DiffUtils.getRatio package:fuzzywuzzy/diffutils/diff_utils.dart:732 SimpleRatio.apply package:fuzzywuzzy/ratios/simple_ratio.dart:7 ratio package:fuzzywuzzy/fuzzywuzzy.dart:14 WeightedRatio.apply package:fuzzywuzzy/algorithms/weighted_ratio.dart:26 Extractor.extractWithoutOrder package:fuzzywuzzy/extractor.dart:27 Extractor.extractSorted package:fuzzywuzzy/extractor.dart:53 extractAllSorted
Hi ! I have the same error being thrown when I give a string with an emoji in it, could it be related ?
Hi ! I have the same error being thrown when I give a string with an emoji in it, could it be related ?
To expand on this, my dataset included chinese characters (UTF-8 encoding). Although taking a random subset of the dataset did not trigger the error - therefore I thought this might have been unrelated.
The dataset used consisted of the following dictionary - https://www.mdbg.net/chinese/dictionary?page=cedict
Hi ! I have the same error being thrown when I give a string with an emoji in it, could it be related ?
Could you post your dataset if that's possible? If not; could you try removing any non-ascii characters from the dataset and see if it doesn't crash?
Hi ! I have the same error being thrown when I give a string with an emoji in it, could it be related ?
To expand on this, my dataset included chinese characters (UTF-8 encoding). Although taking a random subset of the dataset did not trigger the error - therefore I thought this might have been unrelated.
The dataset used consisted of the following dictionary - https://www.mdbg.net/chinese/dictionary?page=cedict
Thank you, I'll take a look with this.
I don't have a dataset to give, as it's straight up test from a textfield : any emoji can make a crash, just removing it fix it. I haven't tested chinese character, but japanese (and their chinese characters) seems to be fine on my side (it is just considered as a character, fuzziness still works fine).
I encounter same issue with this code
ratio("🌙 love song", "love")
Same here. It's a unicode problem maybe?
Hello, I fixed the code.
Go to diff_utils.dart find levEditDistance() function.
Add int maxRange = 1114111;
at the top of the function.
find these codes
var c1 = s1.runes.toList();
var c2 = s2.runes.toList();
replace it with this
var c1 = s1.codeUnits.toList();
var c2 = s2.codeUnits.toList();
This will work.
When does @SphericalKat will merge this fix?
As some you already stated, the issue is related with the special characters handling (emojis in my case).
As an easy temporary fix, you can use a regex to delete all non ASCII chars within the choice getter:
extractAllSorted<SearchResultItem>(
query: query,
choices: options,
cutoff: 65,
getter: (x) => x.name.replaceAll(RegExp(r'[^\x00-\x7F]'), ''),
);
I can confirm that this is still a problem. @SphericalKat can you merge @seceba's suggestion?
I created a PR with the changes suggested by @seceba and it works. Until it's merged you can use it by making this change in your pubspec.yaml.
fuzzywuzzy:
# Use a fork where non ascii characters are handled.
git:
url: https://github.com/Kal-Elx/dart-fuzzywuzzy.git
ref: fc70dd42f1d526ec3634af81598991173e272e09
I faced the same issue and can confirm the PR fixes it. Thank you very much @Kal-Elx
I can also confirm, the PR also fixed the issue on my side!
Thanks for the fix @Kal-Elx This has been released to pub.dev!
Error 🙄
My FuzzyWuzzy Implementation
I am currently using fuzzy search inside Search Delegate flutter , but i don't think issue is through that as you'll see;
Suggestions (choice list)
Sugesstions are my choices and its a large list :
Remarks
Additional context
• No issues found!
F:\Fluttter Apps\customer>flutter doctor -v [√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.19043.1151], locale en-US) • Flutter version 2.5.0 at D:\src\flutter\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 4cc385b4b8 (13 days ago), 2021-09-07 23:01:49 -0700 • Engine revision f0826da7ef • Dart version 2.14.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at C:\Users\LAKHN KUMAWAT\AppData\Local\Android\sdk • Platform android-31, build-tools 31.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.
[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] VS Code (version 1.60.1) • VS Code at C:\Users\LAKHN KUMAWAT\AppData\Local\Programs\Microsoft VS Code • Flutter extension can be installed from: https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available) • RMX1851 (mobile) • 4e5981a2 • android-arm64 • Android 11 (API 30) • Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82 • Edge (web) • edge • web-javascript • Microsoft Edge 93.0.961.47
• No issues found!
F:\flutter_ecommerce_app>flutter --version Flutter 2.5.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision 4cc385b4b8 (9 days ago) • 2021-09-07 23:01:49 -0700 Engine • revision f0826da7ef Tools • Dart 2.14.0