curl --request POST \
--url https://optimize.rime.ai/textnorm \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--fail \
--data '{
"text": "<string>"
}'
import requests
url = "https://optimize.rime.ai/textnorm"
payload = {
"text": "<string>"
}
headers = {
"Accept": "application/json",
"Authorization": "Bearer <authorization>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {
Accept: 'application/json',
Authorization: 'Bearer <authorization>',
'Content-Type': 'application/json'
},
body: '{"text":"<string>"}'
};
fetch('https://optimize.rime.ai/textnorm', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://optimize.rime.ai/textnorm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"text\": \"<string>\"\n}",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Authorization: Bearer <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://optimize.rime.ai/textnorm"
payload := strings.NewReader("{\n \"text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer <authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://optimize.rime.ai/textnorm")
.header("Accept", "application/json")
.header("Authorization", "Bearer <authorization>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\"\n}")
.asString();
{
"normalized": "one two three four, one, two, three, four, one, eight hundred, four four four, four one four one"
}
Other APIs
Text Normalization
Return the grammar normalizer’s output for an input string.
curl --request POST \
--url https://optimize.rime.ai/textnorm \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--fail \
--data '{
"text": "<string>"
}'
import requests
url = "https://optimize.rime.ai/textnorm"
payload = {
"text": "<string>"
}
headers = {
"Accept": "application/json",
"Authorization": "Bearer <authorization>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {
Accept: 'application/json',
Authorization: 'Bearer <authorization>',
'Content-Type': 'application/json'
},
body: '{"text":"<string>"}'
};
fetch('https://optimize.rime.ai/textnorm', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://optimize.rime.ai/textnorm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"text\": \"<string>\"\n}",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Authorization: Bearer <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://optimize.rime.ai/textnorm"
payload := strings.NewReader("{\n \"text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer <authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://optimize.rime.ai/textnorm")
.header("Accept", "application/json")
.header("Authorization", "Bearer <authorization>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\"\n}")
.asString();
{
"normalized": "one two three four, one, two, three, four, one, eight hundred, four four four, four one four one"
}
The Rime API authenticates every request with a bearer token in the
The response includes the normalized string:
Check each non-standard word in the output. Here
Authorization header: Authorization: Bearer YOUR_API_KEY. See API authentication for how to create a key.
Overview
This endpoint returns the grammar normalizer’s output for an input string. Use it to preview how numbers, phone numbers, dates, and other non-standard words will be spoken, or to debug an unexpected pronunciation. The output matches Coda’s normalization. Mist v3 can groupspell() sequences differently.
Defaults to English. Pass the
lang field for other languages. The full list is in Languages. For details on what’s normalized natively, known gaps, and how to pre-normalize problematic patterns, see Text normalization.Example
Send the string astext, and optionally a lang code:
curl -X POST https://optimize.rime.ai/textnorm \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"1234 1,2,3,4 1-800-444-4141 "}'
{"normalized":"one two three four, one, two, three, four, one, eight hundred, four four four, four one four one"}
1234 is read digit by digit, and the phone number keeps its grouping, with 800 read as “eight hundred”. If a reading is wrong for your context, pre-normalize that text before you send it. Text normalization explains how.
To normalize text in a non-English language, pass a language code:
curl -X POST https://optimize.rime.ai/textnorm \
-H "Authorization: Bearer $(rime key)" \
-H "Content-Type: application/json" \
-d '{"text":"Tengo 2 perros","lang":"es"}'
Variable parameters
string
required
The string you’d like to normalize, up to 10,000 characters. Numbers, phone numbers, and other non-standard words will be expanded into their spoken form.
string
Language code (for example,
en, es, fr, de, and additional languages) selecting the normalization rules. Defaults to English when omitted. language is accepted as an alias. If you send both, lang is used.curl --request POST \
--url https://optimize.rime.ai/textnorm \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--fail \
--data '{
"text": "<string>"
}'
import requests
url = "https://optimize.rime.ai/textnorm"
payload = {
"text": "<string>"
}
headers = {
"Accept": "application/json",
"Authorization": "Bearer <authorization>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {
Accept: 'application/json',
Authorization: 'Bearer <authorization>',
'Content-Type': 'application/json'
},
body: '{"text":"<string>"}'
};
fetch('https://optimize.rime.ai/textnorm', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://optimize.rime.ai/textnorm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"text\": \"<string>\"\n}",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Authorization: Bearer <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://optimize.rime.ai/textnorm"
payload := strings.NewReader("{\n \"text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer <authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://optimize.rime.ai/textnorm")
.header("Accept", "application/json")
.header("Authorization", "Bearer <authorization>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\"\n}")
.asString();
{
"normalized": "one two three four, one, two, three, four, one, eight hundred, four four four, four one four one"
}

