示例#1
0
        /// <summary>
        ///
        /// </summary>
        private void ShowBugReportSummaryWordCloud()
        {
            try
            {
                // Create the interop host control.
                System.Windows.Forms.Integration.WindowsFormsHost host =
                    new System.Windows.Forms.Integration.WindowsFormsHost();

                // Create the MaskedTextBox control.
                Gma.CodeCloud.Controls.CloudControl abc = new Gma.CodeCloud.Controls.CloudControl();

                System.Windows.Forms.ProgressBar abcd = new System.Windows.Forms.ProgressBar();

                //IBlacklist blacklist = ComponentFactory.CreateBlacklist(false);

                var currDir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);

                // Combine the base folder with your specific folder....
                string specificFolder = System.IO.Path.Combine(currDir, "MARC 3.0");

                // Check if folder exists and if not, create it
                if (!Directory.Exists(specificFolder))
                {
                    Directory.CreateDirectory(specificFolder);
                }

                IBlacklist blacklist = CommonBlacklist.CreateFromTextFile(specificFolder + "\\InputData\\stopwords_en.txt");


                var preProcessedList = ApplyStopwordsRemoval(Model.BugReportSummaryList);

                InputType            inputType = ComponentFactory.DetectInputType(String.Join(",", preProcessedList.ToArray()));
                IProgressIndicator   progress  = ComponentFactory.CreateProgressBar(inputType, abcd);
                IEnumerable <string> terms     = ComponentFactory.CreateExtractor(inputType, String.Join(",", preProcessedList.ToArray()), progress);
                IWordStemmer         stemmer   = ComponentFactory.CreateWordStemmer(false);

                IEnumerable <IWord> words = terms
                                            .Filter(blacklist)
                                            .CountOccurences();

                abc.WeightedWords =
                    words
                    .GroupByStem(stemmer)
                    .SortByOccurences()
                    .Cast <IWord>();

                // Assign the MaskedTextBox control as the host control's child.
                host.Child = abc;

                this.bugReportSummaryWordCloudGrid.Children.Add(host);
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong in the word cloud engine.", "Unexpected Error", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        private void ShowUserRequirementsSummaryWordCloud()
        {
            try
            {
                // Create the interop host control.
                System.Windows.Forms.Integration.WindowsFormsHost host =
                    new System.Windows.Forms.Integration.WindowsFormsHost();

                // Create the MaskedTextBox control.
                Gma.CodeCloud.Controls.CloudControl abc = new Gma.CodeCloud.Controls.CloudControl();

                System.Windows.Forms.ProgressBar abcd = new System.Windows.Forms.ProgressBar();

                IBlacklist blacklist = ComponentFactory.CreateBlacklist(false);
                //IBlacklist customBlacklist = CommonBlacklist.CreateFromTextFile(s_BlacklistTxtFileName);

                var preProcessedList = ApplyStopwordsRemoval(Model.UserRequirementsSummaryList);

                InputType            inputType = ComponentFactory.DetectInputType(String.Join(",", preProcessedList.ToArray()));
                IProgressIndicator   progress  = ComponentFactory.CreateProgressBar(inputType, abcd);
                IEnumerable <string> terms     = ComponentFactory.CreateExtractor(inputType, String.Join(",", preProcessedList.ToArray()), progress);
                IWordStemmer         stemmer   = ComponentFactory.CreateWordStemmer(false);

                IEnumerable <IWord> words = terms
                                            .Filter(blacklist)
                                            .CountOccurences();

                abc.WeightedWords =
                    words
                    .GroupByStem(stemmer)
                    .SortByOccurences()
                    .Cast <IWord>();

                // Assign the MaskedTextBox control as the host control's child.
                host.Child = abc;

                this.userRequirementsSummaryWordCloudGrid.Children.Add(host);
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong in the word cloud engine.", "Unexpected Error", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }