示例#1
0
        private void LabelTopic_DoWork(object sender, DoWorkEventArgs e)
        {
            if (!Directory.Exists(FileMg.ManualTopicLabelFileDir))
            {
                Directory.CreateDirectory(FileMg.ManualTopicLabelFileDir);
            }

            string modelFilePath = tbModelFilePath.Text;

            if (string.IsNullOrEmpty(modelFilePath.Trim()))
            {
                MessageBox.Show("Please select manual model file first!");
                return;
            }

            PrepareManualModel prepareManualModel = new PrepareManualModel(tbModelFilePath.Text, FileMg.ManualTopicLabelFileDir + Constants.TopicManualTermFileName);

            prepareManualModel.ParseManualModel();
        }
示例#2
0
        private static bool LabelTopic(BackgroundWorker backgroundWorker, string modelFilePath)
        {
            OutputMg.OutputHeader1(backgroundWorker, "Step 3", "Label the Generated Topics");

            if (!Directory.Exists(FileMg.ManualTopicLabelFileDir))
            {
                Directory.CreateDirectory(FileMg.ManualTopicLabelFileDir);
            }

            OutputMg.OutputContent(backgroundWorker, "Start to parse manual model file.");
            PrepareManualModel prepareManualModel = new PrepareManualModel(modelFilePath, FileMg.ManualTopicLabelFileDir + Constants.TopicManualTermFileName);

            prepareManualModel.ParseManualModel();
            if (!File.Exists(FileMg.ManualTopicLabelFileDir + Constants.TopicManualTermFileName))
            {
                OutputMg.OutputContent(backgroundWorker, "Failed to parse manual model file, please check the file format.");
                return(false);
            }

            OutputMg.OutputContent(backgroundWorker, "Finished parsing manual model file.");

            return(true);
        }