public MDetectorConfig GetMDetectorConfig() { var config = new MDetectorConfig() { UrlDetectorModel = new UrlDetectorModel(URL_DETECTOR_RESOURCES_XML_FILENAME), ThresholdPercent = ML_THRESHOLD_PERCENT, ThresholdPercentBetween3Language = ML_THRESHOLD_PERCENT_BETWEEN_3_LANGUAGE, ThresholdDetectingWordCount = ML_THRESHOLD_DETECTING_WORD_COUNT, ThresholdPercentDetectingWordCount = ML_THRESHOLD_PERCENT_DETECTING_WORD_COUNT, ThresholdAbsoluteWeightLanguage = ML_THRESHOLD_ABSOLUTE_WEIGHT_LANGUAGE, }; return(config); }
//private bool _Disposed; //private ManyLanguageDetectorModel _ManyLanguageDetectorModel; //need to hold for suppress finalizer //private IMModel _IMModel; //private IRModel _IRModel; /*public ConcurrentFactory( MDetectorConfig config, ManyLanguageDetectorModel model, int instanceCount ) * { * if ( instanceCount <= 0 ) throw (new ArgumentException("instanceCount")); * if ( config == null ) throw (new ArgumentNullException("config")); * if ( model == null ) throw (new ArgumentNullException("model")); * * _InstanceCount = instanceCount; * _Semaphore = new Semaphore( _InstanceCount, _InstanceCount ); * _Stack = new ConcurrentStack< ILanguageDetector >(); * for ( int i = 0; i < _InstanceCount; i++ ) * { * _Stack.Push( new ManyLanguageDetector( config, model ) ); * } * //_ManyLanguageDetectorModel = model; * }*/ public ConcurrentFactory(MDetectorConfig config, IMModel model, int instanceCount) { if (instanceCount <= 0) { throw (new ArgumentException("instanceCount")); } if (config == null) { throw (new ArgumentNullException("config")); } if (model == null) { throw (new ArgumentNullException("model")); } _InstanceCount = instanceCount; _Semaphore = new Semaphore(_InstanceCount, _InstanceCount); _Stack = new ConcurrentStack <ILanguageDetector>(); for (int i = 0; i < _InstanceCount; i++) { _Stack.Push(new MDetector(config, model)); } //_IMModel = model; }
public MDetectorBinaryNative(MDetectorConfig config, MModelBinaryNative model) : base(config, model) { _ModelBinaryNative = model; }