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 帐户或创建一个新帐户。