Keywords

The Keywords V2 API has been removed as of Nov. 1st, 2018.

keywords(data, [api_key], [version], [cloud], [top_n], [threshold]
Identify the important words within a document.

Current Version: 4

Arguments

data – String | List – required – text to be analyzed
[api_key] – String – optional – your indico API key
[cloud] – String – optional – your private cloud subdomain
[v or version] – Integer – optional (defaults to 4) – specify model version
[top_n] – Integer – optional (defaults to 3) – only return this many of the most likely topics
[threshold] – Float – optional (defaults to .0) – only return topics with likelihood greater than this number

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.

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

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

Example

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)