Quickstart Guide


Step 1: Get Your Free API Key

First time users: If you want to use indico's public API, you must have a free account and API key. To create an account and receive your API key, register here.

Returning users: If you already have an account, you can always retrieve your API key and manage your API usage on your indico dashboard. To access your dashboard, click the login button in the upper right of this screen or go directly to indico.io/dashboard.

Enterprise users: If you are an enterprise user, you can retrieve your API key and private cloud domain from your indico dashboard. To access your dashboard, click the login button in the upper right of this screen or go directly to indico.io/dashboard. If you want to become an enterprise user, get in touch with us, and feel free to play with the public API in the meantime!

 

Step 2: Choose Your Method and Get Started!

Native Support for Multiple Programming Languages: For your convenience, indico provides native integration with some major programming languages. For installation and usage instructions, click the appropriate link in the left sidebar. Note: We do support Python 3!

RESTful API calls: Don't worry if the programming language you want to use with indico is not listed. You can also use the indico suite of predictive APIs directly through RESTful API calls. Here is a simple example API call using cURL (you will need to sign up to get your free API key. Replace `YOUR_API_KEY` with your personal API key).

curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment' --data '{"data": "indico is so easy to use!"}'

Installation

In order to use the indico APIs, you need a personal API key. If you plan to use one of our client libraries, you'll also need to install a package through a package manager or source.

 

1. Getting your API key

First time users: get a free key by registering for an account
Returning users: check yours by visiting your dashboard
Enterprise users: check your API key and private cloud domain by visiting your dashboard, or contact us if you want to become an enterprise user

 

2. Installing the indicoio PyPi package

There are two methods of installing our Python package.

Method 1 - Installing with pip
You can install the latest version of our package using pip

pip install indicoio

Method 2 - Installing from source
You can also install indicoio from source from our GitHub repository.

git clone https://github.com/IndicoDataSolutions/IndicoIo-Python.git

python setup.py install

2. Installing the indico RubyGem

There are two methods of installing our Ruby gem

Method 1 - Installing using gem
You can install the latest version of the indico RubyGem using gem by running the following in your terminal:

gem install indico

Method 2 - Installing using Bundler
You can also install indico using Bundler.

Add the following to your projects Gemfile:

gem indico

Then execute the following terminal command in the project's directory:

bundle install

2. Installing the indico.io package

There's one method of installing our node package

Method 1 - Using a package manager
You can install the latest version of our package using npm

npm install indico.io

2. Installing the indico package

There are two methods of installing our Java library.

Method 1 - Installing with Maven
You can install the latest version of the indico module using Maven by including the following in your pom.xml file:

<dependency>
    <groupId>io.indico</groupId>
    <artifactId>io.indico</artifactId>
    <version>3.X.X</version>
</dependency>
Be sure to replace the version number with the latest version, which can be found here.

Method 2 - Downloading from Github
All of our client libraries are open source, so if you want the code itself feel free to grab it from github using the command below.

git clone https://github.com/IndicoDataSolutions/IndicoIo-Java.git

2. Installing the indicoio R wrapper

There's one method of installing our R library

Installing using devtools
First, in order for the wrapper to install correctly, you'll need to install biocLite - a third party package manager. This will allow you to install EBImage, an image resizing library that isn't hosted on CRAN (hence the extra step).

Then you can install the latest version of the indicoio wrapper using devtools.

source("https://bioconductor.org/biocLite.R")
biocLite("EBImage")

Then you can install the latest version of the indicoio wrapper using devtools. If you don't have devtools, run

install.packages('devtools')

then run

library(devtools)
devtools::install_github("IndicoDataSolutions/IndicoIo-R")

2. Installing the indicoio package

There's one method of installing our PHP package

Installing using Composer
You can install the latest version of the indicoio package by following these steps:

1. Create a composer.json file in your project's directory.
2. Write the following in the file:

{
  'require': {
    "indicoio/indicoio-php": "*"
  },
  'minimum-stability': "dev"
}

3. Run the following command in the same directory (NOTE: You must have composer installed):

composer install
 

Common installation issues

Issue 1: If pip is not recognized as a command, then you may need to install it using these instructions.
Issue 2: If you cannot resolve installation issues with your Python distribution, then you can also use Anaconda.
Issue 3: If installation fails with a TypeError: 'NoneType' object is not callable error, it's likely you're missing the python development headers. On debian based distros, apt-get install python-dev should resolve the issue.
Issue 4: If installation fails with an error than includes a mention of "jpeg" or "tiff", it's likely your installation of Python's imaging library (Pillow) has failed due to missing dependencies. Please reference the Pillow install documentation for help with installation.


 

Common installation issues

Issue 1: If gem is not recognized as a command, then you may need to install it using these instructions.
Issue 2: If bundle is not recognized as a command, then you may need to install it using the terminal command gem install bundle.


 

Common installation issues

Issue 1: If npm is not recognized as a command, then you may need to install it using these instructions.


 

Common installation issues

Issue 1: You might require admin rights to install and use devtools, i.e. sudo or run as administrator.
Issue 2: If you see an error that looks like

ERROR: dependency ‘EBImage’ is not available for package ‘indicoio’
* removing ‘/usr/local/lib/R/3.2/site-library/indicoio’

Then you may have also gotten the following error when installing EBImage

ERROR: dependency ‘fftwtools’ is not available for package ‘EBImage’
* removing ‘/usr/local/lib/R/3.2/site-library/EBImage’

To fix, you'll need to install fftw tools on your system. For debian-based (ubuntu, etc.) run sudo apt-get install libfftw and for OS X run brew install fftw. Various systems may have different names but searching for [system name] install fftw should get you there.


 

Common installation issues

Issue 1: If pip is not recognized as a command, then you may need to install it using these instructions.
Issue 2: If you cannot resolve installation issues with your Python distribution, then you can also use Anaconda.
Issue 3: If installation fails with a TypeError: 'NoneType' object is not callable error, it's likely you're missing the python development headers. On debian based distros, apt-get install python-dev should resolve the issue.


 

Making your first call!

You should run the following commands in Python to test whether you have successfully installed indicoio. Don't forget, you will need your API key to make your first call. In the code below replace YOUR_API_KEY with your personal API key (the 32-digit alphanumeric sequence assigned to you when you registered with indico). You should get back a number between 0 and 1.

# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
# single output
0.9819219949985644

# batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
Array (
    [0] => 0.9819219949985644,
    [1] => 0.00015202198176385973
)
# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.sentiment("I love writing code!")

# batch example
indicoio.sentiment([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.sentiment("I love writing code!")

# batch example
Indico.sentiment([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.sentiment("I love writing code!")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
];
indico.sentiment(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.sentiment.predict(
    "I love writing code!"
);
Double result = single.getSentiment();
System.out.println(result);

// batch example
String[] example = {
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
};
BatchIndicoResult multiple = indico.sentiment.predict(example);
List<Double> results = multiple.getSentiment();
System.out.println(results);
library(indicoio)

# single example
sentiment(
    "I love writing code!",
    api_key = 'YOUR_API_KEY'
)

# batch example
sentiment(
    c(
        "I love writing code!",
        "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::sentiment(
    "I love writing code!"
);

# batch example
IndicoIo::sentiment([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/sentiment',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "I love writing code!",
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/sentiment/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "I love writing code!",
      "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
    ]
  })
).then(function(res) { console.log(res) });
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment' --data '{"data":"I love writing code!"}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment/batch' --data '{"data":["I love writing code!", "Alexander and the Terrible, Horrible, No Good, Very Bad Day"]}'

Configuration

The indico API supports configuration via several different formats:

  • Configuration Files
  • Creating a Properties File
  • Environment Variables
  • Programming Language-specific Syntax

Private cloud endpoint
Each of the following configuration methods includes code for specifying a Private Cloud address but this won't apply to you unless you've paid for infrastructure.

 

Configuration File

If you'd like to simply set up your API key once and forget about it, indico supports simple configuration via .indicorc files. This file can either be placed in your home directory or in your current working directory. All settings are optional.

Home Directory for Different Systems
Linux and OS X:
/home/<username>/.indicorc

Windows:
C:\Users\<username>\.indicorc

[auth]
api_key = YOUR_API_KEY

[private_cloud]
cloud = YOUR_PRIVATE_CLOUD

Creating a Properties File

This method allows you to store your API key in a configuration file, then reference that file upon object creation. This method allows you to keep your API key out of your code and lets you exercise a little bit more discretion in distributing or open-sourcing any code built on indico.

import io.indico.Indico;

String yourApiKey = 'YOUR_API_KEY'
String yourPrivateCloud = 'YOUR_SUBDOMAIN'
Indico indico = new Indico(yourApiKey, yourPrivateCloud);

String filePath = "my/file.properties"
indico.createPropertiesFile(filePath);

// The second indico object is now properly initialized
Indico indicoTwo = new Indico(new File(filePath));

Environment Variables

If you're more comfortable with bash-style configuration, simply setting the $INDICO_API_KEY or $INDICO_CLOUD environment variable is all that is needed to get up and running with the indico API.

This method involves setting environment variables, specifically $INDICO_API_KEY and $INDICO_CLOUD (for private cloud users only). The typical method of setting environment variables using the .bashrc don't apply to java given the typical environment set up. For details on setting environment variables in eclipse look at this StackOverflow question

# unix
export INDICO_API_KEY = YOUR_API_KEY
export INDICO_CLOUD = YOUR_SUBDOMAIN

# windows

setx INDICO_API_KEY YOUR_API_KEY
setx INDICO_CLOUD YOUR_SUBDOMAIN

Programming Language-specific syntax

Passing as a function argument
In addition to the methods above, our client libraries each support passing in settings as function arguments. See the code on the right for details.

Using a module variable
This method allows you to specify your API key a single time within a program or once per interpreter session by defining the module variable. This method eliminates the need to specify your API key or private cloud address more than one time and can help keep your code more readable.

import indicoio

# option 1: pass configuration as a function argument
print(indicoio.sentiment('indico is so easy to use!', api_key="YOUR_API_KEY", cloud="YOUR_SUBDOMAIN"))

# option 2: set module variable
indicoio.config.api_key = 'YOUR_API_KEY'
indicoio.config.cloud = 'YOUR_SUBDOMAIN'
print(indicoio.sentiment('indico is so easy to use!'))

# 0.9782025594088044
require 'indico'

# option 1: pass configuration as a function argument
config = {api_key: "YOUR_API_KEY", cloud: "YOUR_SUBDOMAIN"}
puts(Indico.sentiment("indico is so easy to use!", config))

# option 2: set module variable
Indico.api_key = "YOUR_API_KEY"
Indico.private_cloud = "YOUR_SUBDOMAIN"
puts(Indico.sentiment("indico is so easy to use!"))

# {"Sentiment"=>0.9782025594088044}
var indico = require('indico.io');

# option 1: pass configuration as a function argument
var settings = {"api_key": "YOUR_API_KEY"};
var results = indico.sentiment('indico is so easy to use!', settings)

# option 2: set module variable
indico.apiKey = "YOUR_API_KEY";
var results = indico.sentiment('indico is so easy to use!')

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

results.then(response).catch(logError);
// 0.9782025594088044
import io.indico.Indico;
import io.indico.api.IndicoResult;

# option 1: pass to instantiation
String yourApiKey = "YOUR_API_KEY"
String yourPrivateCloud = "YOUR_SUBDOMAIN"
Indico indico = new Indico(yourApiKey, yourPrivateCloud);

# option 2: loading from a properties file (see above for making the file)
String filePath = "my/file.properties"
Indico indico = new Indico(new File(filePath));

IndicoResult results = indico.sentiment.predict("indico is so easy to use!");
Double sentiment = results.getSentiment();

System.out.println(sentiment);
// 0.9782025594088044
library(indicoio)

# pass configuration as function arguments
print(sentiment("indico is so easy to use!", api_key='YOUR_API_KEY', cloud="YOUR_SUBDOMAIN"))

# 0.9782025594088044
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;

# option 1: pass configuration as a function argument
print_r(IndicoIo::sentiment(
    'indico is so easy to use!',
    $api_key="YOUR_API_KEY",
    $cloud="YOUR_SUBDOMAIN"));

# option 2: set module variable
IndicoIo::$config['api_key'] = "YOUR_API_KEY";
IndicoIo::$config['cloud'] = "YOUR_SUBDOMAIN";
print_r(IndicoIo::sentiment(
    'indico is so easy to use!'));

// Array ( [Sentiment] => 0.9782025594088044 )

?>

Batch Requests

Each indicoio function can be called with a batch of data for analyzing many examples with a single network request. This can improve the speed of using the indico APIs significantly. Simply pass in a list of inputs and receive a list of results in return. The optimal balance between the size of the batch requests and the amount of network requests varies case by case, but perfomance is usually optimal between 20-100 examples.

Not using the latest package?
If you're using an older version of our client libraries the syntax for batch calls is different. Namely, you'll need to call a separate batch function as shown to the right.

import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# Version >= 0.9.0
indicoio.sentiment(['indico is so easy to use!', 'Still really easy, yiss'])

# Version < 0.9.0
indicoio.batch_sentiment(['indico is so easy to use!', 'Still really easy, yiss'])
# [0.9782025594088044, 0.9895808115135271]
require 'indico'
config = {api_key: "YOUR_API_KEY"}

# Version > v0.4.0
Indico.sentiment(["indico is so easy to use!", "Still really easy, yiss"], config)
# [0.9782025594088044, 0.9895808115135271]

# Version <= v0.4.0
Indico.batch_sentiment(["indico is so easy to use!", "Still really easy, yiss"], config)
# [0.9782025594088044, 0.9895808115135271]
var indico = require('indico.io');

var settings = {"api_key": "YOUR_API_KEY"};
var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

indico.sentiment(['indico is so easy to use!', 'Still really easy, yiss'], settings)
  .then(response)
  .catch(logError);

// [0.9782025594088044, 0.9895808115135271]
import io.indico.Indico;
import io.indico.api.IndicoResult;

Indico indico = new Indico("");
List<String> examples = new ArrayList<String>();
examples.add("indico is so easy to use!");
examples.add("Still really easy, yiss");

// Version >= 3.1.0
List<Double> results = test.sentiment.predict(examples).getSentiment();

// Version < 3.1.0
IndicoResult results = indico.batchSentiment.predict(examples).getSentiment();
Double sentiment = results.getSentiment();

// [0.9782025594088044, 0.9895808115135271]
library(indicoio)

examples <- list("indico is so easy to use!", "Still really easy, yiss")

# our R package still uses 'batch' at the moment
batch_sentiment(examples, api_key='YOUR_API_KEY')
# [0.9782025594088044, 0.9895808115135271]
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;

IndicoIo::sentiment(
    ['indico is so easy to use!', 'Still really easy, yiss'],
    $api_key="YOUR_API_KEY"
);

// Array ( 
//	  [0] => 0.9782025594088044,
//	  [1] => 0.9895808115135271
// )

?>
$.post(
  'https://apiv2.indico.io/sentiment/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "indico is so easy to use!",
      "Still really easy, yiss"
    ]
  })
).then(function(res) { console.log(res) });

// {"results": [0.9819219949985644, 0.00015202198176385973]} 
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment/batch' --data '{"data":["indico is so easy to use!", "Still really easy, yiss"]}'

// [0.9819219949985644, 0.00015202198176385973] 

Call Usage

For the most part, every article of text or image you send to indico will count as one call towards your monthly call volume. Take note than an "article of text" could be a word, sentence, or entire document. So, if you sent the API a sentence (as a single example) for analysis, then sent the API an entire document (as a single example), you would have made two API calls.

Here's some more clarification on how call usage works, as well as a few exceptions:


Batch Requests
When you send a batch query to indico, each article of text or image in the query will count as a call. For example, if you query sentiment with a list of 100 text examples, this will be recorded as 100 calls.

Analyze Text, Analyze Image, and Intersections
Requests to APIs that query multiple other APIs - Analyze Text, Intersections, and Analyze Image - count as a call to each API being queried. For example, a non-batch query to Analyze Text where APIs=['sentiment', 'emotion'] will be recorded as two calls.

Custom Collections
Custom Collections follows non standard rules for recording calls towards your monthly call volume. If you are using a Custom Collection, please check the documentation of the methods you are using to learn how calls are calculated for them.

indico Toolkit
All calls to the indico Toolkit follow the same rules as any other queries to our APIs and will count towards your monthly call limit.

 

Text Analysis

Use our models to analyze text in a variety of contexts!


:String or List: required: The API processes strings as a single piece of text and return a single result. You can also send a list of phrases to be processed all in one call(more efficient).
:Map: optional: Some of the functions have optional parameters that are passed to the function with a map, the keys being the names of the options shown below.

:Array: optional: Some of the functions have optional parameters that are passed to the function with an array, the keys being the names of the options shown below.

:String: required/optional: Your API key for authenticating your usage. If you haven't set your API key in another way, this is required.
:String: optional: If specified, calls will be made to the private cloud address provided. If you haven't purchased private infrastructure from us then this input is irrelevant.
:List: required: For analyze_text, analyze_image and intersections you must provide a list of APIs you'd like to use. intersectiosn requires exactly 2 at a time.
:Integer: optional: For text tags and keywords we provide the option to get results in order of score up to the specified Nth highest score.
:Float: optional: Set a threshold that scores must be greater than in order to be returned in the call's response. Currently for text tags and keywords.
:Boolean: optional: For text tags this argument specifies that you'd like each individual probability to be normalized between 0 and 1 rather than the sum of all tag scores adding to 1.
:Boolean: optional: The opposite of {{ independent }}. The keywords API returns independent scores by default and this argument allows you to normalize them such that all scores add to 1.

// These are standard imports that
// are generally handled by your IDE,
// but just to be explicit:
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

Input Text Format

Text can be sent to the indicoio text analysis functions as raw text strings or URLs. If the indicoio API detects the text input is a URL, the text function will be run on the webpage text of the URL. Both single and batch requests of over 5 MB will be rejected. Sample code for passing in raw text or a URL is provided below.

Passing in Raw Text

import indicoio

indicoio.sentiment('text to analyze')

Specifying Text URL

import indicoio

indicoio.sentiment('https://TEXT_URL')

Passing in Raw Text

require 'indico'

Indico.sentiment("text to analyze")

Specifying Text URL

require 'indico'

url = "https://TEXT_URL"
Indico.sentiment(url)

Passing in Raw Text

var indico = require('indico.io')
indico.apiKey = "YOUR_API_KEY";

indico.sentiment("text to analyze")
  .then(function(res) {
    console.log(res);
  }).catch(function(err) {
    console.warn(err);
  });

Specifying Text URL

var indico = require('indico.io')
indico.apiKey = "YOUR_API_KEY";

indico.sentiment("https://TEXT_URL")
  .then(function(res) {
    console.log(res);
  }).catch(function(err) {
    console.warn(err);
  });

Sending text through the API

import java.io.File;
import java.util.List;
import java.util.Map;
import io.indico.Indico;
import io.indico.api.text.Sentiment;

Indico indico = new Indico("YOUR_API_KEY");

// As a String
IndicoResult responseOne = indico.sentiment.predict("text to analyze");
Double result = responseOne.getSentiment();
System.out.println(result);

// From a URL
IndicoResult responseTwo = indico.sentiment.predict("https://IMAGE_URL");
result = responseTwo.getSentiment();
System.out.println(result);

Passing in Raw Text

library(indicoio)

sentiment("text to analyze")

Specifying Text URL

library(indicoio)

sentiment("https://TEXT_URL")

Passing in Raw Text

<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = "YOUR_API_KEY";
IndicoIo::sentiment("text to analyze");
?>

Specifying Text URL

<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = "YOUR_API_KEY";
IndicoIo::sentiment("https://TEXT_URL");
?>

Passing in Raw Text

$.post('https://apiv2.indico.io/sentiment',
  JSON.stringify({
    api_key: "YOUR_API_KEY",
    data: "text to analyze"
  })
).then(function(res) { console.log(res) });

Specifying Text URL

$.post('https://apiv2.indico.io/sentiment',
  JSON.stringify({
    api_key: "YOUR_API_KEY",
    data: "https://TEXT_URL"
  })
).then(function(res) { console.log(res) });

Passing in Raw Text

curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment' -d '{"data": "text to analyze"}'

Specifying Text URL

curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment' -d '{"data": "https://TEXT_URL"}'

Sentiment Analysis


Quickly and efficiently determine if text is positive or negative.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- String (defaults to 'english') - optional - The language of the input text. If set to 'detect', Sentiment will first attempt to determine the language of the input text and calculate sentiment in that language. The language options are 'arabic', 'chinese', 'dutch', 'english', 'french', 'german', 'italian', 'japanese', 'korean', 'portuguese', 'russian', and 'spanish'.

Output

This function will return a number between 0 and 1. This number is a probability representing the likelihood that the analyzed text is positive or negative. Values greater than 0.5 indicate positive sentiment, while values less than 0.5 indicate negative sentiment.

# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
# single output
0.9819219949985644

# batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
Array (
    [0] => 0.9819219949985644,
    [1] => 0.00015202198176385973
)
# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.sentiment("I love writing code!")

# batch example
indicoio.sentiment([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.sentiment("I love writing code!")

# batch example
Indico.sentiment([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.sentiment("I love writing code!")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
];
indico.sentiment(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.sentiment.predict(
    "I love writing code!"
);
Double result = single.getSentiment();
System.out.println(result);

// batch example
String[] example = {
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
};
BatchIndicoResult multiple = indico.sentiment.predict(example);
List<Double> results = multiple.getSentiment();
System.out.println(results);
library(indicoio)

# single example
sentiment(
    "I love writing code!",
    api_key = 'YOUR_API_KEY'
)

# batch example
sentiment(
    c(
        "I love writing code!",
        "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::sentiment(
    "I love writing code!"
);

# batch example
IndicoIo::sentiment([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/sentiment',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "I love writing code!",
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/sentiment/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "I love writing code!",
      "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
    ]
  })
).then(function(res) { console.log(res) });
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment' --data '{"data":"I love writing code!"}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment/batch' --data '{"data":["I love writing code!", "Alexander and the Terrible, Horrible, No Good, Very Bad Day"]}'

High Quality Sentiment Analysis


Highly accurate sentiment analysis but less performant than the standard Sentiment API. Note: Sentiment HQ only supports English analysis. For multilingual support, please use the standard Sentiment API.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

This function will return a number between 0 and 1. This number is a probability representing the likelihood that the analyzed text is positive or negative. Values greater than 0.5 indicate positive sentiment, while values less than 0.5 indicate negative sentiment.

# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
# single output
0.9819219949985644

# batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
   0.9819219949985644,
   0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
// single output
0.9819219949985644

// batch output
Array (
    [0] => 0.9819219949985644,
    [1] => 0.00015202198176385973
)
# single output
0.9819219949985644

# batch output
[
    0.9819219949985644,
    0.00015202198176385973
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.sentiment_hq("I love writing code!")

# batch example
indicoio.sentiment_hq([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.sentiment_hq("I love writing code!")

# batch example
Indico.sentiment_hq([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.sentimentHQ("I love writing code!")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
];
indico.sentimentHQ(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.sentimentHQ.predict(
    "I love writing code!"
);
Double result = single.getSentimentHQ();
System.out.println(result);

// batch example
String[] example = {
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
};
BatchIndicoResult multiple = indico.sentimentHQ.predict(example);
List<Double> results = multiple.getSentimentHQ();
System.out.println(results);
library(indicoio)

# single example
sentiment_hq(
    "I love writing code!",
    api_key = 'YOUR_API_KEY'
)

# batch example
sentiment_hq(
    c(
        "I love writing code!",
        "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::sentiment_hq(
    "I love writing code!"
);

# batch example
IndicoIo::sentiment_hq([
    "I love writing code!",
    "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/sentimenthq',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "I love writing code!"
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/sentimenthq/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "I love writing code!",
      "Alexander and the Terrible, Horrible, No Good, Very Bad Day"
    ]
  })
).then(function(res) { console.log(res) });
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentimenthq' --data '{"data":"I love writing code!"}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentimenthq/batch' --data '{"data":["I love writing code!", "Alexander and the Terrible, Horrible, No Good, Very Bad Day"]}'

Text Tags


Determine the topics in the phrase or document `str`.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Integer - optional (defaults to 1) - specify model version
- Integer - optionals - only return this many of the most likely topics
- Float (defaults to 0.) - optional - only return topics with likelihood greater than this number
- Boolean (defaults to False) - optional - when False, the probabilities of all topics sum to 1, when True, topic probabilities are independent and are not constrained to sum to 1.

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

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
    }
]
# 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
    }
]
// 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
    }
]
// 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
    }
]
// 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
    }
]
# single output
[[1]]
[[1]]$anime
[1] 0.003982535730280216
[[1]]$anthropology
[1] 0.020311181569223534
[[1]]$archery
[1] 0.4893124752591462
... 105 topics omitted ...
[[1]]$wrestling
[1] 0.0009661379304299885
[[1]]$writing
[1] 0.00532591437084736
[[1]]$yoga
[1] 0.001874647791589776

