public List <string[]> SplitRequests(string request) { var words = request.Split(separators, StringSplitOptions.RemoveEmptyEntries); var result = new List <string[]>(); foreach (var word in words) { var resultWord = PrepareWord(word); var synonymList = Synonyms.FirstOrDefault(list => list.Any(s => MatchWord(resultWord, s))); var wordSynonyms = new List <string>() { resultWord }; if (synonymList != null) { wordSynonyms.AddRange(synonymList.Where(s => !MatchWord(resultWord, s))); } result.Add(wordSynonyms.Distinct().ToArray()); } return(result); }
/// <summary> /// /// </summary> /// <param name="key"></param> public static SynonymInfo GetInfo(string key) { return(Synonyms.FirstOrDefault(f => f.Key == key)); }