nahj speechs complete
This commit is contained in:
parent
46ca9a6b50
commit
2cc613a8fe
10008
output/nahj_speechs_complete.json
Normal file
10008
output/nahj_speechs_complete.json
Normal file
File diff suppressed because it is too large
Load Diff
7812
output/nahj_speechs_new.json
Normal file
7812
output/nahj_speechs_new.json
Normal file
File diff suppressed because it is too large
Load Diff
24
temp2.py
Normal file
24
temp2.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import json
|
||||||
|
|
||||||
|
path = './output/nahj_speechs_new.json'
|
||||||
|
|
||||||
|
with open(path, 'r' , encoding='utf-8') as f:
|
||||||
|
records = json.load(f)
|
||||||
|
|
||||||
|
|
||||||
|
for index, item in enumerate(records):
|
||||||
|
try:
|
||||||
|
if item['sentences']:
|
||||||
|
continue
|
||||||
|
except:
|
||||||
|
sentences = []
|
||||||
|
sentences.append(item['persian_translate'].strip())
|
||||||
|
item['sentences'] = sentences
|
||||||
|
|
||||||
|
path = './output/nahj_speechs_complete.json'
|
||||||
|
|
||||||
|
data = json.dumps(records, ensure_ascii=False, indent=2)
|
||||||
|
with open(path, 'w' , encoding='utf-8') as f:
|
||||||
|
f.write(data)
|
||||||
|
|
||||||
|
print('finished!')
|
Loading…
Reference in New Issue
Block a user