Skip to content
Snippets Groups Projects
Commit c81711ef authored by nwarslan's avatar nwarslan
Browse files

code

parent fb947d77
No related branches found
No related tags found
No related merge requests found
......@@ -94,14 +94,14 @@ def tag_de_text(summary):
if summary['DeUnderTitle'] != None:
if len(summary['DeUnderTitle'])>0:
txt += '<UNDERTITLE>'+summary['DeUnderTitle']+'</UNDERTITLE>'
if len(summary['DeTeaser'])>0:
txt += '<TEASER>'+summary['DeTeaser']+'</TEASER>'
if summary['DeTeaser'] != None:
if len(summary['DeTeaser'])>0:
txt += '<TEASER>'+summary['DeTeaser']+'</TEASER>'
sections = summary['DeSummary'].split('\n')
sections = [s for s in sections if s != '']
for paragraph in sections:
txt += '<SECTION>'+split_into_sentences(paragraph)+'</SECTION>'
txt += '</ARTICLE>'
#print(txt)
return txt
def load_json(filename):
......@@ -114,15 +114,9 @@ def data(title, sections, ID):
with open(DE_SUM, 'r') as f:
summaries = json.load(f)
#de_en_articles = load_pkl(OUT+'de_en_articles.pkl')
de_en_articles = load_json(OUT+'de_en_articles.json')
en_tagged_text = tag_en_text(title, sections)
#de_summary = summaries[ID]
#with open(OUT+ID+'_de.txt','w') as f:
#f.writelines(summaries[ID]['DeTitle']+'\n\n'+summaries[ID]['DeSummary'])
de_tagged_text = tag_de_text(summaries[ID])
#print(de_en_articles.keys())
de_en_articles[ID]={'De_Summary': de_tagged_text,'En_Article': en_tagged_text}
#if ID in de_en_articles.keys():
with open(OUT+'de_en_articles.json','w') as f:
json.dump(de_en_articles,f)
\ No newline at end of file
json.dump(de_en_articles,f)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment