Exemple #1
0
 public string Commit()
 {
     if (!string.IsNullOrEmpty(CurrentWord))
     {
         PushCurrentWord();
     }
     PhraseService.IncrementPhraseUsage(Words.Select(x => x.Key));
     ShouldClearOnNextInput = true;
     DoViewModelChanged();
     return(ToString());
 }
Exemple #2
0
        private void GetWordSuggestions()
        {
            List <string> result = PhraseService.GetWordSuggestions(Words.Select(x => x.Key), CurrentWord, NumberOfSuggestedWords);

            if (result.Count < NumberOfSuggestedWords)
            {
                // Request twice as many words than we need. That way when we add to phrase words and call Distinct we won't
                // end up with fewer than the total number of words required
                List <string> suggestionsFromDictionary = WordService.GetWordSuggestions(CurrentWord, NumberOfSuggestedWords * 2);
                result.AddRange(suggestionsFromDictionary);
            }
            SuggestedWords = result.Distinct().Take(NumberOfSuggestedWords);
        }