Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void TestLevenstein(string s1, string s2, int answer)
        {
            var levensteinInfo = new LevensteinInfo(s1, s2);

            Assert.AreEqual(answer, levensteinInfo.GetDistance());
        }
Ejemplo n.º 3
0
        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]++;
        }