Skip to content

Commit

Permalink
adding error verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Comi committed Mar 21, 2023
1 parent 678cb4e commit 7355b25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/zberta/intent_discovery/unknown_intents.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ def unknown_intents_set(dataset, lang, spacy_model=None):
os.system("python -m spacy download " + spacy_model + " --no-deps")
nlp_engine = spacy.load(spacy_model)
if lang == 'en':
print("calling EN")
classes = en_dependency_parser(dataset)
elif lang == 'it':
print("calling IT")
classes = it_dependency_parser(dataset)
else:
classes = None
Expand Down
5 changes: 5 additions & 0 deletions src/zberta/intent_discovery/zberta.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ def find_new_intents(self, utterances: List = None, lang='en'):
for i in tqdm(range(0, len(self.dataset if utterances is None else utterances))):
pred_classes = []
if utterances is not None:
print(utterances[i])
print(lang)
classes = unknown_intents_set(utterances[i], lang)
print(classes)
else:
classes = self.z_classes
for class_set in classes[i]:
print(class_set)
temp = class_set.replace('-', ' ').replace('None', '')
if temp not in pred_classes and len(temp) > 1:
print(temp)
pred_classes.append(temp)
with torch.no_grad():
try:
Expand Down

0 comments on commit 7355b25

Please sign in to comment.