diff options
| author | chzhang <zch921005@126.com> | 2022-12-24 19:53:43 +0800 |
|---|---|---|
| committer | chzhang <zch921005@126.com> | 2022-12-24 19:53:43 +0800 |
| commit | b51f61ed565a6a2bb871968e3c91d64cd8e27268 (patch) | |
| tree | 92df6cd133681b7eed5182b97488d8752163c716 /misc/process.py | |
| parent | cdb361b10631a3ab222d783c491b29dd523d61d0 (diff) | |
softmax grad
Diffstat (limited to 'misc/process.py')
| -rw-r--r-- | misc/process.py | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/misc/process.py b/misc/process.py index e613615..8a21c60 100644 --- a/misc/process.py +++ b/misc/process.py @@ -1,29 +1,29 @@ - -from datetime import datetime - -def merge(): - chinese = open('./raw_chinese.txt', encoding='UTF-8').readlines() - english = open('./raw_english.txt', encoding='UTF-8').readlines() - merge = open('./merge_{}.txt'.format(today), 'w', encoding='UTF-8') - for c_row, e_row in zip(chinese, english): - c_row = c_row.replace(',', ' ').replace(',', ' ') - merge.write(' '.join(c_row.split()) + '\n') - # e_row = e_row.replace(',', ' ').replace(',', ' ') - merge.write(e_row) - -def split(): - merge = open('./merge_{}.txt'.format(today), encoding='utf-8').readlines() - chinese = open('./chinese_{}.txt'.format(today), 'w', encoding='utf-8') - english = open('./english_{}.txt'.format(today), 'w', encoding='utf-8') - for i, row in enumerate(merge): - if i % 2 == 0: - chinese.write(row) - else: - english.write(row) - -if __name__ == '__main__': - today = datetime.now().strftime('%Y%m%d') - # merge() - split() - pass - +
+from datetime import datetime
+
+def merge():
+ chinese = open('./raw_chinese.txt', encoding='UTF-8').readlines()
+ english = open('./raw_english.txt', encoding='UTF-8').readlines()
+ merge = open('./merge_{}.txt'.format(today), 'w', encoding='UTF-8')
+ for c_row, e_row in zip(chinese, english):
+ c_row = c_row.replace(',', ' ').replace(',', ' ')
+ merge.write(' '.join(c_row.split()) + '\n')
+ # e_row = e_row.replace(',', ' ').replace(',', ' ')
+ merge.write(e_row)
+
+def split():
+ merge = open('./merge_{}.txt'.format(today), encoding='utf-8').readlines()
+ chinese = open('./chinese_{}.txt'.format(today), 'w', encoding='utf-8')
+ english = open('./english_{}.txt'.format(today), 'w', encoding='utf-8')
+ for i, row in enumerate(merge):
+ if i % 2 == 0:
+ chinese.write(row)
+ else:
+ english.write(row)
+
+if __name__ == '__main__':
+ today = datetime.now().strftime('%Y%m%d')
+ # merge()
+ split()
+ pass
+
|
