-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A few proposed modifications #20
Changes from 4 commits
6e27c00
6cf51c3
ef54409
dd3a8a4
76723e0
45fcbeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +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 = {} | ||
_snippet_to_check = [] | ||
for i, (query, result) in enumerate(zip(query_list, serper_response.json())): | ||
if query != result.get("searchParameters").get("q"): | ||
|
@@ -85,13 +86,17 @@ def _retrieve_evidence_4_all_claim(self, query_list: list[str], top_k: int = 5, | |
} | ||
else: | ||
results = result.get("organic", [])[:top_k] # Choose top 5 result | ||
merge_evidence_text = [f"Text: {_result['snippet']} \n Source: {_result['link']}" for _result in results] | ||
merge_evidence_text = [re.sub(r"\n+", "\n", evidence) for evidence in merge_evidence_text] | ||
merge_evidence_text = [ | ||
f"Text: {_result['snippet']} \n Source: {_result['link']} \n Date: {_result.get('date', 'Unknown')}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include the date of the result in the prompt. Thanks to this, OFV can verify claims such as "Did X happen before Y?" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi! The inclusion of the date as a separate factor might be helpful, but I suspect it is not essential. In your example, "X happens before Y," we would expect the generated queries to be like ["When did X happen?", "When did Y happen?"]. Given such queries, retrieved evidence is expected to be sufficient to solve this problem. Prompt for query generation: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, sorry for late reply, I was on vacation. Unfortunately, not all articles come with clear dates in them. But Serp can return their creation date anyway. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this could be available behind a flag in |
||
for _result in results | ||
] | ||
evidences[i] = { | ||
"text": "\n\n".join(merge_evidence_text), | ||
"url": "Multiple", | ||
} | ||
|
||
# Save date for each url | ||
url_to_date.update({result.get("link"): result.get("date") for result in results}) | ||
# Save query-url pair, 1 query may have multiple urls | ||
query_url_dict.update({query: [result.get("link") for result in results]}) | ||
_snippet_to_check += [result["snippet"] for result in results] | ||
|
@@ -157,7 +162,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}" for snippet, _url in zip(_snippet_list, url_to_check)] | ||
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 = [re.sub(r"\n+", "\n", evidence) for evidence in merge_evidence_text] | ||
evidences[_query_index] = { | ||
"text": "\n\n".join(merge_evidence_text), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow to modify num_retries while initing FactCheck class.