Added register_intent in Skill class and grammar
This commit is contained in:
parent
1e9f9cd0ba
commit
3372594987
@ -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)
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user