def evaluate_ser(entity, outputs):
    """
    Get all correct and incorrect queries. Correct means all entities are identified correctly
    with exact span

    :param entity: list of (start_index, end_index, label) tuples for EACH query
    :param outputs: PARSED mallard/duckling responses
    :return: Two lists of indicies, one for correct queries and one for incorrect
    """
    incorrect_queries = []
    correct_queries = []

    for i, (entity_info, output) in enumerate(zip(entity, outputs)):
        correct = True

        # For each entity, see if it is present in the mallard output
        for entity in entity_info:
            span = (entity[0], entity[1])
            entity_type = entity[2]

            if entity_type not in output:
                correct = False
            else:
                if span not in output[entity_type]:
                    correct = False
        if correct:
            correct_queries.append(i)
        else:
            incorrect_queries.append(i)

    return correct_queries, incorrect_queries