Public API Documentation for Indic Text

The Indic Text API allows developers to access the functionalities for processing Indo-Aryan languages. Here's a comprehensive guide on how to use the API with some examples in JavaScript:

Installation

To use the API, you can either download the Javascript files from the website or use the CDN links provided at https://cdn.jsdelivr.net/gh/aninditabasu/indic@2.7.0/dist/.

<!--Using the CDN link-->
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/aninditabasu/indic@2.7.0/dist/indic.js"></script>

API Endpoints and Methods

Transliteration

The Transliteration method allows users to transliterate text from one script to another. Here's an example of how to use the API to transliterate from English to Bengali:

let indic = new Indic('bengali');
let textToTransliterate = 'Hello World';
let transliteratedText = indic.transliterate(textToTransliterate);
console.log(transliteratedText); // Output: হেলো ওয়ার্ল্ড

Tokenization

Tokenization is the process of splitting text into individual words. Here's an example of how to use the API to tokenize a sentence:

let indic = new Indic('telugu');
let sentenceToTokenize = 'నా హృదయం పూర్తిగా ప్రేమ ఆశ్రయం చేస్తుంది';
let tokenizedText = indic.tokenize(sentenceToTokenize);
console.log(tokenizedText); // Output: [ 'నా', 'హృదయం', 'పూర్తిగా', 'ప్రేమ', 'ఆశ్రయం', 'చేస్తుంది' ]

Romanization

Romanization is the process of converting a non-latin script into the Latin script. Here's an example of how to use the API to romanize the Devanagari script into the Latin script:

let indic = new Indic('roman');
let textToRomanize = 'हिन्दी भाषा';
let romanizedText = indic.romanize(textToRomanize);
console.log(romanizedText); // Output: hindī bhāṣā

Concatenation

The Concatenation method allows users to concatenate two or more words together. Here's an example of how to use the API to concatenate two words in the Bengali script:

let indic = new Indic('bengali');
let wordsToConcatenate = ['বাংলা', 'ভাষা'];
let concatenatedText = indic.concat(wordsToConcatenate);
console.log(concatenatedText); // Output: বাংলা ভাষা

Transcription

Transcription is the process of converting speech into text. Here's an example of how to use the API to transcribe speech in Hindi:

let indic = new Indic('hindi');
let audioToTranscribe = 'https://example.com/audio.wav';
let transcription = indic.transcribe(audioToTranscribe);
console.log(transcription); // Output: काशीपुर में बहुत सारे विकास आया था

Conclusion

The Indic Text API is a valuable tool for developers working with Indo-Aryan languages. With the help of this documentation, you can quickly integrate the API into your projects. Keep exploring the API and find more ways to optimize your work. Happy coding!

Related APIs in Open Data