microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 2.35 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/SpeakerIdentificationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACH,YAAY,EAEf,MAAM,cAAc,CAAC;AAEtB;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB;IACtE,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,cAAc,CAAgB;IAEtC,OAAO;WAaO,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,0BAA0B;IAIhF,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED,IAAW,UAAU,IAAI,MAAM,EAAE,CAEhC;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;CACJ","file":"SpeakerIdentificationModel.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { SpeakerRecognitionModel } from \"./SpeakerRecognitionModel.js\";\r\nimport {\r\n VoiceProfile,\r\n VoiceProfileType,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines SpeakerIdentificationModel class for Speaker Recognition\r\n * Model contains a set of profiles against which to identify speaker(s)\r\n * @class SpeakerIdentificationModel\r\n */\r\nexport class SpeakerIdentificationModel implements SpeakerRecognitionModel {\r\n private privVoiceProfiles: VoiceProfile[] = [];\r\n private privProfileIds: string[] = [];\r\n\r\n private constructor(profiles: VoiceProfile[]) {\r\n Contracts.throwIfNullOrUndefined(profiles, \"VoiceProfiles\");\r\n if (profiles.length === 0) {\r\n throw new Error(\"Empty Voice Profiles array\");\r\n }\r\n for (const profile of profiles) {\r\n if (profile.profileType !== VoiceProfileType.TextIndependentIdentification) {\r\n throw new Error(\"Identification model can only be created from Identification profile: \" + profile.profileId);\r\n }\r\n this.privVoiceProfiles.push(profile);\r\n this.privProfileIds.push(profile.profileId);\r\n }\r\n }\r\n public static fromProfiles(profiles: VoiceProfile[]): SpeakerIdentificationModel {\r\n return new SpeakerIdentificationModel(profiles);\r\n }\r\n\r\n public get voiceProfileIds(): string {\r\n return this.privProfileIds.join(\",\");\r\n }\r\n\r\n public get profileIds(): string[] {\r\n return this.privProfileIds;\r\n }\r\n\r\n public get scenario(): string {\r\n return \"TextIndependentIdentification\";\r\n }\r\n}\r\n"]}