Delen via


De snelle transcriptie-API gebruiken met Azure AI Speech

Snelle transcriptie-API wordt gebruikt om audiobestanden te transcriberen met synchrone en snellere resultaten dan realtime. Gebruik snelle transcriptie in de scenario's waarin u het transcript van een audio-opname zo snel mogelijk nodig hebt met voorspelbare latentie, zoals:

  • Snelle audio- of videotranscriptie, ondertitels en bewerken.
  • Videovertaling

In tegenstelling tot de batchtranscriptie-API produceert snelle transcriptie-API alleen transcripties in de weergavevorm (niet lexical). Het weergaveformulier is een meer leesbare vorm van de transcriptie die interpunctie en hoofdlettergebruik bevat.

Vereisten

  • Een Azure AI Speech-resource in een van de regio's waar de snelle transcriptie-API beschikbaar is. De ondersteunde regio's zijn: Australië - oost, Brazilië - zuid, India - centraal, VS - oost, VS - oost 2, Frans - centraal, Japan - oost, VS - noord-centraal, Europa - noord, VS - zuid-centraal, Azië - zuidoost, Zweden - centraal, Europa - west, VS - west 2, VS - west 3. Zie Speech-serviceregio's voor meer informatie over regio's die worden ondersteund voor andere functies van de Speech-service.

  • Een audiobestand (minder dan 2 uur lang en kleiner dan 200 MB) in een van de indelingen en codecs die worden ondersteund door de batchtranscriptie-API. Zie ondersteunde audio-indelingen voor meer informatie over ondersteunde audio-indelingen.

De snelle transcriptie-API gebruiken

Tip

Probeer snelle transcriptie uit in de Azure AI Foundry-portal.

We leren hoe u de snelle transcriptie-API (via Transcripties - Transcriberen) gebruikt met de volgende scenario's:

  • Bekende landinstelling opgegeven: Een audiobestand transcriberen met een opgegeven landinstelling. Als u de landinstelling van het audiobestand kent, kunt u dit opgeven om de nauwkeurigheid van transcripties te verbeteren en de latentie te minimaliseren.
  • Taalidentificatie ingeschakeld: Een audiobestand transcriberen met taalidentificatie ingeschakeld. Als u niet zeker weet wat de landinstelling van het audiobestand is, kunt u taalidentificatie inschakelen zodat de Speech-service de landinstelling kan identificeren.
  • Diarization on: Transcribeer een audiobestand met diarization on. Diarization maakt onderscheid tussen verschillende sprekers in het gesprek. De Speech-service biedt informatie over welke spreker een bepaald deel van de getranscribeerde spraak sprak.
  • Meerdere kanalen ingeschakeld: een audiobestand transcriberen dat een of twee kanalen heeft. Transcripties met meerdere kanalen zijn handig voor audiobestanden met meerdere kanalen, zoals audiobestanden met meerdere luidsprekers of audiobestanden met achtergrondgeluiden. De snelle transcriptie-API voegt standaard alle invoerkanalen samen in één kanaal en voert vervolgens de transcriptie uit. Als dit niet wenselijk is, kunnen kanalen onafhankelijk worden getranscribeerd zonder samen te voegen.

Maak een POST-aanvraag met meerdere onderdelen/formuliergegevens naar het transcriptions eindpunt met het audiobestand en de eigenschappen van de aanvraagbody.

In het volgende voorbeeld ziet u hoe u een audiobestand met een opgegeven landinstelling transcribeert. Als u de landinstelling van het audiobestand kent, kunt u dit opgeven om de nauwkeurigheid van transcripties te verbeteren en de latentie te minimaliseren.

  • Vervang door YourSubscriptionKey uw Spraak-resourcesleutel.
  • Vervang door YourServiceRegion uw spraakresourceregio.
  • Vervang YourAudioFile door het pad naar uw audiobestand.
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
--header 'Content-Type: multipart/form-data' \
--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey' \
--form 'audio=@"YourAudioFile"' \
--form 'definition="{
    "locales":["en-US"]}"'

