Beispiel #1
0
            public ConcurrentFactory GetMultiLanguageConcurrentFactory()
            {
                var f = _MultiLanguageConcurrentFactory;

                if (f == null)
                {
                    lock ( _SyncLock )
                    {
                        f = _MultiLanguageConcurrentFactory;
                        if (f == null)
                        {
                            var config      = Config.Inst.GetMDetectorConfig();
                            var modelConfig = Config.Inst.GetMModelBinaryNativeConfig();
                            var model       = new MModelBinaryNative(modelConfig);

                            /*
                             * var modelConfig = Config.Inst.GetManyLanguageDetectorModelConfig();
                             * var model       = new ManyLanguageDetectorModel( modelConfig );
                             */

                            f = new ConcurrentFactory(config, model, Config.Inst.CONCURRENT_FACTORY_INSTANCE_COUNT);
                            _MultiLanguageConcurrentFactory = f;
                            //GC.KeepAlive( _MultiLanguageConcurrentFactory );
                        }
                    }
                }
                return(f);
            }
Beispiel #2
0
            public ConcurrentFactory GetRussianLanguageConcurrentFactory()
            {
                var f = _RussianLanguageConcurrentFactory;

                if (f == null)
                {
                    lock ( _SyncLock )
                    {
                        f = _RussianLanguageConcurrentFactory;
                        if (f == null)
                        {
                            var config      = Config.Inst.GetRDetectorConfig();
                            var modelConfig = Config.Inst.GetRModelConfig();
                            var model       = new RModelClassic(modelConfig);

                            f = new ConcurrentFactory(config, model, Config.Inst.CONCURRENT_FACTORY_INSTANCE_COUNT);
                            _RussianLanguageConcurrentFactory = f;
                            //GC.KeepAlive( _RussianLanguageConcurrentFactory );
                        }
                    }
                }
                return(f);
            }