windows and lighting debugged

This commit is contained in:
Khalim Conn-Kowlessar 2023-07-21 10:40:47 +01:00
parent 3f723785e4
commit 0594ab7a7e
3 changed files with 14 additions and 2 deletions

View file

@ -17,6 +17,10 @@ class WindowAttributes(BaseUtility):
"throughout": "full"
}
WELSH_TEXT = {
"gwydrau dwbl llawn": "full double glazing",
}
def __init__(self, description: str):
self.description: str = clean_description(description.lower())
@ -24,6 +28,11 @@ class WindowAttributes(BaseUtility):
# and indicate there was no data
self.nodata = not description or description in self.DATA_ANOMALY_MATCHES
translation = self.WELSH_TEXT.get(self.description)
if translation:
self.nodata = False
self.description = translation
if not self.nodata:
if not any(
rt in self.description for rt in

View file

@ -29,5 +29,6 @@ test_cases = [
{'original_description': 'Below average lighting efficiency', 'low_energy_proportion': 0.25},
{'original_description': 'Excellent lighting efficiency', 'low_energy_proportion': 1.0},
{'original_description': 'Low energy lighting in 2% of fixed outlets', 'low_energy_proportion': 0.02},
{'original_description': 'No Low energy lighting', 'low_energy_proportion': 0}
{'original_description': 'No Low energy lighting', 'low_energy_proportion': 0},
{'original_description': 'Goleuadau ynni-isel mewn 60% oGÇÖr mannau gosod', 'low_energy_proportion': 0.6}
]

View file

@ -35,5 +35,7 @@ windows_cases = [
{'original_description': 'Some secondary glazing', 'has_glazing': True, 'glazing_coverage': 'partial',
'glazing_type': 'secondary', 'no_data': False},
{'original_description': 'Some triple glazing', 'has_glazing': True, 'glazing_coverage': 'partial',
'glazing_type': 'triple', 'no_data': False}
'glazing_type': 'triple', 'no_data': False},
{'original_description': 'Gwydrau dwbl llawn', 'has_glazing': True, 'glazing_coverage': 'full',
'glazing_type': 'double', 'no_data': False}
]