Search code examples
sentiment-analysisalchemyapi

How to analyse sentiment of a news article using AlchemyAPI?


I want to analyse sentiment of a news article (input: text not URL) using AlchemyAPI. Please suggest me how Can I do that.

I tried with demo http://www.alchemyapi.com/products/demo/alchemylanguage/ but it provides sentiment for each entities separately, not for the whole article text.

Thanks for help.


Solution

  • You can get the sentiment for the whole document in the demo, (see screenshot):

    enter image description here

    If you want to do it programatically, the API call you are looking for is TextGetTextSentiment. You should first register for a free API key. Then to get the sentiment of the text "my great text", go to the following URL:

    http://access.alchemyapi.com/calls/text/TextGetTextSentiment?apikey=<YOUR_API_KEY>&sentiment=1&showSourceText=1&text=my%20great%20text
    

    As you see the text is url encoded at the end. For more details take a look at the documentation of TextGetTextSentiment.