百度搜索框中,输入“东北”,搜索框下面会以北京为前缀,展示“东北往事之黑道风云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,然后把它呈现给用户,这就是最简单的智能搜索提示。
未完待写......