microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 2.72 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.\r\n// Licensed under the MIT license.\r\n\r\nimport { IPrimaryLanguage } from \"./SimpleSpeechPhrase.js\";\r\n\r\n// speech.hypothesis\r\nexport interface ISpeechHypothesis {\r\n Text: string;\r\n Offset: number;\r\n Duration: number;\r\n PrimaryLanguage?: IPrimaryLanguage;\r\n SpeakerId?: string;\r\n [key: string]: any;\r\n}\r\n\r\nexport class SpeechHypothesis implements ISpeechHypothesis {\r\n private privSpeechHypothesis: ISpeechHypothesis;\r\n\r\n private constructor(json: string, baseOffset: number) {\r\n this.privSpeechHypothesis = JSON.parse(json) as ISpeechHypothesis;\r\n this.updateOffset(baseOffset);\r\n }\r\n\r\n public static fromJSON(json: string, baseOffset: number): SpeechHypothesis {\r\n return new SpeechHypothesis(json, baseOffset);\r\n }\r\n\r\n private updateOffset(baseOffset: number): void {\r\n this.privSpeechHypothesis.Offset += baseOffset;\r\n }\r\n\r\n public asJson(): string {\r\n return JSON.stringify(this.privSpeechHypothesis);\r\n }\r\n\r\n public get Text(): string {\r\n return this.privSpeechHypothesis.Text;\r\n }\r\n\r\n public get Offset(): number {\r\n return this.privSpeechHypothesis.Offset;\r\n }\r\n\r\n public get Duration(): number {\r\n return this.privSpeechHypothesis.Duration;\r\n }\r\n\r\n public get Language(): string {\r\n return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Language;\r\n }\r\n\r\n public get LanguageDetectionConfidence(): string {\r\n return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Confidence;\r\n }\r\n\r\n public get SpeakerId(): string {\r\n return this.privSpeechHypothesis.SpeakerId;\r\n }\r\n}\r\n"]}