From 93323375814528709a3c8c600f23c23f68d34601 Mon Sep 17 00:00:00 2001 From: Nick Touran Date: Fri, 28 Nov 2025 16:07:55 -0500 Subject: [PATCH] Fix ordering and naming of App A --- src/nrsk/regs/load_10cfr50.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/nrsk/regs/load_10cfr50.py b/src/nrsk/regs/load_10cfr50.py index 1364212..c2f6133 100755 --- a/src/nrsk/regs/load_10cfr50.py +++ b/src/nrsk/regs/load_10cfr50.py @@ -93,7 +93,7 @@ def process_10cfr50_app_a(): def process(line): line = re.sub(r"\((\d+)\)", r"\1.", line) - line = re.sub(r"\((.+)\)", r", \1,", line) + line = re.sub(r"\((.+?)\)", r", \1,", line) return line needs_lines = [".. list2need::", " :types: req, req, req", ""] @@ -105,7 +105,9 @@ def process_10cfr50_app_a(): if re.search(r"^[A-Z]+\. [A-Z]", line): LOG.info("Reading %s", line) elif match := re.search(r"^Criterion (\d+)—(.+?)\.(.+)", line): - num = match.group(1).strip() + num = int(match.group(1).strip()) + if num == 34: + breakpoint() title = match.group(2).strip() subnum = 1 LOG.info( @@ -113,18 +115,18 @@ def process_10cfr50_app_a(): match.group(1).strip(), match.group(2).strip(), ) - needs_lines.append(f" * (R_GDC_{num}){process(title)}") + needs_lines.append(f" * (R_GDC_{num:02d}){process(title)}") sentences = tokenize.tokenize_sentences(match.group(3).strip()) for sent in sentences: needs_lines.append( - f" * (R_GDC_{num}_{subnum}){process(sent.strip())}" + f" * (R_GDC_{num:02d}_{subnum:02d}){process(sent.strip())}" ) subnum += 1 else: sentences = tokenize.tokenize_sentences(line) for sent in sentences: needs_lines.append( - f" * (R_GDC_{num}_{subnum}){process(sent.strip())}" + f" * (R_GDC_{num:02d}_{subnum:02d}){process(sent.strip())}" ) subnum += 1