fix entity detection
@@ -77,6 +77,7 @@ def get_result(request, what_to_annotate):
utt_entities_batch = [{} for _ in last_utts]
utt_entities = {}
+ try:
if utts_list:
logger.info(f"input {utts_list}")
(
@@ -92,8 +93,15 @@ def get_result(request, what_to_annotate):
tokens_conf_batch,
) = entity_detection(utts_list)
logger.info(f"entity_substr_batch {entity_substr_batch} finegrained_tags_batch {finegrained_tags_batch}")
-
- for entity_substr_list, tags_list, finegrained_tags_list, entity_offsets_list, last_utt_start, uttr, num in zip(
+ for (
+ entity_substr_list,
+ tags_list,
+ finegrained_tags_list,
+ entity_offsets_list,
+ last_utt_start,
+ uttr,
+ num,
+ ) in zip(
entity_substr_batch,
tags_batch,
finegrained_tags_batch,
@@ -149,9 +157,10 @@ def get_result(request, what_to_annotate):
if utt_entities:
utt_entities_batch[num] = utt_entities
-
- if not last_utts:
+ else:
utt_entities_batch.append({})
+ except Exception as e:
+ logger.info(f"error in entity detection, {e}")
total_time = time.time() - st_time
logger.info(f"entity detection exec time: {total_time: .3f}s")
