Transliteration API
The Transliteration API is a REST API used to transliterate the content from English to Indic languages and vice-versa. The solution is an automated solution that converts the content in real-time. It is easy to integrate into your applications and display content in the 11 most popular Indian languages
How Does API Work?
The Transliteration API will use the App Id and API key to authenticate requests. Your credentials carry many privileges, so be sure to keep them secure.
-
Pass valid login credentials:
- Rev App ID
- App Key
-
Select Source language & Target language
-
Post Source Content
-
Validate user credentials & load default account settings
-
Return content in Target language
cURL for Integration
Translate content to one target language
Request
Response
Transliterating Multiple sentences
Request
Response
API References
HTTP Request URL
URL Elements | Sample URL |
---|---|
https://(hostname) | https://revapi.reverieinc.com/ |
Headers
The format of the data to be posted: application/json
A unique key/token provided by Reverie to identify the user using the Localization API.
The unique account ID to identify the user and the default account settings.
The parameter to identify the API : transliteration
- The version refers to the specific iteration of the API that is being called.
- Note: The default version is 2.0.
- The script used in the input text.
- Example :
or
,hi
,bn
- Refer to section Language Codes for valid language code.
- The script to which you want to convert the input text.
- Example :
or
,hi
,bn
- Refer to section Language Codes for valid language code.
- The Domain refers to the universe in which you use the Transliteration . Example- Health Care, Insurance, Legal, etc.
- Refer to section Domain Codes for valid language code.
- The language of the words in the input text.
- Refer to section Domain Codes for valid language code.
- Example:
data: "Singh Sahab aap Kahan the."
In the example above, the Hindi language words are written in the English language script (Roman Script). Socnt_lang = "hi"
. - Note: This is an optional parameter. If no value is provided, by default the value is the same as
src_lang
.
Request
- List of input text for transliteration.
- Specify whether the API should initially search in the Exception DB to transliterate the input text.
- Note - By default, the
isBulk
=true
and will not search in the Exception DB.
- Mention the number of transliteration suggestions the API should return for the input text.
- Note - By default, the
noOfSuggestions
= 1, means the API will return only one transliteration suggestion for the input string. - Example: Consider
noOfSuggestions = 2
Source Content Target Content Rama 1. रामा 2. रमा
- The abbreviate will Validate whether any Abbreviations/ Acronyms are passed in the input text and will transliterate it accurately.
- Note - By default, the
abbreviate
=true
- Note - If the value is false, the API will consider the abbreviation as a word and transliterate it to the nearest available word.
- Note - In the input text, pass the abbreviations in upper case.
- The feature to screen the non-dictionary words used in a sentence. In other words, the mask will indicate the words that should not be translated into the target language.
- Note - By default, the
enableLookup
=true
. - Note - To set the
nmtMask
=true
, it is mandatory thesrc_lang
=en
(English). - Description: Specify whether to convert the numbers in the input text to the target language script based on the value type.
- Three types of values for this parameter:
- local: This value can convert the input number to the target language script.
Example:Source String Target String 2020.04 २०२०.०४ - words: This value can convert numbers into words with respect to the target language.
Example:Source String Target String 505 पांच सौ पांच - roman: This value can convert Roman numbers to English numbers.
Example:- If the user types
sector V
in English, the transliteration would beसेक्टर 5
in Hindi. Block II
will be transliterated asब्लॉक 2
.
- If the user types
- local: This value can convert the input number to the target language script.
- Specify whether you want to retain the entities like email ID and URL in the input script.
- Note: By default, the
ignoreTaggedEntities
=true
and will transliterate the email ID and URL into the target language script. - Example: Consider
ignoreTaggedEntities = false
Source String Target String Check product details in www.reverieinc.com चेक प्रोडक्ट डिटेल्स इन www.reverieinc.com
- This is used for transliterating ordinal values to English numbers.
- Note - Default value =
False
. - Example: If the user types
15th Main
in English, the transliteration would be15 मेन
in Hindi.
- This is used to produce the abbreviation output without a dot.
- Note - Default value =
False
. - Example: If a user wants an abbreviation output without a dot and is given
SMS
as an input, then the result would beएसएमएस
.
Response
- The API will return the string(s) in the target language script.
- The input text in the source language script.
- A string which is the result of converting the input text to the output script
- Status of API – successful/fail.
- By default, the
api_status
= 2 for all the successful transactions.
Handling Errors
The Transliteration API raises exceptions for many reasons, such as failed conversions, invalid parameters, authentication errors, and network unavailability. It will provide more specific machine-readable messages with an error response so that users can react to errors more effectively.
Refer to: API Messages section to know the error code and corresponding messages.
API Messages
Status Code | Status Type | Message | Description |
---|---|---|---|
200 | Success/OK | - | Successfully executed the request. |
400 | Bad Request | Message depending on the missing parameter | Incorrect request format or data posted incorrectly. |
403 | Forbidden | Invalid REV-API-KEY or REV-APP-ID | Entered invalid credentials. |
403 | Forbidden | usage exhausted | The provided credits or character limit is exhausted. |
403 | Forbidden | API key expired | The API key provided to a user is expired. |
403 | Forbidden | unauthorized to use this src/tgt language | Invalid language code passed or user cannot use the defined language code. |
403 | Forbidden | unauthorized to use this API | The REV-APPNAME entered is invalid, or the user is not authorized to use it. |
500 | Internal Server Error | Internal Server Error | An error occurred with the API. |