# batch output
[[1]]
[[1]]$anime
[1] 0.003982535730280216
[[1]]$anthropology
[1] 0.020311181569223534
[[1]]$archery
[1] 0.4893124752591462
... 105 topics omitted ...
[[1]]$wrestling
[1] 0.0009661379304299885
[[1]]$writing
[1] 0.00532591437084736
[[1]]$yoga
[1] 0.001874647791589776

[[2]]
[[2]]$anime
[1] 0.0020400125677411812
[[2]]$anthropology
[1] 0.010790799662278016
[[2]]$archery
[1] 0.002072348777350773
... 105 topics omitted ...
[[2]]$wrestling
[1] 0.0012626451944395167
[[2]]$writing
[1] 0.004772236821288096
[[2]]$yoga
[1] 0.22969626130844248
// single output
Array (
  [anime] => 0.003982535730280216,
  [anthropology] => 0.020311181569223534,
  [archery] => 0.4893124752591462,
  ... 105 topics omitted ...,
  [wrestling] => 0.0009661379304299885,
  [writing] => 0.00532591437084736,
  [yoga] => 0.001874647791589776
)

// batch output
Array (
    [0] => Array (
        [anime] => 0.003982535730280216,
        [anthropology] => 0.020311181569223534,
        [archery] => 0.4893124752591462,
        ... 105 topics omitted ...,
        [wrestling] => 0.0009661379304299885,
        [writing] => 0.00532591437084736,
        [yoga] => 0.001874647791589776
    ),
    [1] => Array (
        [anime] => 0.0020400125677411812,
        [anthropology] => 0.010790799662278016,
        [archery] => 0.002072348777350773,
        ... 105 topics omitted ...,
        [wrestling] => 0.0012626451944395167,
        [writing] => 0.004772236821288096,
        [yoga] => 0.22969626130844248
    )
)
# 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

import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.text_tags("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.")

# batch example
indicoio.text_tags([
    "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."
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.text_tags("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.")

# batch example
Indico.text_tags([
    "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."
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.textTags("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.")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "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."
];

indico.textTags(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.text.TextTag;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;
import java.util.HashMap;

Map params = new HashMap();
params.put("threshold", 0.1)

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.textTags.predict(
    "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.", params
);
Map<TextTag, Double> result = single.getTextTags();
System.out.println(result);

// batch example
String[] example = {
    "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."
};
BatchIndicoResult multiple = indico.textTags.predict(example, params);
List<Map<TextTag, Double>> results = multiple.getTextTags();
System.out.println(results);
library(indicoio)

# single example
text_tags(
    "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.",
    api_key = 'YOUR_API_KEY'
)

# batch example
text_tags(
    c(
        "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."
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::text_tags(
    "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."
);

# batch example
IndicoIo::text_tags([
    "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."
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/texttags',
  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(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/texttags/batch',
  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(function(res) { console.log(res) });

# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/texttags' --data '{"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}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/texttags/batch' --data '{"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}'

Language Detection


Automatically determine the language of a phrase or document.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Integer - optional (defaults to 3) - only return this many of the most likely languages
- Float - optional (defaults to .0) - only return languages with likelihood greater than this number
- Boolean (defaults to False) - optional - when False, the probabilities of all languages sum to 1, when True, language probabilities are independent and are not constrained to sum to 1.

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
    }
]
# 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
    }
]
// 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
    }
]
// 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
    }
]
// 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
    }
]
# single output
[[1]]
[[1]]$swedish
[1] 0.00004324968926091062
[[1]]$lithuanian
[1] 0.007702528578033991
[[1]]$vietnamese
[1] 0.0002575132225946431
... 33 languages omitted ...
[[1]]$english
[1] 0.2071775132225946431
[[1]]$chinese
[1] 0.008160047807935744
[[1]]$arabic
[1] 0.00015069427192724994

# batch output
[[1]]
[[1]]$swedish
[1] 0.00004324968926091062
[[1]]$lithuanian
[1] 0.007702528578033991
[[1]]$vietnamese
[1] 0.0002575132225946431
... 33 languages omitted ...
[[1]]$english
[1] 0.2071775132225946431
[[1]]$chinese
[1] 0.008160047807935744
[[1]]$arabic
[1] 0.00015069427192724994

[[2]]
[[2]]$swedish
[1] 0.0020400125677411812
[[2]]$lithuanian
[1] 0.010790799662278016
[[2]]$vietnamese
[1] 0.002072348777350773
... 33 languages omitted ...
[[2]]$english
[1] 0.0012626451944395167
[[2]]$chinese
[1] 0.004772236821288096
[[2]]$arabic
[1] 0.22969626130844248
// single output
Array (
  [swedish] => 0.00004324968926091062,
  [lithuanian] => 0.007702528578033991,
  [vietnamese] => 0.0002575132225946431,
  ... 33 languages omitted ...,
  [english] => 0.2071775132225946431,
  [chinese] => 0.008160047807935744,
  [arabic] => 0.00015069427192724994
)

// batch output
Array (
    [0] => Array (
        [swedish] => 0.00004324968926091062,
        [lithuanian] => 0.007702528578033991,
        [vietnamese] => 0.0002575132225946431,
        ... 33 languages omitted ...,
        [english] => 0.2071775132225946431,
        [chinese] => 0.008160047807935744,
        [arabic] => 0.00015069427192724994
    ),
    [1] => Array (
        [swedish] => 0.0020400125677411812,
        [lithuanian] => 0.010790799662278016,
        [vietnamese] => 0.002072348777350773,
        ... 33 languages omitted ...,
        [english] => 0.0012626451944395167,
        [chinese] => 0.004772236821288096,
        [arabic] => 0.22969626130844248
    )
)
# 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
    }
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.language("How are you?")

# batch example
indicoio.language([
    "How are you?",
    "¿Cómo estás?"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.language("How are you?")

# batch example
Indico.language([
    "How are you?",
    "¿Cómo estás?"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.language("How are you?")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "How are you?",
    "¿Cómo estás?"
];
indico.language(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.text.Language;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.language.predict(
    "How are you?"
);
Map<Language, Double> = single.getLanguage();
System.out.println(result);

// batch example
String[] example = {
    "How are you?",
    "¿Cómo estás?"
};
BatchIndicoResult multiple = indico.language.predict(example);
List<Map<Language, Double>> results = multiple.getLanguage();
System.out.println(results);
library(indicoio)

# single example
language(
    "How are you?",
    api_key = 'YOUR_API_KEY'
)

# batch example
language(
    c(
        "How are you?",
        "¿Cómo estás?"
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::language(
    "How are you?"
);

# batch example
IndicoIo::language([
    "How are you?",
    "¿Cómo estás?"
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/language',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "How are you?"
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/language/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "How are you?",
      "¿Cómo estás?"
    ]
  })
).then(function(res) { console.log(res) });
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/language' --data '{"data":"How are you?"}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/language/batch' --data '{"data":["How are you?", "¿Cómo estás?"]}'

Political Analysis


Gauge the political leanings of a phrase or document.

Private cloud endpoint

POST https://[cloud].indico.domains/political/[batch]/?version=[version]

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Integer - optional (defaults to 1) - specify model version, versions 1 and 2 are available
- Integer - optional (defaults to 3) - only return this many of the most likely topics
- Float - optional (defaults to .0) - only return topics with likelihood greater than this number - Boolean (defaults to False) - optional - when False, the probabilities of all languages sum to 1, when True, language probabilities are independent and are not constrained to sum to 1.
For an example of how to pass keyword arguments to the indico API in a post request, see the right hand sidebar.

Output

This function will return a dictionary with 4 key-value pairs. These key-value pairs represent the likelihood that each of 4 political leanings are expressed in the analyzed text. The keys in the dictionary are strings containing the political leanings and the values are the probabilities that the analyzed text is expressing each political view.

Values less than 0.05 indicate that it is very unlikely the text is expressing that particular political leaning.

# single output
{
    'libertarian': 0.27192999211817354,
    'green': 0.06525078204908323,
    'liberal': 0.11033990553871972,
    'conservative': 0.5524793202940235
}

# batch output
[
    {
        'libertarian': 0.27192999211817354,
        'green': 0.06525078204908323,
        'liberal': 0.11033990553871972,
        'conservative': 0.5524793202940235
    },
    {
        'libertarian': 0.02334343866477883,
        'green': 0.03302544570586526,
        'liberal': 0.9254000702504355,
        'conservative': 0.01823104537892042
    }
]
# single output
{
    'libertarian': 0.27192999211817354,
    'green': 0.06525078204908323,
    'liberal': 0.11033990553871972,
    'conservative': 0.5524793202940235
}

# batch output
[
    {
        'libertarian': 0.27192999211817354,
        'green': 0.06525078204908323,
        'liberal': 0.11033990553871972,
        'conservative': 0.5524793202940235
    },
    {
        'libertarian': 0.02334343866477883,
        'green': 0.03302544570586526,
        'liberal': 0.9254000702504355,
        'conservative': 0.01823104537892042
    }
]
// single output
{
    'libertarian': 0.27192999211817354,
    'green': 0.06525078204908323,
    'liberal': 0.11033990553871972,
    'conservative': 0.5524793202940235
}

// batch output
[
    {
        'libertarian': 0.27192999211817354,
        'green': 0.06525078204908323,
        'liberal': 0.11033990553871972,
        'conservative': 0.5524793202940235
    },
    {
        'libertarian': 0.02334343866477883,
        'green': 0.03302544570586526,
        'liberal': 0.9254000702504355,
        'conservative': 0.01823104537892042
    }
]
// single output
{
    'libertarian': 0.27192999211817354,
    'green': 0.06525078204908323,
    'liberal': 0.11033990553871972,
    'conservative': 0.5524793202940235
}

// batch output
[
    {
        'libertarian': 0.27192999211817354,
        'green': 0.06525078204908323,
        'liberal': 0.11033990553871972,
        'conservative': 0.5524793202940235
    },
    {
        'libertarian': 0.02334343866477883,
        'green': 0.03302544570586526,
        'liberal': 0.9254000702504355,
        'conservative': 0.01823104537892042
    }
]
// single output
{
    'libertarian': 0.27192999211817354,
    'green': 0.06525078204908323,
    'liberal': 0.11033990553871972,
    'conservative': 0.5524793202940235
}

// batch output
[
    {
        'libertarian': 0.27192999211817354,
        'green': 0.06525078204908323,
        'liberal': 0.11033990553871972,
        'conservative': 0.5524793202940235
    },
    {
        'libertarian': 0.02334343866477883,
        'green': 0.03302544570586526,
        'liberal': 0.9254000702504355,
        'conservative': 0.01823104537892042
    }
]
# single output
[[1]]
[[1]]$libertarian
[1] 0.27192999211817354
[[1]]$green
[1] 0.06525078204908323
[[1]]$liberal
[1] 0.11033990553871972
[[1]]$conservative
[1] 0.5524793202940235

# batch output
[[1]]
[[1]]$libertarian
[1] 0.27192999211817354
[[1]]$green
[1] 0.06525078204908323
[[1]]$liberal
[1] 0.11033990553871972
[[1]]$conservative
[1] 0.5524793202940235

[[2]]
[[2]]$libertarian
[1] 0.02334343866477883
[[2]]$green
[1] 0.03302544570586526
[[2]]$liberal
[1] 0.9254000702504355
[[2]]$conservative
[1] 0.01823104537892042
// single output
Array (
  [libertarian] => 0.27192999211817354,
  [green] => 0.06525078204908323,
  [liberal] => 0.11033990553871972,
  [conservative] => 0.5524793202940235
)

// batch output
Array (
    [0] => Array (
        [libertarian] => 0.27192999211817354,
        [green] => 0.06525078204908323,
        [liberal] => 0.11033990553871972,
        [conservative] => 0.5524793202940235
    ),
    [1] => Array (
        [libertarian] => 0.02334343866477883,
        [green] => 0.03302544570586526,
        [liberal] => 0.9254000702504355,
        [conservative] => 0.01823104537892042
    )
)
# single output
{
    'libertarian': 0.27192999211817354,
    'green': 0.06525078204908323,
    'liberal': 0.11033990553871972,
    'conservative': 0.5524793202940235
}

# batch output
[
    {
        'libertarian': 0.27192999211817354,
        'green': 0.06525078204908323,
        'liberal': 0.11033990553871972,
        'conservative': 0.5524793202940235
    },
    {
        'libertarian': 0.02334343866477883,
        'green': 0.03302544570586526,
        'liberal': 0.9254000702504355,
        'conservative': 0.01823104537892042
    }
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.political("I have a constitutional right to bear arms!")

# batch example
indicoio.political([
    "I have a constitutional right to bear arms!",
    "I wish more candidates cared about the environment."
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.political("I have a constitutional right to bear arms!")

# batch example
Indico.political([
    "I have a constitutional right to bear arms!",
    "I wish more candidates cared about the environment."
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.political("I have a constitutional right to bear arms!")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "I have a constitutional right to bear arms!",
    "I wish more candidates cared about the environment."
];
indico.political(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.text.PoliticalClass;
import io.indico.api.BatchIndicoResult;
import java.util.HashMap;

Map params = new HashMap();
params.put("threshold", 0.25)

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.political.predict(
    "I have a constitutional right to bear arms!", params
);
Map<PoliticalClass, Double> result = single.getPolitical();
System.out.println(result);

// batch example
String[] example = {
    "I have a constitutional right to bear arms!",
    "I wish more candidates cared about the environment."
};
BatchIndicoResult multiple = indico.political.predict(example, params);
List<Map<PoliticalClass, Double>> results = multiple.getPolitical();
System.out.println(results);
library(indicoio)

# single example
political(
    "I have a constitutional right to bear arms!",
    api_key = 'YOUR_API_KEY'
)

# batch example
political(
    c(
        "I have a constitutional right to bear arms!",
        "I wish more candidates cared about the environment."
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::political(
    "I have a constitutional right to bear arms!"
);

# batch example
IndicoIo::political([
    "I have a constitutional right to bear arms!",
    "I wish more candidates cared about the environment."
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/political',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "I have a constitutional right to bear arms!",
    'threshold': 0.25
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/political/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "I have a constitutional right to bear arms!",
      "I wish more candidates cared about the environment."
    ],
    'threshold': 0.25
  })
).then(function(res) { console.log(res) });

# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/political' --data '{"data":"I have a constitutional right to bear arms!", "threshold": 0.25}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/political/batch' --data '{"data":["I have a constitutional right to bear arms!", "I wish more candidates cared about the environment."], "threshold": 0.25}'

Keywords


Identify the important words within a document.

Private cloud endpoint

POST https://[cloud].indico.domains/keywords/[batch]/?version=[version]

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Integer - optional (defaults to 1) - specify model version
- Integer - optional (defaults to 3) - only return this many of the most likely topics
- Float - optional (defaults to .0) - only return topics with likelihood greater than this number
- Boolean (defaults to False) - optional - when True, it will scale the scores for each keyword such that the lowest is 0 and the highest is 1, which makes setting a threshold easier
For an example of how to pass keyword arguments to the indico API in a post request, see the righthand sidebar.

Output

This function will return a dictionary with top_n key-value pairs. These key-value pairs represent the likelihood that each of the extracted keywords are relevant to the analyzed text. The keys in the dictionary are strings containing the extracted keywords, and the values are the likelihoods that these keywords are relevant to the analyzed text.

NOTE: We've deployed a new, more accurate version of keywords that can be accessed by setting the version option to 2.

# single output
{
    'state': 0.38810469246709006,
    'sunshine': 0.61189530753291
}

# batch output
[
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }, 
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }
]
# single output
{
    'state': 0.38810469246709006,
    'sunshine': 0.61189530753291
}

# batch output
[
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }, 
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }
]
// single output
{
    'state': 0.38810469246709006,
    'sunshine': 0.61189530753291
}

// batch output
[
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }, 
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }
]
// single output
{
    'state': 0.38810469246709006,
    'sunshine': 0.61189530753291
}

// batch output
[
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }, 
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }
]
// single output
{
    'state': 0.38810469246709006,
    'sunshine': 0.61189530753291
}

// batch output
[
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }, 
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }
]
# single output
[[1]]
[[1]]$state
[1] 0.38810469246709006
[[1]]$sunshine
[1] 0.61189530753291

# batch output
[[1]]
[[1]]$state
[1] 0.38810469246709006
[[1]]$sunshine
[1] 0.61189530753291

[[2]]
[[2]]$state
[1] 0.38810469246709006
[[2]]$sunshine
[1] 0.61189530753291
// single output
Array (
  [state] => 0.38810469246709006,
  [sunshine] => 0.61189530753291
)

// batch output
Array (
    [0] => Array (
        [state] => 0.38810469246709006,
        [sunshine] => 0.61189530753291
    ), 
    [1] => Array (
        [state] => 0.38810469246709006,
        [sunshine] => 0.61189530753291
    )
)
# single output
{
    'state': 0.38810469246709006,
    'sunshine': 0.61189530753291
}

# batch output
[
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }, 
    {
        'state': 0.38810469246709006,
        'sunshine': 0.61189530753291
    }
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.keywords("Some call it the sunshine state", version=2)

# batch example
indicoio.keywords([
    "Some call it the sunshine state",
    "Some call it the sunshine state"
], version=2)
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.keywords("Some call it the sunshine state", {version: 2})

# batch example
Indico.keywords([
    "Some call it the sunshine state",
    "Some call it the sunshine state"
], {version: 2})
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.keywords("Some call it the sunshine state", {version: 2})
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "Some call it the sunshine state",
    "Some call it the sunshine state"
];
indico.keywords(batchInput, {version: 2})
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

Map<String, Object> params = new HashMap<String, Object>() {­{
    put("version", 2);
}­};

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.keywords.predict(
    "Some call it the sunshine state",
    params
);
Map<String, Double> result = single.getKeywords();
System.out.println(result);

// batch example
String[] example = {
    "Some call it the sunshine state",
    "Some call it the sunshine state"
};
BatchIndicoResult multiple = indico.keywords.predict(example, params);
List<Map<String, Double>> results = multiple.getKeywords();
System.out.println(results);
library(indicoio)

# single example
keywords(
    "Some call it the sunshine state",
    api_key = 'YOUR_API_KEY',
    version = 2
)

# batch example
keywords(
    c(
        "Some call it the sunshine state",
        "Some call it the sunshine state"
    ),
    api_key = 'YOUR_API_KEY',
    version = 2
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::keywords(
    "Some call it the sunshine state",
    array("version" => 2)
);

# batch example
IndicoIo::keywords([
    "Some call it the sunshine state",
    "Some call it the sunshine state"
], array("version" => 2));

?>
// single example
$.post(
  'https://apiv2.indico.io/keywords?version=2',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "Some call it the sunshine state",
    'threshold': 0.1
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/keywords/batch?version=2',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "Some call it the sunshine state",
      "Some call it the sunshine state"
    ],
    'threshold': 0.1
  })
).then(function(res) { console.log(res) });
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/keywords?version=2' --data '{"data":"Some call it the sunshine state", "threshold": 0.1}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/keywords/batch?version=2' --data '{"data":["Some call it the sunshine state", "Some call it the sunshine state"], "threshold": 0.1}'

People


Identify references to specific persons found in a document.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Float (defaults to 0.01) - optional - only return named entities 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 right hand sidebar.

Output

This function will return a list of dictionaries of three key-value pairs. Each dictionary represents a substring from the input document that the model has predicted is a person with confidence greater than your threshold. Eash dictionary has three keys: text, confidence, and position. The text key maps to a substring from the document that is predicted to be a person. The confidence key maps to a float between 0 and 1, representing how confident the model is that the text is a person. The position key maps to a two element list with the start character position and end character position of text in the input document.

# single output
[
    {
        'text': 'Mike Brown',
        'confidence':  0.913224,
        'position':  [26, 36]
    }
]

# batch output
[
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ],
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ]
]
# single output
[
    {
        'text': 'Mike Brown',
        'confidence':  0.913224,
        'position':  [26, 36]
    }
]

# batch output
[
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ],
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ]
]
// single output
[
    {
        'text': 'Mike Brown',
        'confidence':  0.913224,
        'position':  [26, 36]
    }
]

// batch output
[
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ],
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ]
]
// single output
[
    {
        'text': 'Mike Brown',
        'confidence':  0.913224,
        'position':  [26, 36]
    }
]

// batch output
[
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ],
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ]
]
// single output
[
    {
        'text': 'Mike Brown',
        'confidence':  0.913224,
        'position':  [26, 36]
    }
]

// batch output
[
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ],
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ]
]
# single output
[[1]]
[[1]]$text
[1] Mike Brown
[[1]]$confidence
[1] 0.913224
[[1]]$position
[1] [26, 36]

# batch output
[[1]]
[[1]]$text
[1] Mike Brown
[[1]]$confidence
[1] 0.913224
[[1]]$position
[1] [26, 36]

[[2]]
[[2]]$text
[1] Mike Brown
[[2]]$confidence
[1] 0.913224
[[2]]$position
[1] [26, 36]
// single output
Array (
        [0] => Array (
            [text] => 'Mike Brown',
            [confidence] =>  0.913224,
            [position] => Array (
                    [0] => 26,
                    [1] => 36,
                )
        )
)

// batch output
Array (
    [0] => Array (
            [0] => Array (
                [text] => 'Mike Brown',
                [confidence] =>  0.913224,
                [position] => Array (
                        [0] => 26,
                        [1] => 36,
                    )
            )
    ),
    [1] => Array (
            [0] => Array (
                [text] => 'Mike Brown',
                [confidence] =>  0.913224,
                [position] => Array (
                        [0] => 26,
                        [1] => 36,
                    )
            )
    )
)
# single output
[
    {
        'text': 'Mike Brown',
        'confidence':  0.913224,
        'position':  [26, 36]
    }
]

