Text Analysis

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

Arguments

data :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).
[api_key] :String: required/optional: Your API key for authenticating your usage. If you haven’t set your API key in another way, this is required.
[cloud] :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.
apis :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.
[top_n] :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.
[threshold] :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.

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')

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!'}]

Example

// Single Example
fetch('https://apiv2.indico.io/sentiment', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: 'This sentence is awful. This sentence is great!',
    split: 'sentence'
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));