public string Commit() { if (!string.IsNullOrEmpty(CurrentWord)) { PushCurrentWord(); } PhraseService.IncrementPhraseUsage(Words.Select(x => x.Key)); ShouldClearOnNextInput = true; DoViewModelChanged(); return(ToString()); }
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); }