def post(self, request, *args, **kwargs): result = [] error = [] data = request.body valid_json = is_json(data) if valid_json: status = 200 data = json.loads(data) result, error = Interactive_Learning().expression(data) else: error.append("Please sent valid json data") json_data = json.dumps({'result': result, 'error': error}) return self.render_to_http_response(json_data)
def post(self, request, *args, **kwargs): error = [] result = {} n_iter = 100 data = request.body valid_json = is_json(data) if valid_json: data = json.loads(data) final_res_list = named_entity_handler.NerPredicting().predict(data) else: error.append("[-] please send a valid json data") json_data = json.dumps({'result': final_res_list, 'error': error}) return self.render_to_http_response(json_data)
def post(self, request, *args, **kwargs): result = [] error = [] data = request.body valid_json = is_json(data) if valid_json: status = 200 data = json.loads(data) result, error = story_handler.Story().Prediction(data) else: error.append("Please sent valid json data") json_data = json.dumps({'result': result, 'error': error}) return self.render_to_http_response(json_data)
def post(self, request, *args, **kwargs): result = {} error = [] status = 200 data = request.body if is_json(data): # pdb.set_trace() data = json.loads(data) result, error = db_handler.Intent().insert_intent(data) else: status = 400 error.append("This is not a valid json") print("[-] This is not a valid json") json_data = json.dumps({"result": result, "error": error}) return self.render_to_http_response(json_data, status=status)
def post(self, request, *args, **kwargs): result = {} error = [] data = request.body valid_json = is_json(data) if valid_json: data = json.loads(data) result, error, status = db_handler.Named_Entity_DB().save_data( data) else: status = 400 error.append("[-] Please sent valid json data") f_result = {'result': result, 'error': error} json_data = json.dumps(f_result) return self.render_to_http_response(json_data, status=status)
def post(self, request, *args, **kwargs): result = {} error = [] status = 200 data = request.body if is_json(data): data = json.loads(data) result, error = intent_handler.Prediction().predict_KNN(data) else: status = 400 error.append("This is not valid json") print("[-] This is not valid json") json_data = json.dumps({"result": result, "error": error}) return self.render_to_http_response(json_data, status=status)
def post(self, request): # result = {} error = [] status = 200 data = request.body if is_json(data): # pdb.set_trace() data = json.loads(data) intent_id = db_handler.Get_Intent_Handler().get_intent_id( data["intent"]) else: status = 400 error.append("This is not a valid json") print("[-] This is not a valid json") json_data = json.dumps({"intent_id": intent_id, "error": error}) return self.render_to_http_response(json_data, status=status)
def post(self, request, *args, **kwargs): data = request.body valid_json = is_json(data) status = 200 all_entities = [] flag = False if valid_json: data = json.loads(data) all_entities = named_entity_handler.Get_Entity__handler( ).get_all_entities() else: status = 400 error.append("[-] Please sent valid json data") # json_data = SerializerMixin.serialize('json', all_datas) json_data = json.dumps(all_entities) return self.render_to_http_response(json_data, status)
def post(self, request, *args, **kwargs): result = {} error = [] status = 200 data = request.body if is_json(data): # pdb.set_trace() data = json.loads(data) context = { } result, error = db_handler.retrieve_all_intent(context) if len(error) > 0: status = 400 else: print("This is not valid json") json_data = json.dumps({"result" : result, "error" : error}) return self.render_to_http_response(json_data, status = status)
def post(self, request, *args, **kwargs): error = [] result = [] data = request.body valid_json = is_json(data) if valid_json: status = 200 data = json.loads(data) id = data["id"] result, error, status = named_entity_handler.Update_Entities_handler( ).add_entity(data) else: status = 400 error.append("[-] Please sent valid json data") json_data = json.dumps({'result': result, 'error': error}) return self.render_to_http_response(json_data, status=status)
def post(self, request, *args, **kwargs): result = [] error = [] data = request.body valid_json = is_json(data) if valid_json: data = json.loads(data) # TRAIN_DATA creation result = named_entity_handler.NerPreprocessing().data_preperation( data ) #training is happening in the named_entity_handler.py don't worry # First it will process the data and from there itself it will give data for training and return the result... else: error.append("Please sent valid json data") json_data = json.dumps({'result': result, 'error': error}) return self.render_to_http_response(json_data)
def post(self, request, *args, **kwargs): error = [] result = [] status = 200 data = request.body valid_json = is_json(data) if valid_json: data = json.loads(data) id = data["id"] result, error, status = named_entity_handler.Delete_Entities_By_ID_handler.delete_data( id) else: status = 400 error.append("[-] Please sent valid json data") json_data = json.dumps({'result': result, 'error': error}) return self.render_to_http_response(json_data, content_type='application/json', status=status)
def post(self, request, *args, **kwargs): result = {} error = [] status = 200 data = request.body if is_json(data): # pdb.set_trace() data = json.loads(data) input_data = data["data"] input_intent = data["intent"] context = { "query" : input_data, "intent" : input_intent } result, error = db_handler.insert_query(context) # if len(error) > 0: # status = 400 else: print("This is not valid json") json_data = json.dumps({"result" : result, "error" : error}) return self.render_to_http_response(json_data, status = status)