Fix training year filter and reject incomplete OCR titles

This commit is contained in:
codex committed 2026-11-24 10:21:22 +00:00
1 parent 65d851bb92
commit 3717a00459
3 files changed
+11 -4

No files matched your search

+1 -2
View File
@@ -42,7 +42,6 @@ DIRECTORY_COLUMNS = (
)
_TRAINING_LABEL = "повышение квалификации"
_TRAINING_KIND = re.compile(r",\s*повышение квалификации\s*(?:,|$)", re.IGNORECASE)
_TRAINING_MENTION = re.compile(
r"\b(?:повышение квалификации|(?:курс|программ)[а-яё]* (?:повышения|по повышению) квалификации)\b",
re.IGNORECASE,
@@ -66,7 +65,7 @@ def _has_training(data: dict[str, Any], since_year: int | None) -> bool:
structured_texts.add(text)
if since_year is not None and (type(year) is not int or year < since_year):
continue
if text and text != str(year) and (dedicated or _TRAINING_KIND.search(_QUOTED_TEXT.sub("", text))):
if text and text != str(year) and (dedicated or _TRAINING_MENTION.search(_QUOTED_TEXT.sub("", text))):
return True
# Profiles may also list completed courses in manually entered paragraphs or lists.
for text in _clean_list(section.get("paragraphs")) + _clean_list(section.get("items")):