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B,0BAA0B,IAAI,IAAI;IAIlC,eAAe,IAAI,IAAI;IAIvB,KAAK,IAAI,gBAAgB;IAMhC,IAAW,uBAAuB,IAAI,MAAM,CAE3C;IAED,IAAW,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAElD;IAED,IAAW,wBAAwB,IAAI,MAAM,CAE5C;IAED,IAAW,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAEhD;IAED,IAAW,2BAA2B,IAAI,2BAA2B,CAEpE;IAED,IAAW,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,EAEzE;CACJ","file":"SpeechConfig.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n ForceDictationPropertyName,\r\n OutputFormatPropertyName,\r\n ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports.js\";\r\nimport {IStringDictionary} from \"../common/Exports.js\";\r\nimport {Contracts} from \"./Contracts.js\";\r\nimport {\r\n OutputFormat,\r\n ProfanityOption,\r\n PropertyCollection,\r\n PropertyId,\r\n ServicePropertyChannel,\r\n SpeechSynthesisOutputFormat,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Speech configuration.\r\n * @class SpeechConfig\r\n */\r\nexport abstract class SpeechConfig {\r\n /**\r\n * Creates and initializes an instance.\r\n * @constructor\r\n */\r\n protected constructor() {\r\n return;\r\n }\r\n\r\n /**\r\n * Static instance of SpeechConfig returned by passing subscriptionKey and service region.\r\n * Note: Please use your LanguageUnderstanding subscription key in case you want to use the Intent recognizer.\r\n * @member SpeechConfig.fromSubscription\r\n * @function\r\n * @public\r\n * @param {string} subscriptionKey - The subscription key.\r\n * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n * @returns {SpeechConfig} The speech factory\r\n */\r\n public static fromSubscription(subscriptionKey: string, region: string): SpeechConfig {\r\n Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_IntentRegion, region);\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n\r\n return speechImpl;\r\n }\r\n\r\n /**\r\n * Creates an instance of the speech config with specified endpoint and subscription key.\r\n * This method is intended only for users who use a non-standard service endpoint or parameters.\r\n * Note: Please use your LanguageUnderstanding subscription key in case you want to use the Intent recognizer.\r\n * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\r\n * For example, if language is defined in the uri as query parameter \"language=de-DE\", and also set by\r\n * SpeechConfig.speechRecognitionLanguage = \"en-US\", the language setting in uri takes precedence,\r\n * and the effective language is \"de-DE\". Only the parameters that are not specified in the\r\n * endpoint URL can be set by other APIs.\r\n * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to\r\n * use the authorization token.\r\n * @member SpeechConfig.fromEndpoint\r\n * @function\r\n * @public\r\n * @param {URL} endpoint - The service endpoint to connect to.\r\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n * @returns {SpeechConfig} A speech factory instance.\r\n */\r\n public static fromEndpoint(endpoint: URL, subscriptionKey?: string): SpeechConfig {\r\n Contracts.throwIfNull(endpoint, \"endpoint\");\r\n\r\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\r\n\r\n if (undefined !== subscriptionKey) {\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n }\r\n return speechImpl;\r\n }\r\n\r\n /**\r\n * Creates an instance of the speech config with specified host and subscription key.\r\n * This method is intended only for users who use a non-default service host. Standard resource path will be assumed.\r\n * For services with a non-standard resource path or no path at all, use fromEndpoint instead.\r\n * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\r\n * Note: To use an authorization token with fromHost, use fromHost(URL),\r\n * and then set the AuthorizationToken property on the created SpeechConfig instance.\r\n * Note: Added in version 1.9.0.\r\n * @member SpeechConfig.fromHost\r\n * @function\r\n * @public\r\n * @param {URL} host - The service endpoint to connect to. Format is \"protocol://host:port\" where \":port\" is optional.\r\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n * @returns {SpeechConfig} A speech factory instance.\r\n */\r\n public static fromHost(hostName: URL, subscriptionKey?: string): SpeechConfig {\r\n Contracts.throwIfNull(hostName, \"hostName\");\r\n\r\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Host, hostName.protocol + \"//\" + hostName.hostname + (hostName.port === \"\" ? \"\" : \":\" + hostName.port));\r\n\r\n if (undefined !== subscriptionKey) {\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n }\r\n return speechImpl;\r\n }\r\n\r\n /**\r\n * Creates an instance of the speech factory with specified initial authorization token and region.\r\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n * Note: Please use a token derived from your LanguageUnderstanding subscription key in case you want\r\n * to use the Intent recognizer. As configuration values are copied when creating a new recognizer,\r\n * the new token value will not apply to recognizers that have already been created. For recognizers\r\n * that have been created before, you need to set authorization token of the corresponding recognizer\r\n * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n * @member SpeechConfig.fromAuthorizationToken\r\n * @function\r\n * @public\r\n * @param {string} authorizationToken - The initial authorization token.\r\n * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n * @returns {SpeechConfig} A speech factory instance.\r\n */\r\n public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechConfig {\r\n Contracts.throwIfNull(authorizationToken, \"authorizationToken\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_IntentRegion, region);\r\n speechImpl.authorizationToken = authorizationToken;\r\n return speechImpl;\r\n }\r\n\r\n /**\r\n * Sets the proxy configuration.\r\n * Only relevant in Node.js environments.\r\n * Added in version 1.4.0.\r\n * @param proxyHostName The host name of the proxy server.\r\n * @param proxyPort The port number of the proxy server.\r\n */\r\n public abstract setProxy(proxyHostName: string, proxyPort: number): void;\r\n\r\n /**\r\n * Sets the proxy configuration.\r\n * Only relevant in Node.js environments.\r\n * Added in version 1.4.0.\r\n * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\r\n * @param proxyPort The port number of the proxy server.\r\n * @param proxyUserName The username of the proxy server.\r\n * @param proxyPassword The password of the proxy server.\r\n */\r\n public abstract setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n\r\n /**\r\n * Gets the authorization token.\r\n * @member SpeechConfig.prototype.authorizationToken\r\n * @function\r\n * @public\r\n */\r\n public abstract get authorizationToken(): string;\r\n\r\n /**\r\n * Gets/Sets the authorization token.\r\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n * @member SpeechConfig.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public abstract set authorizationToken(value: string);\r\n\r\n /**\r\n * Returns the configured language.\r\n * @member SpeechConfig.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n */\r\n public abstract get speechRecognitionLanguage(): string;\r\n\r\n /**\r\n * Gets/Sets the input language.\r\n * @member SpeechConfig.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public abstract set speechRecognitionLanguage(value: string);\r\n\r\n /**\r\n * Sets an arbitrary property.\r\n * @member SpeechConfig.prototype.setProperty\r\n * @function\r\n * @public\r\n * @param {string | PropertyId} name - The name of the property to set.\r\n * @param {string} value - The new value of the property.\r\n */\r\n public abstract setProperty(name: string | PropertyId, value: string): void;\r\n\r\n /**\r\n * Returns the current value of an arbitrary property.\r\n * @member SpeechConfig.prototype.getProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property to query.\r\n * @param {string} def - The value to return in case the property is not known.\r\n * @returns {string} The current value, or provided default, of the given property.\r\n */\r\n public abstract getProperty(name: string, def?: string): string;\r\n\r\n /**\r\n * Gets speech recognition output format (simple or detailed).\r\n * Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to\r\n * get synthesized audio output format.\r\n * @member SpeechConfig.prototype.outputFormat\r\n * @function\r\n * @public\r\n * @returns {OutputFormat} Returns the output format.\r\n */\r\n public abstract get outputFormat(): OutputFormat;\r\n\r\n /**\r\n * Gets/Sets speech recognition output format (simple or detailed).\r\n * Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to\r\n * set synthesized audio output format.\r\n * @member SpeechConfig.prototype.outputFormat\r\n * @function\r\n * @public\r\n */\r\n public abstract set outputFormat(format: OutputFormat);\r\n\r\n /**\r\n * Gets the endpoint ID of a customized speech model that is used for speech recognition.\r\n * @member SpeechConfig.prototype.endpointId\r\n * @function\r\n * @public\r\n * @return {string} The endpoint ID\r\n */\r\n public abstract get endpointId(): string;\r\n\r\n /**\r\n * Gets/Sets the endpoint ID of a customized speech model that is used for speech recognition.\r\n * @member SpeechConfig.prototype.endpointId\r\n * @function\r\n * @public\r\n * @param {string} value - The endpoint ID\r\n */\r\n public abstract set endpointId(value: string);\r\n\r\n /**\r\n * Closes the configuration.\r\n * @member SpeechConfig.prototype.close\r\n * @function\r\n * @public\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n public close(): void { }\r\n\r\n /**\r\n * @member SpeechConfig.prototype.subscriptionKey\r\n * @function\r\n * @public\r\n * @return {string} The subscription key set on the config.\r\n */\r\n public abstract get subscriptionKey(): string;\r\n\r\n /**\r\n * @member SpeechConfig.prototype.region\r\n * @function\r\n * @public\r\n * @return {region} The region set on the config.\r\n */\r\n public abstract get region(): string;\r\n\r\n /**\r\n * Sets a property value that will be passed to service using the specified channel.\r\n * Added in version 1.7.0.\r\n * @member SpeechConfig.prototype.setServiceProperty\r\n * @function\r\n * @public\r\n * @param {name} The name of the property.\r\n * @param {value} Value to set.\r\n * @param {channel} The channel used to pass the specified property to service.\r\n */\r\n public abstract setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void;\r\n\r\n /**\r\n * Sets profanity option.\r\n * Added in version 1.7.0.\r\n * @member SpeechConfig.prototype.setProfanity\r\n * @function\r\n * @public\r\n * @param {profanity} Profanity option to set.\r\n */\r\n public abstract setProfanity(profanity: ProfanityOption): void;\r\n\r\n /**\r\n * Enable audio logging in service.\r\n * Audio and content logs are stored either in Microsoft-owned storage, or in your own storage account linked\r\n * to your Cognitive Services subscription (Bring Your Own Storage (BYOS) enabled Speech resource).\r\n * The logs will be removed after 30 days.\r\n * Added in version 1.7.0.\r\n * @member SpeechConfig.prototype.enableAudioLogging\r\n * @function\r\n * @public\r\n */\r\n public abstract enableAudioLogging(): void;\r\n\r\n /**\r\n * Includes word-level timestamps.\r\n * Added in version 1.7.0.\r\n * @member SpeechConfig.prototype.requestWordLevelTimestamps\r\n * @function\r\n * @public\r\n */\r\n public abstract requestWordLevelTimestamps(): void;\r\n\r\n /**\r\n * Enable dictation. Only supported in speech continuous recognition.\r\n * Added in version 1.7.0.\r\n * @member SpeechConfig.prototype.enableDictation\r\n * @function\r\n * @public\r\n */\r\n public abstract enableDictation(): void;\r\n\r\n /**\r\n * Gets the language of the speech synthesizer.\r\n * Added in version 1.11.0.\r\n * @member SpeechConfig.prototype.speechSynthesisLanguage\r\n * @function\r\n * @public\r\n * @returns {string} Returns the speech synthesis language.\r\n */\r\n public abstract get speechSynthesisLanguage(): string;\r\n\r\n /**\r\n * Sets the language of the speech synthesizer.\r\n * Added in version 1.11.0.\r\n * @member SpeechConfig.prototype.speechSynthesisLanguage\r\n * @function\r\n * @public\r\n */\r\n public abstract set speechSynthesisLanguage(language: string);\r\n\r\n /**\r\n * Gets the voice of the speech synthesizer.\r\n * Added in version 1.11.0.\r\n * @member SpeechConfig.prototype.speechSynthesisVoiceName\r\n * @function\r\n * @public\r\n * @returns {string} Returns the speech synthesis voice.\r\n */\r\n public abstract get speechSynthesisVoiceName(): string;\r\n\r\n /**\r\n * Sets the voice of the speech synthesizer. (see <a href=\"https://aka.ms/speech/tts-languages\">available voices</a>).\r\n * Added in version 1.11.0.\r\n * @member SpeechConfig.prototype.speechSynthesisVoiceName\r\n * @function\r\n * @public\r\n */\r\n public abstract set speechSynthesisVoiceName(voice: string);\r\n\r\n /**\r\n * Gets the speech synthesis output format.\r\n * Added in version 1.11.0.\r\n * @member SpeechConfig.prototype.speechSynthesisOutputFormat\r\n * @function\r\n * @public\r\n * @returns {SpeechSynthesisOutputFormat} Returns the speech synthesis output format\r\n */\r\n public abstract get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat;\r\n\r\n /**\r\n * Sets the speech synthesis output format (e.g. Riff16Khz16BitMonoPcm).\r\n * The default format is Audio16Khz64KBitRateMonoMp3 for browser and Riff16Khz16BitMonoPcm for Node.JS.\r\n * Added in version 1.11.0.\r\n * @member SpeechConfig.prototype.speechSynthesisOutputFormat\r\n * @function\r\n * @public\r\n */\r\n public abstract set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat);\r\n}\r\n\r\n/**\r\n * @public\r\n * @class SpeechConfigImpl\r\n */\r\nexport class SpeechConfigImpl extends SpeechConfig {\r\n\r\n private privProperties: PropertyCollection;\r\n\r\n public constructor() {\r\n super();\r\n this.privProperties = new PropertyCollection();\r\n this.speechRecognitionLanguage = \"en-US\"; // Should we have a default?\r\n this.outputFormat = OutputFormat.Simple;\r\n }\r\n\r\n public get properties(): PropertyCollection {\r\n return this.privProperties;\r\n }\r\n\r\n public get endPoint(): URL {\r\n return new URL(this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Endpoint));\r\n }\r\n\r\n public get subscriptionKey(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Key);\r\n }\r\n\r\n public get region(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n }\r\n\r\n public get authorizationToken(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n }\r\n\r\n public set authorizationToken(value: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n }\r\n\r\n public get speechRecognitionLanguage(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n }\r\n\r\n public set speechRecognitionLanguage(value: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\r\n }\r\n\r\n public get autoDetectSourceLanguages(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages);\r\n }\r\n\r\n public set autoDetectSourceLanguages(value: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, value);\r\n }\r\n\r\n public get outputFormat(): OutputFormat {\r\n return OutputFormat[this.privProperties.getProperty(OutputFormatPropertyName, undefined) as keyof typeof OutputFormat];\r\n }\r\n\r\n public set outputFormat(value: OutputFormat) {\r\n this.privProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\r\n }\r\n\r\n public get endpointId(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\r\n }\r\n\r\n public set endpointId(value: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EndpointId, value);\r\n }\r\n\r\n public setProperty(name: string | PropertyId, value: string): void {\r\n Contracts.throwIfNull(value, \"value\");\r\n\r\n this.privProperties.setProperty(name, value);\r\n }\r\n\r\n public getProperty(name: string | PropertyId, def?: string): string {\r\n\r\n return this.privProperties.getProperty(name, def);\r\n }\r\n\r\n public setProxy(proxyHostName: string, proxyPort: number): void;\r\n public setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n public setProxy(proxyHostName: any, proxyPort: any, proxyUserName?: any, proxyPassword?: any): void {\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyHostName], proxyHostName as string);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPort], proxyPort as string);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyUserName], proxyUserName as string);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPassword], proxyPassword as string);\r\n }\r\n\r\n public setServiceProperty(name: string, value: string): void {\r\n const currentProperties: IStringDictionary<string> = JSON.parse(this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n currentProperties[name] = value;\r\n\r\n this.privProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n }\r\n\r\n public setProfanity(profanity: ProfanityOption): void {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\r\n }\r\n\r\n public enableAudioLogging(): void {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\r\n }\r\n public requestWordLevelTimestamps(): void {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\r\n this.privProperties.setProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Detailed]);\r\n }\r\n public enableDictation(): void {\r\n this.privProperties.setProperty(ForceDictationPropertyName, \"true\");\r\n }\r\n\r\n public clone(): SpeechConfigImpl {\r\n const ret: SpeechConfigImpl = new SpeechConfigImpl();\r\n ret.privProperties = this.privProperties.clone();\r\n return ret;\r\n }\r\n\r\n public get speechSynthesisLanguage(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage);\r\n }\r\n\r\n public set speechSynthesisLanguage(language: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthLanguage, language);\r\n }\r\n\r\n public get speechSynthesisVoiceName(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice);\r\n }\r\n\r\n public set speechSynthesisVoiceName(voice: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthVoice, voice);\r\n }\r\n\r\n public get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat {\r\n return SpeechSynthesisOutputFormat[this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined) as keyof typeof SpeechSynthesisOutputFormat];\r\n }\r\n\r\n public set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, SpeechSynthesisOutputFormat[format]);\r\n }\r\n}\r\n"]}