diff --git a/jarvis/skills/__init__.py b/jarvis/skills/__init__.py index ec5dbee..4e96295 100644 --- a/jarvis/skills/__init__.py +++ b/jarvis/skills/__init__.py @@ -15,7 +15,7 @@ class Skill: def register(self): self.register_entities() self.register_regex() - print("[" + self.name + "] Registred entitie(s) and regex(s)") + print("[" + self.name + "] Registered entity/entities and regex(s)") def register_entities(self): path = os.path.dirname(get_path_file.__file__) + "/skills/" + self.category + "/" + self.skill_folder @@ -38,3 +38,6 @@ class Skill: with open(file, "r") as infile: for line in infile.readlines(): intent_manager.register_regex(line.replace('\n', ''), self.name) + + def register_intent(self, intent): + intent_manager.register_intent(intent.build(), domain=self.name) diff --git a/jarvis/skills/research/wikipedia/__init__.py b/jarvis/skills/research/wikipedia/__init__.py index e061fef..8cd7fa6 100644 --- a/jarvis/skills/research/wikipedia/__init__.py +++ b/jarvis/skills/research/wikipedia/__init__.py @@ -1,6 +1,6 @@ from adapt.intent import IntentBuilder -from jarvis.skills import Skill, intent_manager +from jarvis.skills import Skill class WikipediaSkill(Skill): @@ -10,5 +10,7 @@ class WikipediaSkill(Skill): def register(self): super().register() - intent_manager.register_intent(IntentBuilder("WikipediaQueryIntent").require("Wikipedia").require("ArticleTitle").build(), - domain=self.name) + wikipedia_query_intent = IntentBuilder("WikipediaQueryIntent")\ + .require("Wikipedia")\ + .require("ArticleTitle") + super().register_intent(wikipedia_query_intent)