Beispiel #1
0
 public void OnBtnTermFrequencyInverseDocumentFrequencyClicked(string catg)
 {
     if (_interactor.GetNumberOfShelvesInLibrary() != 0)
     {
         foreach (string shelf in _interactor.GetCategories())
         {
             if (_interactor.TermFrequencyExist(shelf) && _interactor.InverseDocumentFrequencyExist(shelf))
             {
                 _interactor.CalculateTermFrequencyInverseDocumentFrequency(shelf);
             }
             else
             {
                 _view.Show("Error. TermFrequency exist:" + _interactor.TermFrequencyExist(shelf) +
                            ",\tInverseDocumentFrequency exist:" +
                            _interactor.InverseDocumentFrequencyExist(shelf) + "; for category: \"" + catg +
                            "\". " +
                            "TermFrequency and InverseDocumentFrequency needs to be computed before proceeding.");
             }
         }
         _view.Show("Finished computing Term Frequency * Inverse Document Frequency");
     }
     else
     {
         _view.Show("There is no categories to calculate TermFrequency*InverseDocumentFrequency");
     }
 }
 private void TFIDFForEachCategory()
 {
     foreach (string shelf in _interactor.GetCategories())
     {
         if (_interactor.TermFrequencyExist(shelf) && _interactor.InverseDocumentFrequencyExist(shelf))
         {
             _interactor.CalculateTermFrequencyInverseDocumentFrequency(shelf);
         }
         else
         {
             _view.Show("Error. TermFrequency exist:" + _interactor.TermFrequencyExist(shelf) +
                        ",\tInverseDocumentFrequency exist:" +
                        _interactor.InverseDocumentFrequencyExist(shelf) + "; for category: \"" + shelf +
                        "\". " +
                        "TermFrequency and InverseDocumentFrequency needs to be computed before proceeding.");
         }
     }
 }