Advertise here

fuzzyset.js – Fuzzy String Set for JavaScript

July 09, 2018     314     Text & String
fuzzyset.js – Fuzzy String Set for JavaScript

fuzzyset.js is a data structure that performs something akin to fulltext search against data to determine likely mispellings and approximate string matching. 

Usage

The usage is simple. Just add a string to the set, and ask for it later by using .get:

a = FuzzySet();a.add("michael axiak");
a.get("micael asiak");
[[0.8461538461538461, 'michael axiak']];

The result will be an array of [score, matched_value] arrays. The score is between 0 and 1, with 1 being a perfect match

 

Methods
  • get(value, [default], [minScore=.33]): try to match a string to entries with a score of at least minScore (defaulted to .33), otherwise return null or default if it is given.
  • add(value): add a value to the set returning false if it is already in the set.
  • length(): return the number of items in the set.
  • isEmpty(): returns true if the set is empty.
  • values(): returns an array of the values in the set.

 

Related Plugins

Latest Plugins


Subscribe to Newsletter

Subscribe to email newsletter for latest jQuery plugins & tutorials.



AdvertisementAdvertise with us!