public List <string> FindSentences(string words, OrderWordsInSearch orderWordsInSearch) { var uniqueWords = new HashSet <string>(words.Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries)); List <Sentence> sentences = _sentenceWordsQuery.FindSentencesByWords(uniqueWords.Select(e => e.Trim()).ToList(), orderWordsInSearch); if (EnumerableValidator.IsEmpty(sentences)) { NLPWrapper.ExternalObjects.Sentence sentence = _textAnalyzer.ParseSentence(words, false); var normalWords = new List <string>(); foreach (Word word in sentence.Words) { if (EnumerableValidator.IsNotEmpty(word.NormalForms)) { normalWords.AddRange(word.NormalForms); } else { normalWords.Add(word.GetAppropriateWordText()); } } sentences = _sentenceWordsQuery.FindSentencesByWords(normalWords, orderWordsInSearch); } return(sentences.Select(e => e.Text).ToList()); }
public void ParseSentence(string textSentence) { Sentence sentence = _textAnalyzer.ParseSentence(textSentence); /*PartSentence partSentence = sentence.PartSentence; * ShowWords(partSentence); * Console.WriteLine();*/ ShowSentence(sentence); }