Blog

2 New Endpoints to Return Transcripts as Paragraphs and Sentences

Changelog
2 New Endpoints to Return Transcripts as Paragraphs and Sentences

A common request from developers is what to do with a massive transcription you get back from the AssemblyAI Speech-to-Text API once it has been converted successfully. Displaying the transcription text as one big text block is often not very user-friendly, and a lot of black magic logic usually gets implemented to break this wall of text into something more digestible.

To make developers' lives easier, we now have two new endpoints that allow you to pull a completed transcript broken into paragraphs, or should you desire to be more specific, sentences!

To access this new feature, there is nothing extra you have to do with your account. You don't even have to resubmit the audio! All you have to do is send a GET request to the endpoint of your choosing:

/v2/transcript/{TRANSCRIPT ID}/paragraphs
/v2/transcript/{TRANSCRIPT ID}/sentences

Here is a simple example of hitting the new /v2/transcript/{TRANSCRIPT ID}/paragraphs endpoint in Python:

import request

endpoint = 'https://api.assembly.com/v2/transcript/{TRANSCRIPT ID}/paragraphs'

headers = {'authorization': 'YOUR ASSEMBLYAI API TOKEN'}

response = requests.get(endpoint, headers=headers)

print(response.json())

And that is it! You will then get back a broken-down response into your choice of paragraphs or sentences for you to loop over and display as you wish. Here is an example response from the above Python code:

{
   "paragraphs":[
      {
         "text":"Hello. I'm Sunny Williams. I'm up here on the International Space Station. So this is No two. This is a really cool module.",
         "start":770,
         "end":10710,
         "confidence":0.97,
         "words":[
            {"text": "Hello.", "start": 100, "end": 1000, "confidence": 0.99},
            "..."
         ]
      },
      {
         "text":"Of course, most of these modules, you'll see, they have four sides and they're put together that way we could sort of work on a flat plane, either a wall, a floor, another wall, or the ceiling. But again, all you have to do is turn yourself and your reference changes. The reason I'm bringing that up is because this is where four out of six of us sleep. And so people always ask about sleeping in space. Do you lie down?",
         "start":11370,
         "end":39060,
         "confidence":0.99,
         "words":[
            {"text": "Of.", "start": 12, "end": 450, "confidence": 0.99},
            "..."
         ]
      },
      {
         "text":"Are you in a bed? Not really, because it doesn't matter. You don't really have the sensation of lying down. You just sit in your sleeping bag. So Here's one sleep station right here.",
         "start":39070,
         "end":50250,
         "confidence":0.99,
         "words":[
            {"text": "Are.", "start": 45, "end": 290, "confidence": 0.99},
            "..."
         ]
      },

        "......"

    ],
    "id": "3otc28umy-25ae-4446-b133-70e244be5208",
    "confidence": 0.951530612244907,
    "audio_duration": 521.352
}

Now you are ready to create easy to read interfaces straight from your audio file!

You can read more about each endpoint in the AssemblyAI API Docs!

Subscribe to our blog!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

You may also like

Checkout some of our recent research and product updates

How to transcribe an audio file with Python and AssemblyAI
Tutorials
How to transcribe an audio file with Python and AssemblyAI

In this tutorial, we show you how to easily transcribe an audio or video file using Python and the AssemblyAI API in just a few lines of code!

Open Sourcing our Drone CI/CD CloudWatch Auto Scaler
Engineering
Open Sourcing our Drone CI/CD CloudWatch Auto Scaler

At AssemblyAI, we use Drone as our primary CI/CD tool. It's dead simple to set up and operate which frees us up to build out our product. Recently we decided to figure out how to build a cost-effective, easily-scalable Drone worker fleet for our GPU instances.

Getting started with HttpClientFactory in C# and .NET 5
Engineering
Getting started with HttpClientFactory in C# and .NET 5

HttpClientFactory has been around the .NET ecosystem for a few years now. In this post we will look at 3 basic implementations of HttpClientFactory; basic, named, and typed.

ADVANCED TRANSCRIPTON FEATURES

Unlock your media with our advanced features like PII Redaction,
Keyword Boosts, Automatic Transcript Highlights, and more