People

people.predict(data, [params])
Identify references to specific persons found in a document.

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
[threshold] – Float (defaults to 0.01) – optional – only return named entities with likelihood greater than this number

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. Each 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]
        }
    ]
]

Example

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