示例#1
0
        //=============== Only PoS-Tagger (without Morphology) ===============//
        private static void ProcessText_without_Morphology(string text)
        {
            var(config, ssc) = PosTaggerEnvironment.CreatePosTaggerProcessorConfig();

            using (ssc)
                using (var tokenizer = new Tokenizer(config.TokenizerConfig))
                    using (var posTaggerScriber = PosTaggerScriber.Create(config.ModelFilename, config.TemplateFilename))
                    {
                        var posTaggerPreMerging = new PosTaggerPreMerging(config.Model);
                        var result = new List <word_t>();

                        tokenizer.Run(text, true, words =>
                        {
                            //-merge-phrases-abbreviations-numbers-
                            posTaggerPreMerging.Run(words);

                            //directly pos-tagging
                            posTaggerScriber.Run(words);

                            result.AddRange(words);
                        });

                        Console.WriteLine("pos-tagger-entity-count: " + result.Count + Environment.NewLine);
                        foreach (var w in result)
                        {
                            Console.WriteLine(w);
                        }
                        Console.WriteLine();
                    }
        }
示例#2
0
        public PosTaggerModelBuilder(string templateFilename, LanguageTypeEnum languageType, UrlDetectorConfig urlDetectorConfig)
        {
            templateFilename.ThrowIfNullOrWhiteSpace("templateFilename");
            urlDetectorConfig.ThrowIfNull("urlDetectorConfig");

            _PosTaggerScriber            = PosTaggerScriber.Create4ModelBuilder(templateFilename);
            _PosTaggerInputTypeProcessor = CreatePosTaggerInputTypeProcessor(languageType);
            _UrlDetector = new UrlDetector(urlDetectorConfig);
            _Words       = new List <word_t>();
        }
示例#3
0
        public PosTaggerProcessor(PosTaggerProcessorConfig config, IMorphoModel morphoModel, MorphoAmbiguityResolverModel morphoAmbiguityModel)
        {
            CheckConfig(config, morphoModel, morphoAmbiguityModel);

            _Tokenizer                      = new Tokenizer(config.TokenizerConfig);
            _Words                          = new List <word_t>(DEFAULT_WORDSLIST_CAPACITY);
            _PosTaggerScriber               = PosTaggerScriber.Create(config.ModelFilename, config.TemplateFilename);
            _PosTaggerPreMerging            = new PosTaggerPreMerging(config.Model);
            _PosTaggerMorphoAnalyzer        = new PosTaggerMorphoAnalyzer(morphoModel, morphoAmbiguityModel);
            _ProcessSentCallback_1_Delegate = new Tokenizer.ProcessSentCallbackDelegate(ProcessSentCallback_1);
            _ProcessSentCallback_2_Delegate = new Tokenizer.ProcessSentCallbackDelegate(ProcessSentCallback_2);
        }
示例#4
0
        public static PosTaggerScriber Create4ModelBuilder(string templateFilename)
        {
            var _PosTaggerCRFSuiteConverter = new PosTaggerScriber(templateFilename);

            return(_PosTaggerCRFSuiteConverter);
        }
示例#5
0
        public static PosTaggerScriber Create(string modelFilename, string templateFilename)
        {
            var _PosTaggerCRFSuiteConverter = new PosTaggerScriber(modelFilename, templateFilename);

            return(_PosTaggerCRFSuiteConverter);
        }