-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(readme): add a readme detailing usage
Signed-off-by: SphericalKat <[email protected]>
- Loading branch information
1 parent
6c2feab
commit 5f19d9a
Showing
5 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# FuzzyWuzzy | ||
|
||
This is a dart port of the popular [FuzzyWuzzy](https://github.com/seatgeek/fuzzywuzzy) python package. This algorithm uses [Levenshtein distance](https://en.wikipedia.org/wiki/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](https://github.com/ztane/python-Levenshtein/). | ||
- Simple to use. | ||
- Lightweight. | ||
- Massive props to the folks over at seatgeek for coming up with the [algorithm](http://chairnerd.seatgeek.com/fuzzywuzzy-fuzzy-string-matching-in-python/). | ||
|
||
## Get started | ||
|
||
### Add dependency | ||
|
||
```yaml | ||
dependencies: | ||
fuzzywuzzy: 0.1.0 # latest version | ||
``` | ||
## Usage | ||
First, import the package | ||
```dart | ||
import 'package:fuzzywuzzy/fuzzywuzzy.dart' | ||
``` | ||
|
||
|
||
### Simple ratio | ||
```dart | ||
ratio("mysmilarstring", "myawfullysimilarstirng") // 72 | ||
ratio("mysmilarstring", "mysimilarstring") // 97 | ||
``` | ||
|
||
### Partial ratio | ||
```dart | ||
partialRatio("similar", "somewhresimlrbetweenthisstring") // 71 | ||
``` | ||
|
||
### Token sort ratio | ||
```dart | ||
tokenSortPartialRatio("order words out of", "words out of order") // 100 | ||
tokenSortRatio("order words out of"," words out of order") // 100 | ||
``` | ||
|
||
### Token set ratio | ||
```dart | ||
tokenSetRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear") // 100 | ||
tokenSetPartialRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear") // 100 | ||
``` | ||
|
||
### Weighted ratio | ||
```dart | ||
weightedRatio("The quick brown fox jimps ofver the small lazy dog", "the quick brown fox jumps over the small lazy dog") // 97 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters