diff --git a/ovos_workshop/skills/ovos.py b/ovos_workshop/skills/ovos.py index d661d41..d025dc0 100644 --- a/ovos_workshop/skills/ovos.py +++ b/ovos_workshop/skills/ovos.py @@ -2569,7 +2569,7 @@ def _join_word_list_it(items: List[str], connector: str, sep: str = ",") -> str: sep += " " # Join the list with Italian euphonic rules applied to the last connector - joined_string = sep.join(str(item) for item in items[:-1]) + joined_string = sep.join(item for item in items[:-1]) # Check for euphonic transformation cases for "e" and "o" if cons[connector] == "e" and items[-1][0].lower() == "e": @@ -2578,6 +2578,5 @@ def _join_word_list_it(items: List[str], connector: str, sep: str = ",") -> str: final_connector = "od" else: final_connector = cons[connector] - return f"{joined_string} {final_connector} {items[-1]}" diff --git a/test/unittests/test_euphony.py b/test/unittests/test_euphony.py index f65f2c7..6eab84c 100644 --- a/test/unittests/test_euphony.py +++ b/test/unittests/test_euphony.py @@ -30,6 +30,18 @@ def test_euphonic_conjunction_or_with_other_words(self): result = _join_word_list_it(["libro", "orologio"], "or") self.assertEqual(result, "libro od orologio") + def test_join_three_words(self): + result = _join_word_list_it(["mare", "estate", "inverno"], "and") + self.assertEqual(result, "mare, estate e inverno") + + def test_empty_list(self): + result = _join_word_list_it([], "and") + self.assertEqual(result, "") + + def test_single_word(self): + result = _join_word_list_it(["mare"], "and") + self.assertEqual(result, "mare") + if __name__ == "__main__": unittest.main()