public override void run(string format, string[] args)
        {
            base.run(format, args);

            mlParams = CmdLineUtil.loadTrainingParameters(@params.Params, false);
            if (mlParams == null)
            {
                mlParams = ModelUtil.createTrainingParameters(@params.Iterations.Value, @params.Cutoff.Value);
            }

            TokenizerCrossValidator validator;

            TokenizerEvaluationMonitor listener = null;

            if (@params.Misclassified.Value)
            {
                listener = new TokenEvaluationErrorListener();
            }

            try
            {
                Dictionary dict = TokenizerTrainerTool.loadDict(@params.AbbDict);

                TokenizerFactory tokFactory = TokenizerFactory.create(@params.Factory, @params.Lang, dict, @params.AlphaNumOpt.Value, null);
                validator = new TokenizerCrossValidator(mlParams, tokFactory, listener);

                validator.evaluate(sampleStream, @params.Folds.Value);
            }
            catch (IOException e)
            {
                throw new TerminateToolException(-1, "IO error while reading training data or indexing data: " + e.Message, e);
            }
            finally
            {
                try
                {
                    sampleStream.close();
                }
                catch (IOException)
                {
                    // sorry that this can fail
                }
            }

            FMeasure result = validator.FMeasure;

            Console.WriteLine(result.ToString());
        }
        public override void run(string format, string[] args)
        {
            base.run(format, args);

            TokenizerModel model = (new TokenizerModelLoader()).load(@params.Model);

            TokenizerEvaluationMonitor misclassifiedListener = null;

            if (@params.Misclassified.Value)
            {
                misclassifiedListener = new TokenEvaluationErrorListener();
            }

            TokenizerEvaluator evaluator = new TokenizerEvaluator(new opennlp.tools.tokenize.TokenizerME(model), misclassifiedListener);

            Console.Write("Evaluating ... ");

            try
            {
                evaluator.evaluate(sampleStream);
            }
            catch (IOException e)
            {
                Console.Error.WriteLine("failed");
                throw new TerminateToolException(-1, "IO error while reading test data: " + e.Message, e);
            }
            finally
            {
                try
                {
                    sampleStream.close();
                }
                catch (IOException)
                {
                    // sorry that this can fail
                }
            }

            Console.WriteLine("done");

            Console.WriteLine();

            Console.WriteLine(evaluator.FMeasure);
        }