示例#1
0
        private async void btnAnalyze_Click(object sender, EventArgs e)
        {
            root           = new TreeItem();
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                await root.LoadFromSentence(txtBox.Text);

                txtSubject.Text    = root.Children[0].Children[0].NounPhrase.toReadableString();
                txtVerbPhrase.Text = root.Children[0].Children[0].VerbPhrase.toReadableString();
                QuestionAndAnswer qa = root.Children[0].Children[0].GetQuestionAndAnswer();
                txtQuestion.Text = qa.Question;
                txtAnswer.Text   = qa.Answer;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error analyzing text", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            LoadTree();
            Cursor.Current = Cursors.Default;
            ItemTree.ExpandAll();
        }