### ExtractTop usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Extract the top N matches using FuzzySearch.extractTop. The example returns the top 3 matches for 'goolge'.
```groovy
FuzzySearch.extractTop("goolge", ["google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl"], 3)
[(string: google, score: 83, index: 0), (string: googleplus, score: 63, index:5), (string: plexoogl, score: 43, index: 7)]
```
--------------------------------
### Token Set Ratio usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Calculate token set full and partial ratios using FuzzySearch.tokenSetRatio and FuzzySearch.tokenSetPartialRatio. Both examples return 100.
```groovy
FuzzySearch.tokenSetRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear")
100
FuzzySearch.tokenSetPartialRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear")
100
```
--------------------------------
### Partial Ratio usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Calculate the partial ratio between two strings using FuzzySearch.partialRatio. The example shows a score of 71.
```groovy
FuzzySearch.partialRatio("similar", "somewhresimlrbetweenthisstring")
71
```
--------------------------------
### ExtractAll usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Extract all matches using FuzzySearch.extractAll. The first example shows all matches, the second shows a score cutoff of 40.
```groovy
FuzzySearch.extractAll("goolge", ["google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl"]);
[(string: google, score: 83, index: 0), (string: bing, score: 20, index: 1), (string: facebook, score: 29, index: 2), (string: linkedin, score: 29, index: 3), (string: twitter, score: 15, index: 4), (string: googleplus, score: 63, index: 5), (string: bingnews, score: 29, index: 6), (string: plexoogl, score: 43, index: 7)]
// score cutoff
FuzzySearch.extractAll("goolge", ["google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl"], 40)
[(string: google, score: 83, index: 0), (string: googleplus, score: 63, index: 5), (string: plexoogl, score: 43, index: 7)]
```
--------------------------------
### Weighted Ratio usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Calculate the weighted ratio using FuzzySearch.weightedRatio. The example shows a score of 97.
```groovy
FuzzySearch.weightedRatio("The quick brown fox jimps ofver the small lazy dog", "the quick brown fox jumps over the small lazy dog")
97
```
--------------------------------
### Token Sort Ratio usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Calculate token sort partial and full ratios using FuzzySearch.tokenSortPartialRatio and FuzzySearch.tokenSortRatio. Both examples return 100.
```groovy
FuzzySearch.tokenSortPartialRatio("order words out of"," words out of order")
100
FuzzySearch.tokenSortRatio("order words out of"," words out of order")
100
```
--------------------------------
### ExtractOne usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Extract the best matching string from a list using FuzzySearch.extractOne. The example returns Dallas Cowboys with a score of 90.
```groovy
// groovy
FuzzySearch.extractOne("cowboys", ["Atlanta Falcons", "New York Jets", "New York Giants", "Dallas Cowboys"])
(string: Dallas Cowboys, score: 90, index: 3)
```
--------------------------------
### Simple Ratio usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Calculate the simple ratio between two strings using FuzzySearch.ratio. The examples show scores of 72 and 97 for different string pairs.
```groovy
FuzzySearch.ratio("mysmilarstring","myawfullysimilarstirng")
72
FuzzySearch.ratio("mysmilarstring","mysimilarstring")
97
```
--------------------------------
### ExtractSorted usage
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Extract matches sorted by score using FuzzySearch.extractSorted. The first example shows all matches sorted, the second shows a score cutoff of 3.
```groovy
FuzzySearch.extractSorted("goolge", ["google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl"]);
[(string: google, score: 83, index: 0), (string: googleplus, score: 63, index: 5), (string: plexoogl, score: 43, index: 7), (string: facebook, score: 29, index: 2), (string: linkedin, score: 29, index: 3), (string: bingnews, score: 29, index: 6), (string: bing, score: 20, index: 1), (string: twitter, score: 15, index: 4)]
// score cutoff
FuzzySearch.extractSorted("goolge", ["google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl"], 3);
[(string: google, score: 83, index: 0), (string: googleplus, score: 63, index: 5), (string: plexoogl, score: 43, index: 7)]
```
--------------------------------
### Gradle dependency for fuzzywuzzy
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Add the fuzzywuzzy library to your Gradle project. Replace VERSION with the latest release version.
```gradle
repositories {
mavenCentral()
}
dependencies {
implementation 'me.xdrop:fuzzywuzzy:VERSION'
}
```
--------------------------------
### Maven dependency for fuzzywuzzy
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Add the fuzzywuzzy library to your Maven project. Replace VERSION with the latest release version.
```xml
me.xdrop
fuzzywuzzy
VERSION
```
--------------------------------
### Extract using any object
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Use extractOne with a collection of custom objects and a function to convert them to strings. The result is a BoundExtractedResult that can be used to retrieve the original object.
```java
List foo = ...;
BoundExtractedResult match = FuzzySearch.extractOne("cowboys", foo, x -> x.toString());
Foo matchFoo = match.getReferent();
```
--------------------------------
### JPMS module declaration for fuzzywuzzy
Source: https://github.com/xdrop/fuzzywuzzy/blob/master/README.md
Required for Java 9+ projects using the Java Platform Module System. Add these declarations to your module-info.java file.
```java
module my.modulename.here {
requires java.base;
requires me.xdrop.fuzzywuzzy;
}
```