Verify that the word in the English dictionary is programmatically in C #

I want to check if a word is in the English dictionary and make it a tag. All I know is that NetSpell has a dll, but I don't know how to check it.

+5
source share
1 answer

This solution:

NetSpell.SpellChecker.Dictionary.WordDictionary oDict = new NetSpell.SpellChecker.Dictionary.WordDictionary(); 

oDict.DictionaryFile = "en-US.dic"; 
//load and initialize the dictionary 
oDict.Initialize();
string txtWords = Company;
NetSpell.SpellChecker.Spelling oSpell = new NetSpell.SpellChecker.Spelling(); 

oSpell.Dictionary = oDict; 
char []chDelims = {' ','\n', '\t', '\r'};
foreach (string s in txtWords.Split(chDelims)) 
{ 
    if (s.Length > 0 && oSpell.TestWord(s)) 
    { 
        //Do something here...
    } 
} 
+7
source

All Articles