IssueID #1487: added p prefix for paragraph xml ids

This commit is contained in:
Cyprian Laskowski 2021-01-08 10:43:46 +01:00
parent 3761f8b253
commit f7900c84e5

View File

@ -34,7 +34,8 @@ for line in input_file:
(name, value) = match.groups() (name, value) = match.groups()
if (name == 'newpar id'): if (name == 'newpar id'):
write_paragraph(output_file, output_map) write_paragraph(output_file, output_map)
output_map = {'paragraph': line.strip(), 'sentence':None, 'texts':[], 'tokens':[]} paragraph_line = re.sub('^(# newpar id = )(\d+)$', r'\1p\2', line.strip())
output_map = {'paragraph': paragraph_line, 'sentence':None, 'texts':[], 'tokens':[]}
elif (name == 'sent_id'): elif (name == 'sent_id'):
if (value.endswith('.1')): if (value.endswith('.1')):
output_map['sentence'] = re.sub('^(# sent_id = )(\d+\.1)$', r'\1s\2', line.strip()) output_map['sentence'] = re.sub('^(# sent_id = )(\d+\.1)$', r'\1s\2', line.strip())