• 大小: 16KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-09
  • 语言: 其他
  • 标签:

资源简介

一个可以以句自动造句的源代码 效果不是很理想,但比较有意思

资源截图

代码片段和文件信息

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.Diagnostics;
using System.IO;

namespace WordMills
{
        partial class Form1 : Form
        {
                WordExtractor we = new WordExtractor();
                TextStatistics ts = new TextStatistics();

                public Form1()
                {
                        InitializeComponent();
                }

                private void learnButton_Click(object sender EventArgs e)
                {
                        if (this.openTextFileDialog.ShowDialog() == DialogResult.OK)
                        {
                                this.we.Clear();
                                this.we.Worker = this.learnTextBackgroundWorker;
                                this.learnButton.Enabled = false;
                                this.stopLearnButton.Enabled = true;
                                this.simulateButton.Enabled = false;
                                this.mainMenuStrip.Enabled = false;
                                this.learnTextBackgroundWorker.RunWorkerAsync(this.openTextFileDialog.FileNames);
                        }
                }

                //Learn text background worker
                private void learnTextBackgroundWorker_DoWork(object sender DoWorkEventArgs e)
                {
                        Trace.WriteLine(“learn text...“);
                        String[] fileNames = (String[])e.Argument;
                        foreach (String fileName in fileNames)
                        {
                                if (this.we.Extract(fileName) < 0)
                                        MessageBox.Show(this.we.Error “Error“);
                        }
                        Trace.WriteLine(“extract statistics...“);
                        if (this.ts.Calculate(we) < 0)
                                MessageBox.Show(this.ts.Error “Error“);                                                                        
                }

                private void learnTextBackgroundWorker_ProgressChanged(object sender ProgressChangedEventArgs e)
                {
                        this.progressLabel.Text = e.UserState.ToString();
                }

                private void learnTextBackgroundWorker_RunWorkerCompleted(object sender RunWorkerCompletedEventArgs e)
                {
                        Trace.WriteLine(“...finished“);
                        this.learnButton.Enabled = true;
                        this.stopLearnButton.Enabled = false;
                        this.simulateButton.Enabled = true;
                        this.mainMenuStrip.Enabled = true;
                }
                //Learn text background worker

                private void stopLearnButton_Click(object sender EventArgs e)
      

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2008-05-23 10:46  src\
     文件        6376  2008-05-23 10:38  src\Form1.cs
     文件       15720  2008-05-23 10:38  src\Form1.Designer.cs
     文件        6848  2008-05-23 09:32  src\Form1.resx
     目录           0  2008-05-23 10:46  src\Lib\
     文件       14101  2008-05-23 10:44  src\Lib\TextStatistics.cs
     文件       13584  2008-05-23 13:38  src\Lib\WordExtractor.cs
     文件         605  2008-05-20 10:31  src\Program.cs
     目录           0  2008-05-23 10:46  src\Properties\
     文件        1430  2008-05-20 10:31  src\Properties\AssemblyInfo.cs
     文件        3311  2008-05-20 10:31  src\Properties\Resources.Designer.cs
     文件        5612  2008-05-20 10:31  src\Properties\Resources.resx
     文件        1198  2008-05-20 10:31  src\Properties\Settings.Designer.cs
     文件         249  2008-05-20 10:31  src\Properties\Settings.settings
     文件        3861  2008-05-23 09:50  src\WordMills.csproj
     文件         907  2008-05-20 10:31  src\WordMills.sln

评论

共有 条评论

相关资源