1 |
- {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.AutoDetectSourceLanguageConfig = void 0;\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Contracts_js_1 = require(\"./Contracts.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\nconst LanguageIdMode_js_1 = require(\"./LanguageIdMode.js\");\n/**\n * Language auto detect configuration.\n * @class AutoDetectSourceLanguageConfig\n * Added in version 1.13.0.\n */\nclass AutoDetectSourceLanguageConfig {\n constructor() {\n this.privProperties = new Exports_js_2.PropertyCollection();\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_LanguageIdMode, \"AtStart\");\n this.privLanguageIdMode = LanguageIdMode_js_1.LanguageIdMode.AtStart;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromOpenRange\n * @function\n * @public\n * Only [[SpeechSynthesizer]] supports source language auto detection from open range,\n * for [[Recognizer]], please use AutoDetectSourceLanguageConfig with specific source languages.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with open range.\n */\n static fromOpenRange() {\n const config = new AutoDetectSourceLanguageConfig();\n config.properties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, Exports_js_1.AutoDetectSourceLanguagesOpenRangeOptionName);\n return config;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromLanguages\n * @function\n * @public\n * @param {string[]} languages Comma-separated string of languages (eg. \"en-US,fr-FR\") to populate properties of config.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given languages.\n */\n static fromLanguages(languages) {\n Contracts_js_1.Contracts.throwIfArrayEmptyOrWhitespace(languages, \"languages\");\n const config = new AutoDetectSourceLanguageConfig();\n config.properties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, languages.join());\n return config;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromSourceLanguageConfigs\n * @function\n * @public\n * @param {SourceLanguageConfig[]} configs SourceLanguageConfigs to populate properties of config.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given SourceLanguageConfigs.\n */\n static fromSourceLanguageConfigs(configs) {\n if (configs.length < 1) {\n throw new Error(\"Expected non-empty SourceLanguageConfig array.\");\n }\n const autoConfig = new AutoDetectSourceLanguageConfig();\n const langs = [];\n configs.forEach(config => {\n langs.push(config.language);\n if (config.endpointId !== undefined && config.endpointId !== \"\") {\n const customProperty = config.language + Exports_js_2.PropertyId.SpeechServiceConnection_EndpointId.toString();\n autoConfig.properties.setProperty(customProperty, config.endpointId);\n }\n });\n autoConfig.properties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, langs.join());\n return autoConfig;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.prototype.properties\n * @function\n * @public\n * @return {PropertyCollection} Properties of the config.\n * @summary Gets an auto detected language config properties\n */\n get properties() {\n return this.privProperties;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.prototype.mode\n * @function\n * @public\n * @param {LanguageIdMode} mode LID mode desired.\n * @summary Sets LID operation to desired mode\n */\n set mode(mode) {\n if (mode === LanguageIdMode_js_1.LanguageIdMode.Continuous) {\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"2\");\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_LanguageIdMode, \"Continuous\");\n } else {\n // LanguageIdMode.AtStart\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"1\");\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_LanguageIdMode, \"AtStart\");\n }\n this.privLanguageIdMode = mode;\n }\n}\nexports.AutoDetectSourceLanguageConfig = AutoDetectSourceLanguageConfig;","map":{"version":3,"names":["Object","defineProperty","exports","value","AutoDetectSourceLanguageConfig","Exports_js_1","require","Contracts_js_1","Exports_js_2","LanguageIdMode_js_1","constructor","privProperties","PropertyCollection","setProperty","PropertyId","SpeechServiceConnection_LanguageIdMode","privLanguageIdMode","LanguageIdMode","AtStart","fromOpenRange","config","properties","SpeechServiceConnection_AutoDetectSourceLanguages","AutoDetectSourceLanguagesOpenRangeOptionName","fromLanguages","languages","Contracts","throwIfArrayEmptyOrWhitespace","join","fromSourceLanguageConfigs","configs","length","Error","autoConfig","langs","forEach","push","language","endpointId","undefined","customProperty","SpeechServiceConnection_EndpointId","toString","mode","Continuous","SpeechServiceConnection_RecognitionEndpointVersion"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/AutoDetectSourceLanguageConfig.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AutoDetectSourceLanguageConfig = void 0;\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Contracts_js_1 = require(\"./Contracts.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\nconst LanguageIdMode_js_1 = require(\"./LanguageIdMode.js\");\n/**\n * Language auto detect configuration.\n * @class AutoDetectSourceLanguageConfig\n * Added in version 1.13.0.\n */\nclass AutoDetectSourceLanguageConfig {\n constructor() {\n this.privProperties = new Exports_js_2.PropertyCollection();\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_LanguageIdMode, \"AtStart\");\n this.privLanguageIdMode = LanguageIdMode_js_1.LanguageIdMode.AtStart;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromOpenRange\n * @function\n * @public\n * Only [[SpeechSynthesizer]] supports source language auto detection from open range,\n * for [[Recognizer]], please use AutoDetectSourceLanguageConfig with specific source languages.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with open range.\n */\n static fromOpenRange() {\n const config = new AutoDetectSourceLanguageConfig();\n config.properties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, Exports_js_1.AutoDetectSourceLanguagesOpenRangeOptionName);\n return config;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromLanguages\n * @function\n * @public\n * @param {string[]} languages Comma-separated string of languages (eg. \"en-US,fr-FR\") to populate properties of config.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given languages.\n */\n static fromLanguages(languages) {\n Contracts_js_1.Contracts.throwIfArrayEmptyOrWhitespace(languages, \"languages\");\n const config = new AutoDetectSourceLanguageConfig();\n config.properties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, languages.join());\n return config;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromSourceLanguageConfigs\n * @function\n * @public\n * @param {SourceLanguageConfig[]} configs SourceLanguageConfigs to populate properties of config.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given SourceLanguageConfigs.\n */\n static fromSourceLanguageConfigs(configs) {\n if (configs.length < 1) {\n throw new Error(\"Expected non-empty SourceLanguageConfig array.\");\n }\n const autoConfig = new AutoDetectSourceLanguageConfig();\n const langs = [];\n configs.forEach((config) => {\n langs.push(config.language);\n if (config.endpointId !== undefined && config.endpointId !== \"\") {\n const customProperty = config.language + Exports_js_2.PropertyId.SpeechServiceConnection_EndpointId.toString();\n autoConfig.properties.setProperty(customProperty, config.endpointId);\n }\n });\n autoConfig.properties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, langs.join());\n return autoConfig;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.prototype.properties\n * @function\n * @public\n * @return {PropertyCollection} Properties of the config.\n * @summary Gets an auto detected language config properties\n */\n get properties() {\n return this.privProperties;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.prototype.mode\n * @function\n * @public\n * @param {LanguageIdMode} mode LID mode desired.\n * @summary Sets LID operation to desired mode\n */\n set mode(mode) {\n if (mode === LanguageIdMode_js_1.LanguageIdMode.Continuous) {\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"2\");\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_LanguageIdMode, \"Continuous\");\n }\n else { // LanguageIdMode.AtStart\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"1\");\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_LanguageIdMode, \"AtStart\");\n }\n this.privLanguageIdMode = mode;\n }\n}\nexports.AutoDetectSourceLanguageConfig = AutoDetectSourceLanguageConfig;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,8BAA8B,GAAG,KAAK,CAAC;AAC/C,MAAMC,YAAY,GAAGC,OAAO,CAAC,6BAA6B,CAAC;AAC3D,MAAMC,cAAc,GAAGD,OAAO,CAAC,gBAAgB,CAAC;AAChD,MAAME,YAAY,GAAGF,OAAO,CAAC,cAAc,CAAC;AAC5C,MAAMG,mBAAmB,GAAGH,OAAO,CAAC,qBAAqB,CAAC;AAC1D;AACA;AACA;AACA;AACA;AACA,MAAMF,8BAA8B,CAAC;EACjCM,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,cAAc,GAAG,IAAIH,YAAY,CAACI,kBAAkB,CAAC,CAAC;IAC3D,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K,EAAE,EAAE;QAC7D,MAAME,cAAc,GAAGpB,MAAM,CAACiB,QAAQ,GAAG7B,YAAY,CAACM,UAAU,CAAC2B,kCAAkC,CAACC,QAAQ,CAAC,CAAC;QAC9GT,UAAU,CAACZ,UAAU,CAACR,WAAW,CAAC2B,cAAc,EAAEpB,MAAM,CAACkB,UAAU,CAAC;MACxE;IACJ,CAAC,CAAC;IACFL,UAAU,CAACZ,UAAU,CAACR,WAAW,CAACL,YAAY,CAACM,UAAU,CAACQ,iDAAiD,EAAEY,KAAK,CAACN,IAAI,CAAC,CAAC,CAAC;IAC1H,OAAOK,UAAU;EACrB;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,IAAIZ,UAAUA,CAAA,EAAG;IACb,OAAO,IAAI,CAACV,cAAc;EAC9B;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,IAAIgC,IAAIA,CAACA,IAAI,EAAE;IACX,IAAIA,IAAI,KAAKlC,mBAAmB,CAACQ,cAAc,CAAC2B,UAAU,EAAE;MACxD,IAAI,CAACjC,cAAc,CAACE,WAAW,CAACL,YAAY,CAACM,UAAU,CAAC+B,kDAAkD,EAAE,GAAG,CAAC;MAChH,IAAI,CAAClC,cAAc,CAACE,WAAW,CAACL,YAAY,CAACM,UAAU,CAACC,sCAAsC,EAAE,YAAY,CAAC;IACjH,CAAC,MACI;MAAE;MACH,IAAI,CAACJ,cAAc,CAACE,WAAW,CAACL,YAAY,CAACM,UAAU,CAAC+B,kDAAkD,EAAE,GAAG,CAAC;MAChH,IAAI,CAAClC,cAAc,CAACE,WAAW,CAACL,YAAY,CAACM,UAAU,CAACC,sCAAsC,EAAE,SAAS,CAAC;IAC9G;IACA,IAAI,CAACC,kBAAkB,GAAG2B,IAAI;EAClC;AACJ;AACAzC,OAAO,CAACE,8BAA8B,GAAGA,8BAA8B","ignoreList":[]},"metadata":{},"sourceType":"script","externalDependencies":[]}
|