Exemple #1
0
        public async Task FuzzyRecognizer_Null_Choices_Exception()
        {
            var fuzzyRecognizer = new FuzzyRecognizer(new FuzzyRecognizerOptions()
            {
                IgnoreCase = false
            });

            var result = await fuzzyRecognizer.Recognize(null, "Gary Pretty");
        }
Exemple #2
0
        public async Task FuzzyRecognizer_Empty_Choices_List_Returns_Empty_Result()
        {
            var fuzzyRecognizer = new FuzzyRecognizer(new FuzzyRecognizerOptions()
            {
                IgnoreCase = false
            });

            var result = await fuzzyRecognizer.Recognize(new List <string>(), "Gary Pretty");

            Assert.IsTrue(result.Matches.Count == 0);
        }
Exemple #3
0
        public async Task FuzzyRecognizer_Null_Utterance_Exception()
        {
            var choices = new List <string>()
            {
                "GARY PRETTY",
                "Gary Pretty"
            };

            var fuzzyRecognizer = new FuzzyRecognizer(new FuzzyRecognizerOptions()
            {
                IgnoreCase = false
            });

            var result = await fuzzyRecognizer.Recognize(choices, null);
        }
Exemple #4
0
        public async Task FuzzyRecognizer_TestIgnoreNonAlphanumeric_False()
        {
            var choices = new List <string>()
            {
                "Ti^na Hende*rson",
                "N&i$co^le Wa*ker",
            };

            var fuzzyRecognizer = new FuzzyRecognizer(new FuzzyRecognizerOptions()
            {
                IgnoreNonAlphanumeric = false,
            });

            var result = await fuzzyRecognizer.Recognize(choices, "Nicole Waker");

            Assert.IsNotNull(result, "Recognizer result should not be null");
            Assert.AreEqual(result.Matches.First().Score, 0.75, "Incorrect number of matches");
        }
Exemple #5
0
        public async Task FuzzyRecognizer_TestIgnoreCase_True()
        {
            var choices = new List <string>()
            {
                "GARY PRETTY",
                "Gary Pretty"
            };

            var fuzzyRecognizer = new FuzzyRecognizer(new FuzzyRecognizerOptions()
            {
                IgnoreCase = true
            });

            var result = await fuzzyRecognizer.Recognize(choices, "Gary Pretty");

            Assert.IsNotNull(result, "Recognizer result should not be null");
            Assert.AreEqual(result.Matches.Count, 2, "Incorrect number of matches");
            Assert.AreEqual(result.Matches.Count(m => m.Score == 1), 2);
        }
Exemple #6
0
        public async Task FuzzyRecognizer_TestScores_DefaultOptions()
        {
            var choices = new List <string>()
            {
                "Phil Coulson",
                "Peggy Carter",
                "Gary Pretty",
                "Peter Parker",
                "Tony Stark",
                "Bruce Banner",
                "Garry Pritti"
            };

            var fuzzyRecognizer = new FuzzyRecognizer();

            var result = await fuzzyRecognizer.Recognize(choices, "Gary Prety");

            Assert.IsNotNull(result, "Recognizer result should not be null");
            Assert.IsTrue(result.Matches.First().Choice == "Gary Pretty");
            Assert.AreEqual(result.Matches.Count, 2, "Incorrect number of matches");
        }