Ejemplo n.º 1
0
        public void Lookup_CountMatchesExpected_EmptyDictionary(string corpusLocation, string queryLocation, int matchCount0Errors, int matchCount1Errors, int matchCount2Errors, int matchCount3Errors)
        {
            using var dawg = DawgHelper.CreateFromCorpus(corpusLocation);
            var terms = DawgHelper.BuildQuery1K(queryLocation);

            Assert.Equal(matchCount0Errors, ResultTotal(dawg, terms, 0u));
            Assert.Equal(matchCount1Errors, ResultTotal(dawg, terms, 1u));
            Assert.Equal(matchCount2Errors, ResultTotal(dawg, terms, 2u));
            Assert.Equal(matchCount3Errors, ResultTotal(dawg, terms, 3u));
        }
Ejemplo n.º 2
0
        public void Lookup_SingleEdit_IsRejected(string word, string modifiedWord)
        {
            const uint editDistance = 0u;

            using var dawg = DawgHelper.Create(word);

            var lookup = dawg.Lookup(modifiedWord, editDistance).ToList();

            Assert.Empty(lookup);
        }
Ejemplo n.º 3
0
        public void Lookup_SingleSubstitution_IsAccepted(string word, string modifiedWord)
        {
            const uint editDistance = 1u;

            using var dawg = DawgHelper.Create(word);

            var lookup = dawg.Lookup(modifiedWord, editDistance).ToList();

            Assert.Single(lookup);
            Assert.Equal(word, lookup[0].Term);
        }
Ejemplo n.º 4
0
        // TODO: Get the proper definitions for the statement below.
        // This isn't full Damerau-Levensthein, it's the optimal string alignment thing instead.
        public void Lookup_InterruptedTransposition_IsNotAccepted(string word, string modifiedWord)
        {
            // Insertion between the transposed characters plus the transposition itself.
            const uint editDistance = 2u;

            using var dawg = DawgHelper.Create(word);

            var lookup = dawg.Lookup(modifiedWord, editDistance).ToList();

            Assert.Empty(lookup);
        }