import { wordSimilaritySort } from "https://deno.land/std@0.224.0/text/mod.ts";
Sorts a string-array by similarity to a given string
Examples
Example 1
Example 1
import { wordSimilaritySort } from "https://deno.land/std@0.224.0/text/word_similarity_sort.ts";
const possibleWords = ["length", "size", "blah", "help"];
// case-insensitive by default
const suggestions = wordSimilaritySort("hep", possibleWords).join(", ");
// force case sensitive
wordSimilaritySort("hep", possibleWords, { caseSensitive: true });