diff --git a/ovos_workshop/skills/ovos.py b/ovos_workshop/skills/ovos.py index 5b3b0e6..c96c9dd 100644 --- a/ovos_workshop/skills/ovos.py +++ b/ovos_workshop/skills/ovos.py @@ -2607,13 +2607,13 @@ def _join_word_list_es(items: List[str], connector: str, sep: str = ",") -> str: joined_string = items[0] # Check for euphonic transformation cases for "y" - w = items[-1].lower().lstrip("h") + w = items[-1].lower().lstrip("h").replace("ó", "o").replace("í", "i").replace("á", "a") if not any([w.startswith("io"), w.startswith("ia"), w.startswith("ie")]): # When following word starts by (H)IA, (H)IE or (H)IO, then usual Y preposition is used - if cons[connector] == "y" and w[0] in ["i", "í"]: + if cons[connector] == "y" and w[0] == "i": final_connector = "e" # Check for euphonic transformation cases for "o" - if cons[connector] == "o" and w[0] in ["o", "ó"]: + if cons[connector] == "o" and w[0] == "o": final_connector = "u" return f"{joined_string} {final_connector} {items[-1]}" diff --git a/test/unittests/test_euphony.py b/test/unittests/test_euphony.py index 7a82591..f0e401d 100644 --- a/test/unittests/test_euphony.py +++ b/test/unittests/test_euphony.py @@ -74,6 +74,8 @@ def test_euphonic_conjunction_exceptionsa_and(self): self.assertEqual(result, "cloro y iodo") result = _join_word_list_es(["Eta", "Iota"], "and") self.assertEqual(result, "Eta y Iota") + result = _join_word_list_es(["paz", "hiógrafo"], "and") + self.assertEqual(result, "paz y hiógrafo") def test_euphonic_conjunction_or(self): # Test euphonic transformation from "o" to "u" @@ -83,5 +85,6 @@ def test_euphonic_conjunction_or(self): self.assertEqual(result, "unos u otros") + if __name__ == "__main__": unittest.main()