Measurements

Measurements automatically formats spoken measurement units into their respective abbreviations.

The Measurements feature in Deepgram's Speech-to-Text API allows for the automatic conversion of spoken measurement units into their respective abbreviations.

By enabling this feature, terms such as "milligram" will be transcribed as "mg".

Enable Feature

To enable the Measurements feature, you need to set the measurements parameter to true when making an API request.

measurements=true

Curl Example

To transcribe audio with the Measurements feature enabled, use the following cURL command:

curl \
  --request POST \
  --header 'Authorization: Token YOUR_DEEPGRAM_API_KEY' \
  --header 'Content-Type: audio/wav' \
  --data-binary @youraudio.wav \
  --url 'https://api.deepgram.com/v1/listen?measurements=true'

🚧

Replace YOUR_DEEPGRAM_API_KEY with your Deepgram API Key.


Query Parameters

ParameterValueData TypeDescription
measurementstrue / falsebooleanEnables the Measurements feature to convert spoken measurements to abbreviations. Default is false.

Analyze Response

When the Measurements feature is enabled, the transcribed text will contain abbreviations for measured units.

Response Example

{
  "metadata": {
    "transaction_key": "your-transaction-key",
    "request_id": "your-request-id",
    "created": "2023-01-01T00:00:00Z",
    "duration": 30.0
  },
  "results": [
    {
      "channels": [
        {
          "alternatives": [
            {
              "transcript": "I just ate 33 g of pasta and drank 55 ml of water.",
              "confidence": 0.98,
              "words": [
                {
                  "word": "I",
                  "start": 0.0,
                  "end": 0.2,
                  "confidence": 0.99
                },
                {
                  "word": "just",
                  "start": 0.2,
                  "end": 0.4,
                  "confidence": 0.98
                },
                {
                  "word": "ate",
                  "start": 0.5,
                  "end": 0.7,
                  "confidence": 0.97
                },
                {
                  "word": "33",
                  "start": 0.8,
                  "end": 1.0,
                  "confidence": 0.96
                },
                {
                  "word": "g",
                  "start": 1.1,
                  "end": 1.3,
                  "confidence": 0.95
                },
                {
                  "word": "of",
                  "start": 1.4,
                  "end": 1.5,
                  "confidence": 0.94
                },
                {
                  "word": "pasta",
                  "start": 1.6,
                  "end": 1.8,
                  "confidence": 0.93
                },
                {
                  "word": "and",
                  "start": 1.9,
                  "end": 2.0,
                  "confidence": 0.92
                },
                {
                  "word": "drank",
                  "start": 2.1,
                  "end": 2.3,
                  "confidence": 0.91
                },
                {
                  "word": "55",
                  "start": 2.4,
                  "end": 2.5,
                  "confidence": 0.90
                },
                {
                  "word": "ml",
                  "start": 2.6,
                  "end": 2.8,
                  "confidence": 0.89
                },
                {
                  "word": "of",
                  "start": 2.9,
                  "end": 3.0,
                  "confidence": 0.88
                },
                {
                  "word": "water",
                  "start": 3.1,
                  "end": 3.3,
                  "confidence": 0.87
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

In this example, spoken measurements like "grams" and "milliliters" have been converted to their respective abbreviations "g" and "ml" in the transcript.

Measurements List

The following units will be converted to their abbreviations.

UnitAbbreviation
milligram(s)mg
centigram(s)cg
gram(s)g
kilogram(s)kg
milliliter(s)ml
centiliter(s)cl
liter(s)l
kiloliter(s)kl
millimeter(s)mm
centimeter(s)cm
meter(s)m
kilometer(s)km

What’s Next