搜索智能提示测试程序

本文介绍了一种基于数据库实现的简单智能搜索提示方法。通过统计短语出现频率,并使用SQL查询匹配用户输入的前缀,快速返回最相关的搜索建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

   百度搜索框中,输入“东北”,搜索框下面会以北京为前缀,展示“东北往事之黑道风云20年”、“东北大学”、“东北二人转”等等搜索词,输入“结构之”,会提示“结构之法”,“结构之法算法之道”等搜索词。下面是用字典树与topk实现这个搜索的智能提示。

我们选取TRank:Ranking Entity Types Using the Web of Data中的摘要和介绍部分选取了48个短语并统计出他们的在文中出现的频率如下表

WebSearch 1
entities  64
information 17
pictures  2
short summaries 1
related entities 5
factual information 1
instrumental 1
application 7
entity type 62
generic type 2
relevant 27
document context 1
Linked Open Data 1
person 22
actor 16
correct 5
general 5
interesting 5
browsing context 3
paper 12
new task 3
ranking entity types 4
propose and evaluate 1
methods 10
collection statistics 3
find the most 1
graph structure 2
extensive 2
experimental 8
collections 7
granularity 1
hierarchies 6
online queries 1
search engines 2
images 1
videos 1
news 7
presented 3
summary 4
object 7
keyword query 1
potential 4
textual 12
public knowledge 1
cases 7
obvious 1
Web pages 5

我们先做一种最简单的用数据库实现方法如下

在建立一个表summary,它的列有sname nchar(50),num smallint,我们用sname记录短语,用num记录他们出现的频数。然后把信息写入到summary表中,如果用户输入en执行下面SQL语句

SELECT   TOP (2) sname
FROM      summary
WHERE   (sname LIKE 'en%')
ORDER BY num DESC

得到entities,entity type,然后把它呈现给用户,这就是最简单的智能搜索提示。

未完待写......

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值