public void TestMethod2() { var tokinizer = new Tokinizer(new HashSet <string>()); var vocabulary = new Vocabulary(); var search = new SearchEngine(vocabulary, new DocumentStorageMemory(), tokinizer); var index = 0; foreach (var doc in docs) { search.Indexing(index, doc); index++; } var docSearch2 = search.Query().MultiMatch("Back to the Future", new List <MatchField <Document> >() { new MatchField <Document>() { field = x => x.Title, Boost = 1 }, new MatchField <Document>() { field = x => x.Body } }).GetSearchHits <Document>(); var json = search.Export(); }
public override string Execute() { var tokinizer = new Tokinizer(stopwords); var documentStore = new DocumentStorageMemory(); var vocabulary = new Vocabulary(); var search = new SearchEngine(vocabulary, documentStore, tokinizer); var bigram = new NGram(2, new Sentencezer(new Tokinizer(new HashSet <string>() { "-", "\"", "(", ")", ":", ";", "," }))); var trigram = new NGram(3, new Sentencezer(new Tokinizer(new HashSet <string>() { "-", "\"", "(", ")", ":", ";", "," }))); var numberOfDocuments = 0; foreach (var contentData in _contentLoader.GetAllChildren <MovieProduct>(_referenceConverter.GetRootLink())) { if (contentData is ISearch movieProduct) { search.Indexing <ISearch>(contentData.ContentLink.ID, movieProduct); bigram.Insert <ISearch>(movieProduct); trigram.Insert <ISearch>(movieProduct); numberOfDocuments++; Debug.WriteLine(movieProduct.Title); } } _blobRepository.Save("BiGram", bigram.Export()); _blobRepository.Save("TriGram", trigram.Export()); _blobRepository.Save("Vocabulary", vocabulary.Export()); _blobRepository.Save("Search", search.Export()); return($"Number of documents; {numberOfDocuments}, number of words {vocabulary.Count()}"); }
public void TestMethod1() { var tokinizer = new Tokinizer(new HashSet <string>()); var vocabulary = new Vocabulary(); IrtRetSearch search = new IrtRetSearch(vocabulary, new DocumentStorageMemory(), tokinizer); var index = 0; foreach (var doc in docs) { search.Indexing(index, doc); index++; } var docSearch2 = search.Search <Document>("Back to the Future", 10).OrderByDescending(x => x.Score).ToList(); }