【发布时间】:2015-03-24 19:25:27
【问题描述】:
我正在使用 Word 的拼写检查器来发布 OCR,这在很大程度上要感谢 Spell Checking in C# Using Word Interop 我已经让整个事情在原则上正常工作。
我的问题是区分拼写正确的单词和单词拼写检查器没有建议的随机垃圾字符序列。
foreach(string s in textBox1.Text.Split(' '))
{
if(s.Length > 0)
{
//Get suggestions for this 'word'
var suggestions = app.GetSpellingSuggestions(s, custDict, MainDictionary: Word.WdLanguageID.wdEnglishUK);
//There is no suggestion, displays correctly spelled words and random nonsense for which word has no suggestion.
if(suggestions.Count == 0)
{
MessageBox.Show(s);
}
foreach (Word.SpellingSuggestion spellingSuggestion in suggestions)
{
//Display the best suggestion then break.
if (suggestions.Count > 0)
{
MessageBox.Show(spellingSuggestion.Name);
break;
}
}
}
}
是否有某种机制来确定建议的“分数”或区分字典中存在的字符串和不存在的字符串?
提前致谢。
【问题讨论】:
-
如果你想通了,你可以回答你自己的问题:)
标签: c# winforms interop spell-checking