Пример #1
0
 private ACRCloudRecognizer()
 {
     if (ConfigurationManager.GetSection("ACRCloud") is NameValueCollection acrCloudConfig)
     {
         _host         = acrCloudConfig["host"];
         _accessKey    = acrCloudConfig["access_key"];
         _accessSecret = acrCloudConfig["access_secret"];
         _timeout      = int.Parse(acrCloudConfig["timeout"]) * 1000;
     }
     _recType = RECOGNIZER_TYPE.acr_rec_type_audio;
 }
Пример #2
0
 public ACRCloudRecognizer(IDictionary <string, Object> config)
 {
     if (config.ContainsKey("host"))
     {
         this.host = (string)config["host"];
     }
     if (config.ContainsKey("access_key"))
     {
         this.accessKey = (string)config["access_key"];
     }
     if (config.ContainsKey("access_secret"))
     {
         this.accessSecret = (string)config["access_secret"];
     }
     if (config.ContainsKey("timeout"))
     {
         this.timeout = 1000 * (int)config["timeout"];
     }
     if (config.ContainsKey("rec_type"))
     {
         this.rec_type = (RECOGNIZER_TYPE)config["rec_type"];
     }
 }
        public ACRCloudRecognizer(IDictionary <string, Object> config)
        {
            if (config.ContainsKey("host"))
            {
                this.host = (string)config["host"];
            }
            if (config.ContainsKey("access_key"))
            {
                this.accessKey = (string)config["access_key"];
            }
            if (config.ContainsKey("access_secret"))
            {
                this.accessSecret = (string)config["access_secret"];
            }
            if (config.ContainsKey("timeout"))
            {
                this.timeout = 1000 * (int)config["timeout"];
            }
            if (config.ContainsKey("rec_type"))
            {
                this.rec_type = (RECOGNIZER_TYPE)config["rec_type"];
            }
            if (config.ContainsKey("filter_energy_min"))
            {
                this.filter_energy_min = (int)config["filter_energy_min"];
            }
            if (config.ContainsKey("silence_energy_threshold"))
            {
                this.silence_energy_threshold = (int)config["silence_energy_threshold"];
            }
            if (config.ContainsKey("silence_rate_threshold"))
            {
                this.silence_rate_threshold = (float)config["silence_rate_threshold"];
            }

            this.acrTool = new ACRCloudExtrTool(this.filter_energy_min, this.silence_energy_threshold, this.silence_rate_threshold);
        }