예제 #1
0
 private async void startDeletingAllTiere()
 {
     await Task.Run(() =>
     {
         string[] splitWords = PreProcessData.docxManager != null ?
                               PreProcessData.getSpaceSplitWords(PreProcessData.docxManager.Text) :
                               PreProcessData.getSpaceSplitWords(PreProcessData.fullFileData);
         List <string> wordsToDelete         = new List <string>();
         List <string> correctWordsWithTiere = getWordsWithTiereFromFile();
         foreach (string splitword in splitWords)
         {
             if (splitword.Contains('-') && !correctWordsWithTiere.Contains(splitword))
             {
                 wordsToDelete.Add(splitword);
             }
         }
         if (PreProcessData.fileFormat == FileFormat_en.eTXT)
         {
             foreach (string wordtodelete in wordsToDelete)
             {
                 string correctWord          = wordtodelete.Replace("-", "");
                 PreProcessData.fullFileData = PreProcessData.fullFileData.Replace(wordtodelete, correctWord);
             }
         }
         else
         {
             foreach (string wordtodelete in wordsToDelete)
             {
                 string correctWord = wordtodelete.Replace("-", "");
                 PreProcessData.docxManager.ReplaceText(wordtodelete, correctWord);
             }
         }
     });
 }
예제 #2
0
        private async void startAsyncClearingStopWords()
        {
            HistoryWorker.appendLnToHistory(richTextBox_FileHistory, new HistoryMessage("Начата автоматическая обработка стоп-слов.", MessageType_en.eStandart));
            await Task.Run(() =>
            {
                StreamReader reader = new StreamReader(STR_STOP_WORDS_FILE);
                string[] stopWords;
                using (reader)
                {
                    stopWords = reader.ReadToEnd().Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
                }

                reader.Close();

                string[] wordsFromText = PreProcessData.getSpaceSplitWords();

                foreach (string word in wordsFromText)
                {
                    if (stopWords.Contains(word.ToLower()))
                    {
                        PreProcessData.changeTextAccordingToFormat(word, "");
                    }
                }
            });

            HistoryWorker.appendLnToHistory(richTextBox_FileHistory, new HistoryMessage("Стоп-Слова успешно удалены.", MessageType_en.eSuccess));
        }
예제 #3
0
        private async void asyncStartReadingSimilarWords(string wordPart)
        {
            //await Task.Run(() =>
            {
                string[] allWordsFromText = PreProcessData.getSpaceSplitWords();


                foreach (string wordFromText in allWordsFromText)
                {
                    if (wordFromText.ToLower().Contains(wordPart.ToLower()))
                    {
                        L_FoundSameWordsFromText.Add(wordFromText);
                    }
                }
            }//);
        }