Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            float p = 0f, r = 0f, f = 0f;

            try
            {
                string dir        = Path.GetDirectoryName(Path.GetFullPath(textBox1.Text.Split(';')[0]));
                string testPath   = Path.Combine(dir, "crfTestDoc.txt");
                string resultPath = Path.Combine(dir, "crfResultDoc.txt");
                string args       = string.Format(" -m {0} {1}", textBox2.Text, testPath);
                //如果是字特征/字+词性特征把这里改成ConvertAnnsToBio1/ConvertAnnsToBio2
                CRF.ConvertAnnsToBio3(testPath, textBox1.Text.Split(';'));
                ProcessUtils.StartProcessRedirect("crf_test.exe", resultPath, args);
                //如果是字特征/字+词性特征把这里改成Score1/Score2
                CRF.Score3(resultPath, ref p, ref r, ref f);
                lblP.Text = p.ToString();
                lblR.Text = r.ToString();
                lblF.Text = f.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //throw;
            }
        }