Dominant secondary-glazing split resolves deterministically to SECONDARY 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jun-te Kim 2026-07-02 11:10:40 +00:00
parent 787f0066c8
commit 248e230d37

View file

@ -17,11 +17,12 @@ _PERCENT_TYPE = re.compile(
# One base type at or above this share is a uniform assertion, not a mix — applied
# as that type (a near-uniform reglaze), not deferred.
_UNIFORM_THRESHOLD_PERCENT = 90
# A dominant base type + stated era → the fully-determined canonical member. Single
# glazing is era-free, so it needs no era. Double/triple with no (or non-canonical)
# era is absent here and falls through to the LLM.
# A dominant base type + stated era → the fully-determined canonical member.
# Single and secondary glazing are era-free, so they need no era. Double/triple
# with no (or non-canonical) era is absent here and falls through to the LLM.
_DOMINANT_MEMBER: dict[tuple[str, Optional[str]], GlazingType] = {
("single", None): GlazingType.SINGLE,
("secondary", None): GlazingType.SECONDARY,
("double", "2002 or later"): GlazingType.DOUBLE_POST_2002,
("double", "pre-2002"): GlazingType.DOUBLE_PRE_2002,
("triple", "2002 or later"): GlazingType.TRIPLE_POST_2002,
@ -51,9 +52,9 @@ def glazing_mix_guard(description: str) -> Optional[GlazingType]:
* ``MIXED`` for a genuine mix two or more glazing types present and none
dominant ( the uniform threshold);
* the fully-determined member for a dominant near-uniform split whose type
carries no era ambiguity single glazing (era-free), or a dominant
double/triple whose era is stated ("pre-2002" / "2002 or later"); the LLM
would otherwise flatten such a split onto its *minority* type;
carries no era ambiguity single or secondary glazing (era-free), or a
dominant double/triple whose era is stated ("pre-2002" / "2002 or later");
the LLM would otherwise flatten such a split onto its *minority* type;
* ``None`` otherwise an unparseable description, or a dominant double/triple
with an unstated/non-canonical era ("unknown age") that still carries genuine
era ambiguity so the LLM classifier resolves it.