Bouw de formulierdefinitie volgens de volgende instructies:

  • Stel de optionele (maar aanbevolen) locales eigenschap in die overeenkomt met de verwachte landinstelling van de audiogegevens om te transcriberen. In dit voorbeeld is de landinstelling ingesteld op en-US. De ondersteunde landinstellingen die u kunt opgeven zijn: de-DE, en-IN, en-US, es-ES, es-MX, fr-FR, hi-IN, it-IT, ja-JP, ko-KR, pt-BR en zh-CN.

Zie de sectie aanvraagconfiguratieopties verderop in deze handleiding voor meer informatie over locales en andere eigenschappen voor de snelle transcriptie-API.

Het antwoord bevat durationMilliseconds, offsetMillisecondsen meer. De combinedPhrases eigenschap bevat de volledige transcripties voor alle sprekers.

{
	"durationMilliseconds": 182439,
	"combinedPhrases": [
		{
			"text": "Good afternoon. This is Sam. Thank you for calling Contoso. How can I help? Hi there. My name is Mary. I'm currently living in Los Angeles, but I'm planning to move to Las Vegas. I would like to apply for a loan. Okay. I see you're currently living in California. Let me make sure I understand you correctly. Uh You'd like to apply for a loan even though you'll be moving soon. Is that right? Yes, exactly. So I'm planning to relocate soon, but I would like to apply for the loan first so that I can purchase a new home once I move there. And are you planning to sell your current home? Yes, I will be listing it on the market soon and hopefully it'll sell quickly. That's why I'm applying for a loan now, so that I can purchase a new house in Nevada and close on it quickly as well once my current home sells. I see. Would you mind holding for a moment while I take your information down? Yeah, no problem. Thank you for your help. Mm-hmm. Just one moment. All right. Thank you for your patience, ma'am. May I have your first and last name, please? Yes, my name is Mary Smith. Thank you, Ms. Smith. May I have your current address, please? Yes. So my address is 123 Main Street in Los Angeles, California, and the zip code is 90923. Sorry, that was a 90 what? 90923. 90923 on Main Street. Got it. Thank you. May I have your phone number as well, please? Uh Yes, my phone number is 504-529-2351 and then yeah. 2351. Got it. And do you have an e-mail address we I can associate with this application? uh Yes, so my e-mail address is mary.a.sm78@gmail.com. Mary.a, was that a S-N as in November or M as in Mike? M as in Mike. Mike78, got it. Thank you. Ms. Smith, do you currently have any other loans? Uh Yes, so I currently have two other loans through Contoso. So my first one is my car loan and then my other is my student loan. They total about 1400 per month combined and my interest rate is 8%. I see. And you're currently paying those loans off monthly, is that right? Yes, of course I do. OK, thank you. Here's what I suggest we do. Let me place you on a brief hold again so that I can talk with one of our loan officers and get this started for you immediately. In the meantime, it would be great if you could take a few minutes and complete the remainder of the secure application online at www.contosoloans.com. Yeah, that sounds good. I can go ahead and get started. Thank you for your help. Thank you."
		}
	],
	"phrases": [
		{
			"offsetMilliseconds": 960,
			"durationMilliseconds": 640,
			"text": "Good afternoon.",
			"words": [
				{
					"text": "Good",
					"offsetMilliseconds": 960,
					"durationMilliseconds": 240
				},
				{
					"text": "afternoon.",
					"offsetMilliseconds": 1200,
					"durationMilliseconds": 400
				}
			],
			"locale": "en-US",
			"confidence": 0.93616915
		},
		{
			"offsetMilliseconds": 1600,
			"durationMilliseconds": 640,
			"text": "This is Sam.",
			"words": [
				{
					"text": "This",
					"offsetMilliseconds": 1600,
					"durationMilliseconds": 240
				},
				{
					"text": "is",
					"offsetMilliseconds": 1840,
					"durationMilliseconds": 120
				},
				{
					"text": "Sam.",
					"offsetMilliseconds": 1960,
					"durationMilliseconds": 280
				}
			],
			"locale": "en-US",
			"confidence": 0.93616915
		},
		{
			"offsetMilliseconds": 2240,
			"durationMilliseconds": 1040,
			"text": "Thank you for calling Contoso.",
			"words": [
				{
					"text": "Thank",
					"offsetMilliseconds": 2240,
					"durationMilliseconds": 200
				},
				{
					"text": "you",
					"offsetMilliseconds": 2440,
					"durationMilliseconds": 80
				},
				{
					"text": "for",
					"offsetMilliseconds": 2520,
					"durationMilliseconds": 120
				},
				{
					"text": "calling",
					"offsetMilliseconds": 2640,
					"durationMilliseconds": 200
				},
				{
					"text": "Contoso.",
					"offsetMilliseconds": 2840,
					"durationMilliseconds": 440
				}
			],
			"locale": "en-US",
			"confidence": 0.93616915
		},
		{
			"offsetMilliseconds": 3280,
			"durationMilliseconds": 640,
			"text": "How can I help?",
			"words": [
				{
					"text": "How",
					"offsetMilliseconds": 3280,
					"durationMilliseconds": 120
				},
				{
					"text": "can",
					"offsetMilliseconds": 3440,
					"durationMilliseconds": 120
				},
				{
					"text": "I",
					"offsetMilliseconds": 3560,
					"durationMilliseconds": 40
				},
				{
					"text": "help?",
					"offsetMilliseconds": 3600,
					"durationMilliseconds": 320
				}
			],
			"locale": "en-US",
			"confidence": 0.93616915
		},
		{
			"offsetMilliseconds": 5040,
			"durationMilliseconds": 400,
			"text": "Hi there.",
			"words": [
				{
					"text": "Hi",
					"offsetMilliseconds": 5040,
					"durationMilliseconds": 240
				},
				{
					"text": "there.",
					"offsetMilliseconds": 5280,
					"durationMilliseconds": 160
				}
			],
			"locale": "en-US",
			"confidence": 0.93616915
		},
		{
			"offsetMilliseconds": 5440,
			"durationMilliseconds": 800,
			"text": "My name is Mary.",
			"words": [
				{
					"text": "My",
					"offsetMilliseconds": 5440,
					"durationMilliseconds": 80
				},
				{
					"text": "name",
					"offsetMilliseconds": 5520,
					"durationMilliseconds": 120
				},
				{
					"text": "is",
					"offsetMilliseconds": 5640,
					"durationMilliseconds": 80
				},
				{
					"text": "Mary.",
					"offsetMilliseconds": 5720,
					"durationMilliseconds": 520
				}
			],
			"locale": "en-US",
			"confidence": 0.93616915
		},
		// More transcription results...
	    // Redacted for brevity
		{
			"offsetMilliseconds": 180320,
			"durationMilliseconds": 680,
			"text": "Thank you for your help.",
			"words": [
				{
					"text": "Thank",
					"offsetMilliseconds": 180320,
					"durationMilliseconds": 160
				},
				{
					"text": "you",
					"offsetMilliseconds": 180480,
					"durationMilliseconds": 80
				},
				{
					"text": "for",
					"offsetMilliseconds": 180560,
					"durationMilliseconds": 120
				},
				{
					"text": "your",
					"offsetMilliseconds": 180680,
					"durationMilliseconds": 120
				},
				{
					"text": "help.",
					"offsetMilliseconds": 180800,
					"durationMilliseconds": 200
				}
			],
			"locale": "en-US",
			"confidence": 0.9314801
		},
		{
			"offsetMilliseconds": 181960,
			"durationMilliseconds": 280,
			"text": "Thank you.",
			"words": [
				{
					"text": "Thank",
					"offsetMilliseconds": 181960,
					"durationMilliseconds": 200
				},
				{
					"text": "you.",
					"offsetMilliseconds": 182160,
					"durationMilliseconds": 80
				}
			],
			"locale": "en-US",
			"confidence": 0.9314801
		}
	]
}

