fuzzywuzzy 0.1.0
fuzzywuzzy: ^0.1.0 copied to clipboard
An implementation of the popular fuzzywuzzy package in dart
FuzzyWuzzy #
This is a dart port of the popular FuzzyWuzzy python package. This algorithm uses Levenshtein distance to calculate similarity between strings.
I personally needed to use this for my own search algorithms, and there weren't any packages as good as my experience with FuzzyWuzzy was, so here we are. Enjoy!
- No dependencies.
- Pure Dart implementation of the superfast python-Levenshtein.
- Simple to use.
- Lightweight.
- Massive props to the folks over at seatgeek for coming up with the algorithm.
Get started #
Add dependency #
dependencies:
fuzzywuzzy: 0.1.0 # latest version
Usage #
First, import the package
import 'package:fuzzywuzzy/fuzzywuzzy.dart'
Simple ratio #
ratio("mysmilarstring", "myawfullysimilarstirng") // 72
ratio("mysmilarstring", "mysimilarstring") // 97
Partial ratio #
partialRatio("similar", "somewhresimlrbetweenthisstring") // 71
Token sort ratio #
tokenSortPartialRatio("order words out of", "words out of order") // 100
tokenSortRatio("order words out of"," words out of order") // 100
Token set ratio #
tokenSetRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear") // 100
tokenSetPartialRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear") // 100
Weighted ratio #
weightedRatio("The quick brown fox jimps ofver the small lazy dog", "the quick brown fox jumps over the small lazy dog") // 97