Exemplo n.º 1
0
        public void RetrievesAllDocuments()
        {
            var documentsProvider = new DocumentsProvider(new NullStemmer());
            var documents = documentsProvider.Read(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"res\Documents.txt")).ToList();

            Assert.That(documents.Count, Is.EqualTo(3));
        }
Exemplo n.º 2
0
        public void WordsTakesIntoAccountTitleAsWell()
        {
            var documentsProvider = new DocumentsProvider(new NullStemmer());
            var documents = documentsProvider.Read(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"res\Documents.txt")).ToList();

            CollectionAssert.Contains(documents[0].Words, "title");
            CollectionAssert.Contains(documents[0].Words, "content");
        }
Exemplo n.º 3
0
        public void SetsUpProperTitlesOfDocuments()
        {
            var documentsProvider = new DocumentsProvider(new NullStemmer());
            var documents = documentsProvider.Read(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"res\Documents.txt")).ToList();

            Assert.That(documents[0].Title, Is.EqualTo("This is a title"));
            Assert.That(documents[1].Title, Is.EqualTo("This is second document"));
            Assert.That(documents[2].Title, Is.EqualTo("This is document without content"));
        }
Exemplo n.º 4
0
        public void SetsUpProperContent()
        {
            var documentsProvider = new DocumentsProvider(new NullStemmer());
            var documents = documentsProvider.Read(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"res\Documents.txt")).ToList();

            Assert.That(documents[0].Content, Is.EqualTo("This is content of the document"));
            Assert.That(documents[1].Content, Is.EqualTo("Short Content"));
            Assert.That(documents[2].Content, Is.EqualTo(string.Empty));
        }
Exemplo n.º 5
0
        private void InitializeSearcherWithStemmer()
        {
            _termsCollection =
                new TermsProvider(ProvideStemmer())
                    .LoadFile(
                        Path.Combine(
                            AppDomain.CurrentDomain.BaseDirectory,
                            KeywordsFilePath));

            _documentPurer = new DocumentPurer(_termsCollection);

            IEnumerable<ExtendedDocument> documents = new DocumentsProvider(ProvideStemmer(), _documentPurer).Read(Path.Combine(
                AppDomain.CurrentDomain.BaseDirectory,
                DocumentsFilePath));

            _tfIdfIndexer = new TfIdfIndexer(documents, _termsCollection);
        }