public List <Word> GetWordStatistics(string essay, double percentageMax)
        {
            var referringProcess = new ReferringProcess();

            referringProcess.UsePercentage = false;

            referringProcess.SentenceList = essay.ClearUnnecessarySymbolsInText()
                                            .DivideTextToSentences()
                                            .ClearWhiteSpacesInList()
                                            .RemoveEmptyItemsInList()
                                            .ToLower();

            referringProcess.WordList = essay.ClearUnnecessarySymbolsInText()
                                        .DivideTextToWords()
                                        .RemoveEmptyItemsInList()
                                        .ToLower();

            //Send also AddProgressPercentage delegate for displaying comparison progress
            referringProcess.CalculateWordWeights(true, percentageMax, AddProgressPercentage);

            return(referringProcess.GoodWordList);
        }
        public List<Word> GetWordStatistics(string essay, double percentageMax)
        {
            var referringProcess = new ReferringProcess();
            referringProcess.UsePercentage = false;

            referringProcess.SentenceList = essay.ClearUnnecessarySymbolsInText()
                    .DivideTextToSentences()
                    .ClearWhiteSpacesInList()
                    .RemoveEmptyItemsInList()
                    .ToLower();

            referringProcess.WordList = essay.ClearUnnecessarySymbolsInText()
                    .DivideTextToWords()
                    .RemoveEmptyItemsInList()
                    .ToLower();

            //Send also AddProgressPercentage delegate for displaying comparison progress
            referringProcess.CalculateWordWeights(true, percentageMax, AddProgressPercentage);

            return referringProcess.GoodWordList;
        }
示例#3
0
        private void view_RunRefferingClick(object sender, RoutedEventArgs e)
        {
            if (ReferringManager.Instance.IsReferringRunning)
            {
                MessageManager.ShowWarning("Процесс реферирования уже запущен. Пожалуйста, дождитесь окончания операции.");
                return;
            }

            //Check WordNet directory and files
            try
            {
                WordNetManager.CheckWordNetPaths(ReferringManager.Instance.WordNetDirectory);
            }
            catch (Exception ex)
            {
                MessageManager.ShowError(ex.Message);
                Logger.LogError(ex.Message);
                return;
            }

            ReferringProcess referring = null; 

            //Initialize referring and WordNet
            try
            {
                referring = new ReferringProcess();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                MessageManager.ShowError(ex.InnerException.Message);
                Logger.LogError(ex.InnerException.Message);
                return;
            }

            referring.ProgressChanged += Referring_ProgressChanged;
            referring.WorkCompleted += Referring_WorkCompleted;

            //Run referring process
            var syncContext = SynchronizationContext.Current;
            Task task = Task.Factory.StartNew(referring.RunReferrengProcess, syncContext);
        }