From 56b9cc4d4f53d6dd23bfe1e97ca7af7fc8de61b1 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 15 Nov 2023 17:56:07 -0800 Subject: [PATCH] Remove unused `padatious_service` module Update neon-utils to include intent registration patch --- neon_core/skills/__main__.py | 1 - neon_core/skills/padatious_service.py | 84 --------------------------- requirements/requirements.txt | 4 +- 3 files changed, 3 insertions(+), 86 deletions(-) delete mode 100644 neon_core/skills/padatious_service.py diff --git a/neon_core/skills/__main__.py b/neon_core/skills/__main__.py index 356c67955..c6b3cd3ec 100644 --- a/neon_core/skills/__main__.py +++ b/neon_core/skills/__main__.py @@ -27,7 +27,6 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from neon_core.skills.service import NeonSkillService -# from neon_core.skills.padatious_service import PadatiousService from neon_utils.log_utils import init_log from ovos_utils.log import LOG from ovos_utils.process_utils import reset_sigint_handler, PIDLock as Lock diff --git a/neon_core/skills/padatious_service.py b/neon_core/skills/padatious_service.py deleted file mode 100644 index d3e17a741..000000000 --- a/neon_core/skills/padatious_service.py +++ /dev/null @@ -1,84 +0,0 @@ -import mycroft.skills.intent_services.padatious_service -from mycroft.skills.intent_services.padatious_service import PadatiousService as _svc, PadatiousIntent -from mycroft.skills.intent_services.padatious_service import PadatiousMatcher as _match - -from multiprocessing.pool import Pool -from ovos_utils import flatten_list -from ovos_utils.log import LOG -from mycroft.skills.intent_services.base import IntentMatch - - -class PadatiousMatcher(_match): - def _match_level(self, utterances, limit, lang=None): - """Match intent and make sure a certain level of confidence is reached. - - Args: - utterances (list of tuples): Utterances to parse, originals paired - with optional normalized version. - limit (float): required confidence level. - """ - # we call flatten in case someone is sending the old style list of tuples - utterances = flatten_list(utterances) - if not self.has_result: - lang = lang or self.service.lang - LOG.debug(f'Padatious Matching confidence > {limit}') - padatious_intent = self.service.threaded_calc_intent(utterances, - lang) - - if padatious_intent: - LOG.info(f"matched intent: {padatious_intent}") - skill_id = padatious_intent.name.split(':')[0] - self.ret = IntentMatch( - 'Padatious', padatious_intent.name, - padatious_intent.matches, skill_id) - self.conf = padatious_intent.conf - self.has_result = True - if self.conf and self.conf > limit: - LOG.debug(f"Matched intent {self.ret} for lang={lang}") - return self.ret - - -class PadatiousService(_svc): - def threaded_calc_intent(self, utterances, lang): - lang = lang or self.lang - lang = lang.lower() - if lang in self.containers: - intent_container = self.containers.get(lang) - with Pool(16) as pool: - idx = 0 - padatious_intent = None - for intent in pool.imap(calc_intent, - ((utt, intent_container) - for utt in utterances)): - if intent: - best = \ - padatious_intent.conf if padatious_intent else 0.0 - if best < intent.conf: - padatious_intent = intent - padatious_intent.matches['utterance'] = \ - utterances[idx] - if intent.conf == 1.0: - LOG.debug(f"Returning perfect match") - return intent - idx += 1 - return padatious_intent - - -def calc_intent(args): - utt = args[0] - intent_container = args[1] - intent = intent_container.calc_intent(utt) - if isinstance(intent, dict): - if "entities" in intent: - intent["matches"] = intent.pop("entities") - intent["sent"] = utt - intent = PadatiousIntent(**intent) - return intent - - -mycroft.skills.intent_service.PadatiousMatcher = PadatiousMatcher -mycroft.skills.intent_service.PadatiousService = PadatiousService - -# TODO: Remove below patches with ovos-core 0.0.8 refactor -from ovos_bus_client.message import Message -mycroft.skills.intent_services.padatious_service.Message = Message diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 395a059e8..5e1df7caf 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -4,7 +4,9 @@ ovos-core==0.0.7 ovos-plugin-common-play~=0.0.5 # utils -neon-utils[network]~=1.7 +neon-utils[network,audio]~=1.7,>=1.7.1a2 +# TODO audio extra patching dependency resolution + ovos-utils~=0.0.35 ovos-bus-client~=0.0.5 neon-transformers~=0.2