Spaces:
Sleeping
Sleeping
Richard Fan
commited on
Commit
·
aacd2d2
1
Parent(s):
850ab67
fixes
Browse files- src/relevancy.py +4 -2
src/relevancy.py
CHANGED
|
@@ -40,10 +40,12 @@ def post_process_chat_gpt_response(paper_data, response, threshold_score=8):
|
|
| 40 |
if response is None:
|
| 41 |
return []
|
| 42 |
json_items = response['message']['content'].replace("\n\n", "\n").split("\n")
|
| 43 |
-
pattern = r"^\d+\. "
|
| 44 |
import pprint
|
| 45 |
try:
|
| 46 |
-
score_items = [
|
|
|
|
|
|
|
| 47 |
except Exception:
|
| 48 |
pprint.pprint([re.sub(pattern, "", line) for line in json_items if "relevancy score" in line.lower()])
|
| 49 |
raise RuntimeError("failed")
|
|
|
|
| 40 |
if response is None:
|
| 41 |
return []
|
| 42 |
json_items = response['message']['content'].replace("\n\n", "\n").split("\n")
|
| 43 |
+
pattern = r"^\d+\. |\\"
|
| 44 |
import pprint
|
| 45 |
try:
|
| 46 |
+
score_items = [
|
| 47 |
+
json.loads(re.sub(pattern, "", line))
|
| 48 |
+
for line in json_items if "relevancy score" in line.lower()]
|
| 49 |
except Exception:
|
| 50 |
pprint.pprint([re.sub(pattern, "", line) for line in json_items if "relevancy score" in line.lower()])
|
| 51 |
raise RuntimeError("failed")
|