adding welsh translations

This commit is contained in:
Khalim Conn-Kowlessar 2023-09-11 11:08:47 +01:00
parent e17983da1a
commit 9bcd78eccc
11 changed files with 98 additions and 60 deletions

View file

@ -32,53 +32,6 @@ def app():
:return:
"""
# epc_client = EpcClient(auth_token=EPC_AUTH_TOKEN)
#
# constituencies = {'E14000555', 'E14000726', 'E14000720', 'E14000721', 'E14000553', 'E14000752'}
# property_types = ["bungalow", "flat", "house", "maisonette", "park home"]
# floor_areas = ["unknown", "s", "m", "l", "xl", "xxl", "xxxl"]
#
# # We pull properties from local authorities, by property type. This will allow us to build
# # a dataset of up to 10k properties per local authority/property type combination
# # For particularly old EPC data, we have inconsistent records so we'll only include EPCS that were
# # conducted after 2010, since SAP09 was introduced in 2009 an later SAP12 was introduced in England
# # and Wales from 31 July 2014
# # Download data from August 2014 onwards
# data = []
# for c in tqdm(constituencies):
# for pt in property_types:
# for fa in floor_areas:
# data.extend(
# pagenated_epc_download(
# client=epc_client,
# params={
# "constituency": c,
# "property-type": pt,
# "from-month": 8,
# "from-year": 2014,
# "floor-area": fa,
# },
# page_size=5000,
# n_pages=10,
# )
# )
# Production of sample data for land registry
# address_meta = [
# {
# "postcode": x["postcode"].upper(),
# "address1": x["address1"].upper(),
# "address2": x["address2"].upper(),
# "address3": x["address3"].upper(),
# "address": x["address"],
# "uprn": x["uprn"]
# } for x in data
# ]
#
# import pickle
# with open("sample_addresses.pkl", "wb") as f:
# pickle.dump(address_meta, f)
# Begin by setting up an empty cleaner
cleaner = EpcClean([])

View file

@ -21,7 +21,9 @@ class FloorAttributes(Definitions):
"crog, dim inswleiddio": "suspended, no insulation",
"(eiddo arall islaw)": "(other premises below)",
"solet, inswleiddio cyfyngedig (rhagdybiaeth)": "solid, limited insulation (assumed)",
"solet, inswleiddio cyfyngedig": "solid, limited insulation"
"solet, inswleiddio cyfyngedig": "solid, limited insulation",
"crog, wedigçöi inswleiddio (rhagdybiaeth)": "suspended, insulated (assumed)",
"crog, wedigçöi inswleiddio": "suspended, insulated"
}
def __init__(self, description: str):

View file

@ -100,7 +100,8 @@ class HotWaterAttributes(Definitions):
"ogçör brif system, dim thermostat ar y silindr": "from main system, no cylinder thermostat",
"twymwr tanddwr, an-frig": "electric immersion, off-peak",
"ogçör brif system, gydag ynnigçör haul": "from main system, plus solar",
"twymwr tanddwr, tarriff safonol": "electric immersion, standard tariff"
"twymwr tanddwr, tarriff safonol": "electric immersion, standard tariff",
"trydan ar unwaith yn y fan lle maegçön cael ei ddefnyddio": 'electric instantaneous at point of use'
}
def __init__(self, description: str):

View file

@ -29,7 +29,10 @@ class MainHeatAttributes(Definitions):
"bwyler a rheiddiaduron, olew": "boiler and radiators, oil",
"heat pumptrydan": "electric heat pump",
"bwyler a rheiddiaduron, trydan": "boiler and radiators, electric",
"bwyler a gwres dan y llawr, olew": "boiler and underfloor heating, oil"
"bwyler a gwres dan y llawr, olew": "boiler and underfloor heating, oil",
'bwyler a rheiddiaduron, lpg': 'boiler and radiators, lpg',
"gwresogyddion ystafell, trydan": "room heaters, electric",
"pwmp gwres sygçön tarddu yn yr awyr, dan y llawr, trydan": "air source heat pump, underfloor heating, electric"
}
REMAP = {

View file

@ -78,6 +78,7 @@ class MainheatControlAttributes(Definitions):
"rhaglennydd a thermostat ystafell": "programmer and room thermostat",
"rheoligçör t+ól +ó llaw": "manual charge control",
"rheolaeth amser a rheolaeth parthau tymheredd": "time and temperature zone control",
"rhaglennydd a thermostatau ar y cyfarpar": "programmer, room thermostat",
}
def __init__(self, description: str):

View file

@ -11,12 +11,17 @@ class RoofAttributes(Definitions):
WELSH_TEXT = {
"ar oleddf, dim inswleiddio": "pitched, no insulation",
"ar oleddf, dim inswleiddio (rhagdybiaeth)": "pitched, no insulation (assumed)",
"(annedd arall uwchben)": "(another dwelling above)",
"yn wastad, inswleiddio cyfyngedig (rhagdybiaeth)": "Flat, limited insulation (assumed)",
"yn wastad, inswleiddio cyfyngedig": "Flat, limited insulation",
"ar oleddf, wedigçöi inswleiddio (rhagdybiaeth)": "pitched, insulated (assumed)",
"ar oleddf, wedigçöi inswleiddio": "pitched, insulated",
"(eiddo arall uwchben)": "(another dwelling above)"
"ar oleddf, inswleiddio cyfyngedig (rhagdybiaeth)": "pitched, limited insulation (assumed)",
"ar oleddf, inswleiddio cyfyngedig": "pitched, limited insulation",
"yn wastad, inswleiddio cyfyngedig (rhagdybiaeth)": "flat, limited insulation (assumed)",
"yn wastad, inswleiddio cyfyngedig": "flat, limited insulation",
"yn wastad, dim inswleiddio (rhagdybiaeth)": "flat, no insulation (assumed)",
"yn wastad, dim inswleiddio": "flat, no insulation",
"(eiddo arall uwchben)": "(another dwelling above)",
"(annedd arall uwchben)": "(another dwelling above)",
"ystafell(oedd) to, wedigçöi hinswleiddio": "roof room(s), insulated",
}
def __init__(self, description: str):
@ -42,13 +47,17 @@ class RoofAttributes(Definitions):
search for regular expressions and translate
"""
insulation_thickness_match = re.search(r"(\d+ mm) o inswleiddio yn y llofft", self.description)
insulation_thickness_match = re.search(r"ar oleddf, (\d+ mm) o inswleiddio yn y llofft", self.description)
insulation_thickness_match2 = re.search(r"ar oleddf, (\d+ mm) lo inswleiddio yn y llof", self.description)
uvalue_search = re.search(r"trawsyriannedd thermol cyfartalog (\d+(\.\d+)?)\s*w/m-¦k", self.description)
# Step 2: Generalized translation with placeholder
if insulation_thickness_match:
insulation_thickness = insulation_thickness_match.group(1)
if (insulation_thickness_match is not None) | (insulation_thickness_match2 is not None):
if insulation_thickness_match is not None:
insulation_thickness = insulation_thickness_match.group(1)
else:
insulation_thickness = insulation_thickness_match2.group(1)
self.description = f"pitched, {insulation_thickness} loft insulation"
elif uvalue_search:
uvalue = uvalue_search.group(1)

