{"_id":"55abcdbd63a6b60d006616fa","version":{"_id":"55a7aee84a33f92b00b7a153","__v":6,"project":"55a7aee84a33f92b00b7a150","createdAt":"2015-07-16T13:17:28.411Z","releaseDate":"2015-07-16T13:17:28.411Z","categories":["55a7aee94a33f92b00b7a154","55a7fefa3efe0c2f0074cbdf","55a8fb10c8bd450d000dd130","55a936b1cf45e1390093f362","55abddeaa36ccd0d00fdebe1","5624db675a86b423009462e1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"editedParams":true,"editedParams2":true,"project":"55a7aee84a33f92b00b7a150","user":"55a7ae50bf1be93100d89df1","parentDoc":null,"category":{"_id":"55a7aee94a33f92b00b7a154","__v":21,"project":"55a7aee84a33f92b00b7a150","version":"55a7aee84a33f92b00b7a153","pages":["55a7aee94a33f92b00b7a156","55a7ea403efe0c2f0074cb75","55a80eb23ec2ec0d00bd66ea","55a811fc6e61e619004f703e","55a8c513cf45e1390093f18c","55a8d9fa27a17d210052516d","55a8f048cf45e1390093f248","55aba4ba63a6b60d006616e1","55abab0a0685ce0d0049fb8d","55abb04da36ccd0d00fdebc1","55abc1cc63a6b60d006616f4","55abcdbd63a6b60d006616fa","55abd36763a6b60d00661700","55abd50ea36ccd0d00fdebdb","55abd8c3a36ccd0d00fdebdf","55abd9cc0685ce0d0049fbb5","55abdb6b63a6b60d00661706","55abdc9b0685ce0d0049fbb8","55c1f5fca131980d005be95b","55fac407bc972f0d0005f644","569f68e766a5640d00efa52d"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-16T13:17:29.102Z","from_sync":false,"order":2,"slug":"endpoints","title":"Endpoints"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-19T16:18:05.217Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"curl https://api.aylien.com/api/v1/sentiment \\\n   -H \"X-AYLIEN-TextAPI-Application-Key: [[app:key]]\" \\\n   -H \"X-AYLIEN-TextAPI-Application-ID: [[app:id]]\" \\\n   -d mode=\"tweet\" \\\n   -d text=\"John+is+a+very+good+football+player\" ","language":"curl"},{"code":"textapi.sentiment({\n  text: 'John is a very good football player',\n  mode: 'tweet'\n}, function(error, response) {\n  if (error === null) {\n    console.log(response);\n  }\n});","language":"javascript"},{"code":"text = 'John is a very good football player'\nsentiment = client.Sentiment({'text': text})\nprint sentiment","language":"python"},{"code":"<?php\n$text = 'John is a very good football player';\n$sentiment = $textapi->Sentiment(array('text' => $text));\nvar_dump($sentiment);\n?>","language":"php"},{"code":"SentimentParams.Builder builder = SentimentParams.newBuilder();\nbuilder.setText(\"John is a very good football player\");\nbuilder.setMode(\"tweet\");\nSentiment sentiment = client.sentiment(builder.build());\nSystem.out.println(sentiment);","language":"java"},{"code":"text = 'John is a very good football player'\n\nsentiment = client.sentiment(text: text)\n\nputs sentiment","language":"ruby"},{"code":"text := \"John is a very good football player\"\nsentimentParams := &textapi.SentimentParams{Text: text, Mode: \"tweet\"}\nsentiment, err := client.Sentiment(sentimentParams)\nif err != nil {\n\t\tpanic(err)\n}\nfmt.Printf(\"%v\\n\", sentiment)","language":"go"},{"code":"string text = \"John is a very good football player\";\n\nSentiment sentiment = client.Sentiment(text: text);\n\nConsole.WriteLine(sentiment.Polarity + \" \" + sentiment.PolarityConfidence);\nConsole.WriteLine(sentiment.Subjectivity + \" \" + sentiment.SubjectivityConfidence);","language":"csharp"}]},"method":"get","results":{"codes":[{"status":200,"language":"json","code":"{\n  \"polarity\":\"positive\",\n  \"subjectivity\":\"subjective\",\n  \"text\":\"John is a very good football player\",\n  \"polarity_confidence\":0.9999936601153382,\n  \"subjectivity_confidence\":0.9963778207617525\n}","name":""}]},"settings":"","auth":"required","params":[{"_id":"55aba608a36ccd0d00fdebbb","ref":"","in":"query","required":false,"desc":"Text to analyze","default":"","type":"string","name":"text"},{"_id":"55a8f048cf45e1390093f249","ref":"","in":"query","required":false,"desc":"Article or webpage to analyze","default":"","type":"string","name":"url"},{"_id":"55abc1cc63a6b60d006616f6","ref":"","in":"query","required":false,"desc":"`tweet` (for short text) or `document` (for long text and reviews)","default":"tweet","type":"string","name":"mode"},{"_id":"55a8f18bc8bd450d000dd113","ref":"","in":"query","required":false,"desc":"Language (refer to [Language Support](/docs/language-support))","default":"auto","type":"string","name":"language"}],"url":"/sentiment"},"isReference":false,"order":2,"body":"Extracting sentiment from a piece of text such as a *tweet*, a *review* or an *article* can provide us with valuable insight about the author's emotions and perspective: whether the tone is **positive**, **neutral** or **negative**, and whether the text is **subjective** (meaning it's reflecting the author's opinion) or **objective** (meaning it's expressing a fact). Our **Sentiment Analysis** endpoint is built exactly for this purpose.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"The `mode` parameter\",\n  \"body\": \"When using Sentiment Analysis be sure to use the appropriate mode parameter based on your input text: `tweet` for short text such as social media updates and `document` for longer text such as a review or an article.\"\n}\n[/block]","excerpt":"/sentiment","slug":"sentiment","type":"endpoint","title":"Sentiment Analysis"}

getSentiment Analysis

/sentiment

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

text:
string
Text to analyze
url:
string
Article or webpage to analyze
mode:
stringtweet
`tweet` (for short text) or `document` (for long text and reviews)
language:
stringauto
Language (refer to [Language Support](/docs/language-support))

Examples


Result Format


Documentation

Extracting sentiment from a piece of text such as a *tweet*, a *review* or an *article* can provide us with valuable insight about the author's emotions and perspective: whether the tone is **positive**, **neutral** or **negative**, and whether the text is **subjective** (meaning it's reflecting the author's opinion) or **objective** (meaning it's expressing a fact). Our **Sentiment Analysis** endpoint is built exactly for this purpose. [block:callout] { "type": "info", "title": "The `mode` parameter", "body": "When using Sentiment Analysis be sure to use the appropriate mode parameter based on your input text: `tweet` for short text such as social media updates and `document` for longer text such as a review or an article." } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}