public List <Document> GetResults(string text) { var splitted = text.Split(' '); var firstWord = ""; var secondWord = ""; var lastOperand = "OR"; foreach (var word in splitted) { if (string.IsNullOrWhiteSpace(firstWord)) { firstWord = LinguisticModule.Stem(word); continue; } Operand operand; var tryParse = Enum.TryParse(word.ToUpper(), true, out operand); if (tryParse) { lastOperand = word.ToUpper(); continue; } if (string.IsNullOrWhiteSpace(secondWord)) { secondWord = LinguisticModule.Stem(word); continue; } } var qp = new QueryParser(firstWord, secondWord, (Operand)Enum.Parse(typeof(Operand), lastOperand.ToString())); return(qp.Parse(ref _tree, Path)); }
private void ReadFilesWorker(int from, int to) { for (int docId = from; docId < to; docId++) { string fileText = FileHelper.ReadFromPath(Path, docId); var stemmedList = LinguisticModule.Stemming(LinguisticModule.Tokenize(fileText)); foreach (var word in stemmedList) { Task.Factory.StartNew(() => WriteStemmedToTree(docId, word)); } } }