forked from Param-Raval/editsql-cust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.py
23 lines (23 loc) · 802 Bytes
/
output.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import json
qlist=[]
with open('/content/drive/My Drive/editsql/logs/logs_sparc_editsql/dev_use_predicted_queries_predictions.json') as f:
for obj in f:
data = json.loads(obj)
qlist.append(data)
i=0
with open('output.txt', 'w') as json_file:
for q in qlist:
i=i+1
#print(q['input_seq'])
#print(q['probability'])
#print(q['prediction'])
#print("=======================================")
json.dump(str(i) + '. ', json_file)
json.dump(' '.join(q['input_seq']), json_file)
json_file.write('\n')
json.dump(q['probability'], json_file)
json_file.write('\n')
json.dump(' '.join(q['prediction']), json_file)
json_file.write('\n')
json.dump("===============================================================", json_file)
json_file.write('\n')