Exemple #1
0
        /// <summary>
        ///     suggestions for a typical fault of spelling, that
        ///		differs with more, than 1 letter from the right form.
        /// </summary>
        private void ReplaceChars(List <Word> tempSuggestion)
        {
            List <string> replacementChars = Dictionary.ReplaceCharacters;

            for (int i = 0; i < replacementChars.Count; i++)
            {
                int    split       = replacementChars[i].IndexOf(' ');
                string key         = replacementChars[i].Substring(0, split);
                string replacement = replacementChars[i].Substring(split + 1);

                int pos = CurrentWord.IndexOf(key, StringComparison.InvariantCulture);
                while (pos > -1)
                {
                    string tempWord = CurrentWord.Substring(0, pos);
                    tempWord += replacement;
                    tempWord += CurrentWord.Substring(pos + key.Length);

                    if (FindWord(ref tempWord))
                    {
                        SuggestWord(tempWord, tempSuggestion);
                    }

                    pos = CurrentWord.IndexOf(key, pos + 1, StringComparison.InvariantCulture);
                }
            }
        }