コード例 #1
0
        public void SoundexIndexTest()
        {
            IDocumentCorpus corpus     = DirectoryCorpus.LoadTextDirectory(directory);
            DiskSoundEx     soundIndex = new DiskSoundEx("./");

            soundIndex.BuildSoundexIndex(corpus);
            soundIndex.GetCount().Should().Be(5);
            soundIndex.Clear();
        }
コード例 #2
0
        public void GetPostingsTest_MultipleNames()
        {
            //Arrange
            IDocumentCorpus corpus      = DirectoryCorpus.LoadTextDirectory(directory);
            DiskSoundEx     authorIndex = new DiskSoundEx("./");

            authorIndex.BuildSoundexIndex(corpus);
            //Act
            var actual = authorIndex.GetPostings("yashua ovando");

            //Assert
            actual.Should().HaveCount(2);
            authorIndex.Clear();
        }
コード例 #3
0
        public void GetPostingsTest_NotExistingName_ReturnsEmpty()
        {
            //Arrange
            IDocumentCorpus corpus      = DirectoryCorpus.LoadTextDirectory(directory);
            DiskSoundEx     authorIndex = new DiskSoundEx("./");

            authorIndex.BuildSoundexIndex(corpus);
            //Act
            var actual = authorIndex.GetPostings("hella");

            //Assert
            actual.Should().BeEmpty();
            authorIndex.Clear();
        }
コード例 #4
0
        public void GetPostingsTest_SimilarSoundingName()
        {
            //Arrange
            IDocumentCorpus corpus      = DirectoryCorpus.LoadTextDirectory(directory);
            DiskSoundEx     authorIndex = new DiskSoundEx("./");

            authorIndex.BuildSoundexIndex(corpus);
            //Act
            var result1 = authorIndex.GetPostings("bloclic");
            var result2 = authorIndex.GetPostings("blacklock");

            //Assert
            result1.Should().BeEquivalentTo(result2);
            authorIndex.Clear();
        }