private static void AddMisspellingsTo(IDictionary<Tuple<string, string>, int> missIndex, LevensteinInfo info) { var misspelling = info.GetMisspelling(); if (!missIndex.ContainsKey(misspelling)) missIndex[misspelling] = 0; missIndex[misspelling]++; }
public void TestGettingMisspellings(string s1, string s2, string c1, string c2) { var levensteinInfo = new LevensteinInfo(s1, s2); var misspelling = levensteinInfo.GetMisspelling(); Assert.AreEqual(misspelling.Item1, c1); Assert.AreEqual(misspelling.Item2, c2); }
private void AddMisspellingsWords(LevensteinInfo info) { var misspelling = info.GetMisspelling(); if (!misspellingsToWords.ContainsKey(misspelling)) misspellingsToWords[misspelling] = new List<Tuple<string, string>>(); misspellingsToWords[misspelling].Add(Tuple.Create(info.GetDictionaryWord(), info.GetWord())); }
public void TestLevenstein(string s1, string s2, int answer) { var levensteinInfo = new LevensteinInfo(s1, s2); Assert.AreEqual(answer, levensteinInfo.GetDistance()); }