Language Detection

POST https://apiv2.indico.io/language

Current Version: 2

Private cloud endpoint

POST https://[cloud].indico.domains/language/[batch]/

Arguments

data – String | List – required – text to be analyzed

Output

This function will return a dictionary with 33 key-value pairs. These key-value pairs represent the likelihood that the analyzed text is written in each of the 33 possible languages. The keys in the dictionary are strings containing the language names and the values are the probabilities that the analyzed text is written in each language.
Values less than 0.05 indicate that it is very unlikely the text is written in the corresponding language.

Complete List of Languages:
Arabic (ar), Bulgarian (bg), Chinese (ch), Czech (cs), Danish (da), Dutch (nl), English (en), Esparanto (eo), Farsi (fa), Finnish (fi), French (fr), German (de), Greek (el), Hebrew (he), Hungarian (hu), Indonesian (id), Italian (it), Japanese (ja), Korean (ko), Latin (la), Lithuanian (lt), Norwegian (no), Polish (pl), Portuguese (pg), Romanian (ro), Russian (ru), Slovak (sk), Spanish (es), Swedish (sv), Tagalog (tl), Thai (th), Turkish (tr), Vietnamese (vi)

# single output
{
    'swedish': 0.00004324968926091062,
    'lithuanian': 0.007702528578033991,
    'vietnamese': 0.0002575132225946431,
    '... 33 languages omitted ...',
    'english': 0.2071775132225946431,
    'chinese': 0.008160047807935744,
    'arabic': 0.00015069427192724994
}

# batch output
[
    {
        'swedish': 0.00004324968926091062,
        'lithuanian': 0.007702528578033991,
        'vietnamese': 0.0002575132225946431,
        '... 33 languages omitted ...',
        'english': 0.2071775132225946431,
        'chinese': 0.008160047807935744,
        'arabic': 0.00015069427192724994
    },
    {
        'swedish': 0.0020400125677411812,
        'lithuanian': 0.010790799662278016,
        'vietnamese': 0.002072348777350773,
        ... 33 languages omitted ...,
        'english': 0.0012626451944395167,
        'chinese': 0.004772236821288096,
        'arabic': 0.22969626130844248
    }
]

Example

// Single Example
fetch('https://apiv2.indico.io/language', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: 'How are you?'
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));

// Batch Example
fetch('https://apiv2.indico.io/language/batch', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: [
      'How are you?',
      '¿Cómo estás?'
    ]
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));