(query_results)
return answers + rest_answers
Extract the variable values from the query results and map them to canonical WebQuestions strings.

    :param query_results: list of dictionaries returned by the sparql endpoint
    :return: list of answers as entity labels or an original id if no canonical label was found.
    >>> sorted(sorted(label_query_results(['Q76', 'Q235234', 'r68123123-12dd222']))[0])  # doctest: +ELLIPSIS
    ['barack h. obama', 'barack hussein obama', ...]
    >>> label_query_results(['10000', '10499', '11004', '05',  ""])
    [['10000'], ['10499'], ['11004'], ['05']]
Extract the variable values from the query results and map them to canonical WebQuestions strings.
Extract the variable values from the query results and map them to canonical WebQuestions strings .
def label_query_results(query_results):
    """
    Extract the variable values from the query results and map them to canonical WebQuestions strings.

    :param query_results: list of dictionaries returned by the sparql endpoint
    :return: list of answers as entity labels or an original id if no canonical label was found.
    >>> sorted(sorted(label_query_results(['Q76', 'Q235234', 'r68123123-12dd222']))[0])  # doctest: +ELLIPSIS
    ['barack h. obama', 'barack hussein obama', ...]
    >>> label_query_results(['10000', '10499', '11004', '05',  ""])
    [['10000'], ['10499'], ['11004'], ['05']]
    """
    answers_to_label = {a for a in query_results if not a.isnumeric() and len(a) > 0}
    rest_answers = [[a] for a in query_results if a.isnumeric()]
    answers = [[l.lower() for l in labels] for _, labels in queries.get_labels_for_entities(answers_to_label).items()]
    answers = normalize_answer_strings(answers)
    return answers + rest_answers
def label_query_results ( query_results ) : answers_to_label = { a for a in query_results if not a . isnumeric ( ) and len ( a ) > 0 } rest_answers = [ [ a ] for a in query_results if a . isnumeric ( ) ] answers = [ [ l . lower ( ) for l in labels ] for _ , labels in queries . get_labels_for_entities ( answers_to_label ) . items ( ) ] answers = normalize_answer_strings ( answers ) return answers + rest_answers