Exemple #1
0
        public void LoadMyDoc()
        {
            // Create an OpenFileDialog to request a file to open.
            OpenFileDialog f = new OpenFileDialog();

            // Initialize the OpenFileDialog to look for DOC files.
            f.DefaultExt = "*.doc";
            f.Filter     = "DOC Files|*.doc";
            ClearRtb();
            ClearTxt();
            try
            {
                // Determine whether the user selected a file from the OpenFileDialog.
                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK &&
                    f.FileName.Length > 0)
                {
                    // Load the contents of the file into the RichTextBox.
                    richTextBox1.LoadFile(f.FileName);
                    GetFileInformation(f.FileName);
                    //удалить стоп-слова из rtb1 и вставить результат в невидимый rtb3
                    //в rbt3 текст без стилей и почищенный от стоп-слов
                    richTextBox3.AppendText(StopwordTool.RemoveStopwords(richTextBox1.Text));
                }
            }
            catch (TypeInitializationException ex)
            {
                MessageBox.Show("В словаре стоп-слов есть повтор!!!", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        //string xmlFile removed for testing

        public string[] Parse(FileType file)//parse method called
        {
            //the file type is sent to the adapter class where parse will be called on it
            List <String> list = this.adapter.Parse(file);

            BuildingString build = new BuildingString();

            StringBuilder sb = build.BuildString(list);

            string bulk = sb.ToString();


            //XmlParser xp = new XmlParser();
            //List<String> list = xp.Parse(fileName);//pass file into xml parser
            //returns list of words between the xml nodes (raw text)

            StopwordTool sw = new StopwordTool();

            sw.Get();    //pulls the words from the database which populates the stopword dictionary

            //runs the list against the stopwords and
            //returns a string with stopwords and duplicates removed
            string words = sw.RemoveStopwords(bulk);

            string[] wordsList = words.Split(' ');//splits the words string into an array to be returned

            return(wordsList);
        }
        //add to stopwords
        public void AddStopWord(string[] words)
        {
            StopwordTool sw = new StopwordTool();

            foreach (string w in words)
            {
                sw.Add(w);
            }

            Console.WriteLine(sw.stopWords);
        }
Exemple #4
0
        public void LoadMyRtf()
        {
            OpenFileDialog f = new OpenFileDialog();

            f.DefaultExt = "*.rtf";
            f.Filter     = "RTF Files|*.rtf";
            ClearRtb();
            ClearTxt();
            try
            {
                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK && f.FileName.Length > 0)
                {
                    richTextBox1.LoadFile(f.FileName);
                    GetFileInformation(f.FileName);
                    //удалить стоп-слова из rtb1 и вставить результат в невидимый rtb3
                    richTextBox3.AppendText(StopwordTool.RemoveStopwords(richTextBox1.Text));
                }
            }
            catch (TypeInitializationException ex)
            {
                MessageBox.Show("В словаре стоп-слов есть повтор!!!", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void StopWords()//calling parse service
        {
            StopwordTool sw = new StopwordTool();

            sw.Get();
        }