aboutsummaryrefslogtreecommitdiff
path: root/gnqa/paper2_eval/src/parse_r2r_result.py
diff options
context:
space:
mode:
authorShelbySolomonDarnell2024-10-17 12:24:26 +0300
committerShelbySolomonDarnell2024-10-17 12:24:26 +0300
commit00cba4b9a1e88891f1f96a1199320092c1962343 (patch)
tree270fd06daa18b2fc5687ee72d912cad771354bb0 /gnqa/paper2_eval/src/parse_r2r_result.py
parente0b2b0e55049b89805f73f291df1e28fa05487fe (diff)
downloadgn-ai-00cba4b9a1e88891f1f96a1199320092c1962343.tar.gz
Docker image built to run code, all evals run using R2RHEADmaster
Diffstat (limited to 'gnqa/paper2_eval/src/parse_r2r_result.py')
-rw-r--r--gnqa/paper2_eval/src/parse_r2r_result.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/gnqa/paper2_eval/src/parse_r2r_result.py b/gnqa/paper2_eval/src/parse_r2r_result.py
index a958629..d5b4c85 100644
--- a/gnqa/paper2_eval/src/parse_r2r_result.py
+++ b/gnqa/paper2_eval/src/parse_r2r_result.py
@@ -1,9 +1,11 @@
import json
import sys
+from document_operations import DocOps, QuestionList
-verbose = 1
-
-read_file = '/data/code/gn-ai/gnqa/paper2_eval/data/rag_out_1.json'
+verbose = 0
+#read_file = '/home/shebes/Coding/gn-ai/gnqa/paper2_eval/data/testresp2.json'
+read_file = '/home/shebes/Coding/gn-ai/gnqa/paper2_eval/data/responses/human/cs_diabetes_responses.json'
+out_file = '../data/dataset/human/intermediate_files/human_cs_diabetes_'
values_key = {
"text" : {"name": "contexts", "append": 1},
@@ -46,10 +48,16 @@ with open(read_file, "r") as r_file:
result_file = json.load(r_file)
ragas_output = {
- "contexts": [],
- "titles": [],
- "answer": "",
- "question": ""}
-extract_response(result_file, values_key, ragas_output)
-
-print(json.dumps(ragas_output, indent=2)) \ No newline at end of file
+ "titles": [],
+ "extraction_id": [],
+ "document_id": [],
+ "id": [],
+ "contexts": [],
+ "answer": "",
+ "question": ""}
+
+print('There are {0} keys in the result file'.format(result_file.keys()))
+for key in result_file.keys():
+ eval_dataset_dict = get_ragas_out_dict()
+ extract_response(result_file[key], values_key, eval_dataset_dict)
+ DocOps.writeDatasetFile(eval_dataset_dict, '{0}{1}'.format(out_file, key)) \ No newline at end of file