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)); }
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"); }
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")); }
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)); }
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); }