microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 23.5 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/SpeechTranslationConfig.ts"],"names":[],"mappings":"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","file":"SpeechTranslationConfig.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\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 SpeechConfig,\r\n SpeechSynthesisOutputFormat,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Speech translation configuration.\r\n * @class SpeechTranslationConfig\r\n */\r\nexport abstract class SpeechTranslationConfig extends SpeechConfig {\r\n\r\n /**\r\n * Creates an instance of recognizer config.\r\n */\r\n protected constructor() {\r\n super();\r\n }\r\n\r\n /**\r\n * Static instance of SpeechTranslationConfig returned by passing a subscription key and service region.\r\n * @member SpeechTranslationConfig.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 {SpeechTranslationConfig} The speech translation config.\r\n */\r\n public static fromSubscription(subscriptionKey: string, region: string): SpeechTranslationConfig {\r\n Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n return ret;\r\n }\r\n\r\n /**\r\n * Static instance of SpeechTranslationConfig returned by passing authorization token and service 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 setting the property authorizationToken with a new\r\n * valid token. Otherwise, all the recognizers created by this SpeechTranslationConfig instance\r\n * will encounter errors during recognition.\r\n * As configuration values are copied when creating a new recognizer, the new token value will not apply\r\n * to recognizers that have already been created.\r\n * For recognizers 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 SpeechTranslationConfig.fromAuthorizationToken\r\n * @function\r\n * @public\r\n * @param {string} authorizationToken - The 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 {SpeechTranslationConfig} The speech translation config.\r\n */\r\n public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechTranslationConfig {\r\n Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n ret.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n return ret;\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: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\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 translation config with specified endpoint and subscription key.\r\n * This method is intended only for users who use a non-standard service endpoint or paramters.\r\n * Note: The query properties specified in the endpoint URL are not changed, even if they are\r\n * set by any other APIs. For example, if language is defined in the uri as query parameter\r\n * \"language=de-DE\", and also set by the speechRecognitionLanguage property, the language\r\n * setting in uri takes precedence, and the effective language is \"de-DE\".\r\n * Only the properties that are not specified in the 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 SpeechTranslationConfig.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.\r\n * @returns {SpeechTranslationConfig} A speech config instance.\r\n */\r\n public static fromEndpoint(endpoint: URL, subscriptionKey: string): SpeechTranslationConfig {\r\n Contracts.throwIfNull(endpoint, \"endpoint\");\r\n Contracts.throwIfNull(subscriptionKey, \"subscriptionKey\");\r\n\r\n const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n return ret;\r\n }\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 SpeechTranslationConfig.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 * Gets/Sets the speech recognition language.\r\n * @member SpeechTranslationConfig.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 * Add a (text) target language to translate into.\r\n * @member SpeechTranslationConfig.prototype.addTargetLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The language such as de-DE\r\n */\r\n public abstract addTargetLanguage(value: string): void;\r\n\r\n /**\r\n * Gets the (text) target language to translate into.\r\n * @member SpeechTranslationConfig.prototype.targetLanguages\r\n * @function\r\n * @public\r\n * @param {string} value - The language such as de-DE\r\n */\r\n public abstract get targetLanguages(): string[];\r\n\r\n /**\r\n * Gets the selected voice name.\r\n * @member SpeechTranslationConfig.prototype.voiceName\r\n * @function\r\n * @public\r\n * @returns {string} The voice name.\r\n */\r\n public abstract get voiceName(): string;\r\n\r\n /**\r\n * Gets/Sets voice of the translated language, enable voice synthesis output.\r\n * @member SpeechTranslationConfig.prototype.voiceName\r\n * @function\r\n * @public\r\n * @param {string} value - The name of the voice.\r\n */\r\n public abstract set voiceName(value: string);\r\n\r\n /**\r\n * Sets a named property as value\r\n * @member SpeechTranslationConfig.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 * Dispose of associated resources.\r\n * @member SpeechTranslationConfig.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public abstract close(): void;\r\n}\r\n\r\n/**\r\n * @private\r\n * @class SpeechTranslationConfigImpl\r\n */\r\nexport class SpeechTranslationConfigImpl extends SpeechTranslationConfig {\r\n\r\n private privSpeechProperties: PropertyCollection;\r\n\r\n public constructor() {\r\n super();\r\n this.privSpeechProperties = new PropertyCollection();\r\n this.outputFormat = OutputFormat.Simple;\r\n }\r\n /**\r\n * Gets/Sets the authorization token.\r\n * If this is set, subscription key is ignored.\r\n * User needs to make sure the provided authorization token is valid and not expired.\r\n * @member SpeechTranslationConfigImpl.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public set authorizationToken(value: string) {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n }\r\n\r\n /**\r\n * Sets the speech recognition language.\r\n * @member SpeechTranslationConfigImpl.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public set speechRecognitionLanguage(value: string) {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\r\n }\r\n\r\n /**\r\n * Gets the speech recognition language.\r\n * @member SpeechTranslationConfigImpl.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @return {string} The speechRecognitionLanguage.\r\n */\r\n public get speechRecognitionLanguage(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n }\r\n\r\n /**\r\n * @member SpeechTranslationConfigImpl.prototype.subscriptionKey\r\n * @function\r\n * @public\r\n */\r\n public get subscriptionKey(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_Key]);\r\n }\r\n\r\n /**\r\n * Gets the output format\r\n * @member SpeechTranslationConfigImpl.prototype.outputFormat\r\n * @function\r\n * @public\r\n */\r\n public get outputFormat(): OutputFormat {\r\n // eslint-disable-next-line\r\n return (OutputFormat as any)[this.privSpeechProperties.getProperty(OutputFormatPropertyName, undefined)];\r\n }\r\n\r\n /**\r\n * Gets/Sets the output format\r\n * @member SpeechTranslationConfigImpl.prototype.outputFormat\r\n * @function\r\n * @public\r\n */\r\n public set outputFormat(value: OutputFormat) {\r\n this.privSpeechProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\r\n }\r\n\r\n /**\r\n * Gets the endpoint id.\r\n * @member SpeechTranslationConfigImpl.prototype.endpointId\r\n * @function\r\n * @public\r\n */\r\n public get endpointId(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\r\n }\r\n\r\n /**\r\n * Gets/Sets the endpoint id.\r\n * @member SpeechTranslationConfigImpl.prototype.endpointId\r\n * @function\r\n * @public\r\n */\r\n public set endpointId(value: string) {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_EndpointId, value);\r\n }\r\n\r\n /**\r\n * Add a (text) target language to translate into.\r\n * @member SpeechTranslationConfigImpl.prototype.addTargetLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The language such as de-DE\r\n */\r\n public addTargetLanguage(value: string): void {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n const languages: string[] = this.targetLanguages;\r\n if (!languages.includes(value)) {\r\n languages.push(value);\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, languages.join(\",\"));\r\n }\r\n }\r\n\r\n /**\r\n * Gets the (text) target language to translate into.\r\n * @member SpeechTranslationConfigImpl.prototype.targetLanguages\r\n * @function\r\n * @public\r\n * @param {string} value - The language such as de-DE\r\n */\r\n public get targetLanguages(): string[] {\r\n\r\n if (this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n } else {\r\n return [];\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Gets the voice name.\r\n * @member SpeechTranslationConfigImpl.prototype.voiceName\r\n * @function\r\n * @public\r\n */\r\n public get voiceName(): string {\r\n return this.getProperty(PropertyId[PropertyId.SpeechServiceConnection_TranslationVoice]);\r\n }\r\n\r\n /**\r\n * Gets/Sets the voice of the translated language, enable voice synthesis output.\r\n * @member SpeechTranslationConfigImpl.prototype.voiceName\r\n * @function\r\n * @public\r\n * @param {string} value - The name of the voice.\r\n */\r\n public set voiceName(value: string) {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_TranslationVoice, value);\r\n }\r\n\r\n /**\r\n * Provides the region.\r\n * @member SpeechTranslationConfigImpl.prototype.region\r\n * @function\r\n * @public\r\n * @returns {string} The region.\r\n */\r\n public get region(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\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 /**\r\n * Gets an arbitrary property value.\r\n * @member SpeechTranslationConfigImpl.prototype.getProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property.\r\n * @param {string} def - The default value of the property in case it is not set.\r\n * @returns {string} The value of the property.\r\n */\r\n public getProperty(name: string, def?: string): string {\r\n return this.privSpeechProperties.getProperty(name, def);\r\n }\r\n\r\n /**\r\n * Gets/Sets an arbitrary property value.\r\n * @member SpeechTranslationConfigImpl.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 value of the property.\r\n */\r\n public setProperty(name: string | PropertyId, value: string): void {\r\n this.privSpeechProperties.setProperty(name, value);\r\n }\r\n\r\n /**\r\n * Provides access to custom properties.\r\n * @member SpeechTranslationConfigImpl.prototype.properties\r\n * @function\r\n * @public\r\n * @returns {PropertyCollection} The properties.\r\n */\r\n public get properties(): PropertyCollection {\r\n return this.privSpeechProperties;\r\n }\r\n\r\n /**\r\n * Dispose of associated resources.\r\n * @member SpeechTranslationConfigImpl.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n return;\r\n }\r\n\r\n public setServiceProperty(name: string, value: string): void {\r\n const currentProperties: IStringDictionary<string> = JSON.parse(this.privSpeechProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n currentProperties[name] = value;\r\n\r\n this.privSpeechProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n }\r\n\r\n public setProfanity(profanity: ProfanityOption): void {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\r\n }\r\n\r\n public enableAudioLogging(): void {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\r\n }\r\n public requestWordLevelTimestamps(): void {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\r\n }\r\n public enableDictation(): void {\r\n this.privSpeechProperties.setProperty(ForceDictationPropertyName, \"true\");\r\n }\r\n\r\n public get speechSynthesisLanguage(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage);\r\n }\r\n\r\n public set speechSynthesisLanguage(language: string) {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthLanguage, language);\r\n }\r\n\r\n public get speechSynthesisVoiceName(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice);\r\n }\r\n\r\n public set speechSynthesisVoiceName(voice: string) {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthVoice, voice);\r\n }\r\n\r\n public get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat {\r\n // eslint-disable-next-line\r\n return (SpeechSynthesisOutputFormat as any)[this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)];\r\n }\r\n\r\n public set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat) {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, SpeechSynthesisOutputFormat[format]);\r\n }\r\n}\r\n"]}