Mark a role whose title or text says remote while no field does, in prep with no model, and let it meet a gate on remote until extract has read it (migration 35, roles.remote_text)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-10-06 14:02:46 +02:00
1 parent f141cffc3c
commit 49929372c7
14 files changed
+144 -36

No files matched your search

+33
View File
@@ -58,6 +58,39 @@ _NOT_REMOTE_WORK = re.compile(r"\bremote[\s-]+(?:sensing|control\w*|monitoring)\
re.IGNORECASE)
#: Phrases in a title or text that say the role is worked remotely, and the
#: phrases that take one back. Both are read on the lowercased text with its
#: hyphens and runs of spaces squashed to one space. A match marks the role as
#: possibly remote (`remote_in_text`); it decides nothing by itself.
REMOTE_TEXT: tuple[str, ...] = (
"fully remote", "100% remote", "100 % remote", "remote first", "remote work",
"remote working", "work remotely", "working remotely", "remote position", "remote role",
"remote job", "remote team", "remote friendly", "remote possible", "remote option",
"remote ok", "work from home", "working from home", "work from anywhere", "home based",
"home office", "homeoffice", "hjemmearbejde", "fjernarbejde", "distansarbete",
)
REMOTE_TEXT_NOT: tuple[str, ...] = (
"no remote", "not remote", "not a remote", "non remote", "not be remote", "cannot be remote",
"no home office", "kein homeoffice", "not available remotely", "not open to remote",
"remote work is not", "remote working is not", "is not a remote", "remote sensing",
"remote control", "remote monitoring",
)
_REMOTE_TEXT = re.compile("|".join(rf"\b{re.escape(p)}\b" for p in REMOTE_TEXT))
_REMOTE_TEXT_NOT = re.compile("|".join(rf"\b{re.escape(p)}\b" for p in REMOTE_TEXT_NOT))
_SQUASHED = re.compile(r"[\s-]+")
def remote_in_text(title: str, text: str) -> bool:
"""Whether the title or the text says the role is worked remotely: a
phrase of `REMOTE_TEXT` left once those of `REMOTE_TEXT_NOT` are taken
out. Cheap evidence, no model: a role marked so passes a location gate
on remote until extract has read it (ADR Fetch prep and score 1.1), so a
false mark costs a cut slot at most, and a missed one nothing new."""
folded = _SQUASHED.sub(" ", f"{title or ''} {text or ''}".lower())
return bool(_REMOTE_TEXT.search(_REMOTE_TEXT_NOT.sub(" ", folded)))
def _line_word(text: str) -> str:
"""`remote_of`'s reading of a line, else its Danish and Swedish words."""
if found := remote_of(text):