Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            QAEngin qna = new QAEngin();
            string  str;
            var     subQuestion = new SubQuestion();

            subQuestion.questionText = questionBox.Text;
            subQuestion.answerText   = input_TB.Text;
            subQuestion.flags        = "need1";
            var match = qna.matchAnswers(subQuestion,
                                         input_TB2.Text);
            var answerText = "Score:" + match.score + Environment.NewLine;

            foreach (var ent in match.missingEntitis)
            {
                answerText += "Missing Entity:" + ent.entityValue + Environment.NewLine;
            }

            foreach (var ans in match.answersFeedbacks.Where(x => x.score < 75))
            {
                answerText += "Missing Answer:" + ans + Environment.NewLine;
            }



            var res = qnaCont.createFeedBack(match);

            foreach (var s in res)
            {
                answerText += s + Environment.NewLine;
            }

            text_TB3.Text = answerText;
        }
Example #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            var inputText = systemAnswer_TB.Text;

            string log        = "";
            var    botResualt = new NLPControler().testAnalizer(inputText, out log, questionInput_TB.Text);

            drawTree(botResualt, answerTreeView);

            inputText = userAnswer_TB2.Text;
            var botResualt2 = new NLPControler().testAnalizer(inputText, out log, questionInput_TB.Text);

            drawTree(botResualt2, userAnswerTreeView);


            QAEngin qna = new QAEngin();
            string  str;
            var     subQuestion = new SubQuestion();

            subQuestion.questionText = questionInput_TB.Text;
            subQuestion.answerText   = systemAnswer_TB.Text;
            subQuestion.flags        = "need1";
            var match = qna.matchAnswers(subQuestion,
                                         userAnswer_TB2.Text);
            var answerText = "Score:" + match.score + Environment.NewLine;

            foreach (var ent in match.missingEntitis)
            {
                answerText += "Missing Entity:" + ent.entityValue + Environment.NewLine;
            }

            foreach (var ans in match.answersFeedbacks.Where(x => x.score < 75))
            {
                answerText += "Missing Answer:" + ans.answer + Environment.NewLine;
            }

            var res = qnaCont.createFeedBack(match);

            foreach (var s in res)
            {
                answerText += s + Environment.NewLine;
            }

            resualt_TB3.Text = answerText;
        }
        public string[] createReplayToUser(string text, UserIntent answerIntent)
        {
            //if user pressing category
            if (getStudyCategory().Contains(text.Trim()))
            {
                throw new menuException();
            }


            switch (answerIntent)
            {
            case UserIntent.dontKnow:
                var feedback = ConversationController.getPhrase(Pkey.neverMind);
                feedback = ConversationController.mergeText(feedback, ConversationController.getPhrase(Pkey.MyAnswerToQuestion));
                feedback = answerArrayToString(new List <string>(studySession.CurrentSubQuestion.answerText.Split('|')), feedback);
                return(feedback);

            case UserIntent.menu:
                throw new menuException();

            case UserIntent.stopSession:
                throw new StopSessionException();

            case UserIntent.sessionBreak:
                throw new sessionBreakException();

            case UserIntent.bot_questions:
            case UserIntent.DefaultFallbackIntent:
            case UserIntent.unknown:
            case UserIntent.historyAnswer:
            default:
                return(formatPhrases(qac.createFeedBack(checkAnswer(text))));
            }

            return(null);
        }