<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/stylometry-identifying-authors-of-texts-using-r/"></div></div><div><a data-url="https://www.r-bloggers.com/stylometry-identifying-authors-of-texts-using-r/" data-counturl="https://www.r-bloggers.com/stylometry-identifying-authors-of-texts-using-r/" data-count="horizontal" data-text="Stylometry: Identifying authors of texts using R" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2016/12/stylometry.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>Few people expect politicians to write every word they utter themselves; reliance on speechwriters and spokepersons is a long-established political practice. Still, it's interesting to know which statements are truly the politician's own words, and which are driven primarily by advisors or influencers.</p>
<p>Recently, David Robinson established a way of figuring out <a target="_blank" rel="nofollow" href="http://blog.revolutionanalytics.com/2016/08/sentiment-analysis-of-trumps-tweets-with-r.html">which tweets from Donald Trump's Twitter account came from him personally</a>, as opposed to from campaign staff, whcih he verified by comparing the sentiment of tweets from Android vs iPhone devices. Now, Ali Arsalan Kazmi has used <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Stylometry">stylometric analysis</a> to investigate the <a target="_blank" rel="nofollow" href="http://aliarsalankazmi.github.io/blog_DA/posts/r/2016/11/18/authorial_analysis_pm.html">provenance of speeches by the Prime Minister of Pakistan</a>. </p>
<p>By looking at the aspects of linguistic style (word/sentence length, frequency of word pairings, use of punctuation, etc.) of the <a target="_blank" rel="nofollow" href="http://htmlpreview.github.io/?https://github.com/aliarsalankazmi/Stylometry_pm_speech_analysis/blob/master/SpeechClusters/clustering_p4.html">speeches</a> of the Prime Minister Nawaz Sharif, Ali found suggestions of at least 2 authors (and possibly more) behind the speeches. This is particularly apparent in this consensus network of appearances of 4-character sequences in speeches, which divides them into two clusters (of possibly differing authorship).</p>
<p><a target="_blank" rel="nofollow" href="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c8b7b0e8970b-pi"><img title="Stylometry" alt="Stylometry" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c8b7b0e8970b-800wi" border="0"></a></p>
<p>Ali used R and several packages to perform the analysis. These included the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/openNLP/">openNLP package</a> to extract attributes from the speech data, the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/stylo/">stylo package</a> for stylometric analysis, the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/fpc/">fpc package</a> for the clustering, and the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/igraph/">igraph package</a> to visualize the clusters. The complete R script used for the analysis is <a target="_blank" rel="nofollow" href="https://raw.githubusercontent.com/aliarsalankazmi/Stylometry---An-Analysis-of-the-PM-s-speeches/master/Script/Analysis_Final.txt">available on Github</a>.</p>
<p>For an overview of the analysis, check out this <a target="_blank" rel="nofollow" href="https://aliarsalankazmi.github.io/Deck-on-Analysis-of-the-PM-s-speeches/index.html#1">slide presentation by Ali</a>, and for the complete details take a look at the blog post linked below.</p>
<p>A Blog On Data Analytics: <a target="_blank" rel="nofollow" href="http://aliarsalankazmi.github.io/blog_DA/posts/r/2016/11/18/authorial_analysis_pm.html">How many Authors does the Prime Minister have for his speeches: A Stylometric Analysis</a></p>
<p> </p>
</div>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/stylometry-identifying-authors-of-texts-using-r/"></div></div><div><a data-url="https://www.r-bloggers.com/stylometry-identifying-authors-of-texts-using-r/" data-counturl="https://www.r-bloggers.com/stylometry-identifying-authors-of-texts-using-r/" data-count="vertical" data-text="Stylometry: Identifying authors of texts using R" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2016/12/stylometry.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/G0CjqPS1QXw"></a></div>