@hahnpro/ms-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 2.6 kB
Source Map (JSON)
{"version":3,"sources":["src/common.speech/ServiceMessages/SpeechHypothesis.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,gBAAgB,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,qBAAa,gBAAiB,YAAW,iBAAiB;IACtD,OAAO,CAAC,oBAAoB,CAAoB;IAEhD,OAAO;WAKO,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,gBAAgB;IAI1E,OAAO,CAAC,YAAY;IAIb,MAAM,IAAI,MAAM;IAIvB,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,2BAA2B,IAAI,MAAM,CAE/C;IAED,IAAW,SAAS,IAAI,MAAM,CAE7B;CACJ","file":"SpeechHypothesis.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { IPrimaryLanguage } from \"./SimpleSpeechPhrase.js\";\n\n// speech.hypothesis\nexport interface ISpeechHypothesis {\n Text: string;\n Offset: number;\n Duration: number;\n PrimaryLanguage?: IPrimaryLanguage;\n SpeakerId?: string;\n [key: string]: any;\n}\n\nexport class SpeechHypothesis implements ISpeechHypothesis {\n private privSpeechHypothesis: ISpeechHypothesis;\n\n private constructor(json: string, baseOffset: number) {\n this.privSpeechHypothesis = JSON.parse(json) as ISpeechHypothesis;\n this.updateOffset(baseOffset);\n }\n\n public static fromJSON(json: string, baseOffset: number): SpeechHypothesis {\n return new SpeechHypothesis(json, baseOffset);\n }\n\n private updateOffset(baseOffset: number): void {\n this.privSpeechHypothesis.Offset += baseOffset;\n }\n\n public asJson(): string {\n return JSON.stringify(this.privSpeechHypothesis);\n }\n\n public get Text(): string {\n return this.privSpeechHypothesis.Text;\n }\n\n public get Offset(): number {\n return this.privSpeechHypothesis.Offset;\n }\n\n public get Duration(): number {\n return this.privSpeechHypothesis.Duration;\n }\n\n public get Language(): string {\n return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Language;\n }\n\n public get LanguageDetectionConfidence(): string {\n return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Confidence;\n }\n\n public get SpeakerId(): string {\n return this.privSpeechHypothesis.SpeakerId;\n }\n}\n"]}