From f7900c84e56476fe4ac316cccb40a837611c6ee5 Mon Sep 17 00:00:00 2001 From: Cyprian Laskowski Date: Fri, 8 Jan 2021 10:43:46 +0100 Subject: [PATCH] IssueID #1487: added p prefix for paragraph xml ids --- scripts/tweak_conllu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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())