From 3f31fb99904265f31eaeb95a41e6358dd5f635ee Mon Sep 17 00:00:00 2001 From: duhaode520 Date: Mon, 15 May 2023 08:11:13 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(=E8=B0=B7=E6=AD=8C=E5=AD=A6?= =?UTF-8?q?=E6=9C=AF=E6=90=9C=E7=B4=A2):=20=E5=8C=85=E8=A3=85search.result?= =?UTF-8?q?s()=E4=B8=BA=E7=A9=BA=E5=8F=AF=E8=83=BD=E9=80=A0=E6=88=90?= =?UTF-8?q?=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/binary-husky/gpt_academic/issues/423 --- ...4\242\345\260\217\345\212\251\346\211\213.py" | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git "a/crazy_functions/\350\260\267\346\255\214\346\243\200\347\264\242\345\260\217\345\212\251\346\211\213.py" "b/crazy_functions/\350\260\267\346\255\214\346\243\200\347\264\242\345\260\217\345\212\251\346\211\213.py" index b9e1f8e39..46c10de4f 100644 --- "a/crazy_functions/\350\260\267\346\255\214\346\243\200\347\264\242\345\260\217\345\212\251\346\211\213.py" +++ "b/crazy_functions/\350\260\267\346\255\214\346\243\200\347\264\242\345\260\217\345\212\251\346\211\213.py" @@ -36,14 +36,18 @@ def string_similar(s1, s2): max_results = 1, sort_by = arxiv.SortCriterion.Relevance, ) - paper = next(search.results()) - if string_similar(title, paper.title) > 0.90: # same paper - abstract = paper.summary.replace('\n', ' ') - is_paper_in_arxiv = True - else: # different paper + try: + paper = next(search.results()) + if string_similar(title, paper.title) > 0.90: # same paper + abstract = paper.summary.replace('\n', ' ') + is_paper_in_arxiv = True + else: # different paper + abstract = abstract + is_paper_in_arxiv = False + paper = next(search.results()) + except: abstract = abstract is_paper_in_arxiv = False - paper = next(search.results()) print(title) print(author) print(citation)