mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Ready to put together proper pipeline
This commit is contained in:
parent
6b86543ce4
commit
10c73aacef
1 changed files with 20 additions and 5 deletions
|
|
@ -50,7 +50,6 @@ def handler():
|
||||||
|
|
||||||
field = "roof-description"
|
field = "roof-description"
|
||||||
unique_vals = Counter([v[field] for v in data])
|
unique_vals = Counter([v[field] for v in data])
|
||||||
pprint(unique_vals)
|
|
||||||
|
|
||||||
def search_description_options(desc):
|
def search_description_options(desc):
|
||||||
if desc == "insulated":
|
if desc == "insulated":
|
||||||
|
|
@ -72,14 +71,22 @@ def handler():
|
||||||
return thickness
|
return thickness
|
||||||
return int(thickness)
|
return int(thickness)
|
||||||
except ValueError as _:
|
except ValueError as _:
|
||||||
|
if "invalid input" in description_lower:
|
||||||
|
return None
|
||||||
desc = description_lower.split("pitched,")[-1].lstrip().split(" ")[0]
|
desc = description_lower.split("pitched,")[-1].lstrip().split(" ")[0]
|
||||||
return search_description_options(desc)
|
return search_description_options(desc)
|
||||||
|
|
||||||
if is_roof_room:
|
if is_roof_room:
|
||||||
|
desc_split_lookup = {
|
||||||
|
"ceiling insulated": "average",
|
||||||
|
"thatched": "average",
|
||||||
|
}
|
||||||
# Just search for specific phrases
|
# Just search for specific phrases
|
||||||
desc_split = description_lower.split("roof room(s),")[-1].lstrip()
|
desc_split = description_lower.split("roof room(s),")[-1].lstrip()
|
||||||
if desc_split == "ceiling insulated":
|
res = desc_split_lookup.get(desc_split)
|
||||||
return "average"
|
if res:
|
||||||
|
return res
|
||||||
|
|
||||||
desc = desc_split.split(" ")[0]
|
desc = desc_split.split(" ")[0]
|
||||||
return search_description_options(desc)
|
return search_description_options(desc)
|
||||||
|
|
||||||
|
|
@ -88,7 +95,7 @@ def handler():
|
||||||
desc = description_lower.split("flat,")[-1].lstrip().split(" ")[0]
|
desc = description_lower.split("flat,")[-1].lstrip().split(" ")[0]
|
||||||
return search_description_options(desc)
|
return search_description_options(desc)
|
||||||
|
|
||||||
raise Exception("Unhandled")
|
return None
|
||||||
|
|
||||||
import re
|
import re
|
||||||
def extract_thermal_transmittence(description_lower):
|
def extract_thermal_transmittence(description_lower):
|
||||||
|
|
@ -123,7 +130,7 @@ def handler():
|
||||||
"""
|
"""
|
||||||
description_lower = description.lower().lstrip().rstrip()
|
description_lower = description.lower().lstrip().rstrip()
|
||||||
|
|
||||||
if "another dwelling above" in description_lower:
|
if "another dwelling above" in description_lower or "other premises above" in description_lower:
|
||||||
return {
|
return {
|
||||||
"is_pitched": False,
|
"is_pitched": False,
|
||||||
"is_roof_room": False,
|
"is_roof_room": False,
|
||||||
|
|
@ -132,6 +139,7 @@ def handler():
|
||||||
"has_dwelling_above": True,
|
"has_dwelling_above": True,
|
||||||
"assumed": "assumed" in description_lower,
|
"assumed": "assumed" in description_lower,
|
||||||
"is_flat": "flat" in description_lower,
|
"is_flat": "flat" in description_lower,
|
||||||
|
"is_thatched": False,
|
||||||
"thermal_transmittence": None,
|
"thermal_transmittence": None,
|
||||||
"thermal_transmittence_unit": None,
|
"thermal_transmittence_unit": None,
|
||||||
}
|
}
|
||||||
|
|
@ -140,12 +148,19 @@ def handler():
|
||||||
is_roof_room = "roof room" in description_lower
|
is_roof_room = "roof room" in description_lower
|
||||||
has_loft = "loft" in description_lower
|
has_loft = "loft" in description_lower
|
||||||
is_flat = "flat" in description_lower
|
is_flat = "flat" in description_lower
|
||||||
|
is_thatched = "thatched" in description_lower
|
||||||
|
|
||||||
thermal_transmittence, thermal_transmittence_unit, insulation_thickness = None, None, None
|
thermal_transmittence, thermal_transmittence_unit, insulation_thickness = None, None, None
|
||||||
if "insulation" in description_lower or "insulated" in description_lower:
|
if "insulation" in description_lower or "insulated" in description_lower:
|
||||||
insulation_thickness = find_insulation_thickness(description_lower, is_pitched, is_roof_room, is_flat)
|
insulation_thickness = find_insulation_thickness(description_lower, is_pitched, is_roof_room, is_flat)
|
||||||
elif "thermal transmittance" in description_lower:
|
elif "thermal transmittance" in description_lower:
|
||||||
thermal_transmittence, thermal_transmittence_unit = extract_thermal_transmittence(description_lower)
|
thermal_transmittence, thermal_transmittence_unit = extract_thermal_transmittence(description_lower)
|
||||||
|
elif is_thatched:
|
||||||
|
# Search for these features:
|
||||||
|
thermal_transmittence, thermal_transmittence_unit = extract_thermal_transmittence(description_lower)
|
||||||
|
insulation_thickness = find_insulation_thickness(
|
||||||
|
description_lower, is_pitched, is_roof_room, is_flat
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
raise Exception("Implment me 2")
|
raise Exception("Implment me 2")
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue