Text Tags

POST https://apiv2.indico.io/texttags?version=[version]
Determine the topics in the phrase or document.

Current Version: 2

Private cloud endpoint

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

Arguments

data – String | List – required – text to be analyzed
[top_n] – Integer – optionals – only return this many of the most likely topics
[threshold] – Float (defaults to 0.) – optional – only return topics with likelihood greater than this number

For an example of how to pass keyword arguments to the indico API in a post request, see the example below.

Output

This function will return a dictionary with 111 key-value pairs. These key-value pairs represent the likelihood that the analyzed text is about each of the 111 possible topics. The keys in the dictionary are strings containing the topic names and the values are the probabilities that the analyzed text is about each topic.

# single output
{
    'anime': 0.003982535730280216,
    'anthropology': 0.020311181569223534,
    'archery': 0.4893124752591462,
    ... 105 topics omitted ...,
    'wrestling': 0.0009661379304299885,
    'writing': 0.00532591437084736,
    'yoga': 0.001874647791589776
}

# batch output
[
    {
        'anime': 0.003982535730280216,
        'anthropology': 0.020311181569223534,
        'archery': 0.4893124752591462,
        ... 105 topics omitted ...,
        'wrestling': 0.0009661379304299885,
        'writing': 0.00532591437084736,
        'yoga': 0.001874647791589776
    },
    {
        'anime': 0.0020400125677411812,
        'anthropology': 0.010790799662278016,
        'archery': 0.002072348777350773,
        ... 105 topics omitted ...,
        'wrestling': 0.0012626451944395167,
        'writing': 0.004772236821288096,
        'yoga': 0.22969626130844248
    }
]

Complete List of Tags

anime, anthropology, archery, architecture, art, astronomy, atheism, aviation, baseball, beer, bicycling, biology, books, boxing, buddhism, business, cars, christianity, climbing, comedy, comics, conspiracy, cooking, crafts, cricket, design, dieting, diy, drugs, economic_discussion, education, electronics, energy, entertainment_news, environmental, fashion, fiction, film, fishing, fitness, gaming, gardening, gender_issues, general_food, golf, guns, health, history, hockey, hunting, individualist_politics, investment, islam, jobs, judaism, left_politics, lgbt, math, medicine, military, music, nba, news, nfl, nostalgia, nutrition, parenting, personal, personal_care_and_beauty, personalfinance, pets, philosophy, photography, poetry, poker, political_discussion, programming, psychology, realestate, relationships, religion, right_politics, romance, rugby, running, sailing, school, science, scuba, singing, skateboarding, soccer, sports, startups_and_entrepreneurship, surfing, swimming, tattoo, technology, television, tennis, travel, ultimate, vegan, vegetarian, weather, wedding, weight_training, wine, wrestling, writing, yoga

Example

// Single Example
fetch('https://apiv2.indico.io/texttags', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: 'The most common form of arrow consists of a shaft with an arrowhead attached to the front end and with fletchings and a nock attached to the other end.',
    threshold: 0.1
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));

// Batch Example
fetch('https://apiv2.indico.io/texttags/batch', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: [
      'The most common form of arrow consists of a shaft with an arrowhead attached to the front end and with fletchings and a nock attached to the other end.',
      'Yoga in Indian traditions, however, is more than physical exercise, it has a meditative and spiritual core.'
    ],
    threshold: 0.1
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));