示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bugReportList"></param>
        /// <returns></returns>
        private List <string> ApplyStopwordsRemoval(List <string> bugReportList)
        {
            List <string> nostopwordsList = new List <string>();

            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);
            }

            foreach (var item in bugReportList)
            {
                List <string> appName;
                try { appName = Model.AppName.ToLower().Split(' ').ToList(); }
                catch
                {
                    appName = null;
                }

                StopWordRemoval.StopWordRemoval temp = new StopWordRemoval.StopWordRemoval(item.Replace('.', ' '), specificFolder, appName);
                nostopwordsList.Add(temp.output);
            }
            return(nostopwordsList);
        }
示例#2
0
        /// <summary>
        /// Method to filter input text.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        private string FilterText(string text)
        {
            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);
            }


            text.Replace('.', ' ');
            if (NoSWCheckboxCheckedState)
            {
                StopWordRemoval.StopWordRemoval temp = new StopWordRemoval.StopWordRemoval(text, specificFolder);
                text = temp.output;
            }


            if (STCheckboxCheckedState)
            {
                string[] words           = text.Split(' ');
                string   finalStemOutput = "";
                foreach (string word in words)
                {
                    Stemmer temp = new Stemmer();
                    temp.add(word.ToCharArray(), word.Length);
                    temp.stem();
                    var stemOutput = temp.ToString();
                    finalStemOutput += stemOutput + " ";
                }
                text = finalStemOutput;
            }
            text = RemoveSpecialCharacters(text);
            return(text);
        }