Skip to content

Enrich Transcription/Translation Data with Detected Language and Original Text #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

OkGoDoIt
Copy link

@OkGoDoIt OkGoDoIt commented Apr 12, 2025

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:

  1. SDK Interface Updates (packages/sdk):

    • Added optional detectedLanguage?: string and originalText?: string fields to TranslationData.
    • These additions are backward compatible as they are optional.
  2. Cloud Service Logic Updates (packages/cloud):

    • Modified TranscriptionService (setupRecognitionHandlersForInstance method):
      • Since the azure api does not return the detected language, we determine it via matching the original text versus the translated text
      • Populates the new detectedLanguage field in TranslationData object.
      • Captures the original event.result.text and populates the originalText field in TranslationData.

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.

@OkGoDoIt OkGoDoIt changed the base branch from main to dev April 12, 2025 18:22
Copy link

netlify bot commented Apr 15, 2025

👷 Deploy request for augmentos-appstore pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 771f912

Copy link

netlify bot commented Apr 15, 2025

👷 Deploy request for augmentos-developer-portal pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 771f912

@OkGoDoIt OkGoDoIt requested a review from isaiahb April 15, 2025 18:25
@OkGoDoIt
Copy link
Author

This is ready for review

@CaydenPierce
Copy link
Member

Looking great. Let's get translation using this end to end and then merge it up once we have a TPA (translation) that is successfully using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance Transcription/Translation Data with Detected Language and Original Text
2 participants