View file

@ -350,4 +350,7 @@ clean_floor_cases = [
{'original_description': 'Solet, inswleiddio cyfyngedig (rhagdybiaeth)', 'thermal_transmittance': None,
'thermal_transmittance_unit': None, 'is_assumed': True, 'is_to_unheated_space': False, 'is_to_external_air': False,
'is_suspended': False, 'is_solid': True, 'insulation_thickness': 'below average', "another_property_below": False},
{'original_description': 'Crog, wediGÇÖi inswleiddio (rhagdybiaeth)', 'thermal_transmittance': None,
'thermal_transmittance_unit': None, 'is_assumed': True, 'is_to_unheated_space': False, 'is_to_external_air': False,
'is_suspended': True, 'is_solid': False, 'insulation_thickness': 'average', "another_property_below": False},
]

View file

@ -154,5 +154,10 @@ hotwater_cases = [
{'original_description': 'Twymwr tanddwr, tarriff safonol', 'heater_type': 'electric immersion',
'system_type': None, 'thermostat_characteristics': None, 'heating_scope': None, 'energy_recovery': None,
'tariff_type': 'standard tariff', 'extra_features': None, 'chp_systems': None, 'distribution_system': None,
'no_system_present': None, 'assumed': False, "appliance": None}
'no_system_present': None, 'assumed': False, "appliance": None},
{'original_description': 'Trydan ar unwaith yn y fan lle maeGÇÖn cael ei ddefnyddio',
'heater_type': 'electric instantaneous',
'system_type': None, 'thermostat_characteristics': None, 'heating_scope': None, 'energy_recovery': None,
'tariff_type': None, 'extra_features': None, 'chp_systems': None, 'distribution_system': None,
'no_system_present': None, 'assumed': False, "appliance": None},
]

View file

