Spaces:
Runtime error
Runtime error
File size: 729 Bytes
d6585f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import json
from tqdm import tqdm
### read: cast 22 eval json
eval_json_path="/root/Corpus/CAsT22_eval_queries/cqr_inferred_results.json"
# read data
with open(eval_json_path, 'r') as fr:
data = json.load(fr)
# write: queries.tsv (format: {qid}\t{query})
eval_queries_path = "/root/Corpus/CAsT22_eval_queries/queries_cqr_result.tsv"
with open(eval_queries_path, 'w') as fw:
for sample in tqdm(data):
conv_id = sample['number']
for turn in sample['turn']:
turn_id = turn['number']
automatic_rewritten_utterance = turn['automatic_rewritten_utterance']
q_id = f"{conv_id}_{turn_id}"
fw.write(f"{q_id}\t{automatic_rewritten_utterance}\n")
|