Each indicoio function can be called with a batch of data for analyzing many examples with a single network request. This can improve the speed of using the indico APIs significantly. Simply pass in a list of inputs and receive a list of results in return. The optimal balance between the size of the batch requests and the amount of network requests varies case by case, but performance is usually optimal between 20-100 examples.Not using the latest package?
If you’re using an older version of our client libraries the syntax for batch calls is different. Namely, you’ll need to call a separate batch function as shown below.
import io.indico.Indico; import io.indico.api.IndicoResult; Indico indico = new Indico(""); List
examples = new ArrayList (); examples.add("indico is so easy to use!"); examples.add("Still really easy, yiss"); // Version >= 3.1.0 List results = test.sentiment.predict(examples).getSentiment(); // Version < 3.1.0 IndicoResult results = indico.batchSentiment.predict(examples).getSentiment(); Double sentiment = results.getSentiment(); // [0.9782025594088044, 0.9895808115135271]