# batch output
[
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ],
    [
        {
            'text': 'Mike Brown',
            'confidence':  0.913224,
            'position':  [26, 36]
        }
    ]
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.people("London Underground's boss Mike Brown warned that the strike ...")

# batch example
indicoio.people([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.people("London Underground's boss Mike Brown warned that the strike ...")

# batch example
Indico.people([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.people("London Underground's boss Mike Brown warned that the strike ...")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
];
indico.people(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;
import java.util.HashMap;

Map params = new HashMap();
params.put("threshold", 0.1)

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.people.predict(
    "London Underground's boss Mike Brown warned that the strike ...", params
);
List<Map<String, Object>> result = single.getPeople();
System.out.println(result);

// batch example
String[] example = {
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
};
BatchIndicoResult multiple = indico.people.predict(example, params);
List<List<Map<String, Object>>> results = multiple.getPeople();
System.out.println(results);
library(indicoio)

# single example
people(
    "London Underground's boss Mike Brown warned that the strike ...",
    api_key = 'YOUR_API_KEY'
)

# batch example
people(
    c(
        "London Underground's boss Mike Brown warned that the strike ...",
        "London Underground's boss Mike Brown warned that the strike ..."
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::people(
    "London Underground's boss Mike Brown warned that the strike ..."
);

# batch example
IndicoIo::people([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/people',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "London Underground's boss Mike Brown warned that the strike ...",
    'threshold': 0.01
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/people/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "London Underground's boss Mike Brown warned that the strike ...",
      "London Underground's boss Mike Brown warned that the strike ..."
    ],
    'threshold': 0.01
  })
).then(function(res) { console.log(res) });

# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/people' --data '{"data":"London Underground\u0027s boss Mike Brown warned that the strike ...", "threshold": 0.01}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/people/batch' --data '{"data":["London Underground\u0027s boss Mike Brown warned that the strike ...", "London Underground\u0027s boss Mike Brown warned that the strike ..."], "threshold": 0.01}'

Places


Identify references to specific places found in a document.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Float (defaults to 0.01) - optional - only return named entities 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 right hand sidebar.

Output

This function will return a list of dictionaries of three key-value pairs. Each dictionary represents a substring from the input document that the model has predicted is a place, with confidence greater than your threshold. Eash dictionary has three keys: text, confidence, and position. The text key maps to a substring from the document that is predicted to be a place. The confidence key maps to a float between 0 and 1, representing how confident the model is that the text is a place. The position key maps to a two element list with the start character position and end character position of text in the input document.

# single output
[
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]

# batch output
[
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
],
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]
]
# single output
[
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]

# batch output
[
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
],
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]
]
// single output
[
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]

// batch output
[
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
],
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]
]
// single output
[
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]

// batch output
[
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
],
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]
]
// single output
[
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]

// batch output
[
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
],
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]
]
# single output
[[1]]
[[1]]$text
[1] London
[[1]]$confidence
[1] 0.913224
[[1]]$position
[1] [0, 6]

# batch output
[[1]]
[[1]]$text
[1] London
[[1]]$confidence
[1] 0.913224
[[1]]$position
[1] [0, 6]

[[2]]
[[2]]$text
[1] London
[[2]]$confidence
[1] 0.913224
[[2]]$position
[1] [0, 6]
// single output
Array (
        [0] => Array (
            [text] => 'London',
            [confidence] =>  0.913224,
            [position] => Array (
                    [0] => 0,
                    [1] => 6,
                )
        )
)

// batch output
Array (
    [0] => Array (
        [0] => Array (
            [text] => 'London',
            [confidence] =>  0.913224,
            [position] => Array (
                    [0] => 0,
                    [1] => 6,
                )
        )
),
    [1] => Array (
        [0] => Array (
            [text] => 'London',
            [confidence] =>  0.913224,
            [position] => Array (
                    [0] => 0,
                    [1] => 6,
                )
        )
)
)
# single output
[
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]

# batch output
[
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
],
    [
    {
        'text': 'London',
        'confidence':  0.913224,
        'position':  [0, 6]
    }
]
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.places("London Underground's boss Mike Brown warned that the strike ...")

# batch example
indicoio.places([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.places("London Underground's boss Mike Brown warned that the strike ...")

# batch example
Indico.places([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.places("London Underground's boss Mike Brown warned that the strike ...")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
];
indico.places(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;
import java.util.HashMap;

Map params = new HashMap();
params.put("threshold", 0.01)

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.places.predict(
    "London Underground's boss Mike Brown warned that the strike ...", params
);
List<Map<String, Object>> result = single.getPlaces();
System.out.println(result);

// batch example
String[] example = {
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
};
BatchIndicoResult multiple = indico.places.predict(example, params);
List<List<Map<String, Object>>> results = multiple.getPlaces();
System.out.println(results);
library(indicoio)

# single example
places(
    "London Underground's boss Mike Brown warned that the strike ...",
    api_key = 'YOUR_API_KEY'
)

# batch example
places(
    c(
        "London Underground's boss Mike Brown warned that the strike ...",
        "London Underground's boss Mike Brown warned that the strike ..."
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::places(
    "London Underground's boss Mike Brown warned that the strike ..."
);

# batch example
IndicoIo::places([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/places',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "London Underground's boss Mike Brown warned that the strike ...",
    'threshold': 0.01
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/places/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "London Underground's boss Mike Brown warned that the strike ...",
      "London Underground's boss Mike Brown warned that the strike ..."
    ],
    'threshold': 0.01
  })
).then(function(res) { console.log(res) });

# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/places' --data '{"data":"London Underground\u0027s boss Mike Brown warned that the strike ...", "threshold": 0.01}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/places/batch' --data '{"data":["London Underground\u0027s boss Mike Brown warned that the strike ...", "London Underground\u0027s boss Mike Brown warned that the strike ..."], "threshold": 0.01}'

Organizations


Identify references to specific organizations found in a document.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Float (defaults to 0.01) - optional - only return named entities 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 right hand sidebar.

Output

This function will return a list of dictionaries of three key-value pairs. Each dictionary represents a substring from the input document that the model has predicted is an organization, with confidence greater than your threshold. Eash dictionary has three keys: text, confidence, and position. The text key maps to a substring from the document that is predicted to be an organization. The confidence key maps to a float between 0 and 1, representing how confident the model is that the text is an organization. The position key maps to a two element list with the start character position and end character position of text in the input document.

# single output
[
    {
        'text': 'London Underground',
        'confidence':  0.913224,
        'position':  [0, 18]
    }
]

# batch output
[
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ],
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ]
]
# single output
[
    {
        'text': 'London Underground',
        'confidence':  0.913224,
        'position':  [0, 18]
    }
]

# batch output
[
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ],
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ]
]
// single output
[
    {
        'text': 'London Underground',
        'confidence':  0.913224,
        'position':  [0, 18]
    }
]

// batch output
[
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ],
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ]
]
// single output
[
    {
        'text': 'London Underground',
        'confidence':  0.913224,
        'position':  [0, 18]
    }
]

// batch output
[
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ],
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ]
]
// single output
[
    {
        'text': 'London Underground',
        'confidence':  0.913224,
        'position':  [0, 18]
    }
]

// batch output
[
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ],
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ]
]
# single output
[[1]]
[[1]]$text
[1] London Underground
[[1]]$confidence
[1] 0.913224
[[1]]$position
[1] [0, 18]

# batch output
[[1]]
[[1]]$text
[1] London Underground
[[1]]$confidence
[1] 0.913224
[[1]]$position
[1] [0, 18]

[[2]]
[[2]]$text
[1] London Underground
[[2]]$confidence
[1] 0.913224
[[2]]$position
[1] [0, 18]
// single output
Array (
        [0] => Array (
            [text] => 'London Underground',
            [confidence] =>  0.913224,
            [position] => Array (
                    [0] => 0,
                    [1] => 18,
                )
        )
)

// batch output
Array (
    [0] => Array (
            [0] => Array (
                [text] => 'London Underground',
                [confidence] =>  0.913224,
                [position] => Array (
                        [0] => 26,
                        [1] => 36,
                    )
            )
    ),
    [1] => Array (
            [0] => Array (
                [text] => 'London Underground',
                [confidence] =>  0.913224,
                [position] => Array (
                        [0] => 26,
                        [1] => 36,
                    )
            )
    )
)
# single output
[
    {
        'text': 'London Underground',
        'confidence':  0.913224,
        'position':  [0, 18]
    }
]

# batch output
[
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ],
    [
        {
            'text': 'London Underground',
            'confidence':  0.913224,
            'position':  [0, 18]
        }
    ]
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.organizations("London Underground's boss Mike Brown warned that the strike ...")

# batch example
indicoio.organizations([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.organizations("London Underground's boss Mike Brown warned that the strike ...")

# batch example
Indico.organizations([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.organizations("London Underground's boss Mike Brown warned that the strike ...")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
];
indico.organizations(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;
import java.util.HashMap;

Map params = new HashMap();
params.put("threshold", 0.01)

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.organizations.predict(
    "London Underground's boss Mike Brown warned that the strike ...", params
);
List<Map<String, Object>> result = single.getOrganizations();
System.out.println(result);

// batch example
String[] example = {
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
};
BatchIndicoResult multiple = indico.organizations.predict(example, params);
List<List<Map<String, Object>>> results = multiple.getOrganizations();
System.out.println(results);
library(indicoio)

# single example
organizations(
    "London Underground's boss Mike Brown warned that the strike ...",
    api_key = 'YOUR_API_KEY'
)

# batch example
organizations(
    c(
        "London Underground's boss Mike Brown warned that the strike ...",
        "London Underground's boss Mike Brown warned that the strike ..."
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::organizations(
    "London Underground's boss Mike Brown warned that the strike ..."
);

# batch example
IndicoIo::organizations([
    "London Underground's boss Mike Brown warned that the strike ...",
    "London Underground's boss Mike Brown warned that the strike ..."
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/organizations',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "London Underground's boss Mike Brown warned that the strike ...",
    'threshold': 0.01
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/organizations/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "London Underground's boss Mike Brown warned that the strike ...",
      "London Underground's boss Mike Brown warned that the strike ..."
    ],
    'threshold': 0.01
  })
).then(function(res) { console.log(res) });

# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/organizations' --data '{"data":"London Underground\u0027s boss Mike Brown warned that the strike ...", "threshold": 0.01}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/organizations/batch' --data '{"data":["London Underground\u0027s boss Mike Brown warned that the strike ...", "London Underground\u0027s boss Mike Brown warned that the strike ..."], "threshold": 0.01}'

Twitter Engagement


Predict audience engagement for a given tweet.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

This function will return a number between 0 and 1. This number is a probability representing the confidence that the analyzed text will be retweeted or favorited. Values greater than 0.5 indicate high engagement content, while values less than 0.5 indicate low engagement content.

# single output
0.640490385821421

# batch output
[
    0.640490385821421,
    0.44804264881126155
]
# single output
0.640490385821421

# batch output
[
   0.640490385821421,
   0.44804264881126155
]
// single output
0.640490385821421

// batch output
[
   0.640490385821421,
   0.44804264881126155
]
// single output
0.640490385821421

// batch output
[
   0.640490385821421,
   0.44804264881126155
]
// single output
0.640490385821421

// batch output
[
    0.640490385821421,
    0.44804264881126155
]
# single output
0.640490385821421

# batch output
[
    0.640490385821421,
    0.44804264881126155
]
// single output
0.640490385821421

// batch output
Array (
    [0] => 0.640490385821421,
    [1] => 0.44804264881126155
)
# single output
0.640490385821421

# batch output
[
    0.640490385821421,
    0.44804264881126155
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.twitter_engagement("Don't forget to vote tomorrow! #democracy #tom4classpresident")

# batch example
indicoio.twitter_engagement([
    "Don't forget to vote tomorrow! #democracy #tom4classpresident",
    "Severe weather warning. We advise you stay home. #weather #tornado #storm"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.twitter_engagement("Don't forget to vote tomorrow! #democracy #tom4classpresident")

# batch example
Indico.twitter_engagement([
    "Don't forget to vote tomorrow! #democracy #tom4classpresident",
    "Severe weather warning. We advise you stay home. #weather #tornado #storm"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.twitterEngagement("Don't forget to vote tomorrow! #democracy #tom4classpresident")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "Don't forget to vote tomorrow! #democracy #tom4classpresident",
    "Severe weather warning. We advise you stay home. #weather #tornado #storm"
];
indico.twitterEngagement(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.twitterEngagement.predict(
    "Don't forget to vote tomorrow! #democracy #tom4classpresident"
);
Double result = single.getTwitterEngagement();
System.out.println(result);

// batch example
String[] example = {
    "Don't forget to vote tomorrow! #democracy #tom4classpresident",
    "Severe weather warning. We advise you stay home. #weather #tornado #storm"
};
BatchIndicoResult multiple = indico.twitterEngagement.predict(example);
List<Double> results = multiple.getTwitterEngagement();
System.out.println(results);
library(indicoio)

# single example
twitter_engagement(
    "Don't forget to vote tomorrow! #democracy #tom4classpresident",
    api_key = 'YOUR_API_KEY'
)

# batch example
twitter_engagement(
    c(
        "Don't forget to vote tomorrow! #democracy #tom4classpresident",
        "Severe weather warning. We advise you stay home. #weather #tornado #storm"
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::twitter_engagement(
    "Don't forget to vote tomorrow! #democracy #tom4classpresident"
);

# batch example
IndicoIo::twitter_engagement([
    "Don't forget to vote tomorrow! #democracy #tom4classpresident",
    "Severe weather warning. We advise you stay home. #weather #tornado #storm"
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/twitterengagement',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "Don't forget to vote tomorrow! #democracy #tom4classpresident"
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/twitterengagement/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "Don't forget to vote tomorrow! #democracy #tom4classpresident",
      "Severe weather warning. We advise you stay home. #weather #tornado #storm"
    ]
  })
).then(function(res) { console.log(res) });
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/twitterengagement' --data '{"data":"Don\u0027t forget to vote tomorrow! #democracy #tom4classpresident"}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/twitterengagement/batch' --data '{"data":["Don\u0027t forget to vote tomorrow! #democracy #tom4classpresident", "Severe weather warning. We advise you stay home. #weather #tornado #storm"]}'

Personality


Predicts the personality traits of a text's author.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

This function returns a dictionary that maps the following personality traits to their likelihood of describing the author: extraversion, openness, agreeableness, conscientiousness. These values are independent, meaning the probabilities don't effect each other. For example, somebody could score 0.9 (90%) on extraversion and 0.86 (86%) on openness.

# single output
{
    'extraversion': 0.384...,
    'openness': 0.730...,
    'agreeableness': 0.439...,
    'conscientiousness': 0.103...
}

# batch output
[
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }, 
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }
]
# single output
{
    'extraversion': 0.384...,
    'openness': 0.730...,
    'agreeableness': 0.439...,
    'conscientiousness': 0.103...
}

# batch output
[
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }, 
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }
]
// single output
{
    'extraversion': 0.384...,
    'openness': 0.730...,
    'agreeableness': 0.439...,
    'conscientiousness': 0.103...
}

// batch output
[
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }, 
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }
]
// single output
{
    'extraversion': 0.384...,
    'openness': 0.730...,
    'agreeableness': 0.439...,
    'conscientiousness': 0.103...
}

// batch output
[
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }, 
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }
]
// single output
{
    'extraversion': 0.384...,
    'openness': 0.730...,
    'agreeableness': 0.439...,
    'conscientiousness': 0.103...
}

// batch output
[
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }, 
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }
]
# single output
[[1]]
[[1]]$extraversion
[1] 0.384...
[[1]]$openness
[1] 0.730...
[[1]]$agreeableness
[1] 0.439...
[[1]]$conscientiousness
[1] 0.103...

# batch output
[[1]]
[[1]]$extraversion
[1] 0.384...
[[1]]$openness
[1] 0.730...
[[1]]$agreeableness
[1] 0.439...
[[1]]$conscientiousness
[1] 0.103...

[[2]]
[[2]]$extraversion
[1] 0.384...
[[2]]$openness
[1] 0.730...
[[2]]$agreeableness
[1] 0.439...
[[2]]$conscientiousness
[1] 0.103...
// single output
Array (
  [extraversion] => 0.384...,
  [openness] => 0.730...,
  [agreeableness] => 0.439...,
  [conscientiousness] => 0.103...
)

// batch output
Array (
    [0] => Array (
        [extraversion] => 0.384...,
        [openness] => 0.730...,
        [agreeableness] => 0.439...,
        [conscientiousness] => 0.103...
    ), 
    [1] => Array (
        [extraversion] => 0.384...,
        [openness] => 0.730...,
        [agreeableness] => 0.439...,
        [conscientiousness] => 0.103...
    )
)
# single output
{
    'extraversion': 0.384...,
    'openness': 0.730...,
    'agreeableness': 0.439...,
    'conscientiousness': 0.103...
}

# batch output
[
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }, 
    {
        'extraversion': 0.384...,
        'openness': 0.730...,
        'agreeableness': 0.439...,
        'conscientiousness': 0.103...
    }
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.personality("I love my friends")

