Relevance

Relevance V1 will be removed on April 15th, 2019. Relevance V2 is now available.

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

Current Version: 1

Arguments

data – String | List – required – text to be analyzed
queries – String | List – required – a list of queries to run against the document
[api_key] – String – optional – your indico API key
[cloud] – String – optional – your private cloud subdomain
[v or version] – Integer – optional (defaults to 1) – specify model version

Output

This function returns a list of floating point values representing the relevance of a given search query to the provided document or documents. The `data` argument and the `queries` argument may be either a single text string or a list of text strings.

# single output
[0.6740826540660497, 0.16670130847921036]

# batch output
[
    [0.16670130847921036],
    [0.2949661163493879]
]

Example

import java.io.File;
import java.util.List;
import io.indico.Indico;
import io.indico.api.text.Relevance;

String[] queries = {
  "team sports", "royalty"
};

// single example
Indico indico = new Indico("YOUR_API_KEY");
List results = indico.relevance.predict("Renowned soccer legend Pele will be visiting...", queries).getRelevance();
System.out.println(results);

// batch example
String[] example = {
    "Renowned soccer legend Pele will be visiting...", 
    "The Queen of England will be visiting..."
};

String[] queries = {
  "royalty"
};
List> batchResults = indico.relevance.predict(example, queries).getRelevance();
System.out.println(batchResults);