//NLP Nonsense -> NLP Offense model public OffensivenessModelRequest(NewQuestionNonsenseCheck newQuestionNonsenseCheck) { this.question = newQuestionNonsenseCheck.question; this.question_id = newQuestionNonsenseCheck.question_id; this.msg_id = ServerUtilities.getAndGenerateMsgIDForGivenQuestion(newQuestionNonsenseCheck.user_id, newQuestionNonsenseCheck.question, newQuestionNonsenseCheck.question_id); this.action = "ESTIMATE_OFFENSIVENESS".ToLower(); }
private void SendQuestionOffenseRequest(NewQuestionNonsenseCheck newQuestionNonsenseCheck) { var temp = new OffensivenessModelRequest(newQuestionNonsenseCheck); if (connections.ContainsKey("NLP") && connections["NLP"] != null && connections["NLP"].State == WebSocketState.Open && temp != null) { String json = JsonSerializer.Serialize(temp); connections["NLP"].SendAsync(new ArraySegment <byte>(usedEncoding.GetBytes(json), 0, json.Length), WebSocketMessageType.Text, true, CancellationToken.None); } else { taskQueue.Enqueue(new NLPTask <NewQuestionNonsenseCheck>(newQuestionNonsenseCheck, SendQuestionOffenseRequest)); } }
public ChatbotVariousServerResponses(NewQuestionNonsenseCheck newQuestionNonsenseCheck, bool isNonsense = true) { if (isNonsense) { question_id = newQuestionNonsenseCheck.question_id; status_msg = "The given question was nonsense."; status_code = 2; user_id = newQuestionNonsenseCheck.user_id; } else { question_id = newQuestionNonsenseCheck.question_id; status_msg = "The given question was offensive."; status_code = 3; user_id = newQuestionNonsenseCheck.user_id; } }
internal static void ProcessProperQuestion(NewQuestionNonsenseCheck newQuestionNonsenseCheck) { try { var result = ProcessChatbotLogic.ProcessChatbotReceiveQuestion(new List <ChatbotNewQuestionModel>() { new ChatbotNewQuestionModel(newQuestionNonsenseCheck) }); if (result != null) { NLPWebSocketController.SendQuestionMatchRequest(result); } } catch (Exception e) { System.Diagnostics.Trace.Write(e.Message); } }
public ChatbotNewQuestionModel(NewQuestionNonsenseCheck newQuestionNonsenseCheck) { user_id = newQuestionNonsenseCheck.user_id; question = newQuestionNonsenseCheck.question; chatbot_temp_id = newQuestionNonsenseCheck.question_id; }
/// <summary> /// Given is an answer that is guaranteed to be offensive, you are given the question and user id, process these. /// </summary> /// <param name="newQuestionNonsenseCheck"></param> public static void ProcessOffensiveAnswer(NewQuestionNonsenseCheck newQuestionNonsenseCheck) { //throw new NotImplementedException(); return; }