Skip to content

Commit

Permalink
fix:keyerror instantiations from disk
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Oct 14, 2024
1 parent 4b1d370 commit 4fb7442
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions ovos_padatious/intent_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,20 @@ def instantiate_from_disk(self):

if f.startswith('{') and f.endswith('}.hash'):
entity_name = f[1:f.find('}.hash')]
self.add_entity(
name=entity_name,
lines=entity_traindata[entity_name],
reload_cache=False,
must_train=False)
if entity_name in entity_traindata:
self.add_entity(
name=entity_name,
lines=entity_traindata[entity_name],
reload_cache=False,
must_train=False)
elif not f.startswith('{') and f.endswith('.hash'):
intent_name = f[0:f.find('.hash')]
self.add_intent(
name=intent_name,
lines=intent_traindata[intent_name],
reload_cache=False,
must_train=False)
if intent_name in intent_traindata:
self.add_intent(
name=intent_name,
lines=intent_traindata[intent_name],
reload_cache=False,
must_train=False)

@_save_args
def add_intent(self, name, lines, reload_cache=False, must_train=True):
Expand Down

0 comments on commit 4fb7442

Please sign in to comment.