### Writer’s Log: 1790 Sentiment Cycle

Ready for maths? No? Well, how about pictures?

Nice, Mole, what are we looking at?

What you see before you is a word sentiment chart of The Gribble’s Eye plotted over the length of the story. This was created using some “R” code and the libraries offered by the professor behind http://www.archerjockers.com/

The pair of people behind the book The Bestseller Code used such code to allow them to grade and understand the so-called literary market: https://books.google.com/books/about/The_Bestseller_Code.html?id=4fXUDAAAQBAJ&printsec=frontcover&source=kp_read_button#v=onepage&q&f=false

I took their code and ran my second, wee novel through it. And that picture is what the code produced.

Sentiment goes up and down. Happy and gay and positive. Sad, angry, loathsome and negative. Good books have a signature sine wave of sentiment. Marketable books have this even more.

Now, mine is neither good nor marketable, but, it’s interesting to note that there is a definite pattern to the story: We start up, then down, up, down, and end on a big UP!

Whee! What a ride.

You want to do this for your own story? Sure. Here’s the R code:

```library(syuzhet)
library(readtext)
setwd("C:\\Documents and Settings\\MeTheUser\\Desktop\\")
text <- get_text_as_string("YOURBOOK.txt")
s_v <- get_sentences(text)
raw_values <- get_sentiment(s_v, method = "syuzhet")
dct_vals <- get_dct_transform(raw_values)
simple_plot(raw_values, title = "TITLE OF BOOK", legend_pos = "top", lps = 20, window = 0.05)```

You’ll have to struggle with installing the supporting modules — but, hey! You’re smart. You can figure it out.

(If you can’t, send me your story text — just words — and I’ll run them through this bit of code for you.)