Example #1
0
        /// <summary>
        /// Adds the passed words to user dictionary.
        /// The words' culture is auto detecting.
        /// </summary>
        /// <param name="words"></param>
        /// <returns>false, if no word was added (all of the word already exist)</returns>
        public bool AddUserWord(IEnumerable <string> words)
        {
            bool res = false;

            foreach (var word in words)
            {
                res |= AddUserWord(word, TextTools.GetTextCulture(word));
            }
            return(res);
        }
Example #2
0
        /// <summary>
        /// Checks spelling of the passed text with the passed culture.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="culture">culture of the whole text</param>
        /// <returns>List of wrong-spelled words</returns>
        public List <Word> CheckTextSpell(string text, string culture)
        {
            List <Word> words    = TextTools.GetWords(text);
            List <Word> badWords = new List <Word> ();

            foreach (Word w in words)
            {
                if (!CheckWordSpell(w.Text, culture))
                {
                    badWords.Add(w);
                }
            }

            return(badWords);
        }
Example #3
0
        /// <summary>
        /// Checks the spelling of the passed word with the passed culture.
        /// </summary>
        /// <param name="word"></param>
        /// <param name="culture"></param>
        /// <returns>true, if word is correct</returns>
        public bool CheckWordSpell(string word, string culture)
        {
            var dic = dictionaryManager.GetDictionary(culture);

            if (dic == null)
            {
                throw new Exception(String.Format(Strings.ErrorDictionaryMissing, culture));
            }

            if (spellOptions.IgnoreUppercaseWords && TextTools.IsUppercaseText(word))
            {
                return(true);
            }

            bool isCorrect = dic.IsWordCorrect(word);

            if (!isCorrect && !spellOptions.CaseSensitive)
            {
                isCorrect = dic.IsWordCorrect(word.ToLower());
            }

            return(isCorrect);
        }
Example #4
0
 /// <summary>
 /// Adds the passed word to user dictionary.
 /// The word's culture is auto detecting.
 /// </summary>
 /// <param name="word"></param>
 /// <returns>false, if word wasn't added (e.g. the word already exists)</returns>
 public bool AddUserWord(string word)
 {
     return(AddUserWord(word, TextTools.GetTextCulture(word)));
 }
Example #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="word"></param>
 /// <param name="suggestForCorrectWord"></param>
 /// <returns></returns>
 public SpellSuggestion[] SuggestCorrectedWords(string word, bool suggestForCorrectWord)
 {
     return(SuggestCorrectedWords(word, TextTools.GetTextCulture(word), suggestForCorrectWord));
 }
Example #6
0
 /// <summary>
 /// Checks the spelling of the passed word. Culture is auto detecting.
 /// </summary>
 /// <param name="word"></param>
 /// <returns>true, if word is correct</returns>
 public bool CheckWordSpell(string word)
 {
     return(CheckWordSpell(word, TextTools.GetTextCulture(word)));
 }