Ejemplo n.º 1
0
 def on_get(self, req, resp):
     context = req.get_param("context")
     sentence = req.get_param("sentence")
     self.response = {}
     context, sentence, refs, resolved = self.get_corefs(context, sentence)
     self.response["context"] = context
     self.response["sentence"] = sentence
     # self.response["context_tokens"] = context_tokens
     # self.response["sentence_tokens"] = sentence_tokens
     self.response["references"] = refs
     resp.body = json.dumps(self.response)
     resp.content_type = 'application/json'
     resp.append_header('Access-Control-Allow-Origin', "*")
     resp.status = falcon.HTTP_200
Ejemplo n.º 2
0
 def on_get(self, req, resp):
     text_param = req.get_param("text")
     self.response = self.get_clusters(text_param)
     resp.body = json.dumps(self.response)
     resp.content_type = 'application/json'
     resp.append_header('Access-Control-Allow-Origin', "*")
     resp.status = falcon.HTTP_200
Ejemplo n.º 3
0
 def on_get(self, req, resp):
     intro = req.get_param("intro")
     poitype = req.get_param("poitype")
     poispan = req.get_param("poispan")
     if poispan is not None:
         poispan = [int(x) for x in poispan.split("-")]
     context = req.get_param("context")
     sentence = req.get_param("sentence")
     self.response = {}
     context, sentence, refs, resolved_sentence = self.get_corefs(
         context, sentence, intro, poitype, poispan)
     self.response["context"] = context
     self.response["sentence"] = sentence
     # self.response["context_tokens"] = context_tokens
     # self.response["sentence_tokens"] = sentence_tokens
     self.response["references"] = refs
     resp.body = json.dumps(self.response)
     resp.content_type = 'application/json'
     resp.append_header('Access-Control-Allow-Origin', "*")
     resp.status = falcon.HTTP_200
Ejemplo n.º 4
0
 def on_get(self, req, resp):
     print("request came in ...")
     data = req.get_param("data")
     print("request data: {}".format(data))
     data = json.loads(data)
     context = data["context"]
     entities = data["entities"]
     sentence = data["sentence"]
     self.response = {}
     context, sentence, refs, resolved_sentence = self.get_corefs(
         context, sentence, entities)
     self.response["context"] = context
     self.response["sentence"] = sentence
     # self.response["context_tokens"] = context_tokens
     # self.response["sentence_tokens"] = sentence_tokens
     self.response["references"] = refs
     self.response["resolved_sentence"] = resolved_sentence
     resp.body = json.dumps(self.response)
     resp.content_type = 'application/json'
     resp.append_header('Access-Control-Allow-Origin', "*")
     resp.status = falcon.HTTP_200
Ejemplo n.º 5
0
 def on_get(self, req, resp):
     data_json = req.get_param("data")
     data = json.loads(data_json)
     print(data)