Christopher Román Jaimes
commited on
Commit
·
1683f88
1
Parent(s):
ac89c56
fix: check if the key exists before to access to it in the dict.
Browse files
app.py
CHANGED
@@ -292,7 +292,8 @@ def generate_answer(text):
|
|
292 |
# Extract valid string left dotted
|
293 |
feature_surfaces = ['SUPERFICIE_BALCON', 'SUPERFICIE_TERRAZA', 'SUPERFICIE_JARDIN', 'SUPERFICIE_TERRENO', 'SUPERFICIE_HABITABLE']
|
294 |
for feature_name in feature_surfaces:
|
295 |
-
entities_formatted
|
|
|
296 |
|
297 |
# Clean Entities
|
298 |
entities_names = list({c.replace("pred_", "").replace("prob_", "") for c in list(entities_formatted.keys())})
|
|
|
292 |
# Extract valid string left dotted
|
293 |
feature_surfaces = ['SUPERFICIE_BALCON', 'SUPERFICIE_TERRAZA', 'SUPERFICIE_JARDIN', 'SUPERFICIE_TERRENO', 'SUPERFICIE_HABITABLE']
|
294 |
for feature_name in feature_surfaces:
|
295 |
+
if entities_formatted.get(f"pred_{feature_name}", None) != None:
|
296 |
+
entities_formatted[f"pred_{feature_name}"] = extract_valid_string_left_dotted(entities_formatted[f"pred_{feature_name}"], text, entities_formatted[f"pos_{feature_name}"])
|
297 |
|
298 |
# Clean Entities
|
299 |
entities_names = list({c.replace("pred_", "").replace("prob_", "") for c in list(entities_formatted.keys())})
|