fixing multiple translations and issues with epc descriptions

This commit is contained in:
Khalim Conn-Kowlessar 2024-09-24 20:53:24 +01:00
parent 504d46c929
commit 3ebda6277e
3 changed files with 32 additions and 14 deletions

View file

@ -69,6 +69,8 @@ class MainHeatAttributes(Definitions):
"portable electric heating assumed for most rooms": "portable electric heaters assumed for most rooms",
"electric storage, electric": "electric storage heaters",
"radiator heating, electric": "room heaters, electric",
"hot-water-only systems, gas": "no system present, electric heaters assumed",
"gas-fired heat pumps, electric": "air source heat pump, electric",
}
edge_case_result = {}

View file

@ -66,10 +66,18 @@ class RoofAttributes(Definitions):
search for regular expressions and translate
"""
loft_insulation_thickness_match = re.search(r"ar oleddf, (\d+ mm) o inswleiddio yn y llofft", self.description)
loft_insulation_thickness_match2 = re.search(r"ar oleddf, (\d+ mm) lo inswleiddio yn y llof", self.description)
loft_insulation_thickness_match3 = re.search(r"ar oleddf, (\d+\+ mm) lo inswleiddio yn y llof",
self.description)
loft_insulation_regexes = [
r"ar oleddf, (\d+ mm) o inswleiddio yn y llofft",
r"ar oleddf, (\d+ mm) lo inswleiddio yn y llof",
r"ar oleddf, (\d+\+ mm) lo inswleiddio yn y llof",
r"ar oleddf, (\d+mm) o inswleiddio yn y llofft",
r"ar oleddf, (\d+\+ mm) o inswleiddio yn y llofft"
]
li_thickness_match = None
for regex in loft_insulation_regexes:
li_thickness_match = re.search(regex, self.description)
if li_thickness_match:
break
uvalue_search = re.search(r"trawsyriannedd thermol cyfartalog (\d+(\.\d+)?)\s*w/m-¦k", self.description)
uvalue_search2 = re.search(
@ -77,15 +85,8 @@ class RoofAttributes(Definitions):
)
# Step 2: Generalized translation with placeholder
if (loft_insulation_thickness_match is not None) | \
(loft_insulation_thickness_match2 is not None) | \
(loft_insulation_thickness_match3 is not None):
if loft_insulation_thickness_match is not None:
insulation_thickness = loft_insulation_thickness_match.group(1)
elif loft_insulation_thickness_match2 is not None:
insulation_thickness = loft_insulation_thickness_match2.group(1)
else:
insulation_thickness = loft_insulation_thickness_match3.group(1)
if li_thickness_match is not None:
insulation_thickness = li_thickness_match.group(1)
self.description = f"pitched, {insulation_thickness} loft insulation"
elif uvalue_search is not None or uvalue_search2 is not None:

View file

@ -1677,6 +1677,21 @@ mainheat_cases = [
'has_coal': False, 'has_oil': False, 'has_wood_pellets': False, 'has_anthracite': False,
'has_dual_fuel_mineral_and_wood': False, 'has_smokeless_fuel': False, 'has_lpg': False, 'has_b30k': False,
'has_assumed': False, 'has_electricaire': False, 'has_assumed_for_most_rooms': False,
'has_underfloor_heating': False}
'has_underfloor_heating': False},
{
'original_description': 'Hot-Water-Only Systems, gas',
'has_radiators': False, 'has_fan_coil_units': False, 'has_pipes_in_screed_above_insulation': False,
'has_pipes_in_insulated_timber_floor': False, 'has_pipes_in_concrete_slab': False, 'has_boiler': False,
'has_air_source_heat_pump': False, 'has_room_heaters': False, 'has_electric_storage_heaters': False,
'has_warm_air': False, 'has_electric_underfloor_heating': False, 'has_electric_ceiling_heating': False,
'has_community_scheme': False, 'has_ground_source_heat_pump': False, 'has_no_system_present': True,
'has_portable_electric_heaters': False, 'has_water_source_heat_pump': False, 'has_electric_heat_pump': False,
'has_micro-cogeneration': False, 'has_solar_assisted_heat_pump': False, 'has_exhaust_source_heat_pump': False,
'has_community_heat_pump': False, 'has_electric': True, 'has_mains_gas': False, 'has_wood_logs': False,
'has_coal': False, 'has_oil': False, 'has_wood_pellets': False, 'has_anthracite': False,
'has_dual_fuel_mineral_and_wood': False, 'has_smokeless_fuel': False, 'has_lpg': False, 'has_b30k': False,
'has_assumed': True, 'has_electricaire': False, 'has_assumed_for_most_rooms': False,
'has_underfloor_heating': False
}
]