示例#1
0
        /// <summary>
        /// </summary>
        /// <param name="word" type="string">
        /// The word to generate suggestions for.
        /// </param>
        public IList <string> Suggest(string word, uint maxSuggestions)
        {
            ensureCustomDictionaryLoaded();
            ContainsResult result = testWord(word);

            if (!result.Contains)
            {
                return(suggest(word, result.PossibleBaseWords, maxSuggestions));
            }
            return(new List <string>());
        }
示例#2
0
        private ContainsResult testWord(string word)
        {
            if (_userWords.Contains(_customDictionary.CaseSensitive ? word : word.ToLower()))
            {
                return(new ContainsResult(true, null));
            }

            ContainsResult result = _dictionary.Contains(word);

            if (result.Contains || word.Length == 0)
            {
                return(result);
            }

            return(_dictionary.Contains(char.ToLower(word[0]) + word.Substring(1)));
        }