forked from zysszy/CAT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre_repair.py
29 lines (26 loc) · 1.25 KB
/
pre_repair.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import time
ft = time.time()
#metrics = ["LCS", "ED", "TFIDF", "BLEU"]
metrics = ["LCS", "ED", "TFIDF", "BLEU"]
titles = ["NMT_zh_en0-8Mu"]
repdir = ["repair-new"]
qk = "quickstart0"
def newrepair():
#os.system(f"cp NMT_zh_en0-8Mu/repair/pre_align.sh")
for title in titles:
for rdir in repdir:
os.system(f"cd {title}/{rdir} && sh pre_align.sh")
for met in metrics:
os.system(f"cp {title}/{rdir}/{met}_Mu_align.zh TS/{qk}/chinese_e.txt")
os.system(f"cp {title}/{rdir}/{met}_Mu.en TS/{qk}/english_e.txt")
os.system(f"cp {title}/{rdir}/{met}_Mu.* TS/{qk}/repairALL-NEW/")
os.system(f"cp {title}/{rdir}/index.{met} TS/{qk}/repairALL-NEW/")
#os.system(f"cd TS/{qk} && sh do.sh && python3 read.py")
os.system(f"cd TS && python3 startall.py")
os.system(f"cd TS/{qk} && python3 read.py")
os.system(f"cp TS/{qk}/word_alignment.txt TS/{qk}/repairALL-NEW/align_ori.{met}.txt")
os.system(f"cp TS/{qk}/word_alignment.txt TS/{qk}/repairALL-NEW/align_ori.{met}.txt")
os.system(f"cp ./NewThres/TestGenerator-NMTRep/bugs* TS/{qk}/repairALL-NEW/")
newrepair()
print (time.time() - ft)