Configuratieopties aanvragen

Hier volgen enkele eigenschappenopties voor het configureren van een transcriptie wanneer u de transcripties aanroept - Transcribeerbewerking .

Eigenschappen Beschrijving Vereist of optioneel
channels De lijst met op nul gebaseerde indexen van de kanalen die afzonderlijk moeten worden getranscribeerd. Maximaal twee kanalen worden ondersteund, tenzij diarisatie is ingeschakeld. De snelle transcriptie-API voegt standaard alle invoerkanalen samen in één kanaal en voert vervolgens de transcriptie uit. Als dit niet wenselijk is, kunnen kanalen onafhankelijk worden getranscribeerd zonder samen te voegen.

Als u de kanalen van een stereo-audiobestand afzonderlijk wilt transcriberen, moet [0,1]u , [0]of [1]. Anders wordt stereogeluid samengevoegd met mono en wordt slechts één kanaal getranscribeerd.

Als het geluid stereo is en diarisatie is ingeschakeld, kunt u de channels eigenschap niet instellen op [0,1]. De Speech-service biedt geen ondersteuning voor diarisatie van meerdere kanalen.

Voor monogeluid wordt de channels eigenschap genegeerd en wordt de audio altijd getranscribeerd als één kanaal.
Optioneel
diarization De diarisatieconfiguratie. Diarisatie is het proces van het herkennen en scheiden van meerdere luidsprekers in één audiokanaal. Geef "diarization": {"maxSpeakers": 2, "enabled": true}bijvoorbeeld op. Vervolgens bevat speaker het transcriptiebestand vermeldingen (zoals "speaker": 0 of "speaker": 1) voor elke getranscribeerde woordgroep. Optioneel
locales De lijst met landinstellingen die overeenkomen met de verwachte landinstelling van de audiogegevens die moeten worden getranscribeerd.

