You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-14Lines changed: 55 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
3
3

4
4
==========
5
-
Easy to use and powerful fuzzy string matching.
5
+
Easy to use and powerful fuzzy string matching.
6
6
7
7
Mostly a JavaScript port of the [TheFuzz](https://github.com/seatgeek/thefuzz) (formerly fuzzywuzzy) Python library, with some additional features like token similarity sorting and wildcard support.
8
8
9
-
Demo <ahref="https://nol13.github.io/fuzzball.js"target="_blank">here</a> comparing some of the different scorers/options. Auto-generated API Docs <ahref="https://github.com/nol13/fuzzball.js/blob/master/jsdocs/fuzzball.md"target="_blank">here</a>.
9
+
Demo <ahref="https://nol13.github.io/fuzzball.js"target="_blank">here</a> comparing some of the different scorers/options. Auto-generated API Docs <ahref="https://github.com/nol13/fuzzball.js/blob/master/jsdocs/fuzzball.md"target="_blank">here</a>.
10
10
11
11
# Contents
12
12
*[Installation](#installation)
@@ -73,7 +73,7 @@ fuzz.extract("mr. harry hood", choices, options);
73
73
[ 'Mr. Henry Hood', 85, 2 ],
74
74
[ 'Mr. Minor', 40, 1 ] ]
75
75
76
-
/**
76
+
/**
77
77
* Set options.returnObjects = true to get back
78
78
* an array of {choice, score, key} objects instead of tuples
If you set options.trySimple to true it will add the simple ratio to the token_set_ratio test suite as well. This can help smooth out occational irregularities in how much differences in the first letter of a token will get penalized.
135
147
136
-
**Token Similarity Sort Ratio**
148
+
**Token Similarity Sort Ratio**
137
149
138
150
Instead of sorting alphabetically, tokens will be sorted by similarity to the smaller set. Useful if the matching token may have a different first letter, but performs a bit slower. You can also use similarity sorting when calculating token_set_ratio by setting sortBySimilarity to true.
139
151
@@ -200,7 +212,7 @@ fuzz.ratio("this is ä test", "this is a test", options);
200
212
100
201
213
```
202
214
203
-
If your strings contain code points beyond the basic multilingual plane (BMP), set **astral** to true. If your strings contain astral symbols and this is not set, those symbols will be treated as multiple characters and the ratio will be off a bit. (This will have some impact on performance, which is why it is turned off by default.)
215
+
If your strings contain code points beyond the basic multilingual plane (BMP), set **astral** to true. If your strings contain astral symbols and this is not set, those symbols will be treated as multiple characters and the ratio will be off a bit. (This will have some impact on performance, which is why it is turned off by default.)
When astral is true it will also normalize your strings before scoring, as long as String.prototype.normalize exists in your environment, but will not attempt to polyfill. (So if you need to compare unnormalized strings in IE, normalize separately) You can set the **normalize** option to false if you want different representations not to match, but is true by default.
When using extractAsPromised or extractAsync, create a new object with a 'canceled' property to use as a cancel token. For performance, by default only every 256th loop will be async, but set asyncLoopOffset to change. It is most likely not worth changing this.
333
+
When using extractAsPromised or extractAsync, you might want to cancel the action before it has finished.
334
+
It can be done using `CancelToken` or `AbortController`.
335
+
336
+
For performance, by default only every 256th loop will be async, but set `asyncLoopOffset` to change. It is most likely not worth changing this.
337
+
338
+
**AbortController**
339
+
340
+
[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) is present in modern browsers and from node version `15+`. It is currently a standard way how to cancel running operations.
0 commit comments