R/Stylo Tutorial

CharlasLiterary Computing

Únete a LibraryThing para publicar.

R/Stylo Tutorial

1prosfilaes
Editado: mayo 1, 2022, 7:06 pm

By melannen:
https://www.librarything.com/topic/337240#7674094

We're on the same side here about the academy! I also agree that there are a lot of things that are gatekept and obfuscated in academia, which stifles new voices and helps bad ideas propagate. But you're barking up the wrong tree here - R is well-known partly because it has done a lot to make stats *more* accessible to non-specialists and people outside the Academy. The first example where R was brought up in this thread was somebody doing a stylometric analysis for fun, as a hobby! That's why I feel so strongly about this - it's really important that programs like R mean that good, rigorous stats are something anybody can easily do at home.

Here's how to run a stylometric analysis using R in less than fifteen minutes:
1. Go to Project Gutenberg. Download txt/UTF-8 files of some texts you want to analyze. Save them to a folder called "corpus". I downloaded a bunch of Bobbsey Twins, since we know they were ghostwritten and people like keeline have done the documentary research to figure out who the ghostwriters were.
2. Go here: https://www.rstudio.com/products/rstudio/download/#download and dowload and install the free desktop version of R studio. (That website also sells pay versions because it's a slicker version of the free software, but you don't need the pay version.)
3. Open your newly installed program. Go to "tools"->"install packages". Type "stylo" and press "install".
4. In the "console" tab, type "library(stylo)" and press enter.
5. Then type "stylo()" and press enter.
6. This brings up a new window (it has a quill pen icon) with a bunch of options. You can adjust the options, but the defaults are pretty good. The only one I changed was I went to "output" and selected "jpg" so that my results will be a pretty graphic.
7. Press "okay".
8. Navigate to the folder your "corpus" folder is in and press "Select folder".
9. The window will go away and you'll see some stuff flash in the "console" tab. Then, go to the folder you selected and you'll see a .jpg file. Open it. There is a tree diagram showing how similar your texts are to each other! There are also some other files that have the word tables that Stylo used to make the tree, so you can load them into a spreadsheet and do other things with them if you want.

There you go, that took me less than half an hour including installing the program, finding the corpora on Gutenberg, googling a tutorial on how to run Stylo (since I'd never used it before and haven't used R in years) and then writing these instructions.

That isn't going to get you rigorous results, of course - for that, you have to do the work to understand the statistics that Stylo is running, and how to select your corpora correctly, and what settings to use for various things - but if you want an easily reproducible-by-anyone method, there you go!

(Other people in this thread: you should play with this, it's fun. I am peacing out of this discussion here too because I have now installed R and am distracted playing with Stylo instead.)

2drneutron
mayo 1, 2022, 10:08 pm

>1 prosfilaes: you may want to pin this thread. As the admin, you can do that and it’ll keep the thread at the top of the list. New folks may want to see the instructions above.

3Petroglyph
mayo 2, 2022, 1:07 am

The README file over on Github has detailed installation instructions (including a few caveats for mac users).

It also links to a three-part set of instructional videos by Maciej Eder, the main developer behind Stylo. It shows you how to use the tool, and what the various features and settings mean.

  1. Introduction to the package 'stylo': first steps
  2. Introduction to the package 'stylo': installation
  3. Introduction to the package 'stylo': basic parameters
There's more useful tips there, but I'll end by including a link to the Computational Stylistics Group, whose projects page lists a few small-scale test projects you can do to get comfortable with the software.