Skip to content

Commit

Permalink
feat:pipeline plugin factory
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Oct 16, 2024
1 parent 094aa3e commit f873cfe
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ovos_padatious/opm.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def padatious_config(self, val):
log_deprecation("self.padatious_config is deprecated, access self.config directly instead", "2.0.0")
self.config = val

def _match_level(self, utterances, limit, lang=None, message: Optional[Message] = None) -> Optional[IntentHandlerMatch]:
def _match_level(self, utterances, limit, lang=None, message: Optional[Message] = None) -> Optional[
IntentHandlerMatch]:
"""Match intent and make sure a certain level of confidence is reached.
Args:
Expand Down Expand Up @@ -296,7 +297,7 @@ def register_entity(self, message):
self._register_object(message, 'entity',
self.containers[lang].add_entity)

def calc_intent(self, utterances: List[str], lang: str = None,
def calc_intent(self, utterances: Union[str, List[str]], lang: Optional[str] = None,
message: Optional[Message] = None) -> Optional[PadatiousIntent]:
"""
Get the best intent match for the given list of utterances. Utilizes a
Expand Down Expand Up @@ -355,10 +356,8 @@ def handle_get_padatious(self, message):
message (Message): message triggering the method
"""
utterance = message.data["utterance"]
norm = message.data.get('norm_utt', utterance)
intent = self.calc_intent(utterance)
if not intent and norm != utterance:
intent = self.calc_intent(norm)
lang = message.data.get("lang", self.lang)
intent = self.calc_intent(utterance, lang=lang)
if intent:
intent = intent.__dict__
self.bus.emit(message.reply("intent.service.padatious.reply",
Expand Down

0 comments on commit f873cfe

Please sign in to comment.