# batch example
indicoio.personality([
    "I love my friends",
    "Everything is awesome!"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.personality("I love my friends")

# batch example
Indico.personality([
    "I love my friends",
    "Everything is awesome!"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.personality("I love my friends")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "I love my friends",
    "Everything is awesome!"
];
indico.personality(batchInput)
  .then(response)
  .catch(logError);
import java.io.File;
import java.util.List;
import java.util.Map;
import io.indico.Indico;
import io.indico.api.text.Personality;

// single example
Indico indico = new Indico("YOUR_API_KEY");
Map<Personality, Double> results = indico.personality.predict("I love my friends").getPersonality();
System.out.println(results);

// batch example
String[] example = {
    I love my friends., 
    I love my friends.
};
List<Map<Personality, Double>> batchResults = indico.personality.predict(example).getPersonality();
System.out.println(batchResults);
library(indicoio)

# single example
personality(
    "I love my friends", 
    api_key = 'YOUR_API_KEY'
)

# batch example
personality(
    c(
        "I love my friends",
        "Everything is awesome!"
    ), 
    api_key = 'YOUR_API_KEY'
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::personality(
    "I love my friends"
);

# batch example
IndicoIo::personality([
    "I love my friends",
    "Everything is awesome!"
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/personality',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "I love my friends"
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/personality/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "I love my friends",
      "Everything is awesome!"
    ]
  })
).then(function(res) { console.log(res) });
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/personality' --data '{"data":"I love my friends"}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/personality/batch' --data '{"data":["I love my friends", "Everything is awesome!"]}'

Personas


Predicts the Myers Briggs persona of an author based on a sample of text.

Private cloud endpoint

POST https://[cloud].indico.domains/personality/[batch]/?persona=true

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Integer - optional (defaults to 3) - only return this many of the most likely topics
- Float - optional (defaults to .0) - 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 right hand sidebar.

Output

This function returns a dictionary that maps from the 16 Myers Briggs personas to the probability that the author aligns with the respective persona.

# single output
{
    'advocate': 0.03894013672918785,
    'debator': 0.038705012628395506,
    'mediator': 0.036483237448904055,
    ... 12 personas omitted ...,
    'consul': 0.12134217481571341
}

# batch output
[
    {
        'advocate': 0.03894013672918785,
        'debator': 0.038705012628395506,
        'mediator': 0.036483237448904055,
        ... 12 personas omitted ...,
        'consul': 0.12134217481571341
    },
    {
        'advocate': 0.06534374748375202,
        'debator': 0.0395961902984347,
        'mediator': 0.06496332439207353,
        ... 12 personas omitted ...,
        'consul': 0.10546097577494343
    }
]
# single output
{
    'advocate': 0.03894013672918785,
    'debator': 0.038705012628395506,
    'mediator': 0.036483237448904055,
    ... 12 personas omitted ...,
    'consul': 0.12134217481571341
}

# batch output
[
    {
        'advocate': 0.03894013672918785,
        'debator': 0.038705012628395506,
        'mediator': 0.036483237448904055,
        ... 12 personas omitted ...,
        'consul': 0.12134217481571341
    },
    {
        'advocate': 0.06534374748375202,
        'debator': 0.0395961902984347,
        'mediator': 0.06496332439207353,
        ... 12 personas omitted ...,
        'consul': 0.10546097577494343
    }
]
// single output
{
    'advocate': 0.03894013672918785,
    'debator': 0.038705012628395506,
    'mediator': 0.036483237448904055,
    ... 12 personas omitted ...,
    'consul': 0.12134217481571341
}

// batch output
[
    {
        'advocate': 0.03894013672918785,
        'debator': 0.038705012628395506,
        'mediator': 0.036483237448904055,
        ... 12 personas omitted ...,
        'consul': 0.12134217481571341
    },
    {
        'advocate': 0.06534374748375202,
        'debator': 0.0395961902984347,
        'mediator': 0.06496332439207353,
        ... 12 personas omitted ...,
        'consul': 0.10546097577494343
    }
]
// single output
{
    'advocate': 0.03894013672918785,
    'debator': 0.038705012628395506,
    'mediator': 0.036483237448904055,
    ... 12 personas omitted ...,
    'consul': 0.12134217481571341
}

// batch output
[
    {
        'advocate': 0.03894013672918785,
        'debator': 0.038705012628395506,
        'mediator': 0.036483237448904055,
        ... 12 personas omitted ...,
        'consul': 0.12134217481571341
    },
    {
        'advocate': 0.06534374748375202,
        'debator': 0.0395961902984347,
        'mediator': 0.06496332439207353,
        ... 12 personas omitted ...,
        'consul': 0.10546097577494343
    }
]
// single output
{
    'advocate': 0.03894013672918785,
    'debator': 0.038705012628395506,
    'mediator': 0.036483237448904055,
    ... 12 personas omitted ...,
    'consul': 0.12134217481571341
}

// batch output
[
    {
        'advocate': 0.03894013672918785,
        'debator': 0.038705012628395506,
        'mediator': 0.036483237448904055,
        ... 12 personas omitted ...,
        'consul': 0.12134217481571341
    },
    {
        'advocate': 0.06534374748375202,
        'debator': 0.0395961902984347,
        'mediator': 0.06496332439207353,
        ... 12 personas omitted ...,
        'consul': 0.10546097577494343
    }
]
# single output
[[1]]
[[1]]$advocate
[1] 0.03894013672918785
[[1]]$debator
[1] 0.038705012628395506
[[1]]$mediator
[1] 0.036483237448904055
... 12 personas omitted ...
[[1]]$consul
[1] 0.12134217481571341

# batch output
[[1]]
[[1]]$advocate
[1] 0.03894013672918785
[[1]]$debator
[1] 0.038705012628395506
[[1]]$mediator
[1] 0.036483237448904055
... 12 personas omitted ...
[[1]]$consul
[1] 0.12134217481571341

[[2]]
[[2]]$advocate
[1] 0.06534374748375202
[[2]]$debator
[1] 0.0395961902984347
[[2]]$mediator
[1] 0.06496332439207353
... 12 personas omitted ...
[[2]]$consul
[1] 0.10546097577494343
// single output
Array (
  [advocate] => 0.03894013672918785,
  [debator] => 0.038705012628395506,
  [mediator] => 0.036483237448904055,
  ... 12 personas omitted ...,
  [consul] => 0.12134217481571341
)

// batch output
Array (
    [0] => Array (
        [advocate] => 0.03894013672918785,
        [debator] => 0.038705012628395506,
        [mediator] => 0.036483237448904055,
         ... 12 personas omitted ...,
        [consul] => 0.12134217481571341
    ),
    [1] => Array (
        [advocate] => 0.06534374748375202,
        [debator] => 0.0395961902984347,
        [mediator] => 0.06496332439207353,
         ... 12 personas omitted ...,
        [consul] => 0.10546097577494343
    )
)
# single output
{
    'advocate': 0.03894013672918785,
    'debator': 0.038705012628395506,
    'mediator': 0.036483237448904055,
    ... 12 personas omitted ...,
    'consul': 0.12134217481571341
}

# batch output
[
    {
        'advocate': 0.03894013672918785,
        'debator': 0.038705012628395506,
        'mediator': 0.036483237448904055,
        ... 12 personas omitted ...,
        'consul': 0.12134217481571341
    },
    {
        'advocate': 0.06534374748375202,
        'debator': 0.0395961902984347,
        'mediator': 0.06496332439207353,
        ... 12 personas omitted ...,
        'consul': 0.10546097577494343
    }
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.personas("I only stay home on Saturday nights to read.")

# batch example
indicoio.personas([
    "I only stay home on Saturday nights to read.",
    "I just want to support my friends and always be there for them."
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.personas("I only stay home on Saturday nights to read.")

# batch example
Indico.personas([
    "I only stay home on Saturday nights to read.",
    "I just want to support my friends and always be there for them."
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.personas("I only stay home on Saturday nights to read.")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "I only stay home on Saturday nights to read.",
    "I just want to support my friends and always be there for them."
];
indico.personas(batchInput)
  .then(response)
  .catch(logError);
import java.io.File;
import java.util.List;
import java.util.Map;
import io.indico.Indico;
import io.indico.api.text.Persona;
import java.util.HashMap;

Map params = new HashMap();
params.put("threshold", 0.1)

// single example
Indico indico = new Indico("YOUR_API_KEY");
Map<Persona, Double> results = indico.persona.predict("I only stay home on Saturday nights to read.", params).getPersona();
System.out.println(results);

// batch example
String[] example = {
    "I only stay home on Saturday nights to read.",
    "I just want to support my friends and always be there for them."
};
List<Map<Persona, Double>> batchResults = indico.persona.predict(example, params).getPersona();
System.out.println(batchResults);
library(indicoio)

# single example
personas(
    "I only stay home on Saturday nights to read.",
    api_key = 'YOUR_API_KEY'
)

# batch example
personas(
    c(
        "I only stay home on Saturday nights to read.",
        "I just want to support my friends and always be there for them."
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::personas(
    "I only stay home on Saturday nights to read."
);

# batch example
IndicoIo::personas([
    "I only stay home on Saturday nights to read.",
    "I just want to support my friends and always be there for them."
]);

?>

// single example
$.post(
  'https://apiv2.indico.io/personality',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "I only stay home on Saturday nights to read.",
    'persona': true,
    'threshold': 0.1
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/personality/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "I only stay home on Saturday nights to read.", 
      "I just want to support my friends and always be there for them."
    ],
    'persona': true,
    'threshold': 0.1
  })
).then(function(res) { console.log(res) });

# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/personality' --data '{"data":"I only stay home on Saturday nights to read.", "persona": true, "threshold": 0.1}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/personality/batch' --data '{"data":["I only stay home on Saturday nights to read.", "I just want to support my friends and always be there for them."], "persona": true, "threshold": 0.1}'

Relevance


Determine how relevant query terms and phrases are to a given document.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String | List - required - a list of queries to run against the document
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

This function returns a list of floating point values representing the relevance of a given search query to the provided document or documents. The `data` argument and the `queries` argument may be either a single text string or a list of text strings.

# single output
[0.6740826540660497, 0.16670130847921036]

# batch output
[
    [0.16670130847921036], 
    [0.2949661163493879]
]
# single output
[0.6740826540660497, 0.16670130847921036]

# batch output
[
    [0.16670130847921036], 
    [0.2949661163493879]
]
// single output
[0.6740826540660497, 0.16670130847921036]

// batch output
[
    [0.16670130847921036],
    [0.2949661163493879]
]
// single output
[0.6740826540660497, 0.16670130847921036]

// batch output
[
    [0.16670130847921036],
    [0.2949661163493879]
]
// single output
[0.6740826540660497. 0.16670130847921036]

// batch output
[
    [0.16670130847921036],
    [0.2949661163493879]
]
# single output
[0.6740826540660497, 0.16670130847921036]

# batch output
[
    [0.16670130847921036],
    [0.2949661163493879]
]
// single output
Array (
    [0] => 0.6740826540660497,
    [1] => 0.16670130847921036
)

// batch output
Array ( 
    [0] => Array (
        [0] => 0.16670130847921036
    ),
    [1] => Array (
        [0] => 0.2949661163493879
    )
)
# single output
[0.6740826540660497, 0.16670130847921036]

# batch output
[
    [0.16670130847921036], 
    [0.2949661163493879]
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.relevance("Renowned soccer legend Pele will be visiting...", ["team sports", "royalty"])

# batch example
indicoio.relevance(["Renowned soccer legend Pele will be visiting...", "The Queen of England will be visiting..."], ["royalty"])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.relevance("Renowned soccer legend Pele will be visiting...", ["team sports", "royalty"])

# batch example
Indico.relevance(["Renowned soccer legend Pele will be visiting...", "The Queen of England will be visiting..."], ["royalty"])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.relevance("Renowned soccer legend Pele will be visiting...", ["team sports", "royalty"])
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "Renowned soccer legend Pele will be visiting...",
    "The Queen of England will be visiting..."
];
indico.relevance(batchInput, ["royalty"])
  .then(response)
  .catch(logError);
import java.io.File;
import java.util.List;
import io.indico.Indico;
import io.indico.api.text.Relevance;

String[] queries = {
  "team sports", "royalty"
};

// single example
Indico indico = new Indico("YOUR_API_KEY");
List<Double> results = indico.relevance.predict("Renowned soccer legend Pele will be visiting...", queries).getRelevance();
System.out.println(results);

// batch example
String[] example = {
    "Renowned soccer legend Pele will be visiting...", 
    "The Queen of England will be visiting..."
};

String[] queries = {
  "royalty"
};
List<List<Double>> batchResults = indico.relevance.predict(example, queries).getRelevance();
System.out.println(batchResults);
library(indicoio)

# single example
relevance(
    "Renowned soccer legend Pele will be visiting...", 
    c("team sports", "royalty")
    api_key = 'YOUR_API_KEY'
)

# batch example
relevance(
    c(
        "Renowned soccer legend Pele will be visiting...",
        "The Queen of England will be visiting..."
    ), 
    c("royalty"),
    api_key = 'YOUR_API_KEY'
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::relevance(
    "Renowned soccer legend Pele will be visiting...",
    ["team sports", "royalty"]
);

# batch example
IndicoIo::relevance([
    "Renowned soccer legend Pele will be visiting...",
    "The Queen of England will be visiting..."
], ["royalty"]);

?>

// single example
$.post(
  'https://apiv2.indico.io/relevance',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "Renowned soccer legend Pele will be visiting...",
    'queries': ["team sports", "royalty"]
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/relevance/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': ["Renowned soccer legend Pele will be visiting...", "The Queen of England will be visiting..."],
    'queries': ["royalty"]
  })
).then(function(res) { console.log(res) });

# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/relevance' --data '{"data":"Renowned soccer legend Pele will be visiting...", "queries":["team sports", "royalty"]}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/relevance/batch' --data '{"data":["Renowned soccer legend Pele will be visiting...", "The Queen of England will be visiting..."], "queries": ["royalty"]}'

Emotion


Predicts the emotion expressed by an author in a sample of text.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Integer - optional (defaults to 3) - only return this many of the most likely topics
- Float - optional (defaults to .0) - 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 right hand sidebar.

Output

This function returns a dictionary that maps from 5 emotions (anger, fear, joy, sadness, surprise) to the probability that the author is expressing the respective emotion.

# single output
{
    'anger': 0.007581704296171665,
    'joy': 0.07016665488481522,
    'fear': 0.8000516295433044,
    'sadness': 0.02512381225824356,
    'surprise': 0.06534374748375202
}

# batch output
[
    {
        'anger': 0.007581704296171665,
        'joy': 0.07016665488481522,
        'fear': 0.8000516295433044,
        'sadness': 0.02512381225824356,
        'surprise': 0.06534374748375202
    },
    {
        'anger': 0.0886223167181015,
        'joy': 0.10006538033485413,
        'fear': 0.1751064658164978,
        'sadness': 0.5425705313682556,
        'surprise': 0.09363535046577454
    }
]
# single output
{
    'anger': 0.007581704296171665,
    'joy': 0.07016665488481522,
    'fear': 0.8000516295433044,
    'sadness': 0.02512381225824356,
    'surprise': 0.06534374748375202
}

# batch output
[
    {
        'anger': 0.007581704296171665,
        'joy': 0.07016665488481522,
        'fear': 0.8000516295433044,
        'sadness': 0.02512381225824356,
        'surprise': 0.06534374748375202
    },
    {
        'anger': 0.0886223167181015,
        'joy': 0.10006538033485413,
        'fear': 0.1751064658164978,
        'sadness': 0.5425705313682556,
        'surprise': 0.09363535046577454
    }
]
// single output
{
    'anger': 0.007581704296171665,
    'joy': 0.07016665488481522,
    'fear': 0.8000516295433044,
    'sadness': 0.02512381225824356,
    'surprise': 0.06534374748375202
}

// batch output
[
    {
        'anger': 0.007581704296171665,
        'joy': 0.07016665488481522,
        'fear': 0.8000516295433044,
        'sadness': 0.02512381225824356,
        'surprise': 0.06534374748375202
    },
    {
        'anger': 0.0886223167181015,
        'joy': 0.10006538033485413,
        'fear': 0.1751064658164978,
        'sadness': 0.5425705313682556,
        'surprise': 0.09363535046577454
    }
]
// single output
{
    'anger': 0.007581704296171665,
    'joy': 0.07016665488481522,
    'fear': 0.8000516295433044,
    'sadness': 0.02512381225824356,
    'surprise': 0.06534374748375202
}

// batch output
[
    {
        'anger': 0.007581704296171665,
        'joy': 0.07016665488481522,
        'fear': 0.8000516295433044,
        'sadness': 0.02512381225824356,
        'surprise': 0.06534374748375202
    },
    {
        'anger': 0.0886223167181015,
        'joy': 0.10006538033485413,
        'fear': 0.1751064658164978,
        'sadness': 0.5425705313682556,
        'surprise': 0.09363535046577454
    }
]
// single output
{
    'anger': 0.007581704296171665,
    'joy': 0.07016665488481522,
    'fear': 0.8000516295433044,
    'sadness': 0.02512381225824356,
    'surprise': 0.06534374748375202
}

// batch output
[
    {
        'anger': 0.007581704296171665,
        'joy': 0.07016665488481522,
        'fear': 0.8000516295433044,
        'sadness': 0.02512381225824356,
        'surprise': 0.06534374748375202
    },
    {
        'anger': 0.0886223167181015,
        'joy': 0.10006538033485413,
        'fear': 0.1751064658164978,
        'sadness': 0.5425705313682556,
        'surprise': 0.09363535046577454
    }
]
# single output
[[1]]
[[1]]$anger
[1] 0.007581704296171665
[[1]]$joy
[1] 0.07016665488481522
[[1]]$fear
[1] 0.8000516295433044
[[1]]$sadness
[1] 0.02512381225824356
[[1]]$surprise
[1] 0.06534374748375202

# batch output
[[1]]
[[1]]$anger
[1] 0.007581704296171665
[[1]]$joy
[1] 0.07016665488481522
[[1]]$fear
[1] 0.8000516295433044
[[1]]$sadness
[1] 0.02512381225824356
[[1]]$surprise
[1] 0.06534374748375202

[[2]]
[[2]]$anger
[1] 0.0886223167181015
[[2]]$joy
[1] 0.10006538033485413
[[2]]$fear
[1] 0.1751064658164978
[[2]]$sadness
[1] 0.5425705313682556
[[2]]$surprise
[1] 0.09363535046577454
// single output
Array (
  [anger] => 0.007581704296171665,
  [joy] => 0.07016665488481522,
  [fear] => 0.8000516295433044,
  [sadness] => 0.02512381225824356,
  [surprise] => 0.06534374748375202
)

// batch output
Array (
    [0] => Array (
        [anger] => 0.007581704296171665,
        [joy] => 0.07016665488481522,
        [fear] => 0.8000516295433044,
        [sadness] => 0.02512381225824356,
        [surprise] => 0.06534374748375202
    ),
    [1] => Array (
        [anger] => 0.007581704296171665,
        [joy] => 0.07016665488481522,
        [fear] => 0.8000516295433044,
        [sadness] => 0.02512381225824356,
        [surprise] => 0.06534374748375202
    )
)
# single output
{
    'anger': 0.007581704296171665,
    'joy': 0.07016665488481522,
    'fear': 0.8000516295433044,
    'sadness': 0.02512381225824356,
    'surprise': 0.06534374748375202
}

# batch output
[
    {
        'anger': 0.007581704296171665,
        'joy': 0.07016665488481522,
        'fear': 0.8000516295433044,
        'sadness': 0.02512381225824356,
        'surprise': 0.06534374748375202
    },
    {
        'anger': 0.0886223167181015,
        'joy': 0.10006538033485413,
        'fear': 0.1751064658164978,
        'sadness': 0.5425705313682556,
        'surprise': 0.09363535046577454
    }
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.emotion("I did it. I got into Grad School. Not just any program, but a GREAT program. :-)")

# batch example
indicoio.emotion([
    "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)",
    "Like seriously my life is bleak, I have been unemployed for almost a year."
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.emotion("I did it. I got into Grad School. Not just any program, but a GREAT program. :-)")

# batch example
Indico.emotion([
    "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)",
    "Like seriously my life is bleak, I have been unemployed for almost a year."
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.emotion("I did it. I got into Grad School. Not just any program, but a GREAT program. :-)")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)",
    "Like seriously my life is bleak, I have been unemployed for almost a year."
];
indico.emotion(batchInput)
  .then(response)
  .catch(logError);
import java.io.File;
import java.util.List;
import java.util.Map;
import io.indico.Indico;
import io.indico.api.text.Emotion;
import java.util.HashMap;

Map params = new HashMap();
params.put("threshold", 0.25)

// single example
Indico indico = new Indico("YOUR_API_KEY");
Map<Emotion, Double> results = indico.emotion.predict("I did it. I got into Grad School. Not just any program, but a GREAT program. :-)", params).getEmotion();
System.out.println(results);

// batch example
String[] example = {
    "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)",
    "Like seriously my life is bleak, I have been unemployed for almost a year."
};
List<Map<Emotion, Double>> batchResults = indico.emotion.predict(example, params).getEmotion();
System.out.println(batchResults);
library(indicoio)

# single example
emotion(
    "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)",
    api_key = 'YOUR_API_KEY'
)

# batch example
emotion(
    c(
        "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)",
        "Like seriously my life is bleak, I have been unemployed for almost a year."
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::emotion(
    "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)"
);

# batch example
IndicoIo::emotion([
    "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)",
    "Like seriously my life is bleak, I have been unemployed for almost a year."
]);

?>

// single example
$.post(
  'https://apiv2.indico.io/emotion',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "I did it. I got into Grad School. Not just any program, but a GREAT program. :-)",
    'threshold': 0.1
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/emotion/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': ["I did it. I got into Grad School. Not just any program, but a GREAT program. :-)", "Like seriously my life is bleak, I have been unemployed for almost a year."],
    'threshold': 0.1
  })
).then(function(res) { console.log(res) });


# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/emotion' --data '{"data":"I did it. I got into Grad School. Not just any program, but a GREAT program. :-)", "threshold": 0.1}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/emotion/batch' --data '{"data":["I did it. I got into Grad School. Not just any program, but a GREAT program. :-)", "Like seriously my life is bleak, I have been unemployed for almost a year."], "threshold": 0.1}'

Text Features


Convert text into meaningful feature vectors.
Extracts abstract text features for use as inputs to learning algorithms.

Private cloud endpoint

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

Arguments

- String | List - required - text to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

List of 300 numbers (floats). Each number corresponds to the strength of that feature in the feature vector.

# single output
[
    0.0545490713952761,
    0.023423018957352944,
    0.003421281571050769,
    ... 294 features omitted ...,
    -0.0599560840072811,
    0.07137194953658677,
    -0.008098228765861361
]

# batch output
[
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ],
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ]
]
# single output
[
    0.0545490713952761,
    0.023423018957352944,
    0.003421281571050769,
    ... 294 features omitted ...,
    -0.0599560840072811,
    0.07137194953658677,
    -0.008098228765861361
]

# batch output
[
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ],
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ]
]
// single output
[
    0.0545490713952761,
    0.023423018957352944,
    0.003421281571050769,
    ... 294 features omitted ...,
    -0.0599560840072811,
    0.07137194953658677,
    -0.008098228765861361
]

// batch output
[
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ],
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ]
]
// single output
[
    0.0545490713952761,
    0.023423018957352944,
    0.003421281571050769,
    ... 294 features omitted ...,
    -0.0599560840072811,
    0.07137194953658677,
    -0.008098228765861361
]

// batch output
[
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ],
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ]
]
// single output
[
    0.0545490713952761,
    0.023423018957352944,
    0.003421281571050769,
    ... 294 features omitted ...,
    -0.0599560840072811,
    0.07137194953658677,
    -0.008098228765861361
]

// batch output
[
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ],
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ]
]
# single output
[[1]]
[1] 0.0545490713952761
[[2]]
[1] 0.023423018957352944
[[3]]
[1] 0.003421281571050769
... 294 features omitted ...
[[2046]]
[1] -0.0599560840072811
[[2047]]
[1] 0.07137194953658677
[[2048]]
[1] -0.008098228765861361

# batch output
[[1]][[1]]
[1] 0.0545490713952761
[[1]][[2]]
[1] 0.023423018957352944
[[1]][[3]]
[1] 0.003421281571050769
... 294 features omitted ...
[[1]][[2046]]
[1] -0.0599560840072811
[[1]][[2047]]
[1] 0.07137194953658677
[[1]][[2048]]
[1] -0.008098228765861361

[[2]][[1]]
[1] 0.0545490713952761
[[2]][[2]]
[1] 0.023423018957352944
[[2]][[3]]
[1] 0.003421281571050769
... 294 features omitted ...
[[2]][[2046]]
[1] -0.0599560840072811
[[2]][[2047]]
[1] 0.07137194953658677
[[2]][[2048]]
[1] -0.008098228765861361
// single output
Array (
  [0] => 0.0545490713952761,
  [1] => 0.023423018957352944,
  [2] => 0.003421281571050769,
  ... 294 features omitted ...,
  [2045] => -0.0599560840072811,
  [2046] => 0.07137194953658677,
  [2047] => -0.008098228765861361
)

// batch output
Array (
    [0] => Array (
    [0] => 0.0545490713952761,
    [1] => 0.023423018957352944,
    [2] => 0.003421281571050769,
    ... 294 features omitted ...,
    [2045] => -0.0599560840072811,
    [2046] => 0.07137194953658677,
    [2047] => -0.008098228765861361
  ),
    [1] => Array (
    [0] => 0.0545490713952761,
    [1] => 0.023423018957352944,
    [2] => 0.003421281571050769,
    ... 294 features omitted ...,
    [2045] => -0.0599560840072811,
    [2046] => 0.07137194953658677,
    [2047] => -0.008098228765861361
  )
)
# single output
[
    0.0545490713952761,
    0.023423018957352944,
    0.003421281571050769,
    ... 294 features omitted ...,
    -0.0599560840072811,
    0.07137194953658677,
    -0.008098228765861361
]

# batch output
[
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ],
    [
        0.0545490713952761,
        0.023423018957352944,
        0.003421281571050769,
        ... 294 features omitted ...,
        -0.0599560840072811,
        0.07137194953658677,
        -0.008098228765861361
    ]
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.text_features("There are so many things you can learn from text.")

