private async void UpdateMisspelledWords()
        {
            var keys = misspelledWords.Keys.ToArray();

            foreach (var key in keys)
            {
                misspelledWords[key] = await Task.Run(() =>
                                                      DictionaryScanner.FindSimilarWords(key, MaxResults, LevDistance, HowManyChanges)
                                                      );
            }
        }
 // Add word to dictionary if it's not already in it
 private async void AddWordToDictionary(string word)
 {
     try
     {
         if (!misspelledWords.ContainsKey(word))
         {
             misspelledWords.Add(
                 word,
                 await Task.Run(() => DictionaryScanner.FindSimilarWords(word, MaxResults, LevDistance, HowManyChanges))
                 );
         }
     }
     catch { }
 }
Exemplo n.º 3
0
        private void Start(string word, int count, int distance, int howManyChanges)
        {
            var     result = new List <string>();
            Boolean isGood = false;
            string  copy   = word;

            if (!DictionaryScanner.IsLowerWordInDictionary(ref word) && word.Length > 1)
            {
                result = DictionaryScanner.FindSimilarWords(word, count, distance, howManyChanges);
            }
            else
            {
                if (copy != word)
                {
                    result.Add(word);
                }
                else
                {
                    isGood = true;
                }
            }

            if (isGood)
            {
                AppendTextBoxes(tbList.Text, Color.Green);
            }
            else
            {
                var list = "";
                if (result.Count != 0)
                {
                    foreach (var item in result)
                    {
                        list += (item + "\r\n");
                    }
                    AppendTextBoxes(list, Color.Red);
                }
                else
                {
                    AppendTextBoxes("Brak", Color.Red);
                }
            }
        }
 public List <string> RawSpellingPropositions(string word)
 {
     return(DictionaryScanner.FindSimilarWords(word, MaxResults, LevDistance, HowManyChanges));
 }