Stuart’s MATLAB Videos

Watch and Learn

Setting-Up and Running Toshi’s Blog Post Code to Analyze Tweets About Fake News

My colleague Toshi made a very interesting post on Loren’s blog recently about analyzing Twitter. Someone asked if he could give some instructions on how to set up and run his code as it is a bit involved. I thought I could help with a code-along style video going over the steps which include:

  • Downloading the blog post code and data
  • Downloading twitty from the File Exchange
  • Registering an application on Twitter (apps.twitter.com) to get authentication tokens for API Access
  • Configuring of twitty with the acquired authentication tokens
  • Downloading the AFINN data set text file

Play the video in full screen mode for a better viewing experience.

Here is that string truncation utility function I used.

function strOut = truncStr(strIn,max,addDots)
% Truncate a char array strIn to a max number of characters and optionally add ellipses

if strlength(strIn) > max    
    strOut = extractBefore(strIn,max);
    if addDots
        strOut=strOut + '...';
    end
else
    strOut=strIn;
end

% Set back to char
if ischar(strIn)
    strOut=char(strOut);
end

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.