Fix ordering and naming of App A
This commit is contained in:
parent
7d09eaecb7
commit
9332337581
1 changed files with 7 additions and 5 deletions
|
|
@ -93,7 +93,7 @@ def process_10cfr50_app_a():
|
||||||
|
|
||||||
def process(line):
|
def process(line):
|
||||||
line = re.sub(r"\((\d+)\)", r"\1.", 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
|
return line
|
||||||
|
|
||||||
needs_lines = [".. list2need::", " :types: req, req, req", ""]
|
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):
|
if re.search(r"^[A-Z]+\. [A-Z]", line):
|
||||||
LOG.info("Reading %s", line)
|
LOG.info("Reading %s", line)
|
||||||
elif match := re.search(r"^Criterion (\d+)—(.+?)\.(.+)", 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()
|
title = match.group(2).strip()
|
||||||
subnum = 1
|
subnum = 1
|
||||||
LOG.info(
|
LOG.info(
|
||||||
|
|
@ -113,18 +115,18 @@ def process_10cfr50_app_a():
|
||||||
match.group(1).strip(),
|
match.group(1).strip(),
|
||||||
match.group(2).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())
|
sentences = tokenize.tokenize_sentences(match.group(3).strip())
|
||||||
for sent in sentences:
|
for sent in sentences:
|
||||||
needs_lines.append(
|
needs_lines.append(
|
||||||
f" * (R_GDC_{num}_{subnum}){process(sent.strip())}"
|
f" * (R_GDC_{num:02d}_{subnum:02d}){process(sent.strip())}"
|
||||||
)
|
)
|
||||||
subnum += 1
|
subnum += 1
|
||||||
else:
|
else:
|
||||||
sentences = tokenize.tokenize_sentences(line)
|
sentences = tokenize.tokenize_sentences(line)
|
||||||
for sent in sentences:
|
for sent in sentences:
|
||||||
needs_lines.append(
|
needs_lines.append(
|
||||||
f" * (R_GDC_{num}_{subnum}){process(sent.strip())}"
|
f" * (R_GDC_{num:02d}_{subnum:02d}){process(sent.strip())}"
|
||||||
)
|
)
|
||||||
subnum += 1
|
subnum += 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue