C#通过正则表达式统计词频的一个方法
/// <summary>
/// 取得指定字符串在源字符串中出现的次数
/// </summary>
/// <param name="str"></param>
/// <param name="sourcestr"></param>
/// <returns></returns>
static int GetStrAppearTimes(string str, string sourcestr)
{
Regex regex = new Regex(str, RegexOptions.IgnoreCase);
var mymatch=regex.Matches(sourcestr);
return mymatch.Count;
}