Enrich Transcription/Translation Data with Detected Language and Original Text #364
+24
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #363
This pull request enhances the data provided in translation stream to let Third-Party Applications (TPAs) Now the original language of a segment as well as the original text. This will allow apps to only translate text that is actually in a different language.
Problem Solved:
Previously, TPAs subscribing to translation streams couldn't easily determine if a translation actually occurred (vs. source and target languages being the same) or what the originally detected language was if it differed from the requested source language. Similarly, transcription streams didn't report the language detected by the underlying speech service. This made it harder for TPAs to build robust and context-aware features.
Changes Implemented:
SDK Interface Updates (
packages/sdk
):detectedLanguage?: string
andoriginalText?: string
fields toTranslationData
.Cloud Service Logic Updates (
packages/cloud
):TranscriptionService
(setupRecognitionHandlersForInstance
method):detectedLanguage
field inTranslationData
object.event.result.text
and populates theoriginalText
field inTranslationData
.Backward Compatibility:
These changes are fully backward compatible. Existing TPAs consuming
TranslationData
will continue to work without modification, as the new fields (detectedLanguage
,originalText
) are optional and will simply be ignored if not used by the TPA.Testing:
I have tested this manually in my development environment. At the moment there are not any automated tests.