*APIs return json data, simillar to what is displayed in json tab. If you are using python client it would be response object.
more information on this can be found at
Docs: Sentiment Analysis
Overall polarity and subjectivity of the text is returned along with the polarity and subjectivity of each sentence
method
analyze_text takes both string and a list of string as input.
Below is an example python code for sentiment analysis.
Sample python client code:
from cognious import CogniousApp
# Use <client_id> and <client_secret> of your application
# Refer to Step 2 of https://cognious.com/documentation/quickstart
app = CogniousApp('DKP3ADiCHVWO0NvuDg9XIpYgZAgKIXc73ZiPfBe2', 'i55x7kQWGc83u2fpKgMmyGCXaWDHYlk7kS986a6e')
# Get the model you want to use
# models.get function returns an instance of the model
model = app.models.get('SentimentAnalysis')
# model.analyze_text(<text>)
# Text source: wikipedia (https://simple.wikipedia.org/wiki/Pollution)
model.analyze_text('Pollution is when something is added to the environment that is harmful or poisonous to all living things. Smoke or dust in the air is a type of pollution as it is bad for the lungs when we breath in. Sewage in drinking water is another type of pollution, as it can make people ill because it contains germs and viruses. People living next to a building site where there is too much noise can become sick as they cannot sleep.')
# model.response contains the response
print(model.response)
# {
# 'success': True,
# 'result': [{
# 'polarity': -0.3428571428571428,
# 'subjectivity': 0.5447619047619047,
# 'sentences': [
# {
# 'polarity': 0.0,
# 'subjectivity': 0.0,
# 'sentence': 'Pollution is when something is added to the environment that is harmful or poisonous to all living things.'
# },
# {
# 'polarity': -0.6999999999999998,
# 'subjectivity': 0.6666666666666666,
# 'sentence': 'Smoke or dust in the air is a type of pollution as it is bad for the lungs when we breath in.'
# },
# {
# 'polarity': -0.5,
# 'subjectivity': 1.0,
# 'sentence': 'Sewage in drinking water is another type of pollution, as it can make people ill because it contains germs and viruses.'
# },
# {
# 'polarity': -0.1714285714285714,
# 'subjectivity': 0.3523809523809524,
# 'sentence': 'People living next to a building site where there is too much noise can become sick as they cannot sleep.'
# }
# ]
# }]
# }