-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.py
86 lines (74 loc) · 1.95 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from pprint import pprint
from mdsearch import Searcher
S = Searcher()
# 综合检索
search_info_1 = {
'query_type': 'integrated_search',
'query': 'Attention Is All You Need',
'match': {
'title': True,
'abstract': False,
'paperContent': False,
'videoContent': False,
'authors': False
},
'filter': {
'yearfrom': 1000,
'yearbefore': 3000,
},
'sort': 'relevance',
'is_filter': False,
'is_rescore': False,
'is_cited': False
}
paper, paper_id, paper_num = S.search_paper_by_name(search_info_1)
print('------Case 1:综合检索------')
for i in range(10):
print(paper[i]['title'])
# 高级检索
search_info_2 = {
'query_type': 'advanced_search',
'match': {
'title': 'attention', # 用户查询内容
'abstract': None,
'paperContent': None,
'videoContent': None,
'authors': "Ashish"
},
'filter': {
'yearfrom': 1000,
'yearbefore': 3000,
},
'sort': 'relevance',
'is_filter': False, # 高级检索无论True还是False都不会进行过滤
'is_rescore': False,
'is_cited': False
}
paper, paper_id, paper_num = S.search_paper_by_name(search_info_2)
print('------Case 2:高级检索------')
for i in range(10):
print(paper[i]['title'])
# 视频定位
search_info_3 = {
'query_type': 'integrated_search',
'query': 'dialog',
'match': {
'title': True,
'abstract': True,
'paperContent': True,
'videoContent': True,
},
'filter': {
'yearfrom': 1000,
'yearbefore': 3000,
},
'sort': 'year',
'is_filter': False,
'is_rescore': False,
'is_cited': False
}
p_id = 'semisuperviseddialoguepolicylearningviastochasticrewardestimation'
video_pos = S.get_video_pos_by_paper_id(search_info_3, p_id)
print('------Case 3:视频定位------')
for p in video_pos:
pprint(p)