Getting text emotions using php library?
Could you advise some php5 library wich i can teach to guess emotions in 开发者_StackOverflow社区texts? (happy comment, angry comment, etc)
For example i need to check in my code if comment "I love your product!" is positive or negative and set appropriate status for this comment in my DB.
I found one but it's too old and hardcoded so i hope on your help.
I know of EmoTE, it's a (partial) PHP port of Synesketch which seems to be quite good.
Beware that for languages other than English you need to get your own emotive text corpus.
There are also some uClassify classifiers, such as Mood and Sentiment (which seems to be the one you're looking for) but they work by training bayesian networks and they don't seem to provide the kind of detailed data that EmoTE provides. Here are some tests using the comments on this question:
Input (uClassify - Sentiment Classifier):
I love your product!
Output:
- positive (99.6 %)
- negative (0.4 %)
Input (uClassify - Sentiment Classifier):
Explain a bit more please
Output:
- positive (67.1 %)
- negative (32.9 %)
Input (uClassify - Sentiment Classifier):
I think not possible
Output:
- negative (92.4 %)
- positive (7.6 %)
Input (uClassify - Sentiment Classifier):
Don't you just love questions like this?
Output:
- negative (86.0 %)
- positive (14.0 %)
Seems to do the job. Also, uClassify has an API and self-hosted solutions that you can use to classify and train existing classifiers with your own data, which might be useful depending on your exact needs.
精彩评论