README.md

indicoio

R client library for indico's API.

Community Supported Library

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.

Installation

source("http://bioconductor.org/biocLite.R")
biocLite("EBImage")

library(devtools)
devtools::install_github("IndicoDataSolutions/IndicoIo-R")

API Keys + Setup

For API key registration and setup, checkout our quickstart guide.

Full Documentation

Detailed documentation and further code examples are available at indico.reame.io.

Supported APIs:

Examples

library(indicoio)

Positive/Negative Sentiment Analysis

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

Political Sentiment Analysis

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

Language Detection

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

Text Tagging

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

Face Emotion Detection


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

Face Features Detection

features <- face_features(data)
length(features)

Image Features Detection

features <- image_features(data)

length(features)
min(unlist(features))
max(unlist(features))
sum(unlist(features))

Batch API

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='********'')


IndicoDataSolutions/IndicoIo-R documentation built on May 7, 2019, 6:37 a.m.