Typo.js and FuzzySet.js Demo
by skibulk
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/typo.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/fuzzyset.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/umd/string-similarity.min.js"></script>
JavaScript
console.clear();
/*
$.get( 'https://cdn.jsdelivr.net/npm/[email protected]/dictionaries/en_US/en_US.aff', function ( affData ) {
$.get( 'https://cdn.jsdelivr.net/npm/[email protected]/dictionaries/en_US/en_US.dic', function ( wordsData ) {
var dictionary = new Typo( "en_US", affData, wordsData );
console.log(dictionary.check("helllo"));
console.log(dictionary.check("hello"));
});
});
var fuzzy = FuzzySet(["hello", "hollow", "hole", "whole"]);
console.log(fuzzy.get("yellow"));
console.log(fuzzy.get("yule"));
*/
console.log(stringSimilarity.compareTwoStrings('Office', 'often'));