Skip to content

Commit

Permalink
Update serper_retriever.py
Browse files Browse the repository at this point in the history
  • Loading branch information
haonan-li authored May 12, 2024
1 parent 76723e0 commit 45fcbeb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions factcheck/core/Retriever/serper_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 45fcbeb

Please sign in to comment.