• 大小: 0.26M
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: 算法  实例  贝叶斯  

资源简介


资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Expat.Bayesian;

namespace SpamFilterSample
{
public partial class Form1 : Form
{
private SpamFilter _filter;

public Form1()
{
InitializeComponent();
}

private void TestFile(string file)
{
if (_filter == null)
{
MessageBox.Show(“Load first!“);
return;
}

string body = new StreamReader(file).ReadToEnd();
txtOut.Text = file + Environment.NewLine + “score: “ + _filter.Test(body).ToString();
txtOut.AppendText(Environment.NewLine + Environment.NewLine + body);
}

#region clicks
private void btnLoad_Click(object sender EventA

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         937  2008-02-05 19:54  SpamFilterSample.sln
     目录           0  2008-02-05 20:08  SpamFilterSample\Bayesian\
     文件        2756  2008-02-05 20:08  SpamFilterSample\Bayesian\Corpus.cs
     文件        9236  2008-02-05 20:08  SpamFilterSample\Bayesian\SpamFilter.cs
     目录           0  2008-02-05 20:31  SpamFilterSample\bin\
     目录           0  2008-02-05 20:30  SpamFilterSample\bin\Release\
     文件       28672  2008-02-05 20:30  SpamFilterSample\bin\Release\SpamFilterSample.exe
     文件        2607  2008-02-05 20:21  SpamFilterSample\Form1.cs
     文件        5294  2008-02-05 20:09  SpamFilterSample\Form1.Designer.cs
     文件        5814  2008-02-05 20:09  SpamFilterSample\Form1.resx
     文件         405  2008-02-05 19:54  SpamFilterSample\Program.cs
     目录           0  2008-02-05 19:54  SpamFilterSample\Properties\
     文件        1348  2008-02-05 19:54  SpamFilterSample\Properties\AssemblyInfo.cs
     文件        2512  2008-02-05 19:54  SpamFilterSample\Properties\Resources.Designer.cs
     文件        5350  2008-02-05 19:54  SpamFilterSample\Properties\Resources.resx
     文件        1022  2008-02-05 19:54  SpamFilterSample\Properties\Settings.Designer.cs
     文件         249  2008-02-05 19:54  SpamFilterSample\Properties\Settings.settings
     文件        3658  2008-02-05 20:16  SpamFilterSample\SpamFilterSample.csproj
     目录           0  2008-02-05 20:23  SpamFilterSample\TestData\
     文件         762  2008-02-05 20:03  SpamFilterSample\TestData\definatelyOK.txt
     文件        2562  2008-02-05 20:18  SpamFilterSample\TestData\definatelySpam.txt
     文件      511066  2008-02-05 20:01  SpamFilterSample\TestData\good.txt
     文件         349  2008-02-05 20:23  SpamFilterSample\TestData\maybeSpam.txt
     文件       50308  2008-02-05 20:30  SpamFilterSample\TestData\out.txt
     文件      207960  2008-02-05 20:01  SpamFilterSample\TestData\spam.txt

评论

共有 条评论