PHP/Python/C/C++库/应用程序来匹配/纠正/提供输入建议

发布于 2024-08-19 08:22:13 字数 247 浏览 16 评论 0原文

我想要一个简单的 & PHP/Python/C/C++ 中的轻量级库/应用程序用于匹配/纠正/提供输入建议。输入/输出示例:

  1. 输入:Webdevelopment ==>输出:Web 开发
  2. 输入:Web 开发 ==>输出:Web 开发
  3. 输入:Web 开发 ==>输出:Web 开发

鉴于有正确单词和短语的数据库,我只需要该库来匹配/猜测短语。有知道的请推荐一下。

I'd like to have a simple & lightweight library/application in PHP/Python/C/C++ library/application to match/correct/give suggestions to input. Example in/out:

  1. Input: Webdevelopment ==> Output: Web Development
  2. Input: Web developmen ==> Output: Web Development
  3. Input: Web develop ==> Output: Web Development

Given there is database of correct words and phrases, I just need the library to match/guess phrases. Please suggest if you know any.

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

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

发布评论

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

评论(2

傾城如夢未必闌珊 2024-08-26 08:22:13

Google 研究总监 Peter Norvik 的如何编写拼写校正器包含 21 行拼写校正器Python 的,完整的解释。

您必须自己将其转换为模块,但这应该很容易。当然,您还需要一个语料库(即单词),但他也提供了这些资源。

How to Write a Spelling Corrector from Google's Director of Resarch Peter Norvik contains a spelling corrector in 21 lines of Python, complete with explanations.

You will have to convert this into a module yourself, but that should be easy. Of course, you will also need a corpus (i.e. words), but he gives sources for these as well.

电影里的梦 2024-08-26 08:22:13

我想你想要做的是计算字符串(输入、输出对)之间的编辑距离。
其中一个比较简单的名称(我用它来从 3 个字母的短名称中找出团队的全名 - 这是一个很长的故事..)是 Levenshtein 距离。页面上的最后一个外部链接有一堆不同的实现(事实证明它是 PHP 4.0.1+ 上的标准)。

I guess what you want to do is compute the edit distance between strings (an input, output pair).
One of the simpler ones (that I've used for figuring out a team's full name from it's 3 letter short one - it's a long story..) is the Levenshtein distance. The last external link on the page has a bunch of different implementations of it (turns out it's standard on PHP 4.0.1+).

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