@ -1201,6 +1201,53 @@ mainheat_cases = [
'has_electric': False, 'has_mains_gas': False, 'has_wood_logs': False, 'has_LPG': False, 'has_coal': False,
'has_oil': True, 'has_wood_pellets': False, 'has_anthracite': False, 'has_dual_fuel_mineral_and_wood': False,
'has_smokeless_fuel': False, 'has_lpg': False, 'has_assumed': False, 'has_electricaire': False,
'has_assumed_for_most_rooms': False, 'has_underfloor_heating': True}
'has_assumed_for_most_rooms': False, 'has_underfloor_heating': True},
{'original_description': 'Bwyler a rheiddiaduron, LPG', 'has_radiators': True, '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': True, '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': False, 'has_portable_electric_heaters': False,
'has_water_source_heat_pump': False, 'has_electric': False, 'has_mains_gas': False, 'has_wood_logs': False,
'has_LPG': 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': True, 'has_assumed': False,
'has_electricaire': False, 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': False,
"has_electric_heat_pumps": False,
"has_micro-cogeneration": False},
{'original_description': 'Gwresogyddion ystafell, trydan', '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': True, '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': False, 'has_portable_electric_heaters': False,
'has_water_source_heat_pump': False, 'has_electric': True, 'has_mains_gas': False, 'has_wood_logs': False,
'has_LPG': 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_assumed': False,
'has_electricaire': False, 'has_assumed_for_most_rooms': False, 'has_underfloor_heating': False,
"has_electric_heat_pumps": False,
"has_micro-cogeneration": False},
{'original_description': 'Air source heat pump, Underfloor heating, electric',
'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': True, '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': False,
'has_portable_electric_heaters': False, 'has_water_source_heat_pump': False, 'has_electric': True,
'has_mains_gas': False, 'has_wood_logs': False, 'has_LPG': 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_assumed': False, 'has_electricaire': False,
'has_assumed_for_most_rooms': False, 'has_underfloor_heating': True, "has_electric_heat_pumps": False,
"has_micro-cogeneration": False},
{'original_description': 'Pwmp gwres syGÇÖn tarddu yn yr awyr, dan y llawr, trydan, electric',
'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': True, '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': False,
'has_portable_electric_heaters': False, 'has_water_source_heat_pump': False, 'has_electric': True,
'has_mains_gas': False, 'has_wood_logs': False, 'has_LPG': 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_assumed': False, 'has_electricaire': False,
'has_assumed_for_most_rooms': False, 'has_underfloor_heating': True, "has_electric_heat_pumps": False,
"has_micro-cogeneration": False},
]

View file

@ -147,4 +147,10 @@ mainheat_control_cases = [
'thermostatic_control': 'time and temperature zone control', 'charging_system': None, 'switch_system': None,
'no_control': None, 'dhw_control': None, 'community_heating': None, 'multiple_room_thermostats': False,
'auxiliary_systems': None, 'trvs': None},
{'original_description': 'Programmer, room thermostat', 'thermostatic_control': 'room thermostat',
'charging_system': None, 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None,
'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None},
{'original_description': 'Rhaglennydd a thermostatau ar y cyfarpar', 'thermostatic_control': 'room thermostat',
'charging_system': None, 'switch_system': 'programmer', 'no_control': None, 'dhw_control': None,
'community_heating': None, 'multiple_room_thermostats': False, 'auxiliary_systems': None, 'trvs': None},
]

View file

@ -366,4 +366,12 @@ clean_roof_test_cases = [
'thermal_transmittance_unit': None, 'is_pitched': False, 'is_roof_room': False, 'is_loft': False, 'is_flat': False,
'is_thatched': False, 'is_at_rafters': False, 'is_assumed': False, 'has_dwelling_above': True, 'is_valid': True,
'insulation_thickness': None},
{'original_description': 'Ar oleddf, inswleiddio cyfyngedig (rhagdybiaeth)', 'thermal_transmittance': None,
'thermal_transmittance_unit': None, 'is_pitched': True, 'is_roof_room': False, 'is_loft': False, 'is_flat': False,
'is_thatched': False, 'is_at_rafters': False, 'is_assumed': True, 'has_dwelling_above': False, 'is_valid': True,
'insulation_thickness': 'below average'},
{'original_description': 'Ystafell(oedd) to, wediGÇÖi hinswleiddio', 'thermal_transmittance': None,
'thermal_transmittance_unit': None, 'is_pitched': False, 'is_roof_room': True, 'is_loft': False, 'is_flat': False,
'is_thatched': False, 'is_at_rafters': False, 'is_assumed': False, 'has_dwelling_above': False, 'is_valid': True,
'insulation_thickness': 'average'},
]