コード例 #1
0
        /// <summary>
        /// 使用CKIP來斷詞、詞性標註。
        /// </summary>
        /// <param name="str">中文文章,太長請分多次送。</param>
        /// <returns>string[0] -> 第一句, string[1] -> 第二句 ...</returns>

        public string[] CWS(string str)
        {
            CKIPSS ckip = new CKIPSS("iisr", "123456");

            bool   isSuccess = false;
            string errorMsg  = "";

            List <string> result = ckip.Send(str, out isSuccess, out errorMsg);

            if (isSuccess)
            {
                return(result.ToArray());
            }
            else
            {
                throw new Exception(errorMsg);
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            init();

            bool          isSuccess;
            string        errorMsg;
            List <string> result = _ckip.Send(textBox3.Text, out isSuccess, out errorMsg);

            if (!isSuccess)
            {
                MessageBox.Show(errorMsg);
            }

            foreach (string s in result)
            {
                textBox4.Text += s + "\r\n\r\n";
                segment(s);
            }
        }