fuzzball.js
wild-wild-utils
fuzzball.js | wild-wild-utils | |
---|---|---|
2 | 1 | |
502 | 33 | |
- | - | |
4.1 | 7.2 | |
9 days ago | 9 days ago | |
JavaScript | JavaScript | |
GNU General Public License v3.0 only | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
fuzzball.js
-
Unlocking Advanced RAG: Citations and Attributions
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, } }
-
I'm thinking of making a search tool to find Dunkey quotes. Here is a very early prototype. More details in comment.
I’ve been using the fuzzball package for the search algorithm in my current project. It might be able to help with matching non-exact strings
wild-wild-utils
-
Wild Wild Path - Object property paths with wildcards and regexps
I also tried to keep it simple with only few primitives, unlike projects like JMESPath or [jq](https://github.com/stedolan/jq), hoping for higher-level libraries to be built on top of it (for example, I added a few functional utilities on top of it [as a separate package](https://github.com/ehmicky/wild-wild-utils)).
What are some alternatives?
ZLOOKUP - Google Sheet Fuzzy String Matching Function
declarative-merge - Merge objects/arrays declaratively
js-levenshtein - The most efficient JS implementation calculating the Levenshtein distance, i.e. the difference between two strings.
re2js - RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
wildflower - Efficient wildcard matching against strings
dot-prop - Get, set, or delete a property from a nested object using a dot path
jq - Command-line JSON processor [Moved to: https://github.com/jqlang/jq]
wild-wild-path - 🤠Object property paths with wildcards and regexps 🌵
emoji-regex - A regular expression to match all Emoji-only symbols as per the Unicode Standard.
get-value - Use property paths (`a.b.c`) get a nested value from an object.
jsonpath - JsonPath engine written in Rust. Webassembly and Javascript support too
get-holidays-parse