Ejemplo n.º 1
0
def map():
    question = request.args.get('question', 0, type=str)
    filtered_sentence = Parssing.get_main_words(datas_management, question)
    url_googleaddress = Extraction.get_urladdress(datas_extraction,
                                                  filtered_sentence)
    googleapi_data = Extraction.get_googleapi_data(datas_extraction,
                                                   url_googleaddress)
    lat = Extraction.get_lat(datas_extraction, googleapi_data)
    lng = Extraction.get_lng(datas_extraction, googleapi_data)
    if lat is None or lng is None:
        return jsonify(result="")
    else:
        url_googlemap = Extraction.get_urlmap(datas_extraction,
                                              filtered_sentence, lat, lng)
        return jsonify(result=url_googlemap)
Ejemplo n.º 2
0
def address():
    question = request.args.get('question', 0, type=str)
    filtered_sentence = Parssing.get_main_words(datas_management, question)
    try:
        url_googleaddress = Extraction.get_urladdress(datas_extraction,
                                                      filtered_sentence)
        googleapi_data = Extraction.get_googleapi_data(datas_extraction,
                                                       url_googleaddress)
        address_location = Extraction.get_address(datas_extraction,
                                                  googleapi_data)
        random_sentence = random.choice(sentences_list.sentences_address)
        address_sentence = random_sentence + address_location
        return jsonify(result=address_sentence)
    except (ValueError, TypeError):
        return jsonify(result="Mince, je ne trouve pas :)")