{"_id":"571e2c232063800e0041a3a2","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"},"__v":4,"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"},"editedParams2":true,"user":"55a7ae50bf1be93100d89df1","editedParams":true,"parentDoc":null,"project":"55a7aee84a33f92b00b7a150","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-25T14:39:31.788Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"curl \"https://api.aylien.com/api/v1/absa/restaurants\" \\\n\t-H \"X-AYLIEN-TextAPI-Application-ID: [[app:id]]\" \\\n\t-H \"X-AYLIEN-TextAPI-Application-Key: [[app:key]]\" \\\n  --data-urlencode \"text=Delicious food. Disappointing service.\"  ","language":"curl"},{"code":"textapi.aspectBasedSentiment({\n\t'domain': 'restaurants',\n\t'text': 'Delicious food. Disappointing service'\n}, function(err, response) {\n\tif (err === null) {\n\t\tresponse.aspects.forEach(function(aspect) {\n\t\t\tconsole.log(aspect);\n\t\t});\n\t}\n});","language":"javascript"},{"language":"python","code":"text = \"Delicious food. Disappointing service.\"\nabsa = client.AspectBasedSentiment({'domain': 'restaurants', 'text': text})\nfor aspect in absa['aspects']:\n\tprint aspect"},{"language":"php","code":"<?php\n$absa = $textapi->AspectBasedSentiment(array('text' => $text, 'domain' => 'restaurants'));\nforeach ($absa->aspects as $aspect) {\n  var_dump($aspect);\n}\n?>"},{"code":"params := &textapi.AspectBasedSentimentParams{\n\tText:   \"Delicious food. Disappointing service.\",\n\tDomain: \"restaurants\",\n}\nsentiment, err := client.AspectBasedSentiment(params)\nif err != nil {\n\tpanic(err)\n}\nfor _, a := range sentiment.Aspects {\n\tfmt.Printf(\"%v\\n\", a)\n}","language":"go"},{"language":"java","code":"AspectBasedSentimentParams.Builder builder = AspectBasedSentimentParams.newBuilder();\nbuilder.setDomain(AspectBasedSentimentParams.StandardDomain.RESTAURANTS);\nbuilder.setText(\"Delicious food. Disappointing service.\");\nAspectsSentiment aspectsSentiment = client.aspectBasedSentiment(builder.build());\nfor (Aspect aspect: aspectsSentiment.getAspects()) {\n\tSystem.out.println(aspect);\n}\nfor (AspectSentence sentence: aspectsSentiment.getSentences()) {\n\tSystem.out.println(sentence);\n}"},{"language":"ruby","code":"text = \"Delicious food. Disappointing service.\"\n\nresponse = client.aspect_based_sentiment(domain: \"restaurants\", text: text)\n\nputs response[:aspects].join(\"\\n\")"},{"language":"csharp","code":"string text = \"Delicious food. Disappointing service.\";\n\nAspectBasedSentiment aspectBasedSentiment = client.AspectBasedSentiment(\"restaurants\", text: text);\n\nforeach (var aspect in aspectBasedSentiment.Aspects)\n{\n  Console.WriteLine(aspect._Aspect + \" is \" + aspect.Polarity);\n}"}]},"method":"get","results":{"codes":[{"status":200,"name":"","code":"{\n  \"text\": \"Delicious food. Disappointing service.\",\n  \"domain\": \"restaurants\",\n  \"aspects\": [{\n    \"aspect\": \"food\",\n    \"aspect_confidence\": 0.9835863709449768,\n    \"polarity\": \"positive\",\n    \"polarity_confidence\": 0.9158669114112854\n  }, {\n    \"aspect\": \"staff\",\n    \"aspect_confidence\": 0.9747142195701599,\n    \"polarity\": \"negative\",\n    \"polarity_confidence\": 0.9969394207000732\n  }],\n  \"sentences\": [{\n    \"text\": \"Delicious food.\",\n    \"polarity\": \"positive\",\n    \"polarity_confidence\": 0.9158669114112854,\n    \"aspects\": [{\n      \"aspect\": \"food\",\n      \"aspect_confidence\": 0.9835863709449768,\n      \"polarity\": \"positive\",\n      \"polarity_confidence\": 0.9158669114112854\n    }]\n  }, {\n    \"text\": \"Disappointing service.\",\n    \"polarity\": \"negative\",\n    \"polarity_confidence\": 0.9969394207000732,\n    \"aspects\": [{\n      \"aspect\": \"staff\",\n      \"aspect_confidence\": 0.9747142195701599,\n      \"polarity\": \"negative\",\n      \"polarity_confidence\": 0.9969394207000732\n    }]\n  }]\n}","language":"json"}]},"settings":"","auth":"required","params":[{"_id":"571e2cc592d3701900706e10","ref":"","in":"query","required":false,"desc":"Text to analyze","default":"","type":"string","name":"text"},{"_id":"571e2cc592d3701900706e0f","ref":"","in":"query","required":false,"desc":"Article or webpage to analyze","default":"","type":"string","name":"url"},{"_id":"571e2d133c34141700f23119","ref":"","in":"path","required":false,"desc":"The domain or industry that the text belongs to (e.g. Hotels)","default":"","type":"string","name":"domain"}],"url":"/absa/:domain"},"isReference":false,"order":3,"body":"Certain types of documents, such as **customer feedback** or **reviews**, may contain fine-grained sentiment about different aspects of the entities (e.g. a product or service) that are mentioned in the document. For instance, a review about a hotel may contain opinionated sentences about its staff, beds and location. This information can be highly valuable for understanding customers' opinion about a particular service or product. \n\nUsing the **Aspect-based Sentiment Analysis** (ABSA) endpoint you can retrieve a list of aspects that are mentioned in a document belonging to a specific domain, and the sentiment of the author towards each of those aspects.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Supported domains\"\n}\n[/block]\nThe following values corresponding to different domains are currently supported, and accepted for the `domain` parameter:\n\n- \"hotels\"\n- \"restaurants\"\n- \"cars\"\n- \"airlines\"","excerpt":"/absa","slug":"absa","type":"endpoint","title":"Aspect-based Sentiment Analysis"}

getAspect-based Sentiment Analysis

/absa

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

domain:
string
The domain or industry that the text belongs to (e.g. Hotels)

Query Params

text:
string
Text to analyze
url:
string
Article or webpage to analyze

Examples


Result Format


Documentation

Certain types of documents, such as **customer feedback** or **reviews**, may contain fine-grained sentiment about different aspects of the entities (e.g. a product or service) that are mentioned in the document. For instance, a review about a hotel may contain opinionated sentences about its staff, beds and location. This information can be highly valuable for understanding customers' opinion about a particular service or product. Using the **Aspect-based Sentiment Analysis** (ABSA) endpoint you can retrieve a list of aspects that are mentioned in a document belonging to a specific domain, and the sentiment of the author towards each of those aspects. [block:api-header] { "type": "basic", "title": "Supported domains" } [/block] The following values corresponding to different domains are currently supported, and accepted for the `domain` parameter: - "hotels" - "restaurants" - "cars" - "airlines"

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