コード例 #1
0
        public IEnumerable <WordEntity> GetSearchWords(PhraseEntity phrase)
        {
            var normalizedPhrase = phrase.Phrase.Replace(" ", "");
            var searchWord       = normalizedPhrase.GetSearchWord(null);

            return(_words
                   .Where(w => normalizedPhrase.GetSearchWord(w.Word) != searchWord &&
                          w.Word.Count(c => !Char.IsWhiteSpace(c)) <= searchWord.Length &&
                          w.Word.Length >= 2 &&
                          w.Word.Length >= 1)
                   .OrderByDescending(w => w.Word.Length)
                   .ToList());
        }
コード例 #2
0
 public IEnumerable <WordEntity> GetWords(PhraseEntity phrase)
 {
     return(_words.Where(w => w.Word.StartsWith(phrase.Phrase)));
 }