# batch example
indicoio.text_features([
    "There are so many things you can learn from text.",
    "You could use the features to train a model!"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.text_features("There are so many things you can learn from text.")

# batch example
Indico.text_features([
    "There are so many things you can learn from text.",
    "You could use the features to train a model!"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.textFeatures("There are so many things you can learn from text.")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "There are so many things you can learn from text.",
    "You could use the features to train a model!"
];
indico.textFeatures(batchInput)
  .then(response)
  .catch(logError);
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.text.PoliticalClass;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.textFeatures.predict(
    "There are so many things you can learn from text."
);
Map<PoliticalClass, Double> result = single.getTextFeatures();
System.out.println(result);

// batch example
String[] example = {
    "There are so many things you can learn from text.",
    "You could use the features to train a model!"
};
BatchIndicoResult multiple = indico.textFeatures.predict(example);
List<Map<PoliticalClass, Double>> results = multiple.getTextFeatures();
System.out.println(results);
library(indicoio)

# single example
text_features(
    "There are so many things you can learn from text.",
    api_key = 'YOUR_API_KEY'
)

# batch example
text_features(
    c(
        "There are so many things you can learn from text.",
        "You could use the features to train a model!"
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::text_features(
    "There are so many things you can learn from text."
);

# batch example
IndicoIo::text_features([
    "There are so many things you can learn from text.",
    "You could use the features to train a model!"
]);

?>
// single example
$.post(
  'https://apiv2.indico.io/textfeatures',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "There are so many things you can learn from text."
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/textfeatures/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "There are so many things you can learn from text.",
      "You could use the features to train a model!"
    ]
  })
).then(function(res) { console.log(res) });

# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/textfeatures' --data '{"data":"There are so many things you can learn from text."}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/textfeatures/batch' --data '{"data":["There are so many things you can learn from text.", "You could use the features to train a model!"]}'

Intersections


See correlations among the results of multiple APIs.

Private cloud endpoint

POST https://[cloud].indico.domains/apis/intersections/[batch]/

Arguments

- List - required - text to be analyzed
- List - required - exactly two models you'd like to see correlations between
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

A nested dictionary with the first set of keys corresponding to the first API listed. These keys map to the values of the results from the second API listed. Finally, the keys on the second level map to the correlation between the two parent keys and the confidence is the model's confidence in this correlation.

# output (you must send multiple examples to use intersections)
{
    'twitter_engagement': {
        'sentiment_hq': {
            'confidence': 0.5330776330179838, 
            'correlation': 0.24545454545454548
        }
    }
}
# output (you must send multiple examples to use intersections)
{
    'twitter_engagement': {
        'sentiment_hq': {
            'confidence': 0.5330776330179838, 
            'correlation': 0.24545454545454548
        }
    }
}
// output (you must send multiple examples to use intersections)
{
    'twitter_engagement': {
        'sentiment_hq': {
            'confidence': 0.5330776330179838, 
            'correlation': 0.24545454545454548
        }
    }
}
// output (you must send multiple examples to use intersections)
{
    'twitter_engagement': {
        'sentiment_hq': {
            'confidence': 0.5330776330179838, 
            'correlation': 0.24545454545454548
        }
    }
}
// output (you must send multiple examples to use intersections)
{
    'twitter_engagement': {
        'sentiment_hq': {
            'confidence': 0.5330776330179838, 
            'correlation': 0.24545454545454548
        }
    }
}
# output (you must send multiple examples to use intersections)
[[1]]
[[1]]$twitter_engagement
[1] {
        'sentiment_hq': {
            'confidence': 0.5330776330179838, 
            'correlation': 0.24545454545454548
        }
    }
// output (you must send multiple examples to use intersections)
Array (
    [twitter_engagement] => Array (
        [sentiment_hq] => Array (
            [confidence] => 0.5330776330179838,
            [correlation] => 0.24545454545454548
        )
    )
)
# output (you must send multiple examples to use intersections)
{
    'twitter_engagement': {
        'sentiment_hq': {
            'confidence': 0.5330776330179838, 
            'correlation': 0.24545454545454548
        }
    }
}
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# Using the first chapter of the Scarlet Letter as an example
indicoio.intersections(prison_door, apis=['twitter_engagement', 'sentiment_hq'])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# Using the first chapter of the Scarlet Letter as an example
Indico.intersections(prison_door, {apis: ['twitter_engagement', 'sentiment_hq']})
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// Using the first chapter of the Scarlet Letter as an example
indico.instersections(prisonDoor, {apis: ['twitter_engagement', 'sentiment_hq']})
  .then(response)
  .catch(logError);
// Using the first chapter of the Scarlet Letter as an example
$.post(
  'https://apiv2.indico.io/intersections?apis=twitterengagement,sentimenthq',
  JSON.stringify({
    'api_key': ,
    'data': prisonDoor
  })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.BatchIndicoResult;

Map<String, List> params = new HashMap()
ArrayList<String> apiList = new ArrayList<String>;
apiList.add("twitter_engagement");
apiList.add("sentiment_hq");
params.put("apis", apiList);

// Using the first chapter of the Scarlet Letter as an example
Indico indico = new Indico("YOUR_API_KEY");
BatchIndicoResult multiple = indico.instersections.predict(
    prisonDoor,
    params
);
Map<String, Map<String, Map<String, Double>>> result = multiple.getIntersections();
System.out.println(result);
library(indicoio)

# Using the first chapter of the Scarlet Letter as an example
intersections(
    prison_door, 
    api_key = 'YOUR_API_KEY',
    apis = c('twitter_engagement', 'sentiment_hq')
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';
$params = array(
    'apis' => array('twitter_engagement', 'sentiment_hq')
);

# Using the first chapter of the Scarlet Letter as an example
IndicoIo::intersections(
    prison_door,
    $params
);

?>
# Using the first chapter of the Scarlet Letter as an example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/apis/intersections?apis=twitter_engagement,sentiment_hq' --data '{"data": ["Example 1", "Example 2", "Example 3"]}'

Analyze Text


Make calls to many APIs in parallel.

Private cloud endpoint

POST https://[cloud].indico.domains/apis/multiapi/[batch]/

Arguments

- String | List - required - text to be analyzed
- List - required - the list of APIs to run in parallel
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

A dictionary where each key maps to the specified models' results. If used on a single input (not recommemnded as using multiple APIs quickly uses up your allotted calls!) you'll get the default response, otherwise a list of the default.

# single output
{
    'sentiment_hq': 0.7300551533699036,
    'political': {
        'Conservative': 0.2288717527904388,
        'Green': 0.05575739681227337,
        'Liberal': 0.6541234047231098,
        'Libertarian': 0.06124744567417795
    }
}

# batch output
{
    "political": [
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        },
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        }
    ], 
    "sentiment_hq": [0.7300551533699036]
}
# single output
{
    'sentiment_hq': 0.7300551533699036,
    'political': {
        'Conservative': 0.2288717527904388,
        'Green': 0.05575739681227337,
        'Liberal': 0.6541234047231098,
        'Libertarian': 0.06124744567417795
    }
}

# batch output
{
    "political": [
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        },
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        }
    ], 
    "sentiment_hq": [0.7300551533699036]
}
# single output
{
    'sentiment_hq': 0.7300551533699036,
    'political': {
        'Conservative': 0.2288717527904388,
        'Green': 0.05575739681227337,
        'Liberal': 0.6541234047231098,
        'Libertarian': 0.06124744567417795
    }
}

# batch output
{
    "political": [
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        },
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        }
    ], 
    "sentiment_hq": [0.7300551533699036]
}
# single output
{
    'sentiment_hq': 0.7300551533699036,
    'political': {
        'Conservative': 0.2288717527904388,
        'Green': 0.05575739681227337,
        'Liberal': 0.6541234047231098,
        'Libertarian': 0.06124744567417795
    }
}

# batch output
{
    "political": [
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        },
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        }
    ], 
    "sentiment_hq": [0.7300551533699036]
}
# single output
{
    'sentiment_hq': 0.7300551533699036,
    'political': {
        'Conservative': 0.2288717527904388,
        'Green': 0.05575739681227337,
        'Liberal': 0.6541234047231098,
        'Libertarian': 0.06124744567417795
    }
}

# batch output
{
    "political": [
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        },
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        }
    ], 
    "sentiment_hq": [0.7300551533699036]
}
# single output
[[1]]
[[1]][[1]]$sentiment_hq
[1] 0.2288717527904388

[[1]][[1]]$conservative
[1] 0.6541234047231098

[[1]][[2]]$green
[1] 0.6541234047231098

[[1]][[3]]$liberal
[1] 0.6541234047231098

[[1]][[4]]$libertarian
[1] 0.06124744567417795

# batch output
[[1]]
[[1]][[1]]$sentiment_hq
[1] 0.2288717527904388

[[1]][[1]]$conservative
[1] 0.6541234047231098

[[1]][[2]]$green
[1] 0.6541234047231098

[[1]][[3]]$liberal
[1] 0.6541234047231098

[[1]][[4]]$libertarian
[1] 0.06124744567417795

[[2]]
[[2]][[1]]$sentiment_hq
[1] 0.2288717527904388

[[2]][[1]]$conservative
[1] 0.6541234047231098

[[2]][[2]]$green
[1] 0.6541234047231098

[[2]][[3]]$liberal
[1] 0.6541234047231098

[[2]][[4]]$libertarian
[1] 0.06124744567417795
// single output
Array (
    [sentiment_hq] => 0.7300551533699036,
    [political] => Array (
        [conservative] => 0.2288717527904388,
        [green] => 0.05575739681227337,
        [liberal] => 0.6541234047231098,
        [libertarian] => 0.06124744567417795,
    )
)

// batch output
Array (
    [political] => Array (
        [0] => Array (
            [conservative] => 0.2288717527904388,
            [green] => 0.05575739681227337,
            [liberal] => 0.6541234047231098,
            [libertarian] => 0.06124744567417795,
        ),
        [1] => Array (
            [conservative] => 0.2288717527904388,
            [green] => 0.05575739681227337,
            [liberal] => 0.6541234047231098,
            [libertarian] => 0.06124744567417795,
        )
    ), 
    [sentiment_hq] => Array (
        [0] => 0.7300551533699036,
        [1] => 0.7300551533699036
    )
)
# single output
{
    'sentiment_hq': 0.7300551533699036,
    'political': {
        'Conservative': 0.2288717527904388,
        'Green': 0.05575739681227337,
        'Liberal': 0.6541234047231098,
        'Libertarian': 0.06124744567417795
    }
}

# batch output
{
    "political": [
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        },
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        }
    ], 
    "sentiment_hq": [0.7300551533699036]
}
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.analyze_text("Democratic candidate Hillary Clinton is excited for the upcoming election.", apis=['sentiment_hq', 'political'])

# batch example
indicoio.analyze_text(
    [
        "Democratic candidate Hillary Clinton is excited for the upcoming election.",
        "Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard."
    ],
    apis=['sentiment_hq', 'political']
)
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.analyze_text("Democratic candidate Hillary Clinton is excited for the upcoming election.", {apis: ['sentiment_hq', 'political']})


# batch example
Indico.analyze_text(
    [
        "Democratic candidate Hillary Clinton is excited for the upcoming election.",
        "Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard."
    ], 
    {apis: ['sentiment_hq', 'political']}
)
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.analyzeText("Democratic candidate Hillary Clinton is excited for the upcoming election.", {apis: ['sentiment_hq', 'political']})
  .then(response)
  .catch(logError);

// batch example
indico.analyzeText(
    [
        "Democratic candidate Hillary Clinton is excited for the upcoming election.",
        "Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard."
    ], 
    {apis: ['sentiment_hq', 'political']}
)
.then(response)
.catch(logError);
// single example
$.post(
  'https://apiv2.indico.io/apis/multiapi',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "Democratic candidate Hillary Clinton is excited for the upcoming election."
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
    'https://apiv2.indico.io/apis/multiapi/batch?apis=twitterengagement,sentimenthq',
    JSON.stringify({
        'api_key': "YOUR_API_KEY",
        'data': [
            "Democratic candidate Hillary Clinton is excited for the upcoming election.",
            "Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard."
        ]
    })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

Map<String, Object> params = new HashMap<>()
ArrayList<String> apiList = new ArrayList<String>();
apiList.add("sentiment_hq");
apiList.add("political");
params.put("apis", apiList);

Indico indico = new Indico("YOUR_API_KEY");

// single example
IndicoResult single  = indico.text.predict(
    "Democratic candidate Hillary Clinton is excited for the upcoming election.",
    params
);
Double result = single.getSentimentHQ();
System.out.println(result);

// batch example
String[] example = {
    "Democratic candidate Hillary Clinton is excited for the upcoming election.", 
    "Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard."
};

BatchIndicoResult multiple = indico.text.predict(
    example,
    params
);
List<Double> result = multiple.getSentimentHQ();
System.out.println(result);
library(indicoio)

# single example
analyze_text(
    "Democratic candidate Hillary Clinton is excited for the upcoming election.", 
    api_key = 'YOUR_API_KEY',
    apis = c('sentiment_hq', 'political')
)


# batch example
analyze_text(
    c("Democratic candidate Hillary Clinton is excited for the upcoming election.", "Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard."), 
    api_key = 'YOUR_API_KEY',
    apis = c('sentiment_hq', 'political')
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';
$params = array(
    'apis' => array('sentiment_hq', 'political')
);

# single example
IndicoIo::analyze_text(
    "Democratic candidate Hillary Clinton is excited for the upcoming election.",
    $params
);

# batch example
IndicoIo::analyze_text(
    [
        "Democratic candidate Hillary Clinton is excited for the upcoming election.",
        "Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard."
    ],
    $params
);

?>
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/apis/multiapi?apis=sentimenthq,political' --data '{"data":"Democratic candidate Hillary Clinton is excited for the upcoming election."}'

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/apis/multiapi/batch?apis=sentimenthq,political' --data '{"data":["Democratic candidate Hillary Clinton is excited for the upcoming election.", "Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard."]}'

Sentence Splitting

If you'd like indico to automatically handle splitting your documents up into sentences or paragraphs to provide a more detailed analysis of your data, all of our text APIs feature a split keyword argument for providing sentence or paragraph level API results.

The valid options for the split keyword are "sentence" and "paragraph".

Output

A list of dictionaries, where each dictionary contains the position, text, and results keys. The position key contains information on the indexes into the original document, the text key contains the analyzed sentence or document, and the results key contains the output of the API.

[{u'position': [0, 23],
  u'results': 8.478955551191238e-05,
  u'text': u'This sentence is awful.'},
 {u'position': [24, 47],
  u'results': 0.9694245630414513,
  u'text': u'This sentence is great!'}]
[{"position"=>[0, 23], "results"=>8.478955551191238e-05, "text"=>"This sentence is awful."}, {"position"=>[24, 47], "results"=>0.9694245630414513, "text"=>"This sentence is great!"}]
  [{u'position': [0, 23],
  u'results': 8.478955551191238e-05,
  u'text': u'This sentence is awful.'},
 {u'position': [24, 47],
  u'results': 0.9694245630414513,
  u'text': u'This sentence is great!'}]

The split keyword is currently not supported in Java.

library(indicoio)
  # batch output
  [[1]]
  [[1]]$text
  [1] This sentence is awful.
  [[1]]$result
  [1] .000084789555511
  [[1]]$position
  [1] [0, 23]

  [[2]]
  [[2]]$text
  [1] This sentence is great!
  [[2]]$result
  [1] 0.96942456304145
  [[2]]$position
  [1] [24, 47]
Array
(
    [0] => Array
        (
            [position] => Array
                (
                    [0] => 0
                    [1] => 23
                )

            [results] => 8.4789555511912E-5
            [text] => This sentence is awful.
        )

    [1] => Array
        (
            [position] => Array
                (
                    [0] => 24
                    [1] => 47
                )

            [results] => 0.96942456304145
            [text] => This sentence is great!
        )

)
[{u'position': [0, 23],
  u'results': 8.478955551191238e-05,
  u'text': u'This sentence is awful.'},
 {u'position': [24, 47],
  u'results': 0.9694245630414513,
  u'text': u'This sentence is great!'}]
[{u'position': [0, 23],
  u'results': 8.478955551191238e-05,
  u'text': u'This sentence is awful.'},
 {u'position': [24, 47],
  u'results': 0.9694245630414513,
  u'text': u'This sentence is great!'}]
import indicoio

indicoio.sentiment('This sentence is awful. This sentence is great!', split='sentence')
require 'indico'

Indico.sentiment("This sentence is awful. This sentence is great!", {"split"=>"sentence"})
var indico = require('indico.io')
indico.apiKey = "YOUR_API_KEY";

indico.sentiment("text to analyze", {'split': 'sentence'})
  .then(function(res) {
    console.log(res);
  }).catch(function(err) {
    console.warn(err);
  });
library(indicoio)

sentiment("This sentence is awful. This sentence is great!", split="sentence")
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = "YOUR_API_KEY";
IndicoIo::sentiment("This sentence is awful. This sentence is great!", array("split" => "sentence", array("split" => "sentence"));
?>
$.post('https://apiv2.indico.io/sentiment',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "This sentence is awful. This sentence is great!",
    'split': "sentence"
  })
).then(function(res) { console.log(res) });
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/sentiment' -d '{"data": "This sentence is awful. This sentence is great!", "split": "sentence"}'

Image Analysis

Use our models to analyze text in a variety of contexts!


:Filepath or Base64 Encoded Image: required: The API processes strings as a single piece of text and return a single result. You can also send a list of phrases to be processed all in one call(more efficient).
[params] :Map: optional: Some of the functions have optional parameters that are passed to the function with a map, the keys being the names of the options shown below.

[config] :Array: optional: Some of the functions have optional parameters that are passed to the function with an array, the keys being the names of the options shown below.

:String: required/optional: Your API key for authenticating your usage. If you haven't set your API key in another way, this is required.
:String: optional: If specified, calls will be made to the private cloud address provided. If you haven't purchased private infrastructure from us then this input is irrelevant.

Input Image Format

Images can be sent to the indicoio image analysis functions as URLs, file paths, base64 encoded images, numpy array objects, or skimage image objects. Sample code for loading in an image using skimage or PIL is provided below. Although images are scaled on our servers, use square crops for optimal performance. Both single and batch image requests of over 15 MB will be rejected.

Specifying Image URL

import indicoio

indicoio.fer('https://IMAGE_URL')

Specifying Filepath

import indicoio

indicoio.fer('FILEPATH')

Formatting images using skimage

import skimage.io
import indicoio

pixel_array = skimage.io.imread('FILEPATH')

indicoio.fer(pixel_array)

Formatting images using PIL and numpy

from PIL import Image
import numpy as np
import indicoio

image = Image.load('FILEPATH')
pixel_array = np.array(image)

indicoio.fer(pixel_array)

Images can be sent to the indico image analysis functions as URLs, file paths or base64 encoded JPEGs or PNGs. Sample code for loading in an image using the base64 RubyGem is provided below. Although images are scaled on our servers, use square crops for optimal performance. Both single and batch image requests of over 15 MB will be rejected.

Specifying Image URL

require 'indico'

url = "https://IMAGE_URL"
Indico.fer(url)

Specifying Filepath

require 'indico'

filepath = "PATH_TO_YOUR_IMAGE"
Indico.fer(filepath)

Formatting images using the Base64 RubyGem

require 'indico'
require 'base64'

filepath = "PATH_TO_YOUR_IMAGE"
base64data = Base64.encode64(File.open(filepath, "rb").read)
Indico.fer(base64data)

Images must be sent to the indico.io image analysis functions as URLs or base64 encoded JPEGs or PNGs. Sample code for loading in an image using the fs Node package is provided below. Although images are scaled on our servers, use square crops for optimal performance. Both single and batch image requests of over 15 MB will be rejected.

Specifying Image URL

var indico = require('indico.io')
indico.apiKey = "YOUR_API_KEY";

indico.fer("https://IMAGE_URL")
  .then(function(res) {
    console.log(res);
  }).catch(function(err) {
    console.warn(err);
  });

Sending an image using fs

var indico = require('indico.io');
var fs = require('fs');

indico.apiKey = "YOUR_API_KEY";

var filename = "PATH_TO_YOUR_IMAGE";

fs.readFile(filename, function(err, data) {
  base64data = new Buffer(data).toString('base64');
  indico.fer(base64data)
  .then(function(res) {
    console.log(res);
  }).catch(function(err) {
    console.warn(err);
  });
});

Images can be sent to the indico image analysis functions as Strings representing image URLs, file paths, BufferedImages and as File objects. Sample code for all three is provided below. Although images are scaled on our servers, use square crops for optimal performance. Both single and batch image requests of over 15 MB will be rejected.

Sending images through the API

import io.indico.Indico;
import io.indico.api.IndicoResult;
import javax.imageio.ImageIO;

Indico indico = new Indico("YOUR_API_KEY");
String filePath = "path/to/image.png";
String imageURL = "https://IMAGE_URL";

// From a URL
IndicoResult responseOne = indico.fer.predict(imageURL);

// As a String
IndicoResult responseTwo = indico.fer.predict(filePath);

// As a File
IndicoResult responseThree = indico.fer.predict(new File(filePath));

// As a BufferedImage
BufferedImage image = ImageIO.read(new File(filePath));
IndicoResult responseFour = indico.fer.predict(image, "png");

Images can be sent to the indicoio image analysis functions as Strings representing image URLs or file paths.
Although images are scaled on our servers, use square crops for optimal performance. Both single and batch image requests of over 15 MB will be rejected.

Specifying Image URL

library(indicoio)

fer("https://IMAGE_URL")

Specifying filepath

library(indicoio)

fer("PATH_IMAGE_FILE")

The IndicoIo image API requires image URLs, image filepaths or base64 encoded PNGs and JPGs. Instructions for loading images into this format are provided below.
Although images are scaled on our servers, use square crops for optimal performance. Both single and batch image requests of over 15 MB will be rejected.

<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;

$url = "https://IMAGE_URL";
$filepath = "/path/to/image";

$im = file_get_contents($filepath);
$b64data = base64_encode($im);

IndicoIo::fer($url);
IndicoIo::fer($filepath);
IndicoIo::fer($b64data);
?>

In your javascript examples we'll be using jQuery ($) to make requests to indico.
Sending JPG and PNG images to our API is also possible with plain Javascript! You can either provide a url that links to the image or a base64 encoded image.
Although images are scaled on our servers, try to use square crops when possible for optimal performance. Both single and batch image requests of over 15 MB will be rejected.

$.post('https://apiv2.indico.io/fer,
  JSON.stringify({
    api_key: "YOUR_API_KEY",
    data: "image-url or base64_image"
  })
).then(function(res) { console.log(res) });

Sending JPG and PNG images to our API is also possible with cURL! It requires that you base64 encode the image and send the new representation to our API.
Although images are scaled on our servers, try to use square crops when possible for optimal performance. Both single and batch image requests of over 15 MB will be rejected.

curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/fer' -d '{"data": "https://IMAGE_URL"}'

b64=$(cat example.png | base64)
echo "{\"data\":\"$b64\"}" > data.json
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/fer' -d @data.json

Facial Emotion Recognition


Determine the emotions expressed in an image of a human face.

Private cloud endpoint

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

Arguments

- refer to img format guide - required
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Boolean (defaults to False) - optional - When True, FER detects all faces in the image and returns their locations with a FER dictionary for each face (see Output for more information)
- Float (defaults to .8) - optional - The certainty threshold (between 0 and 1) the model uses to decide what to return as a face. Only used when detect is True.

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

Output

This function will return a dictionary with 6 key-value pairs. These key-value pairs represent the likelihood that each of 6 detectable emotions are expressed by the face in the analyzed image. The keys in the dictionary are strings containing the emotions (Angry, Sad, Neutral, Surprise, Fear, Happy) and the values are the probabilities that the face in the analyzed image is expressing each emotion.

Values less than 0.05 indicate that it is very unlikely the face is expressing the corresponding emotion.

Using the detect flag changes output format: When using the detect flag the results returned will be a list of dictionaries. Each dictionary in the list corresponds to a detected face. Each dictionary has two key-value pairs, the keys are "emotions" and "location". The value of "emotions" is the same dictionary described above with 6 key-value pairs. The value of "location" is the bounding box of the detected face in the form [x position of top left corner, y position of top-left corner, width of bounding box, height of bounding box].

# single output
{
    'happy': 0.00004324968926091062,
    'sad': 0.007702528578033991,
    'angry': 0.0002575132225946431,
    'fear': 0.2071775132225946431,
    'surprise': 0.008160047807935744,
    'neutral': 0.00015069427192724994
}

# batch output
[
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }, 
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
]
# single output
{
    'happy': 0.00004324968926091062,
    'sad': 0.007702528578033991,
    'angry': 0.0002575132225946431,
    'fear': 0.2071775132225946431,
    'surprise': 0.008160047807935744,
    'neutral': 0.00015069427192724994
}

# batch output
[
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }, 
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
]
// single output
{
    'happy': 0.00004324968926091062,
    'sad': 0.007702528578033991,
    'angry': 0.0002575132225946431,
    'fear': 0.2071775132225946431,
    'surprise': 0.008160047807935744,
    'neutral': 0.00015069427192724994
}

// batch output
[
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }, 
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
]
// single output
{
    'happy': 0.00004324968926091062,
    'sad': 0.007702528578033991,
    'angry': 0.0002575132225946431,
    'fear': 0.2071775132225946431,
    'surprise': 0.008160047807935744,
    'neutral': 0.00015069427192724994
}

// batch output
[
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }, 
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
]
// single output
{
    'happy': 0.00004324968926091062,
    'sad': 0.007702528578033991,
    'angry': 0.0002575132225946431,
    'fear': 0.2071775132225946431,
    'surprise': 0.008160047807935744,
    'neutral': 0.00015069427192724994
}

// batch output
[
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }, 
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
]
# single output
[[1]]
[[1]]$happy
[1] 0.00004324968926091062
[[1]]$sad
[1] 0.007702528578033991
[[1]]$angry
[1] 0.0002575132225946431
[[1]]$fear
[1] 0.2071775132225946431
[[1]]$surprise
[1] 0.008160047807935744
[[1]]$neutral
[1] 0.00015069427192724994

