def __labels_from_result()

in slot_detection/score.py [0:0]


def __labels_from_result(result, item_key):
    labels = []
    if "Emotions" in result[item_key]:
        for emotion in result[item_key]["Emotions"]:
            if float(emotion["Confidence"]) >= min_confidence:
                labels.append({"Name": emotion["Type"], "Confidence": emotion["Confidence"]})
    else:
        if float(result[item_key]["Confidence"]) >= min_confidence:
            labels.append({"Name": result[item_key]["Name"], "Confidence": result[item_key]["Confidence"]})
    return labels