資源簡介
可直接拿來測試哦
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Text.Regularexpressions;
namespace?Test.TFIDF
{
????class?IF_IDF
????{
????????///?
????????///?獲取拆分后的詞組以及每個詞的出現(xiàn)次數(shù)
????????///?
????????///?
????????///?
????????public?Dictionary?GetWordsFrequnce(string?text)
????????{
????????????
????????????Dictionary?dictionary?=?new?Dictionary();
????????????Regex?regex?=?new?Regex(@“[\u4e00-\u9fa5]“);//分揀出中文字符
????????????MatchCollection?results?=?regex.Matches(text);
????????????int?temp;
????????????foreach?(Match?word?in?results)
????????????{
????????????????if?(dictionary.TryGetValue(word.Value?out?temp))
????????????????{
??????????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????6018??2012-07-22?20:19??IFIDF.cs
評論
共有 條評論