# batch output
[[1]]
[[1]]$happy
[1] 0.00004324968926091062
[[1]]$sad
[1] 0.007702528578033991
[[1]]$angry
[1] 0.0002575132225946431
[[1]]$fear
[1] 0.2071775132225946431
[[1]]$surprise
[1] 0.008160047807935744
[[1]]$neutral
[1] 0.00015069427192724994

[[2]]
[[2]]$happy
[1] 0.00004324968926091062
[[2]]$sad
[1] 0.007702528578033991
[[2]]$angry
[1] 0.0002575132225946431
[[2]]$fear
[1] 0.2071775132225946431
[[2]]$surprise
[1] 0.008160047807935744
[[2]]$neutral
[1] 0.00015069427192724994
// single output
Array (
  [happy] => 0.00004324968926091062,
  [sad] => 0.007702528578033991,
  [angry] => 0.0002575132225946431,
  [fear] => 0.2071775132225946431,
  [surprise] => 0.008160047807935744,
  [neutral] => 0.00015069427192724994
)

// batch output
Array (
    [0] => Array (
        [happy] => 0.00004324968926091062,
        [sad] => 0.007702528578033991,
        [angry] => 0.0002575132225946431,
        [fear] => 0.2071775132225946431,
        [surprise] => 0.008160047807935744,
        [neutral] => 0.00015069427192724994
    ), 
    [1] => Array (
        [happy] => 0.00004324968926091062,
        [sad] => 0.007702528578033991,
        [angry] => 0.0002575132225946431,
        [fear] => 0.2071775132225946431,
        [surprise] => 0.008160047807935744,
        [neutral] => 0.00015069427192724994
    )
)
# single output
{
    'happy': 0.00004324968926091062,
    'sad': 0.007702528578033991,
    'angry': 0.0002575132225946431,
    'fear': 0.2071775132225946431,
    'surprise': 0.008160047807935744,
    'neutral': 0.00015069427192724994
}

# batch output
[
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }, 
    {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.fer("<IMAGE>")

# batch example
indicoio.fer([
    "<IMAGE>",
    "<IMAGE>"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.fer("<IMAGE>")

# batch example
Indico.fer([
    "<IMAGE>",
    "<IMAGE>"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.fer("<IMAGE>")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "<IMAGE>",
    "<IMAGE>"
];
indico.fer(batchInput)
  .then(response)
  .catch(logError);
/ single example
$.post(
  'https://apiv2.indico.io/fer',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "<IMAGE>",
    'detect': true
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/fer/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "<IMAGE>",
      "<IMAGE>"
    ],
    'detect': true
  })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.image.FacialEmotion;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.fer.predict(
    "<IMAGE>"
);
Map<FacialEmotion, Double> result = single.getFer();
System.out.println(result);

// batch example
String[] example = {
    "<IMAGE>", 
    "<IMAGE>"
};
BatchIndicoResult multiple = indico.fer.predict(example);
List<Map<FacialEmotion, Double>> results = multiple.getFer();
System.out.println(results);
library(indicoio)

# single example
fer(
    "<IMAGE>", 
    api_key = 'YOUR_API_KEY'
)

# batch example
fer(
    c(
        "<IMAGE>",
        "<IMAGE>"
    ), 
    api_key = 'YOUR_API_KEY'
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::fer(
    "<IMAGE>"
);

# batch example
IndicoIo::fer([
    "<IMAGE>",
    "<IMAGE>"
);

?>
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/fer' -d @data.json

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/fer/batch' -d @data.json

Image Features


Convert images into meaningful feature vectors.
Extracts abstract image features for use as inputs to learning algorithms.

Private cloud endpoint

POST https://[cloud].indico.domains/imagefeatures/[batch]/?version=[version]

Arguments

- refer to img format guide - required
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Integer (defaults to 3) - optional - the version of the model to use (2, or 3; see output for more information)

Output

List of 4096 numbers (floats). Each number corresponds to the strength of that feature in the feature vector. Version 3 is the highest quality and has the lowest error rate. Version 1 has been deprecated.

# single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 2042 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

# batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
# single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 2042 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

# batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
// single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 2042 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

// batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
// single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 2042 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

// batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
// single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 2042 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

// batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
# single output
[[1]]
[1] 0.004583298490803539
[[2]]
[1] 0.0022990592931235367
[[3]]
[1] 0.0007262553487194683
... 2042 features omitted ...
[[2046]]
[1] 0.03889081635783809
[[2047]]
[1] 0.0016173627610188248
[[2048]]
[1] 0.0006673354405158707

# batch output
[[1]][[1]]
[1] 0.004583298490803539
[[1]][[2]]
[1] 0.0022990592931235367
[[1]][[3]]
[1] 0.0007262553487194683
... 2042 features omitted ...
[[1]][[2046]]
[1] 0.03889081635783809
[[1]][[2047]]
[1] 0.0016173627610188248
[[1]][[2048]]
[1] 0.0006673354405158707

[[2]][[1]]
[1] 0.004583298490803539
[[2]][[2]]
[1] 0.0022990592931235367
[[2]][[3]]
[1] 0.0007262553487194683
... 2042 features omitted ...
[[2]][[2046]]
[1] 0.03889081635783809
[[2]][[2047]]
[1] 0.0016173627610188248
[[2]][[2048]]
[1] 0.0006673354405158707
// single output
Array (
  [0] => 0.004583298490803539,
  [1] => 0.0022990592931235367,
  [2] => 0.0007262553487194683,
  ... 2042 features omitted ...,
  [2045] => 0.03889081635783809,
  [2046] => 0.0016173627610188248,
  [2047] => 0.0006673354405158707
)

// batch output
Array (
    [0] => Array (
    [0] => 0.004583298490803539,
    [1] => 0.0022990592931235367,
    [2] => 0.0007262553487194683,
    ... 2042 features omitted ...,
    [2045] => 0.03889081635783809,
    [2046] => 0.0016173627610188248,
    [2047] => 0.0006673354405158707
  ), 
    [1] => Array (
    [0] => 0.004583298490803539,
    [1] => 0.0022990592931235367,
    [2] => 0.0007262553487194683,
    ... 2042 features omitted ...,
    [2045] => 0.03889081635783809,
    [2046] => 0.0016173627610188248,
    [2047] => 0.0006673354405158707
  )
)
# single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 2042 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

# batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 2042 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.image_features("<IMAGE>")

# batch example
indicoio.image_features([
    "<IMAGE>",
    "<IMAGE>"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.image_features("<IMAGE>")

# batch example
Indico.image_features([
    "<IMAGE>",
    "<IMAGE>"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.imageFeatures("<IMAGE>")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "<IMAGE>",
    "<IMAGE>"
];
indico.imageFeatures(batchInput)
  .then(response)
  .catch(logError);
/ single example
$.post(
  'https://apiv2.indico.io/imagefeatures',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "<IMAGE>"
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/imagefeatures/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "<IMAGE>",
      "<IMAGE>"
    ]
  })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.imageFeatures.predict(
    "<IMAGE>"
);
Double result = single.getImageFeatures();
System.out.println(result);

// batch example
String[] example = {
    "<IMAGE>", 
    "<IMAGE>"
};
BatchIndicoResult multiple = indico.imageFeatures.predict(example);
List<Double> results = multiple.getImageFeatures();
System.out.println(results);
library(indicoio)

# single example
image_features(
    "<IMAGE>", 
    api_key = 'YOUR_API_KEY'
)

# batch example
image_features(
    c(
        "<IMAGE>",
        "<IMAGE>"
    ), 
    api_key = 'YOUR_API_KEY'
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::image_features(
    "<IMAGE>"
);

# batch example
IndicoIo::image_features([
    "<IMAGE>",
    "<IMAGE>"
);

?>
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/imagefeatures' -d @data.json

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/imagefeatures/batch' -d @data.json

Facial Features


Convert images of human faces into meaningful feature vectors.
Extracts abstract image features for use as inputs to learning algorithms.

Private cloud endpoint

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

Arguments

- refer to img format guide - required
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Boolean (defaults to True) - optional - When True, fer detects all faces in the image and returns the location and fer dictionary for each face (see Output for more information)
- Float (defaults to .8) - optional - The certainty threshold (between 0 and 1) the model uses to decide what to return as a face. Only used when 'detect is True.

Output

List of 48 numbers (floats). Each number corresponds to the strength of that feature in the feature vector.

# single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 42 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

# batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
# single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 42 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

# batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
// single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 42 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

// batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
// single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 42 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

// batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
// single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 42 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

// batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
# single output
[[1]]
[1] 0.004583298490803539
[[2]]
[1] 0.0022990592931235367
[[3]]
[1] 0.0007262553487194683
... 42 features omitted ...
[[46]]
[1] 0.03889081635783809
[[47]]
[1] 0.0016173627610188248
[[48]]
[1] 0.0006673354405158707

# batch output
[[1]][[1]]
[1] 0.004583298490803539
[[1]][[2]]
[1] 0.0022990592931235367
[[1]][[3]]
[1] 0.0007262553487194683
... 42 features omitted ...
[[1]][[46]]
[1] 0.03889081635783809
[[1]][[47]]
[1] 0.0016173627610188248
[[1]][[48]]
[1] 0.0006673354405158707

[[2]][[1]]
[1] 0.004583298490803539
[[2]][[2]]
[1] 0.0022990592931235367
[[2]][[3]]
[1] 0.0007262553487194683
... 42 features omitted ...
[[2]][[46]]
[1] 0.03889081635783809
[[2]][[47]]
[1] 0.0016173627610188248
[[2]][[48]]
[1] 0.0006673354405158707
// single output
Array (
  [0] => 0.004583298490803539,
  [1] => 0.0022990592931235367,
  [2] => 0.0007262553487194683,
  ... 42 features omitted ...,
  [45] => 0.03889081635783809,
  [46] => 0.0016173627610188248,
  [47] => 0.0006673354405158707
)

// batch output
Array (
    [0] => Array (
    [0] => 0.004583298490803539,
    [1] => 0.0022990592931235367,
    [2] => 0.0007262553487194683,
    ... 42 features omitted ...,
    [45] => 0.03889081635783809,
    [46] => 0.0016173627610188248,
    [47] => 0.0006673354405158707
  ), 
    [1] => Array (
    [0] => 0.004583298490803539,
    [1] => 0.0022990592931235367,
    [2] => 0.0007262553487194683,
    ... 42 features omitted ...,
    [45] => 0.03889081635783809,
    [46] => 0.0016173627610188248,
    [47] => 0.0006673354405158707
  )
)
# single output
[
    0.004583298490803539,
    0.0022990592931235367,
    0.0007262553487194683,
    ... 42 features omitted ...,
    0.03889081635783809,
    0.0016173627610188248,
    0.0006673354405158707
]

# batch output
[
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ], 
    [
        0.004583298490803539,
        0.0022990592931235367,
        0.0007262553487194683,
        ... 42 features omitted ...,
        0.03889081635783809,
        0.0016173627610188248,
        0.0006673354405158707
    ]
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.facial_features("<IMAGE>")

# batch example
indicoio.facial_features([
    "<IMAGE>",
    "<IMAGE>"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.facial_features("<IMAGE>")

# batch example
Indico.facial_features([
    "<IMAGE>",
    "<IMAGE>"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.facialFeatures("<IMAGE>")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "<IMAGE>",
    "<IMAGE>"
];
indico.facialFeatures(batchInput)
  .then(response)
  .catch(logError);
/ single example
$.post(
  'https://apiv2.indico.io/facialfeatures',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "<IMAGE>"
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/facialfeatures/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "<IMAGE>",
      "<IMAGE>"
    ]
  })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.facialFeatures.predict(
    "<IMAGE>"
);
Double result = single.getFacialFeatures();
System.out.println(result);

// batch example
String[] example = {
    "<IMAGE>", 
    "<IMAGE>"
};
BatchIndicoResult multiple = indico.facialFeatures.predict(example);
List<Double> results = multiple.getFacialFeatures();
System.out.println(results);
library(indicoio)

# single example
facial_features(
    "<IMAGE>", 
    api_key = 'YOUR_API_KEY'
)

# batch example
facial_features(
    c(
        "<IMAGE>",
        "<IMAGE>"
    ), 
    api_key = 'YOUR_API_KEY'
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::facial_features(
    "<IMAGE>"
);

# batch example
IndicoIo::facial_features([
    "<IMAGE>",
    "<IMAGE>"
);

?>
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/facialfeatures' -d @data.json

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/facialfeatures/batch' -d @data.json

Facial Localization


Returns a list of face bounding boxes found in a given image.
Available for version 0.8 and later.

Private cloud endpoint

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

Arguments

- refer to img format guide - required
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Float (defaults to .8) - optional - The certainty threshold (between 0 and 1) the model uses to decide what to return as a face
- Boolean (defaults to False) - optional - If set to True, output is a list of cropped face images, each represented by a two dimensional array of integer pixel values

Output

This function will return a list of dictionaries that map from "top_left_corner" and "bottom_right_corner" to pixel coordinate pairs. Each mapping uniquely identifies a facial bounding box. The origin (0, 0) is assumed to be upper left corner. If the `crop` flag is set to True, output will instead be a list of the two dimensional pixel arrays of those images.

# single output
{
    'top_left_corner': (10, 24),
    'bottom_right_corner': : (87, 96),
}

# batch output
[
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }, 
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }
]
# single output
{
    'top_left_corner': (10, 24),
    'bottom_right_corner': : (87, 96),
}

# batch output
[
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }, 
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }
]
// single output
{
    'top_left_corner': (10, 24),
    'bottom_right_corner': : (87, 96),
}

// batch output
[
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }, 
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }
]
// single output
{
    'top_left_corner': (10, 24),
    'bottom_right_corner': : (87, 96),
}

// batch output
[
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }, 
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }
]
// single output
{
    'top_left_corner': (10, 24),
    'bottom_right_corner': : (87, 96),
}

// batch output
[
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }, 
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }
]
# single output
[[1]]
[[1]]$top_left_corner
[[1]]$top_left_corner[[1]]
[1] 10

[[1]]$top_left_corner[[2]]
[1] 24


[[1]]$bottom_right_corner
[[1]]$bottom_right_corner[[1]]
[1] 87

[[1]]$bottom_right_corner[[2]]
[1] 96

# batch output
[[1]]
[[1]]
[[1]]$top_left_corner
[[1]]$top_left_corner[[1]]
[1] 10

[[1]]$top_left_corner[[2]]
[1] 24


[[1]]$bottom_right_corner
[[1]]$bottom_right_corner[[1]]
[1] 87

[[1]]$bottom_right_corner[[2]]
[1] 96

[[2]]
[[1]]
[[1]]$top_left_corner
[[1]]$top_left_corner[[1]]
[1] 10

[[1]]$top_left_corner[[2]]
[1] 24


[[1]]$bottom_right_corner
[[1]]$bottom_right_corner[[1]]
[1] 87

[[1]]$bottom_right_corner[[2]]
[1] 96
// single output
Array 
(
    [0] => Array
        (
            [top_left_corner] => 10,
            [bottom_right_corner] => 96,
        )
)

// batch output
Array (
    [0] => Array 
        (
            [0] => Array
                (
                    [top_left_corner] => 10,
                    [bottom_right_corner] => 96,
                )
        ), 
    [1] => Array 
        (
            [0] => Array
                (
                    [top_left_corner] => 10,
                    [bottom_right_corner] => 96,
                )
        )
)
# single output
{
    'top_left_corner': (10, 24),
    'bottom_right_corner': : (87, 96),
}

# batch output
[
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }, 
    {
        'top_left_corner': (10, 24),
        'bottom_right_corner': : (87, 96),
    }
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.facial_localization("<IMAGE>")

# batch example
indicoio.facial_localization([
    "<IMAGE>",
    "<IMAGE>"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.facial_localization("<IMAGE>")

# batch example
Indico.facial_localization([
    "<IMAGE>",
    "<IMAGE>"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.facialLocalization("<IMAGE>")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "<IMAGE>",
    "<IMAGE>"
];
indico.facialLocalization(batchInput)
  .then(response)
  .catch(logError);
/ single example
$.post(
  'https://apiv2.indico.io/faciallocalization',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "<IMAGE>",
    'sensitivity': 0.8
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/faciallocalization/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "<IMAGE>",
      "<IMAGE>"
    ],
    'sensitivity': 0.8
  })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.facialLocalization.predict(
    "<IMAGE>"
);
Double result = single.getFacialLocalization();
System.out.println(result);

// batch example
String[] example = {
    "<IMAGE>", 
    "<IMAGE>"
};
BatchIndicoResult multiple = indico.facialLocalization.predict(example);
List results = multiple.getFacialLocalization();
System.out.println(results);
library(indicoio)

# single example
facial_localization(
    "<IMAGE>", 
    api_key = 'YOUR_API_KEY'
)

# batch example
facial_localization(
    c(
        "<IMAGE>",
        "<IMAGE>"
    ), 
    api_key = 'YOUR_API_KEY'
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::facial_localization(
    "<IMAGE>"
);

# batch example
IndicoIo::facial_localization([
    "<IMAGE>",
    "<IMAGE>"
);

?>
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/faciallocalization' -d @data.json

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/faciallocalization/batch' -d @data.json

Content Filtering


Determines whether or not an image contains mature content.
Available for version 0.8 and later.

Private cloud endpoint

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

Arguments

- refer to img format guide - required
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

This function will return a number between 0 and 1. This number is a probability representing the likelihood that the analyzed image has offensive content. Values greater than 0.5 indicate that the image most likely contains offensive content, while values less than 0.5 indicate that the image probably does not contain offensive content.

# single output
0.9782025594088044

# batch output
[
    0.9782025594088044, 
    0.3782025594088044
]
# single output
0.9782025594088044

# batch output
[
   0.9782025594088044, 
   0.3782025594088044
]
// single output
0.9782025594088044

// batch output
[
   0.9782025594088044,
   0.3782025594088044
]
// single output
0.9782025594088044

// batch output
[
   0.9782025594088044,
   0.3782025594088044
]
// single output
0.9782025594088044

// batch output
[
    0.9782025594088044,
    0.3782025594088044
]
# single output
0.9782025594088044

# batch output
[
    0.9782025594088044,
    0.3782025594088044
]
// single output
0.9782025594088044

// batch output
Array ( 
    [0] => 0.9782025594088044,
    [1] => 0.3782025594088044
)
# single output
0.9782025594088044

# batch output
[
    0.9782025594088044, 
    0.3782025594088044
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.content_filtering("<IMAGE>")

# batch example
indicoio.content_filtering([
    "<IMAGE>",
    "<IMAGE>"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.content_filtering("<IMAGE>")

# batch example
Indico.content_filtering([
    "<IMAGE>",
    "<IMAGE>"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.contentFiltering("<IMAGE>")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "<IMAGE>",
    "<IMAGE>"
];
indico.contentFiltering(batchInput)
  .then(response)
  .catch(logError);
/ single example
$.post(
  'https://apiv2.indico.io/contentfiltering',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "<IMAGE>"
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/contentfiltering/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "<IMAGE>",
      "<IMAGE>"
    ]
  })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.contentFiltering.predict(
    "<IMAGE>"
);
Double result = single.getContentFiltering();
System.out.println(result);

// batch example
String[] example = {
    "<IMAGE>", 
    "<IMAGE>"
};
BatchIndicoResult multiple = indico.contentFiltering.predict(example);
List<Double> results = multiple.getContentFiltering();
System.out.println(results);
library(indicoio)

# single example
content_filtering(
    "<IMAGE>", 
    api_key = 'YOUR_API_KEY'
)

# batch example
content_filtering(
    c(
        "<IMAGE>",
        "<IMAGE>"
    ), 
    api_key = 'YOUR_API_KEY'
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::content_filtering(
    "<IMAGE>"
);

# batch example
IndicoIo::content_filtering([
    "<IMAGE>",
    "<IMAGE>"
);

?>
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/contentfiltering' -d @data.json

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/contentfiltering/batch' -d @data.json

Image Recognition


Determines the subject of an image.

Private cloud endpoint

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

Arguments

- refer to img format guide - required
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Integer - optional - only return this many of the most likely category
- Float (defaults to 0.) - optional - only return category with likelihood greater than this number
- Boolean (defaults to False) - optional - when True, uses a higher quality model that is slower for batch requests

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

Output

This function will return a dictionary with 1000 key-value pairs. These key-value pairs represent the likelihood that the analyzed image is one of 1000 possible subjects. The keys in the dictionary are strings containing the subject names and the values are the probabilities that the analyzed image is of each subject.

# single output
{
    'kit fox, vulpes macrotis ': 0.004583298490803539,
    'english setter ': 0.0022990592931235367,
    'australian terrier ': 0.0007262553487194683,
    ... 994 topics omitted ...,
    'wrestling': 0.03889081635783809,
    'briard': 0.0016173627610188248,
    'border terrier': 0.0006673354405158707
}

# batch output
[
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    },
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    }
]
# single output
{
    'kit fox, vulpes macrotis ': 0.004583298490803539,
    'english setter ': 0.0022990592931235367,
    'australian terrier ': 0.0007262553487194683,
    ... 994 topics omitted ...,
    'wrestling': 0.03889081635783809,
    'briard': 0.0016173627610188248,
    'border terrier': 0.0006673354405158707
}

# batch output
[
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    },
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    }
]
// single output
{
    'kit fox, vulpes macrotis ': 0.004583298490803539,
    'english setter ': 0.0022990592931235367,
    'australian terrier ': 0.0007262553487194683,
    ... 994 topics omitted ...,
    'wrestling': 0.03889081635783809,
    'briard': 0.0016173627610188248,
    'border terrier': 0.0006673354405158707
}

// batch output
[
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    },
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    }
]
// single output
{
    'kit fox, vulpes macrotis ': 0.004583298490803539,
    'english setter ': 0.0022990592931235367,
    'australian terrier ': 0.0007262553487194683,
    ... 994 topics omitted ...,
    'wrestling': 0.03889081635783809,
    'briard': 0.0016173627610188248,
    'border terrier': 0.0006673354405158707
}

// batch output
[
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    },
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    }
]
// single output
{
    'kit fox, vulpes macrotis ': 0.004583298490803539,
    'english setter ': 0.0022990592931235367,
    'australian terrier ': 0.0007262553487194683,
    ... 994 topics omitted ...,
    'wrestling': 0.03889081635783809,
    'briard': 0.0016173627610188248,
    'border terrier': 0.0006673354405158707
}

// batch output
[
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    },
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    }
]
# single output
[[1]]
[[1]]$kit fox, vulpes macrotis 
[1] 0.004583298490803539
[[1]]$english setter 
[1] 0.0022990592931235367
[[1]]$australian terrier 
[1] 0.0007262553487194683
... 994 topics omitted ...
[[1]]$wrestling
[1] 0.03889081635783809
[[1]]$briard
[1] 0.0016173627610188248
[[1]]$border terrier
[1] 0.0006673354405158707

# batch output
[[1]]
[[1]]$kit fox, vulpes macrotis 
[1] 0.004583298490803539
[[1]]$english setter 
[1] 0.0022990592931235367
[[1]]$australian terrier 
[1] 0.0007262553487194683
... 994 topics omitted ...
[[1]]$wrestling
[1] 0.03889081635783809
[[1]]$briard
[1] 0.0016173627610188248
[[1]]$border terrier
[1] 0.0006673354405158707

