From dadea5bf3b26d233a23c8b7b07ab1d9abbc24e0c Mon Sep 17 00:00:00 2001 From: Jennifer Jiang <37081323+jenniferajiang@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:45:32 +0000 Subject: [PATCH] Release v1.0.3 (#112) * Fix for one-line heading in paragraph chunking algorithm --- src/miade/note.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/miade/note.py b/src/miade/note.py index 3c98815..cda38f9 100644 --- a/src/miade/note.py +++ b/src/miade/note.py @@ -43,7 +43,7 @@ class Note(object): def __init__(self, text: str, regex_config_path: str = "./data/regex_para_chunk.csv"): self.text = text self.raw_text = text - self.regex_config = load_regex_config_mappings("./data/regex_para_chunk.csv") + self.regex_config = load_regex_config_mappings(regex_config_path) self.paragraphs: Optional[List[Paragraph]] = [] def clean_text(self) -> None: @@ -74,12 +74,9 @@ def get_paragraphs(self) -> None: if match: heading = match.group(1) body = match.group(2) - if body == "": - body = heading - heading = "" else: - heading = "" - body = text + heading = text + body = "" end = start + len(text) paragraph = Paragraph(heading=heading, body=body, type=paragraph_type, start=start, end=end)