Spaces:
Paused
Paused
duhaode520
commited on
Commit
•
3f31fb9
1
Parent(s):
c0e57e0
🐞 fix(谷歌学术搜索): 包装search.results()为空可能造成的报错
Browse fileshttps://github.com/binary-husky/gpt_academic/issues/423
- crazy_functions/谷歌检索小助手.py +10 -6
crazy_functions/谷歌检索小助手.py
CHANGED
@@ -36,14 +36,18 @@ def get_meta_information(url, chatbot, history):
|
|
36 |
max_results = 1,
|
37 |
sort_by = arxiv.SortCriterion.Relevance,
|
38 |
)
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
44 |
abstract = abstract
|
45 |
is_paper_in_arxiv = False
|
46 |
-
paper = next(search.results())
|
47 |
print(title)
|
48 |
print(author)
|
49 |
print(citation)
|
|
|
36 |
max_results = 1,
|
37 |
sort_by = arxiv.SortCriterion.Relevance,
|
38 |
)
|
39 |
+
try:
|
40 |
+
paper = next(search.results())
|
41 |
+
if string_similar(title, paper.title) > 0.90: # same paper
|
42 |
+
abstract = paper.summary.replace('\n', ' ')
|
43 |
+
is_paper_in_arxiv = True
|
44 |
+
else: # different paper
|
45 |
+
abstract = abstract
|
46 |
+
is_paper_in_arxiv = False
|
47 |
+
paper = next(search.results())
|
48 |
+
except:
|
49 |
abstract = abstract
|
50 |
is_paper_in_arxiv = False
|
|
|
51 |
print(title)
|
52 |
print(author)
|
53 |
print(citation)
|