(question_object)
return ()
Retrieve the main Freebase entity linked in the url field

    :param question_object: A question encoded as a Json object
    :return: A list of answers as strings
    >>> get_main_entity_from_question({"url": "http://www.freebase.com/view/en/natalie_portman", "targetValue": "(list (description \\"Padm\u00e9 Amidala\\"))", "utterance": "what character did natalie portman play in star wars?"})
    (['Natalie', 'Portman'], 'URL')
    >>> get_main_entity_from_question({"url": "http://www.freebase.com/view/en/j_j_thomson"})
    (['J', 'J', 'Thomson'], 'URL')
    >>> get_main_entity_from_question({"targetValue": "(list (description Abduction) (description Eclipse) (description \\"Valentine's Day\\") (description \\"New Moon\\"))"})
    ()
    >>> get_main_entity_from_question({"url": "http://www.freebase.com/view/en/j_j_thomson"})
    (['J', 'J', 'Thomson'], 'URL')
Retrieve the main Freebase entity linked in the url field
Retrieve the main Freebase entity linked in the url field
def get_main_entity_from_question(question_object):
    """
    Retrieve the main Freebase entity linked in the url field

    :param question_object: A question encoded as a Json object
    :return: A list of answers as strings
    >>> get_main_entity_from_question({"url": "http://www.freebase.com/view/en/natalie_portman", "targetValue": "(list (description \\"Padm\u00e9 Amidala\\"))", "utterance": "what character did natalie portman play in star wars?"})
    (['Natalie', 'Portman'], 'URL')
    >>> get_main_entity_from_question({"url": "http://www.freebase.com/view/en/j_j_thomson"})
    (['J', 'J', 'Thomson'], 'URL')
    >>> get_main_entity_from_question({"targetValue": "(list (description Abduction) (description Eclipse) (description \\"Valentine's Day\\") (description \\"New Moon\\"))"})
    ()
    >>> get_main_entity_from_question({"url": "http://www.freebase.com/view/en/j_j_thomson"})
    (['J', 'J', 'Thomson'], 'URL')
    """
    url = question_object.get('url')
    if url:
        if "http://www.freebase.com/view/en/" not in url:
            return [w.title() for w in url.split()], 'URL'
        entity_tokens = url.replace("http://www.freebase.com/view/en/", "").split("_")
        return [w.title() for w in entity_tokens], 'URL'
    return ()
def get_main_entity_from_question ( question_object ) : url = question_object . get ( 'url' ) if url : if "http://www.freebase.com/view/en/" not in url : return [ w . title ( ) for w in url . split ( ) ] , 'URL' entity_tokens = url . replace ( "http://www.freebase.com/view/en/" , "" ) . split ( "_" ) return [ w . title ( ) for w in entity_tokens ] , 'URL' return ( )