盘古分词

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PanGu;

namespace WindowsFormsApp6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Segment.Init();//初始化
string str = textBox1.Text;
Segment segment = new Segment();
ICollection<WordInfo> words = segment.DoSegment(str);
foreach (WordInfo item in words)
{
textBox2.Text += item.Word + ",";
}
textBox2.Text = textBox2.Text.TrimEnd(',');
}


}
}

原文地址:https://www.cnblogs.com/ryzryz/p/12159941.html