Skip to content

Commit

Permalink
fix:lingua_franca (#257)
Browse files Browse the repository at this point in the history
lingua franca requires lowercased lang codes, which causes ask_yesno to fail

adds better dialect support
  • Loading branch information
JarbasAl authored Oct 18, 2024
1 parent c77ccfc commit 1b836c3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ovos_workshop/skills/ovos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,17 @@ def ask_yesno(self, prompt: str,
'no', including a response of None.
"""
resp = self.get_response(dialog=prompt, data=data)
answer = yes_or_no(resp, lang=self.lang) if resp else resp
# TODO - lingua_franca does not support standardized lang tags
# deprecate it, use a plugin here https://github.com/TigreGotico/ovos-solver-YesNo-plugin
lf_langs = ("az-az", "ca-es", "cs-cz", "da-dk", "de-de",
"en-us", "es-es", "fr-fr",
"hu-hu", "it-it", "nl-nl", "pl-pl",
"fa-ir", "pt-pt", "ru-ru", "sl-si",
"sv-se", "tr-tr", "eu-eu", "uk-ua")
lang, score = closest_match(self.lang, lf_langs)
if score > 10:
lang = self.lang # let it raise a value Error in next line
answer = yes_or_no(resp, lang=lang) if resp else resp
if answer is True:
return "yes"
elif answer is False:
Expand Down

0 comments on commit 1b836c3

Please sign in to comment.