Skip to content

Commit 2951bfd

Browse files
committed
intermediate speaker ID
1 parent 39a24ce commit 2951bfd

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

articles/ai-services/speech-service/includes/quickstarts/stt-diarization/cpp.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Follow these steps to create a console application and install the Speech SDK.
6060
}
6161

6262
auto speechConfig = SpeechConfig::FromSubscription(speechKey, speechRegion);
63+
speechConfig->SetProperty(PropertyId::SpeechServiceResponse_DiarizeIntermediateResults, "true");
6364

6465
speechConfig->SetSpeechRecognitionLanguage("en-US");
6566

@@ -73,6 +74,7 @@ Follow these steps to create a console application and install the Speech SDK.
7374
conversationTranscriber->Transcribing.Connect([](const ConversationTranscriptionEventArgs& e)
7475
{
7576
std::cout << "TRANSCRIBING:" << e.Result->Text << std::endl;
77+
std::cout << "Speaker ID=" << e.Result->SpeakerId << std::endl;
7678
});
7779

7880
conversationTranscriber->Transcribed.Connect([](const ConversationTranscriptionEventArgs& e)

articles/ai-services/speech-service/includes/quickstarts/stt-diarization/java.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,15 @@ Follow these steps to create a console application for conversation transcriptio
8888
SpeechConfig speechConfig = SpeechConfig.fromSubscription(speechKey, speechRegion);
8989
speechConfig.setSpeechRecognitionLanguage("en-US");
9090
AudioConfig audioInput = AudioConfig.fromWavFileInput("katiesteve.wav");
91+
speechConfig.setProperty(PropertyId.SpeechServiceResponse_DiarizeIntermediateResults, "true");
9192

9293
Semaphore stopRecognitionSemaphore = new Semaphore(0);
9394

9495
ConversationTranscriber conversationTranscriber = new ConversationTranscriber(speechConfig, audioInput);
9596
{
9697
// Subscribes to events.
9798
conversationTranscriber.transcribing.addEventListener((s, e) -> {
98-
System.out.println("TRANSCRIBING: Text=" + e.getResult().getText());
99+
System.out.println("TRANSCRIBING: Text=" + e.getResult().getText() + " Speaker ID=" + e.getResult().getSpeakerId() );
99100
});
100101

101102
conversationTranscriber.transcribed.addEventListener((s, e) -> {

articles/ai-services/speech-service/includes/quickstarts/stt-diarization/python.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,19 @@ Follow these steps to create a new console application.
6060
elif evt.result.reason == speechsdk.ResultReason.NoMatch:
6161
print('\tNOMATCH: Speech could not be TRANSCRIBED: {}'.format(evt.result.no_match_details))
6262

63+
def conversation_transcriber_transcribing_cb(evt: speechsdk.SpeechRecognitionEventArgs):
64+
print('TRANSCRIBING:')
65+
print('\tText={}'.format(evt.result.text))
66+
print('\tSpeaker ID={}'.format(evt.result.speaker_id))
67+
6368
def conversation_transcriber_session_started_cb(evt: speechsdk.SessionEventArgs):
6469
print('SessionStarted event')
6570

6671
def recognize_from_file():
6772
# This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
6873
speech_config = speechsdk.SpeechConfig(subscription=os.environ.get('SPEECH_KEY'), region=os.environ.get('SPEECH_REGION'))
6974
speech_config.speech_recognition_language="en-US"
75+
speech_config.set_property(property_id=speechsdk.PropertyId.SpeechServiceResponse_DiarizeIntermediateResults, value='true')
7076

7177
audio_config = speechsdk.audio.AudioConfig(filename="katiesteve.wav")
7278
conversation_transcriber = speechsdk.transcription.ConversationTranscriber(speech_config=speech_config, audio_config=audio_config)
@@ -81,6 +87,7 @@ Follow these steps to create a new console application.
8187

8288
# Connect callbacks to the events fired by the conversation transcriber
8389
conversation_transcriber.transcribed.connect(conversation_transcriber_transcribed_cb)
90+
conversation_transcriber.transcribing.connect(conversation_transcriber_transcribing_cb)
8491
conversation_transcriber.session_started.connect(conversation_transcriber_session_started_cb)
8592
conversation_transcriber.session_stopped.connect(conversation_transcriber_session_stopped_cb)
8693
conversation_transcriber.canceled.connect(conversation_transcriber_recognition_canceled_cb)

0 commit comments

Comments
 (0)