
Algorithmia: nlp/SentimentAnalysis
API Overview
Identify and extract sentiment in given string. Sentiment analysis (also known as opinion mining) refers to the use of natural language processing, text analysis and computational linguistics to identify and extract subjective information in source materials. This algorithm takes an input string and assigns a sentiment rating in the range [-1 to 1] (very negative to very positive)
Determine positive or negative sentiment from text
Introduction Identify and extract sentiment in given string. Sentiment analysis (also known as opinion mining) refers to the use of natural language processing, text analysis and computational linguistics to identify and extract subjective information in source materials. This algorithm takes an input string and assigns a sentiment rating in the range [-1 to 1] (very negative to very positive).
Input: (Required): Key "document", which contains a sentence or paragraph. (Optional): Key "language", for getting sentiment analysis for other languages. Default is ("en" for English). Can also use "auto" for automatically detecting language. Note: for supported languages, please refer to the ISO-639-1 identifiers.
Note: sending a bare string instead of a JSON Object is deprecated from a previous version, and may yield unexpected results
Note: for batch, send as a list of objects
Output: Sentiment value between -1 and 1 (very negative to very positive) Examples Example 1. Parameter 1: Positive sentence. { "document": "I really like eating ice cream in the morning!" } Output:
[ { "sentiment": 0.474, "document": "I really like eating ice cream in the morning!" } ] Example 2. Parameter 1: Negative sentence. { "document": "I really hate you, you are the worst!" } Output:
[ { "sentiment": -0.855, "document": "I really hate you, you are the worst!" } ] Example 3. Parameter 1: Batch of sentences. [ { "document": "I really hate you, you are the worst!" }, { "document": "I really like eating ice cream in the morning!" } ] Output:
[ { "sentiment": -0.855, "document": "I really hate you, you are the worst!" }, { "sentiment": 0.474, "document": "I really like eating ice cream in the morning!" } ] Example 4. Parameter 1: Positive sentence in Turkish Parameter 2: Auto detect language of text Input:
{ "document": "Algorithmia'yi cok seviyorum.", "language": "tr" } Output:
[ { "document": "Algorithmia'yi cok seviyorum.", "sentiment": 0.6369 } ] Example 5. Parameter 1: Negative sentence in French Parameter 2: Autodetect language Input:
{ "document": "Je déteste les grenouilles", "language": "auto" } Output:
[ { "document": "Je déteste les grenouilles", "sentiment": -0.5719 } ] Credits For more information, please refer to http://nlp.stanford.edu/software/corenlp.shtml or Manning, Christopher D., Surdeanu, Mihai, Bauer, John, Finkel, Jenny, Bethard, Steven J., and McClosky, David. 2014. The Stanford CoreNLP Natural Language Processing Toolkit. In Proceedings of 52nd Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 55-60.
For more information, please refer to http://www.socialai.gatech.edu/ or Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.