public void OnBtnTermFrequencyClicked(string catg, string textToBeAnalyzed)
        {
            // calculate TermFrequency to all categories and then press IDF. Then TermFrequencyIDF.

            if (string.IsNullOrWhiteSpace(catg))
            {
                _view.Show("Please enter or chose the category");
                return;
            }

            //feature if the field is not empty then learn
            if (!string.IsNullOrWhiteSpace(textToBeAnalyzed))
            {
                AppendTrainingDoc(catg, textToBeAnalyzed);
                _view.Show("Success");
            }
            else
            {
                // todo feature if the textBox is empty then show saved data

                if (_interactor.WhetherCategoryExist(catg))
                {
                    _view.Show("Write some texts to update the network");
                }
                else
                {
                    _view.Show("The category \"" + catg +
                               "\" was not created. To create this category enter text of news in the TextBox");
                }
            }
        }
Exemplo n.º 2
0
        public void OnBtnTermFrequencyClicked(string catg, string textToBeAnalyzed)
        {
            // calculate TermFrequency to all categories and then press IDF. Then TermFrequencyIDF.

            if (string.IsNullOrWhiteSpace(catg))
            {
                _view.Show("Please enter or chose the category");
                return;
            }

            //feature if the field is not empty then learn
            if (!string.IsNullOrWhiteSpace(textToBeAnalyzed))
            {
                /*
                 * create new category &save only unique words
                 * rewrite if category already exists
                 */
                _interactor.AddCategory(catg, _interactor.GetSplitWords(textToBeAnalyzed));

                _interactor.ComputeTermFrequencyAltogether(catg);

                _view.SetCategories(_interactor.GetCategories().ToArray());

                _view.Show("Success");
            }
            else
            {
                //feature if the textBox is empty then show saved data

                if (_interactor.WhetherCategoryExist(catg))
                {
                    _view.Show("Write some texts to update the network");
                }
                else
                {
                    _view.Show("The category \"" + catg +
                               "\" was not created. To create this category enter text of news in the TextBox");
                }
            }
        }