Api / tool mood analysis for Java

I am writing a Java program and need to analyze small fragments of text (3-4 sentences, paraphrased by the news) for their moods. I just need to know if the article is generally positive, negative or neutral.

For example, ideally, the following would be classified as positive:

Kindle e-book sales for Amazon. Amazon.com says it sells more E-books for the Kindle electronic reader than paperback and copy protection CDs.

All I need is very simple and quick to implement a third-party solution that I can use in my program. It does not have to be completely accurate all the time. Licenses, etc. Not a problem if you can track the solution.

So far I have found a potential good solution, AlchemyAPI , but I'm trying to use it.


If someone has encountered this problem before and knows a particularly good / simple solution or a really good tutorial, I would be very grateful :-)


(I also apologize for the lack of code in this matter.)

+7
source share
2 answers

I just tested AlchemyAPI. it is not 100% accurate, but I think that such technology is still in its infancy.

you will need to register (for free) in order to get the api key.

here is a usage example: http://access.alchemyapi.com/calls/text/TextGetTextSentiment?apikey=<insert your api key>&sentiment=1&showSourceText=1&text=Kindle%20e-book%20sales%20soar%20for%20Amazon.%20Amazon.com%20says%20it%20is%20selling%20more%20e-books%20for%20its%20Kindle%20electronic%20reading%20device%20than%20paperback%20and%20hardback%20print%20editions%20combined

inputs:

  • Moods = 1
  • showSourceText = 1
  • text (I used your uri encoded text sample)

I got the following result (neutral mood, not the expected positive feeling):

 <?xml version="1.0" encoding="UTF-8"?> <results> <status>OK</status> <usage>By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html</usage> <url></url> <language>english</language> <text>Kindle e-book sales soar for Amazon. Amazon.com says it is selling more e-books for its Kindle electronic reading device than paperback and hardback print editions combined</text> <docSentiment> <type>neutral</type> </docSentiment> </results> 


other sample use: http://access.alchemyapi.com/calls/text/TextGetTextSentiment?apikey=<insert your api key>&sentiment=1&showSourceText=1&text=kindle%20is%20amazing

and conclusion:

 <?xml version="1.0" encoding="UTF-8"?> <results> <status>OK</status> <usage>By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html</usage> <url></url> <language>english</language> <text>kindle is amazing</text> <docSentiment> <type>positive</type> <score>0.283568</score> </docSentiment> </results> 
+15
source

All Articles