Ejemplo n.º 1
0
        public void GenerateCompSummary(BackgroundWorker backgroundWorker, string searchTermFilePath, string cleanComponentDir, string compName)
        {
            OutputMg.OutputContent(backgroundWorker, "Start to generate summary");
            OutputMg.OutputContent(backgroundWorker, "-- Start to generate summary for " + compName);
            if (mCompTerms == null)
            {
                OutputMg.OutputContent(backgroundWorker, "Start to combine terms");
                CombineTerms termCombiner = new CombineTerms();
                mCompTerms = termCombiner.GetCombinedTerms(searchTermFilePath, null);
                OutputMg.OutputContent(backgroundWorker, "Finished combining terms");
            }

            if (mCompTerms == null || !mCompTerms.ContainsKey(compName) || mCompSummDictionary.ContainsKey(compName))
            {
                return;
            }

            List <string> compTermList = mCompTerms[compName];
            //get the sentences of components
            string paraFile = cleanComponentDir + compName + ".txt";
            GenerateComponentSummary sentenceSplitter   = new GenerateComponentSummary();
            List <string>            candidateSentences = sentenceSplitter.SplitSingleFileSentence(paraFile);

            if (!mCompSummDictionary.ContainsKey(compName))
            {
                MMRSummary summaryGenerator = new MMRSummary();
                string     summary          = summaryGenerator.GenerateSummary(compTermList, candidateSentences);
                mCompSummDictionary.Add(compName, summary);
            }

            OutputMg.OutputContent(backgroundWorker, "-- Finished generating summary for " + compName);
            OutputMg.OutputContent(backgroundWorker, "Finished generating summary");
        }
Ejemplo n.º 2
0
        private void TryToLoadCompSummary(BackgroundWorker backgroundWorker, string searchTermFilePath, string cleanComponentDir)
        {
            OutputMg.OutputContent(backgroundWorker, "Start to combine terms");
            CombineTerms termCombiner = new CombineTerms();
            Dictionary <string, List <string> > compTerms = termCombiner.GetCombinedTerms(searchTermFilePath, null);

            OutputMg.OutputContent(backgroundWorker, "Finished combining terms");
            OutputMg.OutputContent(backgroundWorker, "Start to generate summary");
            foreach (string comp in compTerms.Keys)
            {
                OutputMg.OutputContent(backgroundWorker, "-- Start to generate summary for " + comp);
                List <string> compTermList = compTerms[comp];

                //get the sentences of components
                string paraFile = cleanComponentDir + comp + ".txt";
                GenerateComponentSummary sentenceSplitter   = new GenerateComponentSummary();
                List <string>            candidateSentences = sentenceSplitter.SplitSingleFileSentence(paraFile);

                MMRSummary summaryGenerator = new MMRSummary();
                string     summary          = summaryGenerator.GenerateSummary(compTermList, candidateSentences);
                mCompSummDictionary.Add(comp, summary);
                OutputMg.OutputContent(backgroundWorker, "-- Finished generating summary for " + comp);
            }
            OutputMg.OutputContent(backgroundWorker, "Finished generating summary");
        }