助理实体和不同的发言人 [英] Assistant Entities and Different Speakers
问题描述
使用Watson-Unity-SDK可以区分说话者/用户,因为它似乎能够返回一个数组,该数组标识在多人交流中哪个说话者说了哪些单词,但我无法确定了解如何执行它,特别是在我向助手服务发送不同讲话(由不同人说)的情况下.
It is possible to differentiate among speakers/users with the Watson-Unity-SDK, as it seems to be able to return an array that identifies which words were spoken by which speakers in a multi-person exchange, but I cannot figure out how to execute it, particularly in the case where I am sending different utterances (spoken by different people) to the Assistant service to get a response accordingly.
有用于解析Assistant的json
输出/响应以及OnRecognize
和OnRecognizeSpeaker
以及SpeechRecognitionResult
和SpeakerLabelsResult
的代码段,但是当出现以下情况时,如何使Watson从服务器返回此代码段:话语被识别并提取其意图?
The code snippets for parsing Assistant's json
output/response as well as OnRecognize
and OnRecognizeSpeaker
and SpeechRecognitionResult
and SpeakerLabelsResult
are there, but how do I get Watson to return this from the server when an utterance is recognized and its intent is extracted?
OnRecognize
和OnRecognizeSpeaker
在Active
属性中仅使用一次,因此它们都被调用,但是只有OnRecognize
会执行语音转文本(转录),并且永远不会触发OnRecognizeSpeaker
...
Both OnRecognize
and OnRecognizeSpeaker
are used only once in the Active
property, so they are both called, but only OnRecognize
does the Speech-to-Text (transcription) and OnRecognizeSpeaker
is never fired...
public bool Active
{
get
{
return _service.IsListening;
}
set
{
if (value && !_service.IsListening)
{
_service.RecognizeModel = (string.IsNullOrEmpty(_recognizeModel) ? "en-US_BroadbandModel" : _recognizeModel);
_service.DetectSilence = true;
_service.EnableWordConfidence = true;
_service.EnableTimestamps = true;
_service.SilenceThreshold = 0.01f;
_service.MaxAlternatives = 0;
_service.EnableInterimResults = true;
_service.OnError = OnError;
_service.InactivityTimeout = -1;
_service.ProfanityFilter = false;
_service.SmartFormatting = true;
_service.SpeakerLabels = false;
_service.WordAlternativesThreshold = null;
_service.StartListening(OnRecognize, OnRecognizeSpeaker);
}
else if (!value && _service.IsListening)
{
_service.StopListening();
}
}
}
通常,Assistant的输出(即其结果)类似于以下内容:
Typically, the output of Assistant (i.e. its result) is something like the following:
Response: {"intents":[{"intent":"General_Greetings","confidence":0.9962662220001222}],"entities":[],"input":{"text":"hello eva"},"output":{"generic":[{"response_type":"text","text":"Hey!"}],"text":["Hey!"],"nodes_visited":["node_1_1545671354384"],"log_messages":[]},"context":{"conversation_id":"f922f2f0-0c71-4188-9331-09975f82255a","system":{"initialized":true,"dialog_stack":[{"dialog_node":"root"}],"dialog_turn_counter":1,"dialog_request_counter":1,"_node_output_map":{"node_1_1545671354384":{"0":[0,0,1]}},"branch_exited":true,"branch_exited_reason":"completed"}}}
我已经设置了intents
和entities
,并且该列表由Assistant服务返回,但是我不确定如何在考虑到STT时如何同时考虑我的实体或如何使其响应识别不同的说话者.
I have set up intents
and entities
, and this list is returned by the Assistant service, but I am not sure how to get it to also consider my entities or how to get it to respond accordingly when the STT recognizes different speakers.
我希望能获得一些帮助,尤其是如何通过Unity脚本执行此操作.
I would appreciate some help, particularly how to do this via Unity scripting.
推荐答案
请设置SpeakerLabels
为True
_service.SpeakerLabels = true;
这篇关于助理实体和不同的发言人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!