public void LevenstainMethodForEqualStrings()
        {
            var string1 = "system under test";
            var string2 = string1;

            Assert.True(LevenstainDistance.CalculateSimilarity(string1, string2) == 1);
        }
Exemplo n.º 2
0
        private void compute_Click(object sender, EventArgs e)
        {
            var string1 = string1txtBox.Text.ToString();
            var string2 = string2txtBox.Text.ToString();

            var levenstainResult = LevenstainDistance.CalculateSimilarity(string1, string2);

            var jaroWinklerResult = JaroWinclerDistance.GetDistance(string1, string2);

            var triGramResult = NGramsComparision.CompareStringsWithTriGram(string1, string2);

            var diceResult = DiceCoefficient.DiceCoefficientCount(string1, string2);

            levenstainTxtBox.Text  = (Math.Round(levenstainResult, 2) * 100).ToString();
            levenstainTxtBox.Text += '%';

            jaroWinklerTxtBox.Text  = (Math.Round(jaroWinklerResult, 2) * 100).ToString();
            jaroWinklerTxtBox.Text += '%';

            nGramTxtBox.Text  = (Math.Round(triGramResult, 2) * 100).ToString();
            nGramTxtBox.Text += '%';

            diceCoefficientTxtBox.Text  = (Math.Round(diceResult, 2) * 100).ToString();
            diceCoefficientTxtBox.Text += '%';
        }
        public void LevenstainMethodForVariousStrings(string source, string target)
        {
            var result = LevenstainDistance.CalculateSimilarity(source, target);

            Assert.True(result < 1 && result > 0);
        }