From 45fcbeb0637a0cce5804b2c8708733b3aa5a1006 Mon Sep 17 00:00:00 2001 From: Haonan Li Date: Sun, 12 May 2024 15:53:21 +0400 Subject: [PATCH] Update serper_retriever.py --- factcheck/core/Retriever/serper_retriever.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/factcheck/core/Retriever/serper_retriever.py b/factcheck/core/Retriever/serper_retriever.py index 58dc0e3..74e3c4d 100644 --- a/factcheck/core/Retriever/serper_retriever.py +++ b/factcheck/core/Retriever/serper_retriever.py @@ -67,7 +67,7 @@ def _retrieve_evidence_4_all_claim(self, query_list: list[str], top_k: int = 5, # get the results for queries with an answer box query_url_dict = {} - url_to_date = {} + url_to_date = {} # TODO: decide whether to use date _snippet_to_check = [] for i, (query, result) in enumerate(zip(query_list, serper_response.json())): if query != result.get("searchParameters").get("q"): @@ -160,7 +160,7 @@ def bs4_parse_text(response, snippet, flag): for _query in query_snippet_dict.keys(): _query_index = query_list.index(_query) _snippet_list = query_snippet_dict[_query] - merge_evidence_text = [f"Text: {snippet} \n Source: {_url} \n Date: {url_to_date.get(_url, 'Unknown')}" for snippet, _url in zip(_snippet_list, url_to_check)] + merge_evidence_text = [f"Text: {snippet} \n Source: {_url}" for snippet, _url in zip(_snippet_list, url_to_check)] merge_evidence_text = [re.sub(r"\n+", "\n", evidence) for evidence in merge_evidence_text] evidences[_query_index] = { "text": "\n\n".join(merge_evidence_text),