Ðåôåðàòû. Àíàëèç òåêñòîâ íà çàèìñòâîâàíèå ìåòîäîì ïîñòðîåíèÿ ñåìàíòè÷åñêèõ ìîäåëåé

        static public string ReadFile(string filename)

        {

            StreamReader Reader = new StreamReader(filename);

            string result = "";

            string tmp = "";

            while ((tmp = Reader.ReadLine()) != null)

                result += (tmp + '\n');

            Reader.Close();

            return result;

        }


        /// <summary>

        /// ب᳠氠ࡱ󱯪񡮳箳��᪫�        /// </summary>

        /// <param name="filename">ɬ��param>

        /// <param name="lineNo">ή� 򳱮리 鮠�/param>

        /// <returns>à︨󡮭�󱯪񡩫柮ull, 沫桱󱯪�㡭᪤殠</returns>

        static public string ReadFile(string filename, int lineNo)

        {

            StreamReader Reader = new StreamReader(filename);

            string result = "";

            string tmp;

            //Ů⩰᦬򽡤졭�硱󱯷릍

            for (int i = 0; i < lineNo; i++)

            {

                tmp = Reader.ReadLine();


                if (tmp == null) //Υ𡢮콸㡱󱯷樍

                {

                    Reader.Close();

                    return null;

                }

            }//for

            result = Reader.ReadLine();

            Reader.Close();

            return result;

        }

    }

}





CFileWriter



using System;

using System.Collections.Generic;

using System.Text;

using System.IO;


namespace app

{

    static class CFileWriter

    {

        public static bool WriteToFile(string filename, string text)

        {

            StreamWriter f;

            if (!File.Exists(filename))

            {

                try

                {

                    f = File.CreateText(filename);

                }

                catch

                {

                    return false;

                }

            }//if

            else

            {

                try

                {

                    f = new StreamWriter(filename, true);

                }

                catch

                {

                    return false;

                }

            }//else

            try

            {

                f.WriteLine(text);

            }

            catch

            {

                return false;

            }

            f.Close();

            return true;

        }

    }

}




FMainDesigner.cs


namespace app

{

    partial class FMain

    {

        /// <summary>

        /// Required designer variable.

        /// </summary>

        private System.ComponentModel.IContainer components = null;


        /// <summary>

        /// Clean up any resources being used.

        /// </summary>

        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }


        #region Windows Form Designer generated code


        /// <summary>

        /// Required method for Designer support - do not modify

        /// the contents of this method with the code editor.

        /// </summary>

        private void InitializeComponent()

       

           


        #endregion


        private System.Windows.Forms.RichTextBox richTextBox1;

        private System.Windows.Forms.Button button1;

        private System.Windows.Forms.Label label1;

        private System.Windows.Forms.TextBox textBox1;

    }

}



FResult.cs


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Data.OleDb;

using System.Threading;

using System.IO;


namespace app

{

 

    public partial class FResult : Form

    {

        /// <summary>

        /// Ƞ䯫衲櫱󞋊        /// </summary>

        public string caption;


        /// <summary>

        /// Ҡꡲ櫱눠       /// </summary>

        public string source;


        /// <summary>

        /// ӳ𡢳崲 �鳼򽡱鮲᫱鸥򫦠衪﮷殭�步

        /// </summary>

        private List<string> syntax_list = new List<string>();


        /// <summary>

        /// ӳ𡢳崲 �鳼򽡱歠�桧᫮㡽즬殲�      /// </summary>

        private List<string> semantic_list = new List<string>();


        /// <summary>

        /// Ҩ�칬 믲ﱻ㡰ᨤ欿�󡫱鸥򫩥 ⬮릠ࡲ櫱󣋊        /// </summary>

        private string separators = ".,:-()!?\"';";


        /// <summary>

        /// ު覬𐬿�Ჱ�󡳨򳩪拊        /// </summary>

        private CStatistics statistics = new CStatistics();


        public FResult()

        {

            InitializeComponent();

        }



        /// <summary>

        /// Callback-᢮󸩪

        /// 嬿 󯤮, ���館吝ﲲ���ﳮ랠衽즬殲᪠鮲汴檱�        /// </summary>

        /// <param name="text"></param>

        delegate void SetTextCallback(string text);


        /// <summary>

        /// Callback-᢮󸩪

        /// 嬿 󯤮, ���館吝ﲲ���ﳮ랠衽즬殲᪠鮲汴檱�        /// </summary>

        /// <param name="text"></param>

        delegate void SetProgressRangeCallBack(int min, int max);


        /// <summary>

        /// Callback-᢮󸩪

        /// 嬿 󯤮, ���館吝ﲲ���ﳮ랠衽즬殲᪠鮲汴檱�        /// </summary>

        /// <param name="text"></param>

        delegate void SetProgressIncCallBack(int value);


        /// <summary>

        /// Callback-᢮󸩪

        /// 嬿 󯤮, ���館吝ﲲ���ﳮ랠衽즬殲᪠鮲汴檱�        /// </summary>

        /// <param name="text"></param>

        delegate void SetLogCallBack(string text);


        /// <summary>

        /// û𐯫𡨠𐩱�� �󹡨񵦩򞋊        /// </summary>

        /// <param name="text"></param>

        private void WriteIntoText(string text)

        {

            if (this.TextOperation.InvokeRequired)

            {

                SetTextCallback d = new SetTextCallback(WriteIntoText);

                this.Invoke(d, new object[] { text });

            }

            else

            {

                TextOperation.Text = text;

                WriteIntoLog(text);

            }//else

        }


        /// <summary>

        /// û𐯫�ᰨ򺡲櫱󞡢 쯣

        /// </summary>

        /// <param name="text"></param>

        private void WriteIntoLog(string text)

        {

            if (this.ProgressLog.InvokeRequired)

            {

                SetLogCallBack d = new SetLogCallBack(WriteIntoLog);

                this.Invoke(d, new object[] { text });

            }

            else

            {

                ProgressLog.Text += text;

                ProgressLog.Text += '\n';

            }//else

        }


        /// <summary>

        /// Ա󡮠㬨㡥𡤰ᮨ�콠progress

        /// </summary>

        /// <param name="min"></param>

        /// <param name="max"></param>

        private void SetProgressRange(int min, int max)

        {

            if (this.progress.InvokeRequired)

            {

                SetProgressRangeCallBack d = new SetProgressRangeCallBack(SetProgressRange);

                this.Invoke(d, new object[] { min, max });

            }

            else

            {

                this.progress.Minimum = min;

                this.progress.Maximum = max;

            }//else

        }


        /// <summary>

Ñòðàíèöû: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42



2012 © Âñå ïðàâà çàùèùåíû
Ïðè èñïîëüçîâàíèè ìàòåðèàëîâ àêòèâíàÿ ññûëêà íà èñòî÷íèê îáÿçàòåëüíà.