R client library for indico's API.
This client library is no longer officially supported by indico. We welcome support from the community regarding bug fixes and additional features. Please submit a pull request with changes.
source("http://bioconductor.org/biocLite.R")
biocLite("EBImage")
library(devtools)
devtools::install_github("IndicoDataSolutions/IndicoIo-R")
For API key registration and setup, checkout our quickstart guide.
Detailed documentation and further code examples are available at indico.reame.io.
library(indicoio)
emotion <- sentiment("Thanks everyone for the birthday wishes!!
It was a crazy few days ><")
emotion
cat(sprintf("This text has %s tonality",
ifelse(emotion > 0.5, "positive", "negative")))
affilation <- political("I am so proud to stand here today
as Prime Minister of four nations
in one United Kingdom.")
affilation
most.like <- names(affilation[which.max(unlist(affilation))])
least.like <- names(affilation[which.min(unlist(affilation))])
cat(sprintf("This text is most like %s and least like %s",
most.like, least.like))
languages <- language("Monday: Delightful with mostly sunny skies.
Highs in the low 70s.")
languages
most.possible <- sort(unlist(languages), decreasing = TRUE)[1:2]
cat(sprintf("Detected %s language with probability %0.4f.\n",
names(most.possible)[1], most.possible[1]))
cat(sprintf("Next possible is %s with probability %0.4f.",
names(most.possible)[2], most.possible[2]))
categories <- text_tags("Monday: Delightful with mostly sunny skies.
Highs in the low 70s.")
categories
most.possible <- sort(unlist(categories), decreasing = TRUE)[1:2]
cat(sprintf("Detected category \%s with probability \%0.4f.\\n",
names(most.possible)[1], most.possible[1]))
cat(sprintf("Next possible is \%s with probability \%0.4f.",
names(most.possible)[2], most.possible[2]))
## Example 1
library(base64enc)
img <- file(filepath, "rb", raw=TRUE)
data <- base64encode(img)
emotion <- face_emotion(data)
most.possible <- sort(unlist(emotion), decreasing = TRUE)[1:2]
cat(sprintf("Detected '%s' emotion with probability %0.4f.\n",
names(most.possible)[1], most.possible[1]))
cat(sprintf("Next possible is '%s' emotion with probability %0.4f.",
names(most.possible)[2], most.possible[2]))
features <- face_features(data)
length(features)
features <- image_features(data)
length(features)
min(unlist(features))
max(unlist(features))
sum(unlist(features))
Each indicoio
function has a corresponding batch function for analyzing many examples with a single request. Simply pass in a list of inputs and receive a list of results in return.
sentiment_scores = sentiment(c('Sample text', 'More sample text'), api_key='********'')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.