added padatious entity support
This commit is contained in:
parent
69697818ec
commit
7152a73031
@ -56,11 +56,12 @@ class Skill:
|
||||
thread.start()
|
||||
|
||||
def register(self):
|
||||
self.register_entities()
|
||||
self.register_entities_adapt()
|
||||
self.register_entities_padatious()
|
||||
self.register_regex()
|
||||
print("[" + self.name + "] Registered entity/entities and regex(s)")
|
||||
|
||||
def register_entities(self):
|
||||
def register_entities_adapt(self):
|
||||
path = self.path + "/vocab/" + languages_utils.get_language() + "/*.voc"
|
||||
|
||||
files = glob.glob(path, recursive=True)
|
||||
@ -71,6 +72,17 @@ class Skill:
|
||||
|
||||
intent_manager.register_entity_adapt(line.replace('\n', ''), filename, self.name)
|
||||
|
||||
def register_entities_padatious(self):
|
||||
path = self.path + "/vocab/" + languages_utils.get_language() + "/*.entity"
|
||||
|
||||
files = glob.glob(path, recursive=True)
|
||||
for file in files:
|
||||
with open(file, "r") as infile:
|
||||
for line in infile.readlines():
|
||||
filename = file.split("/")[-1].split(".entity")[0]
|
||||
|
||||
intent_manager.register_entity_adapt(line.replace('\n', ''), filename, self.name)
|
||||
|
||||
def register_regex(self):
|
||||
path = self.path + "/regex/" + languages_utils.get_language() + "/*.rx"
|
||||
|
||||
|
@ -17,6 +17,11 @@ def register_entity_adapt(entity_value, entity_type, domain):
|
||||
# print("[Adapt]: Added entity with type " + entity_type + " for " + domain)
|
||||
|
||||
|
||||
def register_entity_padatious(entity_name, list):
|
||||
padatious_intents_container.add_entity(entity_name, list)
|
||||
# print("[Padatious]: Added entity with name " + entity_name + " with " str(len(list)) + "examples.")
|
||||
|
||||
|
||||
def register_regex_adapt(regex, domain):
|
||||
adapt_engine.register_regex_entity(regex, domain)
|
||||
# print("[Adapt]: Added new regex for " + domain)
|
||||
|
Reference in New Issue
Block a user