[[2]]
[[2]]$kit fox, vulpes macrotis 
[1] 0.004583298490803539
[[2]]$english setter 
[1] 0.0022990592931235367
[[2]]$australian terrier 
[1] 0.0007262553487194683
... 994 topics omitted ...
[[2]]$wrestling
[1] 0.03889081635783809
[[2]]$briard
[1] 0.0016173627610188248
[[2]]$border terrier
[1] 0.0006673354405158707
// single output
Array (
  [kit fox, vulpes macrotis ] => 0.004583298490803539,
  [english setter ] => 0.0022990592931235367,
  [australian terrier ] => 0.0007262553487194683,
  ... 994 topics omitted ...,
  [wrestling] => 0.03889081635783809,
  [briard] => 0.0016173627610188248,
  [border terrier] => 0.0006673354405158707
)

// batch output
Array (
    [0] => Array (
        [kit fox, vulpes macrotis ] => 0.004583298490803539,
        [english setter ] => 0.0022990592931235367,
        [australian terrier ] => 0.0007262553487194683,
        ... 994 topics omitted ...,
        [wrestling] => 0.03889081635783809,
        [briard] => 0.0016173627610188248,
        [border terrier] => 0.0006673354405158707
    ),
    [1] => Array (
        [kit fox, vulpes macrotis ] => 0.004583298490803539,
        [english setter ] => 0.0022990592931235367,
        [australian terrier ] => 0.0007262553487194683,
        ... 994 topics omitted ...,
        [wrestling] => 0.03889081635783809,
        [briard] => 0.0016173627610188248,
        [border terrier] => 0.0006673354405158707
    )
)
# single output
{
    'kit fox, vulpes macrotis ': 0.004583298490803539,
    'english setter ': 0.0022990592931235367,
    'australian terrier ': 0.0007262553487194683,
    ... 994 topics omitted ...,
    'wrestling': 0.03889081635783809,
    'briard': 0.0016173627610188248,
    'border terrier': 0.0006673354405158707
}

# batch output
[
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    },
    {
        'kit fox, vulpes macrotis ': 0.004583298490803539,
        'english setter ': 0.0022990592931235367,
        'australian terrier ': 0.0007262553487194683,
        ... 994 topics omitted ...,
        'wrestling': 0.03889081635783809,
        'briard': 0.0016173627610188248,
        'border terrier': 0.0006673354405158707
    }
]
Complete List of Tags

A complete list of tags returned can be found here.

import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.image_recognition("<IMAGE>")

# batch example
indicoio.image_recognition([
    "<IMAGE>",
    "<IMAGE>"
])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.image_recognition("<IMAGE>")

# batch example
Indico.image_recognition([
    "<IMAGE>",
    "<IMAGE>"
])
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

// single example
indico.imageRecognition("<IMAGE>")
  .then(response)
  .catch(logError);

// batch example
var batchInput = [
    "<IMAGE>",
    "<IMAGE>"
];
indico.imageRecognition(batchInput)
  .then(response)
  .catch(logError);
/ single example
$.post(
  'https://apiv2.indico.io/imagerecognition',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "<IMAGE>",
    'threshold': 0.01
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/imagerecognition/batch',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "<IMAGE>",
      "<IMAGE>"
    ],
    'threshold': 0.01
  })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.imageRecognition.predict(
    "<IMAGE>"
);
Double result = single.getImageRecognition();
System.out.println(result);

// batch example
String[] example = {
    "<IMAGE>",
    "<IMAGE>"
};
BatchIndicoResult multiple = indico.imageRecognition.predict(example);
List<Double> results = multiple.getImageRecognition();
System.out.println(results);
library(indicoio)

# single example
image_recognition(
    "<IMAGE>",
    api_key = 'YOUR_API_KEY'
)

# batch example
image_recognition(
    c(
        "<IMAGE>",
        "<IMAGE>"
    ),
    api_key = 'YOUR_API_KEY'
)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

# single example
IndicoIo::image_recognition(
    "<IMAGE>"
);

# batch example
IndicoIo::image_recognition([
    "<IMAGE>",
    "<IMAGE>"
);

?>
# single example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/imagerecognition' -d @data.json

# batch example
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/imagerecognition/batch' -d @data.json

Analyze Image


Make calls to many APIs in parallel.

Private cloud endpoint

POST https://[cloud].indico.domains/apis/multiapi/[batch]/

Arguments

- image or list of images - required - images to be analyzed
- list - required - the list of APIs to run in parallel
- String - optional - your indico API key
- String - optional - your private cloud subdomain

Output

A dictionary where each key maps to the specified models' results. If used on a single input (not recommemnded as using multiple APIs quickly uses up your allotted calls!) you'll get the default response, otherwise a list of the default.

# single image output
{
    'image_features': [
        0.0, 
        1.84086012840271, 
        ...
    ],
    'fer': {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
}

# batch output
{
    'image_features': [
        [0.0, 1.84086012840271, ...],
        [0.0, 1.84086012840271, ...]
    ]
    'fer': [
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }, 
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }
    ]
}
# single image output
{
    'image_features': [
        0.0, 
        1.84086012840271, 
        ...
    ],
    'fer': {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
}

# batch output
{
    'image_features': [
        [0.0, 1.84086012840271, ...],
        [0.0, 1.84086012840271, ...]
    ]
    'fer': [
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }, 
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }
    ]
}
// single image output
{
    'image_features': [
        0.0, 
        1.84086012840271, 
        ...
    ],
    'fer': {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
}

// batch output
{
    'image_features': [
        [0.0, 1.84086012840271, ...],
        [0.0, 1.84086012840271, ...]
    ]
    'fer': [
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }, 
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }
    ]
}
// single image output
{
    'image_features': [
        0.0, 
        1.84086012840271, 
        ...
    ],
    'fer': {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
}

// batch output
{
    'image_features': [
        [0.0, 1.84086012840271, ...],
        [0.0, 1.84086012840271, ...]
    ]
    'fer': [
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }, 
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }
    ]
}
// single image output
{
    "image_features": [
        0.0, 
        1.84086012840271, 
        ...
    ],
    "fer": {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
}

// batch output
{
    "image_features": [
        [0.0, 1.84086012840271, ...],
        [0.0, 1.84086012840271, ...]
    ]
    "fer": [
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }, 
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }
    ]
}
# only showing batch output due to size
$image_features
$image_features[[1]]
$image_features[[1]][[1]]
[1] 0
$image_features[[1]][[2]]
[1] 0
...
$image_features[[1]][[2048]]
[1] 0.5831634

$image_features[[2]]
$image_features[[2]][[1]]
[1] 0
$image_features[[2]][[2]]
[1] 1.206545
...
$image_features[[2]][[2048]]
[1] 0

$fer
$fer[[1]]
$fer[[1]]$Angry
[1] 0.07278215
$fer[[1]]$Sad
[1] 0.3101322
$fer[[1]]$Neutral
[1] 0.2584309
$fer[[1]]$Surprise
[1] 0.05389213
$fer[[1]]$Fear
[1] 0.1396564
$fer[[1]]$Happy
[1] 0.1651063


$fer[[2]]
$fer[[2]]$Angry
[1] 0.07278215
$fer[[2]]$Sad
[1] 0.3101322
$fer[[2]]$Neutral
[1] 0.2584309
$fer[[2]]$Surprise
[1] 0.05389213
$fer[[2]]$Fear
[1] 0.1396564
$fer[[2]]$Happy
[1] 0.1651063
// single image output
Array(
    'image_features' => Array(
        0.0, 
        1.84086012840271, 
        ...
    ),
    'fer' => Array (
            [happy] => 0.00004324968926091062,
            [sad] => 0.007702528578033991,
            [angry] => 0.0002575132225946431,
            [fear] => 0.2071775132225946431,
            [surprise] => 0.008160047807935744,
            [neutral] => 0.00015069427192724994
        )
)

// batch output
Array(
    'image_features' => Array(
        [0] => Array(0.0, 1.84086012840271, ...),
        [1] => Array(0.0, 1.84086012840271, ...)
    )
    'fer' => Array(
        [0] => Array (
            [happy] => 0.00004324968926091062,
            [sad] => 0.007702528578033991,
            [angry] => 0.0002575132225946431,
            [fear] => 0.2071775132225946431,
            [surprise] => 0.008160047807935744,
            [neutral] => 0.00015069427192724994
        ), 
        [1] => Array (
            [happy] => 0.00004324968926091062,
            [sad] => 0.007702528578033991,
            [angry] => 0.0002575132225946431,
            [fear] => 0.2071775132225946431,
            [surprise] => 0.008160047807935744,
            [neutral] => 0.00015069427192724994
        )
    )
)
# single image output
{
    'image_features': [
        0.0, 
        1.84086012840271, 
        ...
    ],
    'fer': {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
}

# batch output
{
    'image_features': [
        [0.0, 1.84086012840271, ...],
        [0.0, 1.84086012840271, ...]
    ]
    'fer': [
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }, 
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }
    ]
}
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.analyze_image("<IMAGE>", apis=["image_features", "fer"])

# batch example
indicoio.analyze_image([
    "<IMAGE>", 
    "<IMAGE>"
], apis=["image_features", "fer"])
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.analyze_image("<IMAGE>", {apis:["image_features", "fer"]})

# batch example
Indico.analyze_image([
    "<IMAGE>", 
    "<IMAGE>"
], {apis:["image_features", "fer"]})
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }
  
// single example
indico.analyzeImage("<IMAGE>", {apis: ["image_features", "fer"]})
  .then(response)
  .catch(logError);

// batch example
indico.analyzeImage([
    "<IMAGE>", 
    "<IMAGE>"
], {apis: ["image_features", "fer"]})
  .then(response)
  .catch(logError);
// single example
$.post(
  'https://apiv2.indico.io/apis/multiapi?apis=image_features,fer',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': "<IMAGE>"
  })
).then(function(res) { console.log(res) });

// batch example
$.post(
  'https://apiv2.indico.io/apis/multiapi/batch?apis=image_features,fer',
  JSON.stringify({
    'api_key': "YOUR_API_KEY",
    'data': [
      "<IMAGE>",
      "<IMAGE>"
    ]
  })
).then(function(res) { console.log(res) });
import io.indico.Indico;
import io.indico.api.image.FacialEmotion;
import io.indico.api.BatchIndicoResult;

Map<String, List> params = new HashMap()
ArrayList<String> apiList = new ArrayList<String>;
apiList.add("image_features");
apiList.add("fer");
params.put("apis", apiList);

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.analyzeImage.predict(
    "<IMAGE>",
    params
);
Map<String, Map<FacialEmotion, Double>> result = single.getAnalyzeImage();
System.out.println(result);

// batch example
String[] batchExample = {
    <IMAGE>, 
    <IMAGE>
};
BatchIndicoResult batch = indico.analyzeImage.predict(batchExample,
    params
);
Map<String, ArrayList<Map<FacialEmotion, Double>>> result = batch.getAnalyzeImage();
System.out.println(result);
library(indicoio)

# single example
analyze_image(
    "<IMAGE>",
    apis = ['image_features', 'fer'],
    api_key = 'YOUR_API_KEY'
)

# single example
analyze_image(
    c(<IMAGE>, <IMAGE>),
    apis = ['image_features', 'fer'],
    api_key = 'YOUR_API_KEY'
)
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\IndicoIo as IndicoIo;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

$params = array(
    'apis' => array('image_features', 'fer')
);

# single example
IndicoIo::analyze_image(
    <IMAGE>,
    $params
);

# single example
IndicoIo::analyze_image(
    Array(<IMAGE>, <IMAGE>),
    $params
);

?>
# single example with URL
curl 'https://apiv2.indico.io/apis/multiapi?apis=image_features,fer' -d @data.json

# batch example
curl 'https://apiv2.indico.io/apis/multiapi/batch?apis=image_features,fer' -d @data.json

About Custom Collection

Not everyone's needs align with what indico offers out of the box, so we also provide a generalized solution that learns to recognize patterns in your data. This means that you can apply our technology to a specific use case, as well as train your model on the data most relevant to you.

What is this?
It's a way to automatically learn about new data based on the patterns in past data. For example, if you had a photo sharing app with user specified scene tags, you could use 4,000 tagged photos to predict tags for the remaining 17,000 untagged ones. Right now we support one label per input, but there are ways to work around that.

Who is this for?
Anyone who currently has to label text or image data by hand or has ever shied away from building great things that might require continuous, manual labelling.

What do I need?
All you need is a well defined problem. Say you want to see what kinds of posts your followers like. If you took the text from your posts and passed the amount of likes for each one as a label, you could create a Collection that predicts how much your audience will like new posts. If you're working with a completely unlabeled dataset, you and your team can use our CrowdLabel tool to seamlessly and quickly upload, label, and process data. You can then train a Custom Collection on your newly labeled dataset.

How much do I need?
This one's a bit of a gray area depending on your application. Having very little data is rarely helpful, but having huge amounts doesn't guarantee accurate predictions either. For starters, you should aim for your data to only communicate relevant information. Having a border on all your nature photos could cause your image classifier to believe any bordered image represents nature. To give you a better idea, here's a table that describes how many samples per label you ought to start with on tasks of varying difficulties:

Task Text Samples Image Samples
Easy 100 10
Medium 500 50
Hard 2000 200

How many samples can I add?
Custom Collections is designed to provide high quality predictions with as few data points as possible. In general, you'll see diminishing returns after the first few thousand data points. Because of this, the Custom Collections API currently has a cap at 50,000 samples. If you want to train Collections with larger amounts of input data, reach out to us directly at contact@indico.io and we'll help make your project possible.

What makes a task hard for a computer?
As humans, we know that subtle variations can make a world of difference. We're always working on teaching machine learning models to retain as much useful context as possible, but catching slight cues can be difficult to do in a generalized way. Here are some example categorization tasks for text and image Collections.

Task Text Image
Easy Wallstreet Journal vs. Buzzfeed Jungle vs. Beach
Medium 1 Star vs. 5 Star Review Leather vs. Wood
Hard Dieting vs. Fitness Husky vs. Malamute

Benchmarking Custom Collection

How will my model's accuracy compare to other common techniques?
Especially with small amounts of data, Custom Collections should generally give a higher accuracy than common DIY algorithms. We benchmarked Custom Collections againts some common algorithms for three typical machine learning tasks to give an idea of how it compares.


Task: Sentiment Detection (Text)
Dataset: Large Movie Review Dataset
Custom Collection Domain: "sentiment"
Benchmarked Against: tfidf vectors of samples (with stop words removed) into logistic regression with a grid search for an optimal regularization parameter

Samples Custom Collection Accuracy DIY Algorithm Accuracy
100 0.89 0.58
1,000 0.93 0.82
10,000 0.94 0.86


Task: Topic Classification (Text, 4 Categories)
Dataset: Aggregated News
Custom Collection Domain: "topics"
Benchmarked Against: tfidf vectors of samples (with stop words removed) into logistic regression with a grid search for an optimal regularization parameter

Samples Custom Collection Accuracy DIY Algorithm Accuracy
100 0.81 0.60
1,000 0.86 0.82
10,000 0.88 0.88


Task: Classification (Image, 25 Categories)
Dataset: Caltech 101
Custom Collection Domain: Not set
Benchmarked Against: Logistic regression model trained on HoG features and color histograms for each sample and with a grid search for an optimal regularization parameter

Samples Custom Collection Accuracy DIY Algorithm Accuracy
100 0.82 0.22
1,000 0.95 0.55
10,000 0.94 0.67
from indicoio.custom import Collection
indicoio.config.api_key = 'YOUR_API_KEY'

collection = Collection("collection_name")

# Add Data
collection.add_data([["text1", "label1"], ["text2", "label2"], ...])

# Training
collection.train()

# Telling Collection to block until ready
collection.wait()

# Done! Start analyzing text
collection.predict("indico is so easy to use!")
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

collection = Indico::Collection.new("collection_name")

# Add Data
collection.add_data([["text1", "label1"], ["text2", "label2"], ...])

# Training
collection.train()

#Telling Collection to block until ready
collection.wait()

#Done! Start analyzing text
collection.predict("indico is so easy to use!")

var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';
var collection = indico.Collection('my_collection');

// Adding Data
collection.addData([["text1", "label1"], ["text2", "label2"], ...])

  // Training
  .train()

  // Waiting for Collection to be trained
  .wait()

  // Predicting once the model is ready!
  .predict("This is awesome!")

  // Viewing results
  .then(console.log);
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.indico.Indico;
import io.indico.api.custom.CollectionData;
import io.indico.api.custom.IndicoCollection;
​
Indico indico = new Indico("YOUR_API_KEY");
IndicoCollection newCollection = indico.custom.getCollection("collectionName");

// Add Data
newCollection.addData(new ArrayList<CollectionData>() { {
    add(new CollectionData("text1", "label1"));
    add(new CollectionData("text2", "label2"));
    // ...
} });
​
// Training
newCollection.train();

// Telling Collection to block until ready
newCollection.waitUntilReady();

// Done! Start analyzing text
newCollection.predict("indico is so easy to use!");
library(indicoio)

collection <- Collection(name='collection_name')
test_data <- list(list("text1", "label1"), list("text2", "label2"))

# Add Data
addData(collection, test_data)

#Training
train(collection)

#Tell collection to block until ready
wait(collection)

#Done! Start analyzing text
predict(collection, "indico is so easy to use!")
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\Collection as Collection;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

$collection = new Collection('collection_name');

// Add Data
$collection->addData(array(
    array("text1", "label1"),
    array("text2", "label2")

));

//Training
$collection->train();

// Telling Collection to block until ready
$collection->wait();

// Done! Start analyzing text
$result = $collection->predict('test_text');

?>
// In the following examples we'll be using jQuery ($) to make requests to indico
function sendToIndico(endpoint, data, callback) {
  var key = 'YOUR_API_KEY',
    collectionName = 'my_collection',
    url = 'https://apiv2.indico.io'+ endpoint,
    log = function(res) { console.log(res) };

  var callback = callback || log;

  $.post(url, JSON.stringify({
    api_key: key,
    data: data,
    collection: 'my_collection'
  }), callback);
}

// Add data to your Collection
sendToIndico('/custom/batch/add_data', [
  ['text_sample1', 'label1'],
  ['text_sample2', 'label2'],
  ...
]);

// Train your Collection
sendToIndico('/custom/train', {});

// wait until the Collection is ready to predict
var waitForCollection = setInterval(function() {
  sendToIndico('/custom/collections', {},
    function(res) {
      res = JSON.parse(res);
      res = res['results']['my_collection'];
      if (res['status'] === 'ready') {
        // you're ready to make predictions!
        sendToIndico('/custom/predict', 'yay!');
        clearInterval(waitForCollection);
      } else {
        console.log('not yet...', res);
      }
    }
  );
}, 1000);

// If you've already trained the Collection as shown above, predicting is simpler
sendToIndico('/custom/batch/predict', ['so', 'easy!']);
# Create a collection by providing data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/batch/add_data' --data '{"data": [["text1", "label1"], ["text2", "label2"], ...], "collection": "my_collection" }'

# Train your Collection
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/train' --data '{"collection": "my_collection" }'

# Check the status of your Collections
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/collections' --data '{}'

# When it's ready, make predictions!
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/batch/predict' --data '{"data": ["now", "it\u0027s","done!"], "collection": "my_collection" }'

Creating a Collection

Building your own Collection is simple! All you need is some labelled text or image data. Before we handle data, we first need to create our Collection object.

If the Collection name that you specified has already been created, the command to the right will create a new object that represents the existing Collection. If not, a new one will be created.

Note: There's no need to create a Collection when making calls directly to our URL endpoints. In that case, simply POST the name of the Collection along with the appropriate data outlined in the following sections.

The domain argument
If you're trying to build a Collection similar to one of indico's existing text APIs, you may be able to improve your Collection's performance by adapting one of our models to your domain's use case. If you set a domain when creating a Collection, you don't need to set it when adding data; the Collection will remember what its domain is! Currently, the following settings are valid for the domain argument:

  • "standard" - general text analysis problems
  • "topics" - text classification problems similar to Text Tags
  • "sentiment" - sentiment analysis and related problems
  • "finance" - financial news and reports

The shared argument
You can set shared to true to access a Collection that someone else has given you access to via the sharing methods or a publicly published Collection.

# For the sake of saving space we assume that
# the steps outlined below are done sequentially

// For the sake of saving space we assume that
// the steps outlined below are done sequentially

from indicoio.custom import Collection
indicoio.config.api_key = 'YOUR_API_KEY'

collection = Collection("my_collection", domain='sentiment')

# Accessing a shared Collection
collection = Collection("shared_collection", domain="sentiment", shared=True)
require 'indico'
Indico.api_key =  'YOUR_API_KEY'

collection = Indico::Collection.new("my_collection", {domain: "sentiment"})

# Accessing a shared Collection
collection = Indico::Collection.new("shared_collection", {domain: "sentiment", shared: True})
var indico = require('indico.io');
indico.apiKey =  'YOUR_API_KEY';

var collection = indico.Collection('my_collection', {domain: "sentiment"});

// Accessing a shared Collection
var collection = indico.Collection('my_collection', {shared: true, domain: "sentiment"});
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.indico.Indico;
import io.indico.api.custom.CollectionData;
import io.indico.api.custom.IndicoCollection;
​
Indico indico = new Indico("YOUR_API_KEY");

Map<String, Object> params = new HashMap<String, String>() {­{
    put("domain", "sentiment");
}­};
IndicoCollection newCollection = indico.custom.getCollection("collectionName", params);

// Accessing a shared Collection
IndicoCollection newCollection = indico.custom.getCollection("sharedCollectionName", new HashMap<String, String>() {­{
    put("shared", true);
    put("domain", "sentiment");
}­});

library(indicoio)
collection <- Collection(name='collection_name', domain='sentiment')

# Accessing a shared Collection
collection <- Collection(name="shared_collection_name", shared=TRUE)
<?php

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\Collection as Collection;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

$collection = new Collection($GLOBALS['collection_name'], array("domain" => "sentiment"));

// Accessing a shared Collection
$collection = new Collection($GLOBALS['collection_name'], array("shared" => True, "domain" => "sentiment"));

?>
// When making requests to endpoints, you pass the Collection
// name along with each POST. We'll be using the following
// function in the docs below

function sendToIndico(endpoint, data, callback) {
  var key = 'YOUR_API_KEY',
    collectionName = 'my_collection',
    url = 'https://apiv2.indico.io'+ endpoint,
    log = function(res) { console.log(res) };

  var callback = callback || log;

  // Using jQuery ($) to make requests
  $.post(url, JSON.stringify({
    api_key: key,
    data: data,
    collection: collectionName
  }), callback);
}
# When making calls directly to endpoints, you pass the Collection name along with each post rather than instantiating an object

Adding data to your Collection

Let's say we have a list of 4,000 images labeled with the scene they were taken in. If you're working in JavaScript or you don't have URLs or filenames for your images, you need to Base64 encode them first, which can be done in your programming language of choice or online.

Now we can send the data along with our labels as shown at right. Your Collection is going to attempt to learn patterns that associate the labels you provide with the data they correspond to.

The domain argument
If you're trying to build a Collection similar to one of indico's existing text APIs, you may be able to improve your Collection's performance by adapting one of our models to your domain's use case. Currently, the following settings are valid for the domain argument:

  • "standard" - general text analysis problems
  • "topics" - text classification problems similar to Text Tags
  • "sentiment" - sentiment analysis and related problems
  • "finance" - financial news and reports

