Commit 6b6d6e54 authored by Janez K's avatar Janez K

nlp posts use postdata instead of query string params

parent a5742ec1
...@@ -105,7 +105,9 @@ def load_corpus2(input_dict): ...@@ -105,7 +105,9 @@ def load_corpus2(input_dict):
params = {"filename": fname, "text": data} #set params params = {"filename": fname, "text": data} #set params
#call web service #call web service
resp = post(webservice_url, params=params) #print webservice_url
resp = post(webservice_url, data=params)
#print resp.content
content = json.loads(resp.content)[u'parseFileResponse'][u'parseFileResult'] content = json.loads(resp.content)[u'parseFileResponse'][u'parseFileResult']
""" """
if content[u"error"] != "": if content[u"error"] != "":
...@@ -223,7 +225,7 @@ def load_tagged_corpus(input_dict): ...@@ -223,7 +225,7 @@ def load_tagged_corpus(input_dict):
def totrtale_request(params): def totrtale_request(params):
webservice_url = webservices_totrtale_url + "/runToTrTaLe" webservice_url = webservices_totrtale_url + "/runToTrTaLe"
return post(webservice_url, params=params) return post(webservice_url, data=params)
def nlp_totrtale2(input_dict, widget): def nlp_totrtale2(input_dict, widget):
''' '''
...@@ -467,7 +469,7 @@ def nlp_term_extraction2(input_dict): ...@@ -467,7 +469,7 @@ def nlp_term_extraction2(input_dict):
params = {"corpus":annotations, params = {"corpus":annotations,
"lang": lang, "lang": lang,
"reference_corpus":reference_corpus} "reference_corpus":reference_corpus}
response = post(ws_url, params=params) response = post(ws_url, data=params)
resp = json.loads(response.content)[u'callResponse'][u'callResult'] resp = json.loads(response.content)[u'callResponse'][u'callResult']
stop_list = [] stop_list = []
...@@ -531,7 +533,7 @@ def nlp_def_extraction_patterns2(input_dict): ...@@ -531,7 +533,7 @@ def nlp_def_extraction_patterns2(input_dict):
"pattern":pattern, "pattern":pattern,
"lang":lang} "lang":lang}
response = post(ws_url, params=params) response = post(ws_url, data=params)
response = json.loads(response.content)[u'patDefSentResponse'][u'patDefSentResult'] response = json.loads(response.content)[u'patDefSentResponse'][u'patDefSentResult']
return {'sentences': response} return {'sentences': response}
...@@ -592,7 +594,7 @@ def nlp_def_extraction_terms2(input_dict): ...@@ -592,7 +594,7 @@ def nlp_def_extraction_terms2(input_dict):
"multiword_term":multiword_term, "multiword_term":multiword_term,
"num_multiterms":num_multiterms, "num_multiterms":num_multiterms,
"term_beginning":term_beginning} "term_beginning":term_beginning}
response = post(ws_url, params=params) response = post(ws_url, data=params)
response = json.loads(response.content)[u'termDefSentResponse'][u'termDefSentResult'] response = json.loads(response.content)[u'termDefSentResponse'][u'termDefSentResult']
return {'sentences': response} return {'sentences': response}
...@@ -626,7 +628,7 @@ def nlp_def_extraction_wnet2(input_dict): ...@@ -626,7 +628,7 @@ def nlp_def_extraction_wnet2(input_dict):
ws_url = webservice_def_ex_url + "/wnetDefSent" ws_url = webservice_def_ex_url + "/wnetDefSent"
params = {"corpus":annotations, params = {"corpus":annotations,
"lang":lang} "lang":lang}
response = post(ws_url, params=params) response = post(ws_url, data=params)
response = json.loads(response.content)[u'wnetDefSentResponse'][u'wnetDefSentResult'] response = json.loads(response.content)[u'wnetDefSentResponse'][u'wnetDefSentResult']
return {'sentences': response} return {'sentences': response}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment