def message(): if request.method == 'POST': msg = request.form['msg'] #get msg from the POST question = module.parsing(msg) print("la quest est : " + msg) #below question with stopwords removed. print(question.new_sentence) url_google = question.google() print(url_google) url_wiki = question.wiki() print(url_wiki) #lg.warning(url_wiki) wiki_description = module.wikipedia(url_wiki) print(wiki_description.Pageid) dico = {"google": url_google, "wiki": wiki_description.wikiword()} json_data = json.dumps(dico) return json_data
def test_wiki_url(self): #msg = ('wer ewr 9 rue las cases') question = script.parsing(self.localisation_numero) assert question.wiki() == 'https://fr.wikipedia.org/w/api.php?action=query&list=search&srsearch=9%20rue%20las%20cases&formatversion=2&prop=revisions&rvprop=content&format=json&formatversion=2'
def test_google_url(self): #msg = ('wer ewr 9 rue las cases') question = script.parsing(self.localisation_numero) assert question.google() == 'https://maps.googleapis.com/maps/api/staticmap?center=9+rue+las+cases&zoom=14&size=400x400&markers=9+rue+las+cases&key=AIzaSyD5nqmDGFH1SUZxJAYVtFHP7RNjjFE9CHg'
def test_get_msg_majuscule(self): #msg = ('la super ville que je vois est Paris') question = script.parsing(self.majuscule) assert question.placeToSearch == ['Paris']
def test_get_msg_localisation(self): #msg = ('asd asd boulevard saint germain') question = script.parsing(self.localisation) assert question.placeToSearch == ['boulevard','saint','germain']
def test_get_msg_localisation_numero(self): #msg = ('wer ewr 9 rue las cases') question = script.parsing(self.localisation_numero) assert question.placeToSearch == ['9','rue','las','cases']
def test_get_msg_stopword(self): question = script.parsing(self.stopword) assert question.new_sentence == ['oxford']