• 大小: 127KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: C#
  • 标签: C#  

资源简介

这是一个基于C#的反作弊系统,基于VSM空间向量模型,能对doc和txt文件进行相似度的检测,在VS2005和SQL Server 2005上实现

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.xml;

namespace Felomeng.VSMSimilarity
{
    public partial class Form1 : Form
    {
        private double borderNumber = 0.5;
        private string corpusFolder = Application.StartupPath;
        /// 
        /// 语料文件名
        /// 

        private List fileNames = new List();
        /// 
        /// 降维表
        /// 

        private List reducingKeys = new List();
        /// 
        /// 文章的词典(降维后)
        /// 

        private Dictionary> textsDictionaries = new Dictionary>();
        //Dictionary wordFrequency = new Dictionary();
        public Form1()
        {
            InitializeComponent();
        }

        private void browse_Click(object sender EventArgs e)
        {
            AsignDir();
            if (File.Exists(Application.StartupPath + “\\Dictionaries.xml“))
            {
                DialogResult result = MessageBox.Show(“词典已存在,再替换现有词典吗?“ + Environment.NewLine
                    + “单击是替换,否使用刚统计的词典,单击取消使用原有“ “已经有词典“ MessageBoxButtons.YesNoCancel);
                switch (result)
                {
                    case DialogResult.Yes:
                        File.Delete(Application.StartupPath + “\\Dictionaries.xml“);
                        SaveDictionaries();
                        break;
                    case DialogResult.Cancel: 
                        LoadDictionaries(Application.StartupPath + “\\Dictionaries.xml“);
                        this.corpusDir.Text = “使用原有词典!“;
                        break;
                }
            }
            else
            {
                SaveDictionaries();
            }
        }

        private void AsignDir()
        {
            FolderBrowserDialog browse = new FolderBrowserDialog();
            browse.Description = “指定源语料所在文件夹“;
            if (browse.ShowDialog() == DialogResult.OK)
            {
                this.corpusDir.Text = browse.SelectedPath;
                GetAllDirectories(browse.SelectedPath);
            }
        }

        private void SaveDictionaries()
        {
            StreamWriter write = new StreamWriter(Application.StartupPath + “\\Dictionaries.xml“ true Encoding.GetEncoding(“gb2312“));
            write.WriteLine(“l version=\“1.0\“ encoding=\“GB2312\“?>“);
            write.WriteLine(““);
            foreach (KeyValuePair> dictionary in textsDictionaries)
            {
                foreach (KeyValuePair dict in dictionary.Value)
                {
                    write.WriteLine(“\t

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        956  2010-03-18 09:13  Felomeng.MoreEffectiveVSMSimilarity.sln

     文件      54784  2010-03-17 15:31  向量空间法(Vector Space Model ).doc

     文件      43520  2010-03-17 13:57  向量空间模型文档相似度计算实现(C#).doc

     文件         77  2010-03-19 18:17  Felomeng.VSMSimilarity\app.config

     文件      38935  2010-03-19 15:59  Felomeng.VSMSimilarity\bin\Debug\Dictionaries.xml

     文件      18432  2010-03-19 21:21  Felomeng.VSMSimilarity\bin\Debug\Felomeng.VSMSimilarity.exe

     文件         77  2010-03-19 18:17  Felomeng.VSMSimilarity\bin\Debug\Felomeng.VSMSimilarity.exe.config

     文件      44544  2010-03-19 21:21  Felomeng.VSMSimilarity\bin\Debug\Felomeng.VSMSimilarity.pdb

     文件      14328  2010-03-19 21:21  Felomeng.VSMSimilarity\bin\Debug\Felomeng.VSMSimilarity.vshost.exe

     文件         77  2010-03-19 18:17  Felomeng.VSMSimilarity\bin\Debug\Felomeng.VSMSimilarity.vshost.exe.config

     文件        490  2007-07-21 01:33  Felomeng.VSMSimilarity\bin\Debug\Felomeng.VSMSimilarity.vshost.exe.manifest

     文件        882  2009-03-20 16:29  Felomeng.VSMSimilarity\bin\Debug\WordList.xml

     文件       3903  2010-03-19 20:03  Felomeng.VSMSimilarity\Felomeng.VSMSimilarity.csproj

     文件      19844  2010-03-19 21:21  Felomeng.VSMSimilarity\Form1.cs

     文件       7696  2009-03-25 09:11  Felomeng.VSMSimilarity\Form1.Designer.cs

     文件       5814  2009-03-25 09:11  Felomeng.VSMSimilarity\Form1.resx

     文件       1138  2009-03-19 15:37  Felomeng.VSMSimilarity\InAndOut.cs

     文件        850  2010-03-19 21:21  Felomeng.VSMSimilarity\obj\Debug\Felomeng.VSMSimilarity.csproj.FileListAbsolute.txt

     文件        847  2010-03-18 09:51  Felomeng.VSMSimilarity\obj\Debug\Felomeng.VSMSimilarity.csproj.GenerateResource.Cache

     文件      18432  2010-03-19 21:21  Felomeng.VSMSimilarity\obj\Debug\Felomeng.VSMSimilarity.exe

     文件        180  2010-03-19 20:03  Felomeng.VSMSimilarity\obj\Debug\Felomeng.VSMSimilarity.Form1.resources

     文件      44544  2010-03-19 21:21  Felomeng.VSMSimilarity\obj\Debug\Felomeng.VSMSimilarity.pdb

     文件        180  2010-03-19 20:03  Felomeng.VSMSimilarity\obj\Debug\Felomeng.VSMSimilarity.Properties.Resources.resources

     文件        503  2009-03-18 16:23  Felomeng.VSMSimilarity\Program.cs

     文件       1390  2009-03-18 16:23  Felomeng.VSMSimilarity\Properties\AssemblyInfo.cs

     文件       2894  2009-03-18 16:23  Felomeng.VSMSimilarity\Properties\Resources.Designer.cs

     文件       5612  2009-03-18 16:23  Felomeng.VSMSimilarity\Properties\Resources.resx

     文件       1107  2009-03-18 16:23  Felomeng.VSMSimilarity\Properties\Settings.Designer.cs

     文件        249  2009-03-18 16:23  Felomeng.VSMSimilarity\Properties\Settings.settings

     文件       4741  2010-03-19 01:22  Felomeng.VSMSimilarity\SVMModle.cs

............此处省略36个文件信息

评论

共有 条评论