Commit bcf79185 by libei

remove no-useful

parent 89e0f654
import sys
score = []
bundary = 20000000
for i in range(8):
score.append(open("id_score%d.txt"%i, 'r', encoding="utf-8"))
zh = open("../yatrans_zh2en/data_zh2en.zh.ratio.bpe.dul",'r',encoding="utf-8")
en = open("../yatrans_zh2en/data_zh2en.en.ratio.bpe.dul",'r',encoding="utf-8")
fw = open("data2score.txt",'w',encoding="utf-8")
index2score = {}
for i in range(8):
for line in score[i].readlines():
line = line.strip().replace('\n', '').split('\t')
index2score[i*bundary+int(line[0])] = float(line[1])
sorted_list = sorted(index2score.items(),key=lambda x:x[1],reverse=True)
zh_list = zh.readlines()
en_list = en.readlines()
for item in sorted_list:
fw.write(zh_list[item[0]].replace('\n','').replace('@@ ','')+'\t'+en_list[item[0]].replace('\n','').replace('@@ ','')+'\t'+str(item[1])+'\n')
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论