diff --git a/package-lock.json b/package-lock.json index 9fe955b4..0f7d9863 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "microsoft-cognitiveservices-speech-sdk", - "version": "1.15.0-alpha.0.1", + "version": "1.18.1-alpha.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2074,32 +2074,11 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "requires": { - "ms": "^2.1.1" - } - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "requires": { - "glob": "^7.1.3" + "ms": "2.1.2" } } } @@ -6017,9 +5996,9 @@ } }, "fsevents": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.2.1.tgz", - "integrity": "sha512-bTLYHSeC0UH/EFXS9KqWnXuOl/wHK5Z/d+ghd5AsFMYN7wIGkUCOJyzy88+wJKkZPGON8u4Z9f6U4FdgURE9qA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "optional": true }, @@ -8092,9 +8071,9 @@ "dev": true }, "nan": { - "version": "2.14.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", - "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", "dev": true, "optional": true }, @@ -9303,7 +9282,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "requires": { "glob": "^7.1.3" }, @@ -9312,7 +9290,6 @@ "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -10698,9 +10675,9 @@ "dev": true }, "username-sync": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/username-sync/-/username-sync-1.0.2.tgz", - "integrity": "sha512-ayNkOJdoNSGNDBE46Nkc+l6IXmeugbzahZLSMkwvgRWv5y5ZqNY2IrzcgmkR4z32sj1W3tM3TuTUMqkqBzO+RA==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/username-sync/-/username-sync-1.0.3.tgz", + "integrity": "sha512-m/7/FSqjJNAzF2La448c/aEom0gJy7HY7Y509h6l0ePvEkFictAGptwWaj1msWJ38JbfEDOUoE8kqFee9EHKdA==" }, "util": { "version": "0.11.1", diff --git a/package.json b/package.json index ddf3ad53..187b58d6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "microsoft-cognitiveservices-speech-sdk", "author": "Microsoft Corporation", "homepage": "https://docs.microsoft.com/azure/cognitive-services/speech-service/", - "version": "1.15.0-alpha.0.1", + "version": "1.18.1-alpha.0.1", "license": "MIT", "description": "Microsoft Cognitive Services Speech SDK for JavaScript", "keywords": [ diff --git a/src/common.speech/ServiceMessages/DetailedSpeechPhrase.ts b/src/common.speech/ServiceMessages/DetailedSpeechPhrase.ts index 72401950..86d16827 100644 --- a/src/common.speech/ServiceMessages/DetailedSpeechPhrase.ts +++ b/src/common.speech/ServiceMessages/DetailedSpeechPhrase.ts @@ -40,7 +40,7 @@ export class DetailedSpeechPhrase implements IDetailedSpeechPhrase { } public getJsonWithCorrectedOffsets(baseOffset: number): string { - if (!!this.privDetailedSpeechPhrase.NBest[0].Words) { + if (!!this.privDetailedSpeechPhrase.NBest && !!this.privDetailedSpeechPhrase.NBest[0].Words) { const firstWordOffset: number = this.privDetailedSpeechPhrase.NBest[0].Words[0].Offset; if (firstWordOffset && firstWordOffset < baseOffset) { const offset: number = baseOffset - firstWordOffset; diff --git a/tests/SpeechRecognizerTests.ts b/tests/SpeechRecognizerTests.ts index 4fae4f8c..2a1d3e19 100644 --- a/tests/SpeechRecognizerTests.ts +++ b/tests/SpeechRecognizerTests.ts @@ -1020,6 +1020,32 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => { }); }); + test("Detailed output continuous recognition stops correctly", (done: jest.DoneCallback) => { + // tslint:disable-next-line:no-console + console.info("Detailed output continuous recognition stops correctly"); + const s: sdk.SpeechConfig = BuildSpeechConfig(); + objsToClose.push(s); + s.speechRecognitionLanguage = "en-US"; + s.outputFormat = sdk.OutputFormat.Detailed; + + const config: sdk.AudioConfig = WaveFileAudioInput.getAudioConfigFromFile(Settings.LongerWaveFile); + + const r: sdk.SpeechRecognizer = new sdk.SpeechRecognizer(s, config); + objsToClose.push(r); + expect(r).not.toBeUndefined(); + expect(r instanceof sdk.Recognizer); + + r.sessionStopped = (s: sdk.Recognizer, e: sdk.SessionEventArgs): void => { + done(); + }; + + r.recognizing = (s: sdk.Recognizer, e: sdk.SpeechRecognitionEventArgs): void => { + r.stopContinuousRecognitionAsync(); + }; + + r.startContinuousRecognitionAsync(); + }, 15000); + test("PushStream start-stop-start continuous recognition on PushStream", (done: jest.DoneCallback) => { // tslint:disable-next-line:no-console console.info("Name: PushStream start-stop-start continuous recognition on PushStream"); @@ -1498,7 +1524,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => { test("RecognizeOnceAsync is async", (done: jest.DoneCallback) => { // tslint:disable-next-line:no-console - console.info("Name: ecognizeOnceAsync is async"); + console.info("Name: RecognizeOnceAsync is async"); const s: sdk.SpeechConfig = BuildSpeechConfig(); objsToClose.push(s);