Merge branch 'master' of github.com:microsoft/cognitive-services-speech-sdk-js into yulin/avatar
This commit is contained in:
Коммит
2444ecaa6e
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "microsoft-cognitiveservices-speech-sdk",
|
"name": "microsoft-cognitiveservices-speech-sdk",
|
||||||
"version": "1.30.0-alpha.0.1",
|
"version": "1.31.0-alpha.0.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "microsoft-cognitiveservices-speech-sdk",
|
"name": "microsoft-cognitiveservices-speech-sdk",
|
||||||
"version": "1.30.0-alpha.0.1",
|
"version": "1.31.0-alpha.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"agent-base": "^6.0.1",
|
"agent-base": "^6.0.1",
|
||||||
|
@ -8767,6 +8767,12 @@
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/querystringify": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/queue-microtask": {
|
"node_modules/queue-microtask": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -8980,6 +8986,12 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/requires-port": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
"version": "1.20.0",
|
"version": "1.20.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -10149,13 +10161,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tough-cookie": {
|
"node_modules/tough-cookie": {
|
||||||
"version": "4.0.0",
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"psl": "^1.1.33",
|
"psl": "^1.1.33",
|
||||||
"punycode": "^2.1.1",
|
"punycode": "^2.1.1",
|
||||||
"universalify": "^0.1.2"
|
"universalify": "^0.2.0",
|
||||||
|
"url-parse": "^1.5.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
|
@ -10538,9 +10552,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/universalify": {
|
"node_modules/universalify": {
|
||||||
"version": "0.1.2",
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 4.0.0"
|
"node": ">= 4.0.0"
|
||||||
}
|
}
|
||||||
|
@ -10642,6 +10657,16 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/url-parse": {
|
||||||
|
"version": "1.5.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||||
|
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"querystringify": "^2.1.1",
|
||||||
|
"requires-port": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/use": {
|
"node_modules/use": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -16971,6 +16996,12 @@
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"querystringify": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"queue-microtask": {
|
"queue-microtask": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
@ -17103,6 +17134,12 @@
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"requires-port": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.20.0",
|
"version": "1.20.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -17880,12 +17917,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tough-cookie": {
|
"tough-cookie": {
|
||||||
"version": "4.0.0",
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"psl": "^1.1.33",
|
"psl": "^1.1.33",
|
||||||
"punycode": "^2.1.1",
|
"punycode": "^2.1.1",
|
||||||
"universalify": "^0.1.2"
|
"universalify": "^0.2.0",
|
||||||
|
"url-parse": "^1.5.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tr46": {
|
"tr46": {
|
||||||
|
@ -18125,7 +18165,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"universalify": {
|
"universalify": {
|
||||||
"version": "0.1.2",
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"unset-value": {
|
"unset-value": {
|
||||||
|
@ -18189,6 +18231,16 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"url-parse": {
|
||||||
|
"version": "1.5.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||||
|
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"querystringify": "^2.1.1",
|
||||||
|
"requires-port": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"use": {
|
"use": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "microsoft-cognitiveservices-speech-sdk",
|
"name": "microsoft-cognitiveservices-speech-sdk",
|
||||||
"author": "Microsoft Corporation",
|
"author": "Microsoft Corporation",
|
||||||
"homepage": "https://docs.microsoft.com/azure/cognitive-services/speech-service/",
|
"homepage": "https://docs.microsoft.com/azure/cognitive-services/speech-service/",
|
||||||
"version": "1.30.0-alpha.0.1",
|
"version": "1.31.0-alpha.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "Microsoft Cognitive Services Speech SDK for JavaScript",
|
"description": "Microsoft Cognitive Services Speech SDK for JavaScript",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {
|
||||||
ConversationExpirationEventArgs,
|
ConversationExpirationEventArgs,
|
||||||
ConversationTranslationCanceledEventArgs,
|
ConversationTranslationCanceledEventArgs,
|
||||||
ConversationTranslationResult,
|
ConversationTranslationResult,
|
||||||
|
ResultReason,
|
||||||
Translations
|
Translations
|
||||||
} from "../../sdk/Exports";
|
} from "../../sdk/Exports";
|
||||||
import {
|
import {
|
||||||
|
@ -191,10 +192,11 @@ export class ConversationServiceAdapter extends ServiceRecognizerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
const sessionId: string = this.privConversationRequestSession.sessionId;
|
const sessionId: string = this.privConversationRequestSession.sessionId;
|
||||||
|
const conversationMessageType: string = message.conversationMessageType.toLowerCase();
|
||||||
let sendFinal: boolean = false;
|
let sendFinal: boolean = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (message.conversationMessageType.toLowerCase()) {
|
switch (conversationMessageType) {
|
||||||
case "info":
|
case "info":
|
||||||
case "participant_command":
|
case "participant_command":
|
||||||
case "command":
|
case "command":
|
||||||
|
@ -432,12 +434,13 @@ export class ConversationServiceAdapter extends ServiceRecognizerBase {
|
||||||
case "final":
|
case "final":
|
||||||
|
|
||||||
const speechPayload: SpeechResponsePayload = SpeechResponsePayload.fromJSON(message.textBody);
|
const speechPayload: SpeechResponsePayload = SpeechResponsePayload.fromJSON(message.textBody);
|
||||||
|
const conversationResultReason: ResultReason = (conversationMessageType === "final") ? ResultReason.TranslatedParticipantSpeech : ResultReason.TranslatingParticipantSpeech;
|
||||||
|
|
||||||
const speechResult: ConversationTranslationResult = new ConversationTranslationResult(speechPayload.participantId,
|
const speechResult: ConversationTranslationResult = new ConversationTranslationResult(speechPayload.participantId,
|
||||||
this.getTranslations(speechPayload.translations),
|
this.getTranslations(speechPayload.translations),
|
||||||
speechPayload.language,
|
speechPayload.language,
|
||||||
undefined,
|
speechPayload.id,
|
||||||
undefined,
|
conversationResultReason,
|
||||||
speechPayload.recognition,
|
speechPayload.recognition,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
|
@ -478,6 +481,7 @@ export class ConversationServiceAdapter extends ServiceRecognizerBase {
|
||||||
case "translated_message":
|
case "translated_message":
|
||||||
|
|
||||||
const textPayload: TextResponsePayload = TextResponsePayload.fromJSON(message.textBody);
|
const textPayload: TextResponsePayload = TextResponsePayload.fromJSON(message.textBody);
|
||||||
|
// TODO: (Native parity) a result reason should be set based whether the participantId is ours or not
|
||||||
|
|
||||||
const textResult: ConversationTranslationResult = new ConversationTranslationResult(textPayload.participantId,
|
const textResult: ConversationTranslationResult = new ConversationTranslationResult(textPayload.participantId,
|
||||||
this.getTranslations(textPayload.translations),
|
this.getTranslations(textPayload.translations),
|
||||||
|
|
|
@ -125,4 +125,34 @@ export enum ResultReason {
|
||||||
* @member ResultReason.VoicesListRetrieved
|
* @member ResultReason.VoicesListRetrieved
|
||||||
*/
|
*/
|
||||||
VoicesListRetrieved,
|
VoicesListRetrieved,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the transcription result contains hypothesis text and its translation(s) for
|
||||||
|
* other participants in the conversation.
|
||||||
|
* @member ResultReason.TranslatingParticipantSpeech
|
||||||
|
*/
|
||||||
|
TranslatingParticipantSpeech,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the transcription result contains final text and corresponding translation(s)
|
||||||
|
* for other participants in the conversation. Speech Recognition and Translation are now
|
||||||
|
* complete for this phrase.
|
||||||
|
* @member ResultReason.TranslatedParticipantSpeech
|
||||||
|
*/
|
||||||
|
TranslatedParticipantSpeech,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <summary>
|
||||||
|
* Indicates the transcription result contains the instant message and corresponding
|
||||||
|
* translation(s).
|
||||||
|
* @member ResultReason.TranslatedInstantMessage
|
||||||
|
*/
|
||||||
|
TranslatedInstantMessage,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the transcription result contains the instant message for other participants
|
||||||
|
* in the conversation and corresponding translation(s).
|
||||||
|
* @member ResultReason.TranslatedParticipantInstantMessage
|
||||||
|
*/
|
||||||
|
TranslatedParticipantInstantMessage,
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class SynthesisVoicesResult extends SynthesisResult {
|
||||||
super(requestId, ResultReason.VoicesListRetrieved, undefined, new PropertyCollection());
|
super(requestId, ResultReason.VoicesListRetrieved, undefined, new PropertyCollection());
|
||||||
this.privVoices = [];
|
this.privVoices = [];
|
||||||
for (const item of json) {
|
for (const item of json) {
|
||||||
this.privVoices.push(new VoiceInfo(item as { Name: string; LocalName: string; LocaleName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] }));
|
this.privVoices.push(new VoiceInfo(item as { Name: string; LocalName: string; DisplayName: string; LocaleName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] }));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super(requestId, ResultReason.Canceled, errorDetails ? errorDetails : "Error information unavailable", new PropertyCollection());
|
super(requestId, ResultReason.Canceled, errorDetails ? errorDetails : "Error information unavailable", new PropertyCollection());
|
||||||
|
|
|
@ -33,6 +33,7 @@ export class VoiceInfo {
|
||||||
private privName: string;
|
private privName: string;
|
||||||
private privLocale: string;
|
private privLocale: string;
|
||||||
private privShortName: string;
|
private privShortName: string;
|
||||||
|
private privDisplayName: string;
|
||||||
private privLocalName: string;
|
private privLocalName: string;
|
||||||
private privLocaleName: string;
|
private privLocaleName: string;
|
||||||
private privGender: SynthesisVoiceGender;
|
private privGender: SynthesisVoiceGender;
|
||||||
|
@ -40,13 +41,14 @@ export class VoiceInfo {
|
||||||
private privStyleList: string[] = [];
|
private privStyleList: string[] = [];
|
||||||
private privVoicePath: string;
|
private privVoicePath: string;
|
||||||
|
|
||||||
public constructor(json: { Name: string; LocalName: string; ShortName: string; Gender: string; VoiceType: string; LocaleName: string ; Locale: string; StyleList: string[] }) {
|
public constructor(json: { Name: string; LocalName: string; DisplayName: string; ShortName: string; Gender: string; VoiceType: string; LocaleName: string ; Locale: string; StyleList: string[] }) {
|
||||||
this.privVoicePath = "";
|
this.privVoicePath = "";
|
||||||
if (!!json) {
|
if (!!json) {
|
||||||
this.privName = json.Name;
|
this.privName = json.Name;
|
||||||
this.privLocale = json.Locale;
|
this.privLocale = json.Locale;
|
||||||
this.privShortName = json.ShortName;
|
this.privShortName = json.ShortName;
|
||||||
this.privLocaleName = json.LocaleName;
|
this.privLocaleName = json.LocaleName;
|
||||||
|
this.privDisplayName = json.DisplayName;
|
||||||
this.privLocalName = json.LocalName;
|
this.privLocalName = json.LocalName;
|
||||||
this.privVoiceType = json.VoiceType.endsWith("Standard") ? SynthesisVoiceType.OnlineStandard : SynthesisVoiceType.OnlineNeural;
|
this.privVoiceType = json.VoiceType.endsWith("Standard") ? SynthesisVoiceType.OnlineStandard : SynthesisVoiceType.OnlineNeural;
|
||||||
this.privGender = json.Gender === "Male" ? SynthesisVoiceGender.Male : json.Gender === "Female" ? SynthesisVoiceGender.Female : SynthesisVoiceGender.Unknown;
|
this.privGender = json.Gender === "Male" ? SynthesisVoiceGender.Male : json.Gender === "Female" ? SynthesisVoiceGender.Female : SynthesisVoiceGender.Unknown;
|
||||||
|
@ -70,6 +72,10 @@ export class VoiceInfo {
|
||||||
return this.privShortName;
|
return this.privShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get displayName(): string {
|
||||||
|
return this.privDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
public get localName(): string {
|
public get localName(): string {
|
||||||
return this.privLocalName;
|
return this.privLocalName;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче