diff --git a/backend/lesson_info.py b/backend/lesson_info.py index ca5cc62b..177ef43e 100644 --- a/backend/lesson_info.py +++ b/backend/lesson_info.py @@ -16,8 +16,9 @@ class _InfoParsers: - _teacher_name = r"[A-ZÄÖÜ][a-zäöüß]+(?: [A-ZÄÖÜ][a-zäöüß]+(?:-[A-ZÄÖÜ][a-zäöüß]+|\.)?)+" - _teacher_abbreviation = r"[A-ZÄÖÜ][A-ZÄÖÜa-zäöüß]*" + _teacher_name = (r"[A-ZÄÖÜ][a-zäöüß]+(?: [A-ZÄÖÜ][a-zäöüß]+(?:-[A-ZÄÖÜ][a-zäöüß]+)?\.?)*" + r"(?: [A-ZÄÖÜ][a-zäöüß]+(?:-[A-ZÄÖÜ][a-zäöüß]+)?)") + _teacher_abbreviation = r"[A-ZÄÖÜ][A-ZÄÖÜa-zäöüß]{2,}" _teacher = fr"(?:{_teacher_name})|(?:{_teacher_abbreviation})" # teacher a,teacher b @@ -819,7 +820,7 @@ def add_fuzzy_teachers(text: str, teacher_abbreviation_by_surname: dict[str, str segments = [] prev = 0 - for match in re.finditer(r"\b\w+", text): + for match in re.finditer(rf"{_InfoParsers._teacher}|\b\w+", text): segments.append(LessonInfoTextSegment(text[prev:match.start()])) prev = match.end() diff --git a/backend/plan_processor.py b/backend/plan_processor.py index 99c97dd6..67fb5d9b 100644 --- a/backend/plan_processor.py +++ b/backend/plan_processor.py @@ -14,7 +14,7 @@ class PlanProcessor: - VERSION = "78" + VERSION = "79" def __init__(self, cache: Cache, school_number: str, *, logger: logging.Logger): self._logger = logger