Skip to content

Commit

Permalink
fix: localization
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Nov 7, 2024
1 parent a54e287 commit c72d708
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
16 changes: 3 additions & 13 deletions ovos_workshop/skills/ovos.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
from json_database import JsonStorage
from langcodes import closest_match
from ovos_number_parser import pronounce_number, extract_number
# TODO - drop lingua-franca
from lingua_franca.parse import yes_or_no
from ovos_yes_no_solver import YesNoSolver
from ovos_bus_client import MessageBusClient
from ovos_bus_client.apis.enclosure import EnclosureAPI
from ovos_bus_client.apis.gui import GUIInterface
Expand Down Expand Up @@ -2011,18 +2010,9 @@ def ask_yesno(self, prompt: str,
@return: 'yes', 'no' or the user response if not matched to 'yes' or
'no', including a response of None.
"""
s = YesNoSolver()
resp = self.get_response(dialog=prompt, data=data)
# 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
answer = s.match_yes_or_no(resp, lang=self.lang) if resp else resp
if answer is True:
return "yes"
elif answer is False:
Expand Down
3 changes: 1 addition & 2 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ ovos-utils>= 0.2.1,<1.0.0
ovos_bus_client>=0.0.8,<2.0.0
ovos-config>=0.0.12,<1.0.0
ovos-backend-client>=0.1.0,<2.0.0
# TODO - drop lingua-franca
ovos-lingua-franca>=0.4.6,<1.0.0
ovos-solver-yes-no-plugin>=0.0.1,<1.0.0
ovos-number-parser>=0.0.1,<1.0.0
rapidfuzz
langcodes
Expand Down

0 comments on commit c72d708

Please sign in to comment.