文章标题 标签提取
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;
}
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;
}
相关文章推荐
- asp.net正则表达式提取网页网址、标题、图片实例以及过滤所有HTML标签实例
- ASP.NET正则表达式提取网页网址、标题、图片实例以及过滤所有HTML标签实例
- 织梦DEDECMS教程:去除列表页文章标题加粗标签
- asp.net正则表达式提取网页网址、标题、图片实例以及过滤所有HTML标签实例
- asp.net正则表达式提取网页网址、标题、图片实例以及过滤所有HTML标签实例
- asp.net正则表达式提取网页网址、标题、图片,滤所有HTML标签
- asp.net正则表达式提取网页网址、标题、图片实例以及过滤所有HTML标签实例
- asp.net正则表达式提取网页网址、标题、图片,滤所有HTML标签
- 用java提取不同类型的文章标题就要设计出不同的正则表达式
- asp.net正则表达式提取网页网址、标题、图片实例以及过滤所有HTML标签实例
- DEDECMS教程:去除列表页文章标题加粗标签的方法
- 基础算法7:使用正则提取网页中a标签的链接和标题
- Discuz!提取文章标签
- 如何添加标签、相关文章提取规则『博客帮助』
- 使用php自动将文章标题或内容进行分词,添加和删除标签功能实例!
- 基于标题分类的文章主题句识别与提取方法
- PHPCMS使用get标签获取文章列表过滤重复标题并实现分页
- LI 标签中让文章标题左对齐,日期右对齐的方法
- LI 标签中让文章标题左对齐,日期右对齐的方法
- 文章标题caffe学习之特征提取(参照官网)