示例#1
0
            public static async Task <PosTaggerEnvironment> CreateAsync()
            {
                var sw = Stopwatch.StartNew();

                var morphoModelConfig         = CreateMorphoModelConfig();
                var morphoAmbiguityModel_task = Task.Run(() => CreateMorphoAmbiguityResolverModel());
                var morphoModel_task          = Task.Run(() => MorphoModelFactory.Create(morphoModelConfig));
                var config_task = Task.Run(() => CreatePosTaggerProcessorConfig());

                await Task.WhenAll(morphoAmbiguityModel_task, morphoModel_task, config_task).CAX();

                var morphoAmbiguityModel = morphoAmbiguityModel_task.Result;
                var morphoModel          = morphoModel_task.Result;

                var(config, ssc) = config_task.Result;

                var posTaggerProcessor = new PosTaggerProcessor(config, morphoModel, morphoAmbiguityModel);

                var posEnv = new PosTaggerEnvironment()
                {
                    MorphoAmbiguityResolverModel = morphoAmbiguityModel,
                    MorphoModel        = morphoModel,
                    SentSplitterConfig = ssc,
                    Processor          = posTaggerProcessor,
                };

                sw.Stop(); Console.WriteLine($"load models elapsed: {sw.Elapsed}");

                return(posEnv);
            }
示例#2
0
            public static PosTaggerEnvironment Create()
            {
                var morphoAmbiguityModel = CreateMorphoAmbiguityResolverModel();
                var morphoModelConfig    = CreateMorphoModelConfig();
                var morphoModel          = MorphoModelFactory.Create(morphoModelConfig);
                var config = CreatePosTaggerProcessorConfig();

                var posTaggerProcessor = new PosTaggerProcessor(config, morphoModel, morphoAmbiguityModel);

                var x = new PosTaggerEnvironment()
                {
                    MorphoAmbiguityResolverModel = morphoAmbiguityModel,
                    MorphoModel = morphoModel,
                    Processor   = posTaggerProcessor,
                };

                return(x);
            }
示例#3
0
            public static PosTaggerEnvironment Create()
            {
                var sw = Stopwatch.StartNew();
                var morphoAmbiguityModel = CreateMorphoAmbiguityResolverModel();
                var morphoModelConfig    = CreateMorphoModelConfig();
                var morphoModel          = MorphoModelFactory.Create(morphoModelConfig);

                var(config, ssc) = CreatePosTaggerProcessorConfig();

                var posTaggerProcessor = new PosTaggerProcessor(config, morphoModel, morphoAmbiguityModel);

                var posEnv = new PosTaggerEnvironment()
                {
                    MorphoAmbiguityResolverModel = morphoAmbiguityModel,
                    MorphoModel        = morphoModel,
                    SentSplitterConfig = ssc,
                    Processor          = posTaggerProcessor,
                };

                sw.Stop(); Console.WriteLine($"load models elapsed: {sw.Elapsed}");
                return(posEnv);
            }