Learn R Programming

cognizer (version 0.0.1)

text_sentiment: Process text with IBM Alchemy Language algorithms

Description

text_sentiment: Takes a vector of text and sends to Watson services for various analyses. Requires basic authentication using api key.

text_keywords: Keywords analysis extracts keywords from text, and can optionally provide their sentiment and/or associated knowledge graph.

text_emotion: Emotion analysis of text infers scores for 7 basic emotions.

text_language: Language detection infers language of the provided text. Works best with at least 100 words.

text_entity: Entity analysis extracts names of people, products, places from the provided text. Additional arguments can provide sentiment, knowledge graphs and quotations related to inferred entities.

text_concept: Concept analysis infers categories based on the text, but that are not necessarily in the text. Additional arguments can provide sentiment and/or knowledge graphs related to inferred concepts.

text_relations: Relation analysis infers associations among entities.

text_taxonomy: Taxonomy analysis infers hierarchical relations among entities upto 5 levels deep.

Usage

text_sentiment(text, api_key, output_mode = "json", show_source = 0, keep_data = "true", callback = NULL)
text_keywords(text, api_key, output_mode = "json", show_source = 0, keep_data = "true", callback = NULL, max_retrieve = 50, knowledge_graph = 0, sentiment = 0)
text_emotion(text, api_key, output_mode = "json", show_source = 0, keep_data = "true", callback = NULL)
text_language(text, api_key, output_mode = "json", show_source = 0, keep_data = "true", callback = NULL)
text_entity(text, api_key, output_mode = "json", show_source = 0, keep_data = "true", callback = NULL, max_retrieve = 50, knowledge_graph = 0, sentiment = 0, model = "ie-en-news", coreference = 1, disambiguate = 1, linked_data = 1, quotations = 0, structured_entity = 1)
text_concept(text, api_key, output_mode = "json", show_source = 0, keep_data = "true", callback = NULL, max_retrieve = 8, knowledge_graph = 0, linked_data = 1)
text_relations(text, api_key, output_mode = "json", show_source = 0, keep_data = "true", callback = NULL, model = "ie-en-news")
text_taxonomy(text, api_key, output_mode = "json", show_source = 0, keep_data = "true", callback = NULL, max_retrieve = 50, knowledge_graph = 0, sentiment = 0, model = "ie-en-news", coreference = 1, disambiguate = 1, linked_data = 1, quotations = 0, structured_entity = 1)

Arguments

text
Character vector containing strings to be processed.
api_key
Character scalar containing api key obtained from Watson services.
output_mode
Character scalar specifying returned data structure. Alternative is xml.
show_source
Intenger scalar specifying whether to send text string back or not.
keep_data
Character scalar specifying whether to share your data with Watson services for the purpose of training their models.
callback
Function that can be applied to responses to examine http status, headers, and content, to debug or to write a custom parser for content. The default callback parses content into a data.frame while dropping other response values to make the output easily passable to tidyverse packages like dplyr or ggplot2. For further details or debugging one can pass a fail or a more compicated function.
max_retrieve
Integer scalar fixing the number of keywords to extract from text.
knowledge_graph
Integer scalar indicating whether to grab a knowledge graph associated with keywords. This is an additional transaction.
sentiment
Integer scalar indicating whether to infer sentiment of keywords, expressed as category and number. This is an additional transaction.
model
Character scalar specifying one of three models which will extract entities. Alternatives are 'ie-es-news', 'ie-ar-news' or a custom model.
coreference
Integer scalar specifying whether to resolve coreferences into detected entities.
disambiguate
Integer scalar specifying whether to disambiguate detected entities.
linked_data
Integer scalar specifying whether to include links for related data.
quotations
Integer scalar specifying whether to include quotes related to detected entities.
structured_entity
Integer scalar specifying whether to extract structured entities, such as Quantity, EmailAddress, TwitterHandle, Hashtag, and IPAddress.

Value

Data.frame containing parsed content in a tidy fashion.

See Also

Check http://www.ibm.com/watson/developercloud/alchemy-language.html for further documentation, and https://alchemy-language-demo.mybluemix.net/?cm_mc_uid=70865809903714586773519&cm_mc_sid_50200000=1468266111 for a web demo.