Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
How to Analyze Tweet Sentiments with PHP Machine Learning
Jul 10, 2017 @ 17:10:52

On the SitePoint PHP blog they've posted a new tutorial showing you how to analyze tweet sentiments using a combination of PHP and machine learning (with the help of the php-ai/php-ml library).

As of late, it seems everyone and their proverbial grandma is talking about Machine Learning. [...] Yes, what about Machine Learning and PHP? Fortunately, someone was crazy enough not only to ask that question, but to also develop a generic machine learning library that we can use in our next project. In this post we are going take a look at PHP-ML – a machine learning library for PHP – and we’ll write a sentiment analysis class that we can later reuse for our own chat or tweet bot.

The post then starts in with some of the basics of machine learning and sentiment analysis and briefly introduces the php-ml library and what functionality it offers. It then outlines the problem they're trying to solve and the solution including what data points php-ml will use to determine the sentiment of a tweet. The author shows how to get the php-ml package installed, how to read in the data set and how to "exercise" the sentiment analysis against the tweets. It describes how the evaluation works and shows the accuracy result of a basic run.

tagged: machine learning phpml library tutorial introduction sentiment analysis

Link: https://www.sitepoint.com/how-to-analyze-tweet-sentiments-with-php-machine-learning/

Sameer Borate:
Sentiment Analysis of Twitter feeds
Sep 30, 2014 @ 15:07:35

Sameer Borate continues on his theme of Twitter-related development (part one is here) with his latest post showing how to do sentiment analysis of Twitter feeds. His "sentiment analysis" analyzes a string to determine if it's generally negative or positive based on the AFINN word dataset.

In the last post we looked into accessing Twitter API v1.1 from PHP. In this post we will see how we can add sentiment analysis for the tweets. Generally speaking, sentiment analysis aims to determine the attitude of a writer with respect to some topic. A basic task in sentiment analysis is classifying the polarity of a given text, whether the expressed opinion in a sentence is positive, negative, or neutral. In this post we will use a simple sentiment analysis library to analyze the sentiment of tweets.

His example uses the viracore/caroline library to do the actual analysis. He shows how to install it via Composer and how to make a sample checker, returning the score and the comparative ranking. With that working, he shows how to integrate it into the Twitter connection originally created in the first post, extracting tweets from his own timeline and returning their scores.

tagged: tutorial twitter sentiment positive negative afinn api oauth

Link: http://www.codediesel.com/social/sentiment-analysis-of-twitter-feeds/


Trending Topics: