diff --git a/scripts/tweak_conllu.py b/scripts/tweak_conllu.py index 8ccaec8..53ad6d2 100644 --- a/scripts/tweak_conllu.py +++ b/scripts/tweak_conllu.py @@ -34,7 +34,8 @@ for line in input_file: (name, value) = match.groups() if (name == 'newpar id'): 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'): if (value.endswith('.1')): output_map['sentence'] = re.sub('^(# sent_id = )(\d+\.1)$', r'\1s\2', line.strip())