Keywords

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

keywords.predict(data, [params])
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 io.indico.Indico;
import io.indico.api.IndicoResult;
import io.indico.api.BatchIndicoResult;

Map params = new HashMap() {­{
    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 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> results = multiple.getKeywords();
System.out.println(results);