File size: 996 Bytes
24aaa76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Merges tob_script.json into records/R5/TESTPASS2/error_analysis.json under 'tob_script' and refreshes results.json's copy.
usage: tp2_merge_tob_script.py TESTPASS2_DIR
"""
import json
import os
import sys

TP = sys.argv[1]
e = json.load(open(os.path.join(TP, "error_analysis.json"), encoding="utf-8"))
t = json.load(open(os.path.join(TP, "tob_script.json"), encoding="utf-8"))
t["caveat"] = ("page-level reading-order alignment: misordered or missed lines add substitutions that are not script swaps, so the swap "
               "counts are noisier than the crop-level Azerbaijani figures; the letter shares do not depend on the alignment")
e["tob_script"] = t
json.dump(e, open(os.path.join(TP, "error_analysis.json"), "w", encoding="utf-8"), indent=1, ensure_ascii=False)
r = json.load(open(os.path.join(TP, "results.json"), encoding="utf-8"))
r["error_analysis"] = e
json.dump(r, open(os.path.join(TP, "results.json"), "w", encoding="utf-8"), indent=1, ensure_ascii=False)
print("merged")