With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js. Learn more →
Top 3 JavaScript fuzzy-matching Projects
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
Project mention: Show HN: A fast, accurate and multilingual fuzzy search lib for the front end | news.ycombinator.com | 2024-02-14Thank you. We need more libs like that. I just researched the field yesterday and https://github.com/leeoniya/uFuzzy looked pretty good. But there is a gap in the market of such libs. Just few allow to send the whole html document, serialize and deserialize index to be used in browser, highlighting the matches is desired feature.
Most importantly very few fuzzy search libs can get a simple substring match as a priority, which is understandable but not helpful. Imagine searching for “xample” and not having “example” among the results.
import { ratio, } from 'fuzzball'; import { SequenceMatcher } from 'difflib'; // modified from: https://github.com/nol13/fuzzball.js/blob/773b82991f2bcacc950b413615802aa953193423/fuzzball.js#L942 function partial_ratio(str1: string, str2: string) { if (str1.length <= str2.length) { var shorter = str1 var longer = str2 } else { var shorter = str2 var longer = str1 } var m = new SequenceMatcher(null, shorter, longer); var blocks = m.getMatchingBlocks(); let bestScore: number = 0; let bestMatch: string | null = null let bestStartIdx: number = -1 for (var b = 0; b < blocks.length; b++) { var long_start = (blocks[b][1] - blocks[b][0]) > 0 ? (blocks[b][1] - blocks[b][0]) : 0; var long_end = long_start + shorter.length; var long_substr = longer.substring(long_start,long_end); var r = ratio(shorter,long_substr); if (r > bestScore) { bestScore = r; bestMatch = long_substr; bestStartIdx = long_start; } if (r > 99.5) { break; } } return { bestMatch, bestScore, bestStartIdx, } }
JavaScript fuzzy-matching related posts
- Unlocking Advanced RAG: Citations and Attributions
- Sotd.fun is live
- uFuzzy 1.0 - A tiny, efficient fuzzy search that doesn't suck
- uFuzzy.js – A tiny, efficient fuzzy search that doesn't suck
- Show HN: uFuzzy.js – A tiny, efficient fuzzy search that doesn't suck
- Show HN: uFuzzy.js – A tiny, efficient fuzzy search that doesn't suck
- Show HN: uFuzzy.js – A tiny, efficient fuzzy search that doesn't suck
-
A note from our sponsor - SurveyJS
surveyjs.io | 26 Apr 2024
Index
What are some of the best open-source fuzzy-matching projects in JavaScript? This list will help you:
Project | Stars | |
---|---|---|
1 | uFuzzy | 2,498 |
2 | fuzzball.js | 502 |
3 | ZLOOKUP | 25 |
Sponsored