From d85bcf2cb12de1ec1b1bc2194606b88a9e23e8b8 Mon Sep 17 00:00:00 2001 From: dilyararimovna Date: Thu, 5 May 2022 19:16:43 +0300 Subject: [PATCH] fix: response selection acknowledgement --- .../tag_based_selection.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/response_selectors/convers_evaluation_based_selector/tag_based_selection.py b/response_selectors/convers_evaluation_based_selector/tag_based_selection.py index eea5effde2..ac8ad94330 100644 --- a/response_selectors/convers_evaluation_based_selector/tag_based_selection.py +++ b/response_selectors/convers_evaluation_based_selector/tag_based_selection.py @@ -177,10 +177,8 @@ def choose_best_with_scores(curr_cands_ids, curr_single_scores, candidates, bot_ def get_main_info_annotations(annotated_utterance): intents = get_intents(annotated_utterance, which="all") topics = get_topics(annotated_utterance, which="all") - named_entities = [ent[0]["text"] for ent in annotated_utterance.get("annotations", {}).get("ner", []) if ent] - nounphrases = [ - nounph for nounph in annotated_utterance.get("annotations", {}).get("spacy_nounphrases", []) if nounph - ] + named_entities = get_entities(annotated_utterance, only_named=True, with_labels=False) + nounphrases = get_entities(annotated_utterance, only_named=False, with_labels=False) return intents, topics, named_entities, nounphrases @@ -627,7 +625,7 @@ def tag_based_response_selection(dialog, candidates, scores, confidences, bot_ut # -------------------- SUPER CONFIDENCE CASE HERE! -------------------- categorized_hyps = add_to_top1_category(cand_id, categorized_hyps, _is_require_action_intent) - if cand_uttr["skill_name"] == "dff_grounding_skill" and "acknowledgement" in cand_uttr.get( + if cand_uttr["skill_name"] == "dff_grounding_skill" and ["acknowledgement"] == cand_uttr.get( "response_parts", [] ): acknowledgement_hypothesis = deepcopy(cand_uttr)