如何自动更正算法在PHP和/或C#的工作?算法、工作、PHP

2023-09-03 17:20:33 作者:我好想你

我试图找出如何自动更正算法可以在任一 PHP C#实施。

I am trying to figure out how autocorrect algorithms can be implemented in either PHP or C#.

总之,我有一个用户输入的词,应该能够有轻微的拼写错误被容忍。我也有正确拼写单词的 SQL 数据库。我希望能够抓住最近的(正确)的拼写从数据库中字给该用户输入。

In short, I have a user inputted word that should be able to have minor misspelling be tolerated. I also have an SQL database of correctly spelled words. I want to be able to grab the closest (correctly) spelled word from the database to that which the user entered.

我知道有数不胜数的自动更正包在那里,但我希望能够定制,所以我要寻找在任何 PHP 或 C#

I realize there are a zillion autocorrect packages out there, but I would like to be able to customize it, so I am looking for any information on implementing this functionality in either PHP or C#.

非常感谢, 布雷特

推荐答案

我假设你的意思是彼得·诺维格的拼写校正只有用C#编写或PHP ( 1 , 2 )从他的网站作为链接。

I am assuming you mean Peter Norvig's spell corrector, only written in C# or PHP (1, 2) as linked from his site.

这是本质上的方法谷歌使用的拼写纠正。

This is essentially the method Google uses for spelling corrections.