Beispiel #1
0
        private void init()
        {
            if (_ckip == null)
            {
                _ckip = new CKIPSS(textBox1.Text, textBox2.Text);
            }

            textBox4.Text = "";
        }
        /// <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);
            }
        }