实现 .Net Web 表单拼写检查器

发布于 2024-12-17 00:07:50 字数 205 浏览 3 评论 0原文

我正在我们的一个应用程序中实现 .net Web 表单拼写检查器。
该应用程序仅在内部运行,客户端无法访问互联网,因此我无法使用像谷歌这样的在线拼写检查器。

我在 SO 上看到很多提倡使用 NetSpell 的帖子。然而我一直无法弄清楚如何将它连接到像tiny mce这样的文本编辑器。

有我可以遵循的例子吗?
有没有更简单的方法让拼写检查器工作?

I'm implementing a .net web forms spell checker in one of our applications.
This application is only run internally and the clients do not have access to the internet so I cannot use an online spell checker like google's.

I came across many posts on SO that advocate using NetSpell. However I've been unable to figure out how to hook it up to a text editor like tiny mce.

Is there an example somewhere that I can follow?
Is there an easier way to get spell checker working?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

若言繁花未落 2024-12-24 00:07:51

好吧,这就是我发现的。

TinyMCE 有两个用于执行拼写检查的命令。
这些命令以 json 格式发送,并且具有相同的语法。

在我的使用中,我必须使用特定的语音拼写检查例程。因此,我解析 json 请求,调用拼写检查,然后生成 json 响应。

发布
id - 字符串id,由tinyMCE生成
方法 - 字符串“checkWords”或“getSuggestions”
params - 一个对象数组,对于 checkWords 来说是 (,) 对于 getSuggestions 来说是 (,)

预期响应
结果 - 字符串数组
id - 与帖子相同的 id
error - 我假设的错误消息,我总是只返回 null。

使用示例

Post  
{"id":"c0","method":"checkWords","params":["en",["This","is","a","sentancce","woth","speeling","missteaks"]]}

Expected Response
{"result":["sentancce","woth","speeling","missteaks"],"id":"c0","error":null}

Post
{"id":"c0","method":"getSuggestions","params":["en","sentancce"]}

Expected Response
{"result":["sentence","sentenced","sentences","sentience"],"id":"c0","error":null}

Ok here is what I found out.

TinyMCE has two commands that it uses to perform a spellcheck.
These commands are sent in json format and have the same syntax.

In my usage I have to use a specific phonetic spellcheck routine. So I parse the json request call my spellcheck and then generate a json response.

POST
id - string id, generated by tinyMCE
method - either the string "checkWords" or "getSuggestions"
params - an object array, for checkWords it is (<string>, <stringarray>) for getSuggestions it is (<string>, <string>)

Expected Response
result - a string array
id - the same id from the post
error - An error message I'm assuming, I always just return null.

Example usage

Post  
{"id":"c0","method":"checkWords","params":["en",["This","is","a","sentancce","woth","speeling","missteaks"]]}

Expected Response
{"result":["sentancce","woth","speeling","missteaks"],"id":"c0","error":null}

Post
{"id":"c0","method":"getSuggestions","params":["en","sentancce"]}

Expected Response
{"result":["sentence","sentenced","sentences","sentience"],"id":"c0","error":null}
红颜悴 2024-12-24 00:07:50

我将使用tinymce附带的拼写检查插件,并在内联网中的机器上设置拼写检查服务器。 IESpell 是一个很好的方法。

I would use the spellcheck plugin shipped with tinymce and set up a spellcheck server on a machiene in the intranet. IESpell is a good way to go here.

£冰雨忧蓝° 2024-12-24 00:07:50

我确实实现了 NetSpell 来拼写检查城市名称。什么都不存在,所以我用 C# 开发了一个 Web 服务,从客户端调用该服务,该服务获取字符串,通过 NetSpell(使用自定义词典)传递它,然后返回如果城市/州组合良好,如果不好,NetSpell 给出了哪些建议。

一些 AJAX 魔法会显示一个下拉列表,其中包含 Web 服务返回的建议。不过,整个事情都必须是定制的。如果您需要在不调用外部网络服务的情况下进行拼写检查,我认为这是您最好的选择。

I did implement NetSpell to spell check city names. Nothing existed, so I developed a web service in C# that was called from the client which took the string, passed it through NetSpell (with custom dictionaries) and then returned if the city/state combination was good and if not, what suggestions NetSpell gave.

Some AJAX magic displayed a dropdown with the suggestions the web service returned. The whole thing had to be custom though. If you need to spell check things without calling an external web service, I think this is your best bet.

紙鸢 2024-12-24 00:07:50

我认为塔里亚马的答案已经很接近了。我已经检查了 TinyMce .NET 包,连接自定义拼写检查器而不是提供的看起来非常简单GoogleSpellChecker 类。您只需实现 ISpellChecker 接口(两个简单的方法),将 GoogleSpellChecker 切换到 SpellCheckerModule.cs 文件中的该实现。对于实际的拼写检查,您可以使用 NHunspell,它是 OpenOffice 拼写检查器的 .NET 版本。有关将 SpellCheckerModule 与 TinyMCE 连接的说明,请参阅 Thariama 提供的链接 (kelvinluck.com/2009/01/...)

I think the answer by Thariama is close ehough. I've checked out the spell checker sample included in the TinyMce .NET package, and it looks quite straightforward to hook up a custom spell checker instead of the provided GoogleSpellChecker class. You just have to implement the ISpellChecker interface (two simple methods), switch GoogleSpellChecker to that implementation in the SpellCheckerModule.cs file. For the actual spell checking you could use NHunspell, a .NET version of the OpenOffice spell checker. For a description on hooking up SpellCheckerModule with TinyMCE see the link provided by Thariama (kelvinluck.com/2009/01/...)

久而酒知 2024-12-24 00:07:50

这是使用 COM 的解决方案。只要安装了 Microsoft Word,它就可以很好地工作。

http://www.codeproject.com/KB/cs/spellcheckdemo.aspx

Here's a solution that uses COM. It will work great as long as Microsoft Word is installed.

http://www.codeproject.com/KB/cs/spellcheckdemo.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文