Text Features

Text Features V1 has been superceded by Text Features V2 as of Nov. 1st, 2018.

textFeatures.predict(data, [params])
Convert text into meaningful feature vectors.
Extracts abstract text features for use as inputs to learning algorithms.

Current Version: 2

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 2) – specify model version

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
    ]
]

Example

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 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> results = multiple.getTextFeatures();
System.out.println(results);