Why SpellChecker (C#) incorrectly defines words? -
i need determine correct spelling specific word list. if word wrong write in in file. used class spellchecker, code:
public class spellchecker : idisposable { system.type tword = null; object com_app = null; private static spellchecker checker = new spellchecker(); private spellchecker() { try { tword = type.gettypefromprogid("word.application"); com_app = activator.createinstance(tword); } catch { com_app = null; } } public static spellchecker getchecker() { return checker; } public void dispose() { if (com_app != null) { object[] arg = { null, null, null }; tword.invokemember("quit", bindingflags.invokemethod, null, com_app, arg); com_app = null; } } public bool checkword(string word) { object[] arg = { word }; return (bool)tword.invokemember("checkspelling", bindingflags.invokemethod, null, com_app, arg); } }
but on same word working on different, if setter list (with word) or 1 word. in process debug see, checkword give me true in 1 case, , false in case. 1 word, sure.
var allword = getwords(xdoc); foreach (var word in allword) { if (!spellchecker.checkword(word)) { result.writeline(word); } }
i realized. in cases checkword give me wrong answer. example, need check russian , english word. if give list list = list(){"gsm\mpg4\lte", "Привет"}, on first word in list call me true, second word false.
Comments
Post a Comment