我一直在为一个投资组合管理工具开发一个内部网站。有很多文本数据,公司名称等。我对一些搜索引擎的能力印象深刻,它们可以非常快速地回答“你的意思是:xxxx”。
我需要能够智能地接受用户的查询,并不仅响应原始搜索结果,而且还响应“您的意思是?”当有一个极有可能的替代答案等
我正在开发ASP。NET (VB -别跟我过不去!)]
更新: 好吧,在没有数百万“付费用户”的情况下,我该如何模仿这种模式?
为每个“已知”或“正确”的术语生成拼写错误并执行查找? 还有其他更优雅的方法吗?
我一直在为一个投资组合管理工具开发一个内部网站。有很多文本数据,公司名称等。我对一些搜索引擎的能力印象深刻,它们可以非常快速地回答“你的意思是:xxxx”。
我需要能够智能地接受用户的查询,并不仅响应原始搜索结果,而且还响应“您的意思是?”当有一个极有可能的替代答案等
我正在开发ASP。NET (VB -别跟我过不去!)]
更新: 好吧,在没有数百万“付费用户”的情况下,我该如何模仿这种模式?
为每个“已知”或“正确”的术语生成拼写错误并执行查找? 还有其他更优雅的方法吗?
当前回答
关于“did you mean”算法的理论可以参考《信息检索导论》第3章。它可以在网上免费下载。第3.3节(第52页)准确地回答了你的问题。为了明确回答你的更新,你只需要一个单词字典,不需要其他任何东西(包括数百万用户)。
其他回答
几年前我在这方面看到过一些东西,所以可能已经改变了,但显然他们是通过分析相同用户在短时间内提交非常相似的查询的日志开始的,并根据用户如何纠正自己使用机器学习。
嗯…我认为谷歌使用他们庞大的数据语料库(互联网)来做一些严肃的NLP(自然语言处理)。
例如,他们拥有来自整个互联网的大量数据,以至于他们可以计算出三个单词序列出现的次数(称为三元组)。因此,如果他们看到一个句子:“pink frugr concert”,他们可以看到它的点击率很少,然后在语料库中找到最有可能的“pink * concert”。
他们显然只是做了Davide Gualano所说的一种变化,所以一定要阅读那个链接。谷歌当然使用它所知道的所有网页作为一个语料库,这使得它的算法特别有效。
通常,产品拼写纠正器会使用几种方法来提供拼写建议。一些人:
Decide on a way to determine whether spelling correction is required. These may include insufficient results, results which are not specific or accurate enough (according to some measure), etc. Then: Use a large body of text or a dictionary, where all, or most are known to be correctly spelled. These are easily found online, in places such as LingPipe. Then to determine the best suggestion you look for a word which is the closest match based on several measures. The most intuitive one is similar characters. What has been shown through research and experimentation is that two or three character sequence matches work better. (bigrams and trigrams). To further improve results, weigh a higher score upon a match at the beginning, or end of the word. For performance reasons, index all these words as trigrams or bigrams, so that when you are performing a lookup, you convert to n-gram, and lookup via hashtable or trie. Use heuristics related to potential keyboard mistakes based on character location. So that "hwllo" should be "hello" because 'w' is close to 'e'. Use a phonetic key (Soundex, Metaphone) to index the words and lookup possible corrections. In practice this normally returns worse results than using n-gram indexing, as described above. In each case you must select the best correction from a list. This may be a distance metric such as levenshtein, the keyboard metric, etc. For a multi-word phrase, only one word may be misspelled, in which case you can use the remaining words as context in determining a best match.
简单。他们有大量的数据。他们有每一个可能的术语的统计数据,基于它被查询的频率,以及它的什么变化通常会产生用户点击的结果……因此,当他们看到你在搜索词中经常拼写错误时,他们会提出更常见的答案。
实际上,如果拼写错误实际上是搜索频率最高的词,算法就会把它当成正确的词。
我猜…它可以
寻找词语 如果没有找到,使用一些算法来尝试“猜测”这个词。
可能是来自人工智能的东西,比如Hopfield网络或反向传播网络,或者其他“识别指纹”,恢复损坏的数据,或者Davide已经提到的拼写纠正……