Esempio n. 1
0
        /*
         * calculate the density per document
         */
        //find the density of all topics in each document
        //files in two levels
        public void DoClumpingRank()
        {
            if (File.Exists(rankResult))
            {
                File.Delete(rankResult);
            }

            string topcTermRawData = FileOperators.ReadFileText(topicTermsFilePath);

            if (string.IsNullOrEmpty(topcTermRawData))
            {
                return;
            }

            string topicTermContent = topcTermRawData.ToLower();

            topicTerms = ParseTopicTerms.GetTopicTermValueList(topicTermContent);

            docTopicDensityMap      = new Dictionary <string, Dictionary <string, float> >();
            fileNameTopicDensityMap = new Dictionary <string, Dictionary <string, float> >();

            string[] fileEntities = Directory.GetFiles(txtCleanFileDir);
            CalDocDensityMap(fileEntities);
            string[] dirs = Directory.GetDirectories(txtCleanFileDir);
            foreach (string dir in dirs)
            {
                string[] subFileEntities = Directory.GetFiles(dir);
                CalDocDensityMap(subFileEntities);
            }

            WriteRankingResult();
        }
Esempio n. 2
0
        /*
         * calculate the density per document
         */
        //find the density of all components in each document.
        //files in two levels
        public void DoClumpingRank(BackgroundWorker backgroundWorker)
        {
            if (File.Exists(rankResult))
            {
                File.Delete(rankResult);
            }

            OutputMg.OutputContent(backgroundWorker, "Start parsing topic terms");
            string topicTermContent = FileOperators.ReadFileText(topicTermsFilePath).ToLower();

            topicTerms = ParseTopicTerms.GetTopicTermValueList(topicTermContent);
            OutputMg.OutputContent(backgroundWorker, "Finished parsing topic terms.");

            OutputMg.OutputContent(backgroundWorker, "Start ranking topic");
            docTopicDensityMap      = new Dictionary <string, Dictionary <string, float> >();
            fileNameTopicDensityMap = new Dictionary <string, Dictionary <string, float> >();

            string[] fileEntities = Directory.GetFiles(txtCleanFileDir);
            CalDocDensityMap(fileEntities);
            string[] dirs = Directory.GetDirectories(txtCleanFileDir);
            foreach (string dir in dirs)
            {
                string[] subFileEntities = Directory.GetFiles(dir);
                //CalDocDensityMap(subFileEntities);
                CalDocDensityMap(subFileEntities);
            }

            OutputMg.OutputContent(backgroundWorker, "Finished ranking topic");
            OutputMg.OutputContent(backgroundWorker, "Start writing ranking topic");
            WriteRankingResult();
            OutputMg.OutputContent(backgroundWorker, "Finished writing ranking topic");
        }