NetSpell spellchecker

时光总嘲笑我的痴心妄想 提交于 2019-12-01 06:37:25

问题


Has anyone tried this library out? I cannot get it to work. For example, the spelling suggestions should work as follows.

But I am getting an empty list back. I first got an exception saying

C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\en-us.dic

is missing so I downloaded it from the web. The file I got has a list of thousands of english words and I even tried words from what it in the file and still no luck.

He is some code I tried.

Spelling s = new Spelling();
ArrayList items;
s.MaxSuggestions = 5;
s.SuggestionMode = Spelling.SuggestionEnum.PhoneticNearMiss;
s.Suggest(str);
items = s.Suggestions;
s.SuggestionMode = Spelling.SuggestionEnum.NearMiss;
s.Suggest(str);
items = s.Suggestions;
s.SuggestionMode = Spelling.SuggestionEnum.Phonetic;
s.Suggest(str);
items = s.Suggestions;

The Suggest method is supposed to get suggestions for 'str' and populate the Suggestions property. I am always getting 0 suggestions. I tried all three suggestion types that the library supports to see if that does anything as you can see, but that does not work either.

Even simple calls such as

s.TestWord("book")

give back "false". I think it is not able to use the dictionary file but not sure what else to do about it.


回答1:


That is what it was, the dic file was not compatible. I just used the one that comes with when you download NetSpell and it works like a charm.

By the way, I switche to NHunspell and I like it much better than NetSpell. Easier to use and better suggestions. http://www.crawler-lib.net/nhunspell



来源:https://stackoverflow.com/questions/11751263/netspell-spellchecker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!