@hahnpro/ms-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 5.23 kB
Source Map (JSON)
{"version":3,"sources":["src/common.speech/RecognizerConfig.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAc,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAW,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAC;AAE9F,oBAAY,kBAAkB;IAC1B,MAAM,IAAA;IACN,QAAQ,IAAA;CACX;AAED,qBAAa,gBAAgB;IACzB,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,uBAAuB,CAAsB;IACrD,OAAO,CAAC,8BAA8B,CAAS;IAC/C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,mBAAmB,CAAU;gBAGjC,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,kBAAkB;IAQlC,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED,IAAW,eAAe,IAAI,eAAe,CAE5C;IAED,IAAW,eAAe,CAAC,KAAK,EAAE,eAAe,EAIhD;IAED,IAAW,mBAAmB,IAAI,mBAAmB,CAEpD;IAED,IAAW,0BAA0B,IAAI,MAAM,CAE9C;IAED,IAAW,uBAAuB,IAAI,OAAO,CAE5C;IAED,IAAW,cAAc,IAAI,MAAM,CAElC;IAED,IAAW,yBAAyB,IAAI,MAAM,CAE7C;IAED,IAAW,0BAA0B,IAAI,MAAM,CAE9C;IAED,IAAW,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAEpD;IAED,IAAW,oBAAoB,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAgB1E;IAED,IAAW,aAAa,IAAI,MAAM,CAEjC;IAED,IAAW,2BAA2B,IAAI,OAAO,CAEhD;IAED,IAAW,2BAA2B,CAAC,KAAK,EAAE,OAAO,EAEpD;CACJ","file":"RecognizerConfig.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\n/* eslint-disable max-classes-per-file */\n\nimport { PropertyCollection, PropertyId } from \"../sdk/Exports.js\";\nimport { Context, SpeechServiceConfig } from \"./Exports.js\";\nimport { RecognitionMode } from \"./ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\n\nexport enum SpeechResultFormat {\n Simple,\n Detailed,\n}\n\nexport class RecognizerConfig {\n private privRecognitionMode: RecognitionMode;\n private privLanguageIdMode: string;\n private privSpeechServiceConfig: SpeechServiceConfig;\n private privRecognitionActivityTimeout: number;\n private privParameters: PropertyCollection;\n private privMaxRetryCount: number;\n private privEnableSpeakerId: boolean;\n\n public constructor(\n speechServiceConfig: SpeechServiceConfig,\n parameters: PropertyCollection) {\n this.privSpeechServiceConfig = speechServiceConfig ? speechServiceConfig : new SpeechServiceConfig(new Context(null));\n this.privParameters = parameters;\n this.privMaxRetryCount = parseInt(parameters.getProperty(\"SPEECH-Error-MaxRetryCount\", \"4\"), 10);\n this.privLanguageIdMode = parameters.getProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, undefined);\n this.privEnableSpeakerId = false;\n }\n\n public get parameters(): PropertyCollection {\n return this.privParameters;\n }\n\n public get recognitionMode(): RecognitionMode {\n return this.privRecognitionMode;\n }\n\n public set recognitionMode(value: RecognitionMode) {\n this.privRecognitionMode = value;\n this.privRecognitionActivityTimeout = value === RecognitionMode.Interactive ? 8000 : 25000;\n this.privSpeechServiceConfig.Recognition = RecognitionMode[value];\n }\n\n public get SpeechServiceConfig(): SpeechServiceConfig {\n return this.privSpeechServiceConfig;\n }\n\n public get recognitionActivityTimeout(): number {\n return this.privRecognitionActivityTimeout;\n }\n\n public get isContinuousRecognition(): boolean {\n return this.privRecognitionMode !== RecognitionMode.Interactive;\n }\n\n public get languageIdMode(): string {\n return this.privLanguageIdMode;\n }\n\n public get autoDetectSourceLanguages(): string {\n return this.parameters.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, undefined);\n }\n\n public get recognitionEndpointVersion(): string {\n return this.parameters.getProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"2\");\n }\n\n public set recognitionEndpointVersion(version: string) {\n this.parameters.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, version);\n }\n\n public get sourceLanguageModels(): { language: string; endpoint: string }[] {\n const models: { language: string; endpoint: string }[] = [];\n let modelsExist: boolean = false;\n if (this.autoDetectSourceLanguages !== undefined) {\n for (const language of this.autoDetectSourceLanguages.split(\",\")) {\n const customProperty = language + PropertyId.SpeechServiceConnection_EndpointId.toString();\n const modelId: string = this.parameters.getProperty(customProperty, undefined);\n if (modelId !== undefined) {\n models.push({ language, endpoint: modelId });\n modelsExist = true;\n } else {\n models.push({ language, endpoint: \"\" });\n }\n }\n }\n return modelsExist ? models : undefined;\n }\n\n public get maxRetryCount(): number {\n return this.privMaxRetryCount;\n }\n\n public get isSpeakerDiarizationEnabled(): boolean {\n return this.privEnableSpeakerId;\n }\n\n public set isSpeakerDiarizationEnabled(value: boolean) {\n this.privEnableSpeakerId = value;\n }\n}\n"]}