UNPKG

fuzzystringmatch

Version:

a small library that creates a in-memory index for a fast and fuzzy lookup of search terms

17 lines (14 loc) 553 B
var fuzzyStringmatch = require('../') var digester = new fuzzyStringmatch.Digester var matcher = new fuzzyStringmatch.Matcher(digester) digester.feed('United States of America') digester.feed(new fuzzyStringmatch.Subject('United Kingdom of Great Britain')) digester.feed('Germany') digester.feed('France') digester.feed('Japan') matcher .match('grmany') .forEach((resultEntry) => { var subject = resultEntry.getSubject() console.log(`${subject.getTerm()}, Matchscore: ${resultEntry.getMatchRelation()}`) })