public void DistanceThisThat() { var compare = new Levenshtein(); var far = compare.LD("this", "that"); var close = compare.LD("this", "thiz"); Assert.True(far > close); }
private String[] RankSimilarWords(Dictionary <String, int> results, string originalWord) { var de = new Levenshtein(); var correctionWords = results.OrderByDescending(r => r.Value).Select(r => r.Key).TrimIfOverlyLong(10); return(correctionWords.OrderBy(w => de.LD(w, originalWord)).ToArray()); }
public void DistanceThisAuthorize() { var compare = new Levenshtein(); var far = compare.LD("thiz", "authorize"); var close = compare.LD("thiz", "this"); Assert.True(far > close); }
private String[] RankSimilarWords(Dictionary<String, int> results, string originalWord) { var de = new Levenshtein(); var correctionWords = results.OrderByDescending(r => r.Value).Select(r => r.Key); return correctionWords.OrderBy(w => de.LD(w, originalWord)).TrimIfOverlyLong(10).ToArray(); }