mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Resolve a party-ceiling roof marker to the party-ceiling member 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6fc10683d2
commit
87d0cc41ab
1 changed files with 15 additions and 1 deletions
|
|
@ -1,9 +1,23 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import Optional
|
||||
|
||||
from domain.epc.property_overrides.roof_type import RoofType
|
||||
|
||||
# The roof-type token (before any ``: <insulation>`` suffix), normalised to lower
|
||||
# alphanumerics, → its party-ceiling RoofType member. Normalising strips spacing
|
||||
# and case so both ``"another dwelling above"`` and ``"anotherdwellingabove"``
|
||||
# match the same marker.
|
||||
_PARTY_CEILING_MARKERS: dict[str, RoofType] = {
|
||||
"anotherdwellingabove": RoofType.ADJACENT_ANOTHER_DWELLING_ABOVE,
|
||||
}
|
||||
|
||||
|
||||
def _normalise_roof_token(description: str) -> str:
|
||||
token = description.split(":", 1)[0]
|
||||
return re.sub(r"[^a-z0-9]", "", token.lower())
|
||||
|
||||
|
||||
def roof_party_ceiling_guard(description: str) -> Optional[RoofType]:
|
||||
"""Deterministically resolve a party-ceiling roof description to its RoofType.
|
||||
|
|
@ -20,4 +34,4 @@ def roof_party_ceiling_guard(description: str) -> Optional[RoofType]:
|
|||
that is not a party-ceiling marker so the LLM classifier still handles it
|
||||
(#1376).
|
||||
"""
|
||||
raise NotImplementedError
|
||||
return _PARTY_CEILING_MARKERS.get(_normalise_roof_token(description))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue