@voice-ping/cognitive-services-speech
Version:
VoicePing Cognitive Services Speech SDK for JavaScript forked from Microsoft
1 lines • 1.77 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/SpeakerIdentificationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,YAAY,EAEf,MAAM,WAAW,CAAC;AAEnB;;;;GAIG;AACH,qBAAa,0BAA0B;IACnC,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,OAAO;WAYO,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,0BAA0B;IAIhF,IAAW,eAAe,IAAI,MAAM,CAEnC;CAEJ","file":"SpeakerIdentificationModel.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { Contracts } from \"./Contracts\";\nimport {\n VoiceProfile,\n VoiceProfileType,\n} from \"./Exports\";\n\n/**\n * Defines SpeakerIdentificationModel class for Speaker Recognition\n * Model contains a set of profiles against which to identify speaker(s)\n * @class SpeakerIdentificationModel\n */\nexport class SpeakerIdentificationModel {\n private privVoiceProfiles: VoiceProfile[] = [];\n\n private constructor(profiles: VoiceProfile[]) {\n Contracts.throwIfNullOrUndefined(profiles, \"VoiceProfiles\");\n if (profiles.length === 0) {\n throw new Error(\"Empty Voice Profiles array\");\n }\n profiles.forEach((profile: VoiceProfile) => {\n if (profile.profileType !== VoiceProfileType.TextIndependentIdentification) {\n throw new Error(\"Identification model can only be created from Identification profile: \" + profile.profileId);\n }\n this.privVoiceProfiles.push(profile);\n });\n }\n public static fromProfiles(profiles: VoiceProfile[]): SpeakerIdentificationModel {\n return new SpeakerIdentificationModel(profiles);\n }\n\n public get voiceProfileIds(): string {\n return this.privVoiceProfiles.map((profile: VoiceProfile) => profile.profileId).join(\",\");\n }\n\n}\n"]}