Als u de landinstelling van het audiobestand kent, kunt u dit opgeven om de nauwkeurigheid van transcripties te verbeteren en de latentie te minimaliseren. Als er één landinstelling is opgegeven, wordt die landinstelling gebruikt voor transcriptie.

Maar als u niet zeker weet wat de landinstelling is, kunt u meerdere landinstellingen opgeven. Taalidentificatie kan nauwkeuriger zijn met een nauwkeurigere lijst met kandidaatlandinstellingen.

Als u geen landinstellingen opgeeft of als de landinstellingen die u opgeeft zich niet in het audiobestand, probeert de Speech-service de taal nog steeds te identificeren. Als de taal niet kan worden geïdentificeerd, wordt er een fout geretourneerd.

De ondersteunde landinstellingen die u kunt opgeven zijn: de-DE, en-IN, en-US, es-ES, es-MX, fr-FR, hi-IN, it-IT, ja-JP, ko-KR, pt-BR en zh-CN. U kunt de meest recente ondersteunde talen ophalen via de Transcripties - List Supported Locales REST API. Zie de taalondersteuningsdocumentatie voor de Speech-service voor meer informatie over landinstellingen.
Optioneel, maar aanbevolen als u de verwachte landinstelling kent.
profanityFilterMode Hiermee geeft u op hoe grof taalgebruik moet worden verwerkt in herkenningsresultaten. Geaccepteerde waarden zijn None om grof taalgebruik uit te schakelen, Masked grof taalgebruik te vervangen door sterretjes, Removed om alle grof taalgebruik uit het resultaat te verwijderen of Tags om grof taalgebruikslabels toe te voegen. De standaardwaarde is Masked. Optioneel