开发者

Check if word in english dictionary programmatically in c#

I want to check if a word is in English dictionary and make it a tag. All i know is that NetSpell has a dll but i don't know h开发者_如何学JAVAow to check it.


This is the 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...
    } 
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