Exemplo n.º 1
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            var opt = GetDefaultOption();

            //Parser parser = new Parser();
            //var stopwatch = new Stopwatch();
            if (txtinput.Text.Trim().Length == 0 || Path.GetExtension(txtinput.Text).ToLower() != ".txt")
            {
                return;
            }

            try
            {
                //parser.ParseArguments(args, opt);
                var model = new LDAGibbsSampling();


                model.OnIterate     += LDAProcessEvent;
                progressBar1.Maximum = opt.Niters;
                progressBar1.Value   = 1;
                progressBar1.Visible = true;


                var cor = new Corpora();
                cor.LoadDataFile(opt.Input);
                model.TrainNewModel(cor, opt);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            CommandLineOption opt    = GetDefaultOption();
            Parser            parser = new Parser();
            var stopwatch            = new Stopwatch();

            try
            {
                parser.ParseArguments(args, opt);
                LDAGibbsSampling model = new LDAGibbsSampling();
                Corpora          cor   = new Corpora();
                cor.LoadDataFile(opt.input);
                model.TrainNewModel(cor, opt);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Message);
            }
        }