Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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)));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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)));
 }