Adding data does not count towards your monthly call volume.

# String data
collection.add_data(["string", "label"])

# Image data
collection.add_data(["image-url or b64-image", "label"])

# Batch add data
collection.add_data([["string1", "label1"], ["string2", "label2"]])

# Specifying domain
collection.add_data([["string1", "label1"], ["string2", "label2"]], domain="topics")
# String data
collection.add_data(["string", "label"])

# Image data
collection.add_data(["image-url or b64-image", "label"])

# Batch add data
collection.add_data([["string1", "label1"], ["string2", "label2"]])

# Specifying domain
collection.add_data([["string1", "label1"], ["string2", "label2"]], {domain: "topics"})
// String data
collection.addData(["string", "label"])
  .then(console.log);

// Image data
collection.addData(["image-url or b64-image", "label"])
  .then(console.log);

// Batch add data
collection.addData([["string1", "label1"], ["string2", "label2"]])
  .then(console.log);

// Specifying domain
collection.addData([["string1", "label1"], ["string2", "label2"]], {domain: "topics"})
  .then(console.log);
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.indico.Indico;
import io.indico.api.custom.CollectionData;
import io.indico.api.custom.IndicoCollection;
​
Indico indico = new Indico("YOUR_API_KEY");
IndicoCollection newCollection = indico.custom.getCollection("collectionName");

// Single add data
newCollection.addData(new ArrayList<CollectionData>() {
    add(new CollectionData("text1", "label1"));
});

// Batch add data
newCollection.addData(new ArrayList<CollectionData>() {
    add(new CollectionData("text1", "label1"));
    add(new CollectionData("text2", "label2"));
    // ...
});

Map<String, Object> params = new HashMap<String, String>() {­{
    put("domain", "topics");
}­};

// Specifying domain
newCollection.addData(new ArrayList<CollectionData>() {
    add(new CollectionData("text1", "label1"));
    add(new CollectionData("text2", "label2"));
    // ...
}, params);
library(indicoio)
collection <- Collection(name = "collection_name")

# Single add data
single <- list("text1", "label1")
addData(collection, single)

# Batch add data
batch <- list(list("text1", "label1"), list("text2", "label2"))
addData(collection, batch)

# Specifying domain
batch <- list(list("text1", "label1"), list("text2", "label2"))
addData(collection, batch, domain = "topics")
<?php 

require(__DIR__ . '/vendor/autoload.php');
use \IndicoIo\Collection as Collection;
IndicoIo::$config['api_key'] = 'YOUR_API_KEY';

$collection = new Collection($GLOBALS['collection_name']);

// Single add data
$collection->addData(
  array("text2", "label2")
);

// Batch add data
$collection->addData(array(
    array("text1", "label1"),
    array("text2", "label2")
));

// Specifying domain
$collection->addData(array(
    array("text1", "label1"),
    array("text2", "label2")
), array("domain" => "topics"));

?>
// String data
sendToIndico('/custom/add_data', ["string", "label"])

// Image data
sendToIndico('/custom/add_data', ["image-url or b64-image", "label"])

// Batch add data
sendToIndico('/custom/batch/add_data', [["string1", "label1"], ["string2", "label2"]])

// Specifying domain
sendToIndico('/custom/batch/add_data?domain=topics', [["string1", "label1"], ["string2", "label2"]])
# String data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/add_data' --data '{"data": ["string", "label"], "collection": "my_collection" }'

# Image data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/add_data' --data '{"data": ["image-url or b64-image", "label"], "collection": "my_collection" }'

# Batch add data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/batch/add_data' --data '{"data": [["string1", "label1"], ["string2", "label2"]], "collection": "my_collection" }'

# Specifying domain
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/batch/add_data?domain=topics' --data '{"data": [["string1", "label1"], ["string2", "label2"]], "collection": "my_collection" }'

Removing data from your Collection

A situation may arise where you'd like certain data that you've added to not be considered by your Collection. This is simple to fix! It's very similar to adding data, but without the labels.

Removing data does not count towards your monthly call volume.

# String data
collection.remove_example("string")

# Image data
collection.remove_example("image-url or b64-image")

# Batch remove data
collection.remove_example(["string1", "string2", ...])
# String data
collection.remove_example("string")

# Image data
collection.remove_example("image-url or b64-image")

# Batch remove data
collection.remove_example(["string1", "string2", ...])
  
// String data
collection.removeExample("string")
  .then(console.log);

// Image data
collection.removeExample("image-url or b64-image")
  .then(console.log);

// Batch remove data
collection.removeExample(["string1", "string2", ...])
  .then(console.log);
  // String data
  collection.removeExamples("string");

  // Image data
  collection.removeExamples("image-url or b64-image");

  // Batch remove data
  collection.removeExamples(Arrays.asList(
    "string", "string"
  )); 
# String data
remove_example(
    collection,
    "string", 
    api_key = 'YOUR_API_KEY'
)

# Image data
remove_example(
    collection,
    "image-url or b64-image", 
    api_key = 'YOUR_API_KEY'
)

# Batch remove data
remove_example(
    collection,
    c(
        "string",
        "string"
    ), 
    api_key = 'YOUR_API_KEY'
)
<?php 

// String data
$collection->removeExample("string");

// String data
$collection->removeExample("image-url or b64-image");

// Batch remove data
$collection->removeExample(array("string", "string"));

?>
// String data
sendToIndico('/custom/remove_example', "string");

// Image data
sendToIndico('/custom/remove_example', "image-url or b64-image");

// Batch remove data
sendToIndico('/custom/batch/remove_example', ["string1", "string2", ...])
# String data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/remove_example' --data '{"data": "string", "collection": "my_collection" }'

# Image data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/remove_example' --data '{"data": "image-url or b64-image", "collection": "my_collection" }'

# Batch remove data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/batch/remove_example' --data '{"data": ["string1", "string2", ...], "collection": "my_collection" }'

Training your new Collection

Once you've added the desired data to your Collection, all you need to do is train and you'll be ready to analyze!

You'll see in the code to the right of your screen how simple it is to train a Collection. However, you should keep in mind whether you'd like your code to wait until the model is trained or not. The following block is the status returned by .train().

{
    'model_type': 'classification',
    'input_type': 'image',
    'number_of_examples': 4000,
    'permissions': {'read': [], 'write': []},
    'public': False,
    'registered': False,
    'status': 'training'
}

Adding .wait() will block until the training is complete. Otherwise you'll need to check the status (which we'll show you how to do below) of your new Collection separately and make sure it's ready before using it in analysis.

Since Collection training is resource intensive, each call to `train` is counted as 100 API calls regardless of your Collection size.

# Training
collection.train()

# Telling Collection to block until ready
collection.wait()
# Training
collection.train()

# Telling Collection to block until ready
collection.wait()
// Training
collection.train()
  .then(console.log);

// Waiting for Collection to be ready
collection.train()
  .wait().then(function() {
    // collection ready to predict!
  });
  // Train
  newCollection.train();

  // Tell Collection to block until ready
  newCollection.waitUntilReady();
#Training
train(collection)

#Tell collection to block until ready
wait(collection)
<?php

//Training
$collection->train();

// Telling Collection to block until ready
$collection->wait();

?>
// Train Collection
sendToIndico('custom/train', {});

// Without a client library you'll have to manually check the status of your collection as shown below
# Train Collection
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/train' --data '{"collection": "my_collection" }'

# Without a client library you'll have to manually check the status of your collection as shown below

Checking the status of your Collections

Whether you have mutliple Collections or would like to train a particularly large one and can't wait for it to finish, checking status is key to managing your Collection.

Among other information, checking your Collection's status returns metrics which help evaluate how useful your Collection is at solving the intended task. For classification problems, this means a mean class accuracy score and per-class precision and recall scores. For regression problems, mean absolute error and mean squared error metrics are returned. By inspecting these scores you can evaluate whether or not adding additonal data to your Collection or changing the Collection domain mayb be useful for improving the quality of your predictions. Please note that classification Collections may not return metrics if some of the classes have less than 10 examples. Here's a sample response from calling collections():

{
    'image_tagger': {
        'model_type': 'classification',
        'input_type': 'image',
        'number_of_examples': 4000,
        'status': 'ready',
        'permissions': {
        	'read': [],
        	'write': []
        },
        'metrics': {
        	'class_accuracy': 0.875,
        	'precision': {
        		'cat': 0.9,
        		'dog': 0.875
        	},
        	'recall': {
        		'cat': 0.85,
        		'dog': 1.0
        	}
        },
        'public': False,
        'registered': False,
    },
    'detect_rapper': {
        'model_type': 'classification',
        'input_type': 'text',
        'number_of_examples': 120000,
        'status': 'ready',
        'permissions': {
        	'read': [],
        	'write': []
        },
        'public': False,
        'registered': False,
        ...
    }, ...
}

Checking the status of your Collection does not count towards your monthly call volume.

# Check status of current Collection
collection.info()

# Checking all of your Collections requires a separate function
from indicoio.custom import collections

collections()
# Checking status of your current Collection
collection.info()

# Check all of your Collections
Indico::collections()
// Check status of current collection
collection.info()
  .then(console.log);

// Check status of all your collections
indico.collections()
// Check status of current collection
Map<String, ?> collectionInfo = indico.custom.info(collectionName)

// Check status of all your collections
Map<String, Map<String, ?>> collectionsInfo = indico.custom.getAllCollections();
# Check status of current collection
info(collection)

# Check status of all your collections
collections()
<?php

// Check status of current Collection
$collection->info()

// Check status of all your collections
IndicoIo::collections()

?>
// Get status of all your Collections
sendToIndico('/custom/collections', {});
# Get status of all your Collections
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/collections' --data '{}'

Analyzing new data!

Now your model is ready to predict labels for new data samples. All you need to do is pass a String if you created a text Collection or a Base64 encoded image if you created an image Collection.

The response will be a mapping of the classes you've provided to their predicted likelihood. For our photo example, each class is a scene tag, like "nature", "city", or "space".

{"nature": 0.938..., "city": 0.122..., "space": 0.055...}

If you've set your data domain to something other than "standard", make sure to pass in the same value when predicting on new examples.

If you've trained a Collection for a classification task (predicting which categories text or an image belongs to), the following keyword arguments are supported.

[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.

[independent] - Boolean (defaults to False) - optional - when False, the probabilities of all topics sum to 1, when True, topic probabilities are independent and are not constrained to sum to 1. You must have more than two output categories in order to make use of this flag.

# String data
collection.predict("string")

# Image data
collection.predict("image-url or b64-image")

# Making batch predictions
collection.predict(["string1", "string2", ...])

# Specifying domain
collection.predict(["string1", "string2", ...], domain="topics")
# String data
collection.predict("string")

# Image data
collection.predict("image-url or b64-image")

# Making batch predictions
collection.predict(["string1", "string2", ...])

# Specifying domain
collection.predict(["string1", "string2", ...], {domain: "topics"})
// String data
collection.predict("string")
  .then(console.log);

// Image data
collection.predict("image-url or b64-image")
  .then(console.log);

// Making batch predictions
collection.predict(["string1", "string2", ...])
  .then(console.log);

// Specifying domain
collection.predict(["string1", "string2", ...], {domain: "topics"})
  .then(console.log);
// String data
newCollection.predict();

// Image data
newCollection.predict();

// Making batch predictions
newCollection.predict(Arrays.asList(
    "string",
    "string"
    // ...
));

Map<String, Object> params = new HashMap<String, String>() {­{
    put("domain", "topics");
}­};

// Specifying domain
newCollection.predict(Arrays.asList(
    "string",
    "string"
    // ...
), params);
# String data
predict(collection, "string")

# Image data
predict(collection, "image-url or b64-image")

# Making batch predictions
batch <- list(list(, ), list(, ))
predict(collection, batch)

# Specifying domain
predict(collection, batch, domain = "topics")
<?php 

// String data
$result = $collection->predict("string");

// Image data
$result = $collection->predict("image-url or b64-image");

// Making batch predictions
$result = $collection->predict(
    list("string", "string")
);

// Specifying domain
$result = $collection->predict([
    ,
    
]), array("domain" => "topics"));

?>
// String data
sendToIndico('custom/predict', "string");

// Image data
sendToIndico('custom/predict', "image-url or b64-image");

// Making batch predictions
sendToIndico('custom/batch/predict', ["string1", "string2", ...])

// Specifying domain
sendToIndico('custom/batch/predict?domain=topics', ["string1", "string2", ...])
# String data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/predict' --data '{"data": "string", "collection": "my_collection" }'

# Image data
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/predict' --data '{"data": "image-url or b64-image", "collection": "my_collection" }'

# Making batch predictions
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/batch/predict' --data '{"data": ["string1", "string2", ...], "collection": "my_collection" }'

# Specifying domain
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/batch/predict?domain=topics' --data '{"data": ["string1", "string2", ...], "collection": "my_collection" }'

Renaming a Collection

We provide a way to rename your Collection. Just call .rename(new_name) on the Collection instance with a new Collection name.

Renaming your Collection does not count towards your monthly call volume.

# Rename your current Collection
collection.rename("new_collection_name")
# Rename your current Collection
collection.rename("new_collection_name")
// Rename your current collection
collection.rename("new_collection_name")
  .then(console.log);
// Rename your current collection
collection.rename("new_collection_name");
# Rename your current collection
collection <- rename(collection, "new_collection_name")
<?php

// Rename your current Collection
$collection->rename("new_collection_name");

?>
// Rename your current Collection
sendToIndico('/custom/rename', {"name": "new_collection_name"}, {"collection": "collection"});
# Rename a Collection
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/rename' --data '{"name": "new_collection_name"}'

Sharing a Collection

You can share your Collection to enable specific users to read and/or write to the Collection.

To do so, you must first register the Collection by calling .register(public) on Collection, setting make_public to true or false. Then, you can authorize certain emails to read or write by calling .authorize(email, permission) with "read" or "write" as the permission.

Other users must pass in shared to the Collection object as a Boolean to indicate whether or not the Collection is shared with them. A shared Collection must have a name unique across all shared Collections.

You can deregister the Collection by calling .deregister() on the Collection and deauthorize users by calling .deauthorize(email) on theCollection.

Registering Collections and authorizing users do not count towards your monthly call volume.

# Register Collection as a sharable collection
collection.register(make_public=False)
collection.authorize("contact@indico.io", "write")

# Deauthorize contact@indico.io from Collection
collection.deauthorize("contact@indico.io")

# Deregister Collection
collection.deregister()
# Register Collection as a sharable collection
collection.register(make_public=False)
collection.authorize("contact@indico.io", "write")

# Deauthorize contact@indico.io from Collection
collection.deauthorize("contact@indico.io")

# Deregister Collection
collection.deregister()
# Register Collection as a sharable collection
collection.register(make_public=False)
          .authorize("contact@indico.io", "write")

# Deauthorize contact@indico.io from Collection
collection.deauthorize("contact@indico.io")

# Deregister Collection
collection.deregister()
# Register Collection as a sharable collection
collection.register(false);
collection.authorize("contact@indico.io", PERMISSION.WRITE);

# Deauthorize contact@indico.io from Collection
collection.deauthorize("contact@indico.io");

# Deregister Collection
collection.deregister();
# Register Collection as a sharable collection
register(collection)
authorize(collection, "contact@indico.io", "write")

# Deauthorize contact@indico.io from Collection
deauthorize(collection, "contact@indico.io")

# Deregister Collection
deregister(collection)
<?php

// Register Collection as a sharable collection
$collection->register();
$collection->authorize("contact@indico.io", "write");

// Deauthorize contact@indico.io from Collection
$collection->deauthorize("contact@indico.io");

// Deregister Collection
$collection->deregister();

?>
// Register Collection as a sharable collection
sendToIndico('/custom/register', {"make_public": false});
sendToIndico('/custom/authorize', {"email": "contact@indico.io", "permission_type": "write"});

// Deauthorize contact@indico.io from Collection
sendToIndico('/custom/deauthorize', {"email": "contact@indico.io"});

// Deregister Collection
sendToIndico('/custom/deregister', {});
# Register Collection as a sharable collection
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/register' --data '{"collection": "collection", "make_public": false}'
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/authorize' --data '{"collection": "collection", "email": "contact@indico.io", "permission_type": "write"}'

# Deauthorize contact@indico.io from Collection
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/deauthorize' --data '{"collection": "collection", "email": "contact@indico.io"}'
# Deregister Collection
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/deregister' --data '{"collection": "collection"}'

Publishing a Collection

You can share your Collection with the public for read only access. A shared Collection must have a name unique across all shared Collections.

To do so, you can register the Collection by calling .register(public) on Collection with true for public. Other users must pass in shared to the Collection object as a Boolean to indicate whether or not the Collection is shared with them.

You can un-publish the Collection by calling .deregister() on the Collection.

Registering Collections does not count towards your monthly call volume.

# Register Collection as a published collection.
collection.register(make_public=True)

# Deregister Collection
collection.deregister()
# Register Collection as a published collection.
collection.register(make_public=True)

# Deregister Collection
collection.deregister()
# Register Collection as a published collection.
collection.register(make_public=true)

# Deregister Collection
collection.deregister()
# Register Collection as a published collection.
collection.register(true);

# Deregister Collection
collection.deregister();
# Register Collection as a published collection.
register(collection, TRUE)

# Deregister Collection
deregister(collection)
<?php

// Register Collection as a published collection.
$collection->register(True);

// Deregister Collection
$collection->deregister();

?>
// Register Collection as a published collection.
sendToIndico('/custom/register', {"make_public": true});

// Deregister Collection
sendToIndico('/custom/deregister', {});
# Register Collection as a published collection.
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/register' --data '{"collection": "collection", "make_public": true}'

# Deregister Collection
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/deregister' --data '{"collection": "collection"}'

Deleting a Collection

Eventually you may find that you no longer need a Collection, so we provide a way to delete it. Just call .clear() on the Collection instance.

Clearing your Collection does not count towards your monthly call volume.

# Delete current Collection
collection.clear()
# Delete current Collection
collection.clear()
// Delete current Collection
collection.clear()
  .then(console.log);
// Delete current Collection
collection.clear();
# Delete current Collection
clear(collection)
<?php

// Delete current Collection
$collection->clear();

?>
// Delete current Collection
sendToIndico('/custom/clear_collection', {});
# Delete current Collection
curl -H 'X-ApiKey: YOUR_API_KEY' 'https://apiv2.indico.io/custom/clear_collection' --data '{"collection": my_collection }'

PDF Extraction


Extract images, body text, metadata, and tables from PDF documents.

Private cloud endpoint

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

Arguments

- String | List - required - filename of PDF to be analyzed
- String - optional - your indico API key
- String - optional - your private cloud subdomain
- Boolean (defaults to False) - optional - when True, returns all the images in the PDF file in PIL format
- Boolean (defaults to False) - optional - when True, returns all body text (separately from headers, footers, and tables)
- Boolean (defaults to False) - optional - when True, returns the following: tagged, form, producer, author, encryption status, program used to create the file, file size, PDF version, optimised, modification date, title, creation date, number of pages, page size
- Boolean (defaults to False) - optional - when True, returns the contents of tables in the document, separately from body text

Output

PDF Extraction returns the extracted information in JSON format so you can easily transfer the data to Custom Collections for training your own machine learning models, or for analysis using our pre-trained models. If you need someone to label the data, you can reformat the data and save as a CSV for use with CrowdLabel.

# single output
[
    {
        'images': '[<PIL.PpmImagePlugin.PpmImageFile image mode=RGB size=780x361 at 0x1070D25D0>,  <PIL.PpmImagePlugin.PpmImageFile image mode=RGB size=777x366 at 0x1070D2A90>]',
        'text':  
This is some text. 
And a little more text. 
Here's more text after the table.,
        'metadata':  {'tagged': 'no', 'form': 'none', 'producer': 'Mac OS X 10.7.5 Quartz PDFContext', 'author': ’somedude’, 'encrypted': 'no', 'creator': ’Safari’, 'file size': '5871217 bytes', 'pdf version': '1.3', 'optimized': 'no', 'moddate': 'Thu Feb 28 05:31:00 2012’, 'title': ’Check this PDF Out’, 'creationdate': 'Thu Feb 28 05:31:00 2012', 'pages': ’23’, 'page size': '612 x 792 pts (letter) (rotated 0 degrees)'}
        'tables':  [[['	', 'Column 1', 'Column 2', 'Column 3', 'Column 4'], ['Info1', 'Info2', 'Info3', 'Info4'], ['Info11', 'Info22', 'Info33', 'Info44'], ['Info111, 'Info222', 'Info333', 'Info444'], ['	']]]

    }
]

# batch output
[
    [
    {
        'images': '[<PIL.PpmImagePlugin.PpmImageFile image mode=RGB size=780x361 at 0x1070D25D0>,  <PIL.PpmImagePlugin.PpmImageFile image mode=RGB size=777x366 at 0x1070D2A90>]',
        'text':  
This is some text. 
And a little more text. 
Here's more text after the table.,
        'metadata':  {'tagged': 'no', 'form': 'none', 'producer': 'Mac OS X 10.7.5 Quartz PDFContext', 'author': ’somedude’, 'encrypted': 'no', 'creator': ’Safari’, 'file size': '5871217 bytes', 'pdf version': '1.3', 'optimized': 'no', 'moddate': 'Thu Feb 28 05:31:00 2012’, 'title': ’Check this PDF Out’, 'creationdate': 'Thu Feb 28 05:31:00 2012', 'pages': ’23’, 'page size': '612 x 792 pts (letter) (rotated 0 degrees)'}
        'tables':  [[['	', 'Column 1', 'Column 2', 'Column 3', 'Column 4'], ['Info1', 'Info2', 'Info3', 'Info4'], ['Info11', 'Info22', 'Info33', 'Info44'], ['Info111, 'Info222', 'Info333', 'Info444'], ['	']]]

    }
],
    [
    {
        'images': '[<PIL.PpmImagePlugin.PpmImageFile image mode=RGB size=780x361 at 0x1070D25D0>,  <PIL.PpmImagePlugin.PpmImageFile image mode=RGB size=777x366 at 0x1070D2A90>]',
        'text':  
This is some text. 
And a little more text. 
Here's more text after the table.,
        'metadata':  {'tagged': 'no', 'form': 'none', 'producer': 'Mac OS X 10.7.5 Quartz PDFContext', 'author': ’somedude’, 'encrypted': 'no', 'creator': ’Safari’, 'file size': '5871217 bytes', 'pdf version': '1.3', 'optimized': 'no', 'moddate': 'Thu Feb 28 05:31:00 2012’, 'title': ’Check this PDF Out’, 'creationdate': 'Thu Feb 28 05:31:00 2012', 'pages': ’23’, 'page size': '612 x 792 pts (letter) (rotated 0 degrees)'}
        'tables':  [[['	', 'Column 1', 'Column 2', 'Column 3', 'Column 4'], ['Info1', 'Info2', 'Info3', 'Info4'], ['Info11', 'Info22', 'Info33', 'Info44'], ['Info111, 'Info222', 'Info333', 'Info444'], ['	']]]

    }
]
]
import indicoio
indicoio.config.api_key = 'YOUR_API_KEY'

# single example
indicoio.pdf_extraction("filename")

# batch example
indicoio.pdf_extraction([
    "filename",
    "filename2"
])