您的位置:首页 > 其它

文章标题 标签提取

2012-02-05 23:24 204 查看
引用PanGuDLL

private string GetWords(string input)
{
ICollection<PanGu.WordInfo> words = new Segment().DoSegment(input);
StringBuilder result = new StringBuilder();

List<string> list = new List<string>();
foreach (WordInfo word in words)
{
if (word != null && word.Word.Length > 1)
{
bool has = false;
foreach (string w in list)
{
if (string.Compare(w, word.Word, true) == 0)
{
has = true;
break;
}
}
if (has)
continue;

list.Add(word.Word);
result.Append(word.Word).Append(",");
}
}
if (result.Length > 0)
return result.ToString(0, result.Length - 1);
else
return string.Empty;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