{"id":596,"date":"2019-04-08T11:46:40","date_gmt":"2019-04-08T17:46:40","guid":{"rendered":"http:\/\/briancroxall.net\/w19dh\/?page_id=596"},"modified":"2019-04-08T11:46:41","modified_gmt":"2019-04-08T17:46:41","slug":"stylometry-step-by-step","status":"publish","type":"page","link":"https:\/\/briancroxall.net\/w19dh\/stylometry-step-by-step\/","title":{"rendered":"Stylometry Step-by-Step"},"content":{"rendered":"<p>For our experiments with stylometry, we will be using the <a href=\"https:\/\/sites.google.com\/site\/computationalstylistics\/stylo\">stylo package<\/a> for R developed by <a href=\"http:\/\/maciejeder.org\/\">Maciej Eder<\/a>, <a href=\"http:\/\/info.filg.uj.edu.pl\/~jrybicki\/\">Jan Rybicki<\/a>, and <a href=\"http:\/\/www.mike-kestemont.org\/\">Mike Kestemont<\/a>. This page is a cleaned-up version of their installation guidelines from the package&#8217;s home page as well as their &#8220;<a href=\"https:\/\/docs.google.com\/viewer?a=v&amp;pid=sites&amp;srcid=ZGVmYXVsdGRvbWFpbnxjb21wdXRhdGlvbmFsc3R5bGlzdGljc3xneDpmM2U3OGUzZTM2YjkyYzM\">how-to<\/a>.&#8221;<\/p>\n<h2>Things to install<\/h2>\n<ol>\n<li><a href=\"https:\/\/cran.r-project.org\/\">R<\/a><\/li>\n<li><a href=\"https:\/\/www.rstudio.com\/products\/rstudio\/download\/#download\">RStudio<\/a><\/li>\n<li>Mac users only: <a href=\"https:\/\/www.xquartz.org\/\">XQuartz<\/a>. You will need to restart your computer after installing this.<\/li>\n<\/ol>\n<h2>Prep your corpus<\/h2>\n<ol>\n<li>Create a working folder for the project you\u2019re tackling (e.g., bom-stylo).<\/li>\n<li>Within that working folder, create a folder called \u201ccorpus\u201d and place your texts in there. It will work best if the files are plain text.<\/li>\n<li>Make sure that each text is named with the feature that you\u2019re testing for, followed by an underscore and then whatever you want. For example, authorname_title.txt or gender_title.txt.<\/li>\n<\/ol>\n<h2>In RStudio<\/h2>\n<ol>\n<li>Install Stylo by typing <code>install.packages(\"stylo\")<\/code>. You\u2019ll only need to do this once. Note the need for quotation marks.<\/li>\n<li>Activate Stylo by typing <code>library(stylo)<\/code>. You\u2019ll need to do this each time you start an RStudio session.<\/li>\n<li>Move to your working folder (<em>not<\/em> the corpus folder) with the command <code>setwd(filepath)<\/code>. Alternatively, you can use RStudio&#8217;s menus:&nbsp;<code>Session &gt; Set Working Directory &gt; Choose Directory...<\/code><\/li>\n<li>Type <code>stylo()<\/code> to start up the function with the GUI working.<\/li>\n<li>Click <code>OK<\/code> when you\u2019ve got all the options set.<\/li>\n<\/ol>\n<h2>GUI options to tweak<\/h2>\n<h3>Features<\/h3>\n<ol>\n<li>Change MFW (most frequent word) count. Keep Minimum and Maximum set to identical values.<\/li>\n<li>Change Features from words to chars if wanted.<\/li>\n<\/ol>\n<h3>Statistics<\/h3>\n<ol>\n<li>Cluster Analysis will produce a dendrogram.<\/li>\n<li>PCA (corr.) will produce a principal component analysis, which is easier to read.<\/li>\n<\/ol>\n<h3>Output<\/h3>\n<ol>\n<li>Click \u201cpng\u201d to save a copy of the outputted image file<\/li>\n<li>CPA flavour<\/li>\n<ul>\n<li>Classic will be a simple graph with just the label of the text.<\/li>\n<li>Loadings will provide the MFW superimposed along with the labels of the text.<\/li>\n<\/ul>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>For our experiments with stylometry, we will be using the stylo package for R developed by Maciej Eder, Jan Rybicki, and Mike Kestemont. This page is a cleaned-up version of their installation guidelines from the package&#8217;s home page as well as their &#8220;how-to.&#8221; Things to install R RStudio Mac users only: XQuartz. You will need [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-596","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/PaATg6-9C","_links":{"self":[{"href":"https:\/\/briancroxall.net\/w19dh\/wp-json\/wp\/v2\/pages\/596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/briancroxall.net\/w19dh\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/briancroxall.net\/w19dh\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/briancroxall.net\/w19dh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/briancroxall.net\/w19dh\/wp-json\/wp\/v2\/comments?post=596"}],"version-history":[{"count":1,"href":"https:\/\/briancroxall.net\/w19dh\/wp-json\/wp\/v2\/pages\/596\/revisions"}],"predecessor-version":[{"id":598,"href":"https:\/\/briancroxall.net\/w19dh\/wp-json\/wp\/v2\/pages\/596\/revisions\/598"}],"wp:attachment":[{"href":"https:\/\/briancroxall.net\/w19dh\/wp-json\/wp\/v2\/media?parent=596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}